-
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
Plan incorrectly reports that it will delete existing resource data #15962
Comments
Indeed this is confusing... I tried this out and found that the configuration is correctly updated ( |
I suspect this could be fixed by simply changing EDIT: To elaborate on this a bit more, the reason that the resource does the right thing while TF outputs both values being redone is because the delta calculated by TF is ignored by this snippet. When updating config vars the resource sets all old keys to |
This issue is a limitation of the code that prints out the plan into the UI. The problem is that it just compares each distinct key one by one, and doesn't take into account things like lists, maps, and sets. In this particular case, because the map as a whole is now This'll be fixed after we implement #15180, which we hope to do either as part of the 0.12 release or shortly after, depending on how the rest of the 0.12 development goes (that is, it's a stretch goal). |
Hello! 🤖 This issue relates to an older version of Terraform that is no longer in active development, and because the area of Terraform it relates to has changed significantly since the issue was opened we suspect that the issue is either fixed or that the circumstances around it have changed enough that we'd need an updated issue report in order to reproduce and address it. If you're still seeing this or a similar issue in the latest version of Terraform, please do feel free to open a new bug report! Please be sure to include all of the information requested in the template, even if it might seem redundant with the information already shared in this issue, because the internal details relating to this problem are likely to be different in the current version of Terraform. Thanks! |
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. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
Terraform Version
Terraform Configuration Files
Initial configuration:
Configuration after apply:
Debug Output
https://gist.github.com/bernerdschaefer/6cd4b1937ff1d51b1fbe0042fcfa8936
Expected Behavior
I expect the plan to show that a new config var SECRET will be added to the
app, whose value comes from the new
random_id.secret
resource. For example:Actual Behavior
The plan in fact shows that it will delete the existing FOO configuration
variable, and does not mention the new SECRET variable at all.
This causes us some anxiety when applying such a change in production -- we
basically have to trust that apply will do the right thing even when the plan
says it will remove critical configuration information from the app.
It also took a lot of trial and error to trace this back to the dependency on a
new resource; before it seemed like terraform would "randomly" report it would
delete all of our configurations.
Steps to Reproduce
terraform init
terraform apply
terraform plan
Important Factoids
This is not limited to random_id, but any new resource which has not yet been
applied.
Note that apply in fact does the right thing -- it's only the generated plan
that's incorrect / confusing.
The heroku provider seems to be doing pretty standard stuff here, so I don't
think this is specific to the provider, but I'm happy to re-open an issue there
instead if that makes sense.
The text was updated successfully, but these errors were encountered: