Provider dependency

hello,
is there a way to make a provider config depends on the output of a module?

for example: if in a stack, we have an AKS kubernetes cluster deployed by azurerm provider, and we have a kubernetes provider that deploy helm charts in that cluster
so the config of the kubernetes provider depends on the output of the module who creates the aks cluster

The output helper method only gets evaluated in the 1st pass in tfvars files by design. Dependencies Tfvars Considerations - Terraspace

Tried to explain the reasoning in the docs. ERB evaluation happens twice.

  • 1st pass to calculate the dependency graph.
  • 2nd pass to actually process and compile the file down.

ERB evaluation can result in any helper method being called. If a user custom helper makes a heavy or slow call like a network API call, there’s twice the performance penalty. So only tfvars files are considered by design.

Now, this was changed in terraspace 2.2.0 with this PR https://github.com/boltops-tools/terraspace/pull/262. Basically, only the output helper and configurable allowed keywords will be called in the 1st pass nowadays.

Maybe it’s more feasible to process additional files (not just tfvars files) in the 1st pass now. At least wanted to provide some thoughts.

RE: is there a way to make a provider config depends on the output of a module?

Believe this would mean that the output helper would usable is provider.tf file. Essentially, it means allowing the 1st pass to process more than tfvar files. Something still feels off about this. Unsure. Terraform allows more dynamic logic in a provider.tf to a limited extent but am a little bit unsure of the practice of it myself. Just my 2 cents.