This gets into Terraform's load phases. Providers are loaded at compile time, which is where TF compiles all the configs in the directory into a single dependency chart in memory. In a few providers, actions are taken at this load time.
bumpy-tomato-36167
09/28/2024, 3:18 PM
For the kubernetes provider it seems like it is running "stat" on the config file given.
bumpy-tomato-36167
09/28/2024, 3:22 PM
One way I have found to bypass this is to use the environment variable configuration option. Set the KUBE_CONFIG_PATH environment variable to the path where the file will exist and it should pick it up. A more general approach is to orchestrate multiple tf runs.