-
Notifications
You must be signed in to change notification settings - Fork 9.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Terraform plan fails with cannot be determined until apply
even if the depends_on
dependency is known.
#34391
Comments
Hi @boillodmanuel, In the We use GitHub issues for tracking bugs and enhancements, rather than for questions. While we can sometimes help with certain simple problems here, it's better to use the community forum where there are more people ready to help. Thanks! |
Hi @jbardin ,
I'm aware, and it's exactly what I complaining about. 🛑 For me this is an issue! and let me explain why. The dependency is known, so there is no reason to not read the datasource immediately. Currently, the read is delayed until changes are completed, as you mentioned, and the consequence are that plan failed with the given error. Of course, I simplified the example to reproduce the situation. But this is very blocking for a lot of situation.
If you don't add dependencies between, the creation and/or destruction may fail due to improper order of resource creation/destruction. The only way to fix this, is to explicitly define dependencies between resources, so we can define a proper order to create resources (or to destroy resources). You can reproduce this issue in a more "classic" use case by updating the @jbardin, may you reopen this issue please? |
Hi @boillodmanuel, Terraform can only understand dependencies to the extent they are declared in the configuration. When you use If the infrastructure is built such that there are distinct layers, e.g. you must deploy some resources first before you can begin provisioning a kubernetes cluster on top of those resources, then that will require multiple plan+apply cycles with multiple configurations (or at a minimum, using If you are interested in progress towards designing new workflows to deal with these layered configuration, you can follow #30937 which is a generalized issue about error you are encountering. |
Thanks @jbardin for the explanation. I tried to move the dependencies into the module itself, but this is not possible with community modules. |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. |
Terraform Version
Terraform Configuration Files
🔗 Available on github: https://github.com/boillodmanuel/terraform-depends-on-issue
main.tf
:modules/docs/main.tf
:Debug Output
https://github.com/boillodmanuel/terraform-depends-on-issue/blob/main/tf.plan.debug.output
Expected Behavior
Command
terraform plan
should succeed as module dependency is known.The result should be the same as when dependency is commented:
Actual Behavior
Command
terraform plan
fails with unknown resource error:Steps to Reproduce
terraform init
terraform plan
Additional Context
No response
References
No response
The text was updated successfully, but these errors were encountered: