Interview Prep/Terraform/Providers, Resources and Data Sources

Why is it problematic to configure a provider with attributes of resources created in the same configuration?

AdvancedConceptProviders, Resources and Data Sources
Answer

Terraform needs provider configuration before it can plan resources of that provider. If you feed the Kubernetes or Helm provider from an EKS cluster created in the same apply, the first plan sees unknown values and can fail, or fails on destroy because the cluster disappears before its resources are removed. The fix is separate states (cluster layer, then add-ons layer) or a data source on an already-existing cluster.

All Terraform questions Roadmap: Terraform

More on Providers, Resources and Data Sources