-
Notifications
You must be signed in to change notification settings - Fork 9.7k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Crashing for_each/self regression introduced by #22846 #23194
Comments
Hi @isometry , I'm having the same issue. Have you found a solution? |
Unfortunately, I've found no solution: any reference to |
Hi @isometry, that's what I ended up doing as well. Problem is that my state had been upgraded to a new version with 0.12.12, so 0.12.10 could not use it anymore. This forced me to recreate a cluster with 0.12.10 :( I have just started to use Terraform and this scares me. Luckily I am still setting things up for development only, but what if I had something in production and had this kind of problem? Is there a way for an older version to use the state updated with a newer version? Thanks |
You can do the following to recover your updated state into a new workspace compatible with the older version: # Backup the current 0.12.12 state, transforming it to believe it's a 0.12.10 state
terraform_0.12.12 state pull | jq '.terraform_version="0.12.10"' > backup.tfstate
# Create a new workspace named "recovered" to hold the 0.12.10 state
terraform_0.12.10 workspace new recovered
# Restore the backup into the new workspace
terraform_0.12.10 state push backup.tfstate If you don't have I used the procedure above to successfully recover my state from 0.12.12 to 0.12.10, though other versions may require more work. |
@isometry This is great, thanks! I'll keep in mind from now on when I upgrade. I wish I had asked before :( |
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
Trivial test case:
Debug Output
debug.log
Crash Output
crash.log
Expected Behavior
Terraform completes without crashing: the
local-exec
provisioner run successfully, printingpet name is ${self.id}
.Actual Behavior
Terraform panics whilst resolving
self.id
:Steps to Reproduce
terraform init
terraform apply
Additional Context
The above test case is simply the most trivial I've found to reproduce the crash which is easily reproducible with multiple providers, and with increasingly complex
for_each
loops. Terraform will crash wheneverself
is referenced within a provisioner. In particular, it has introduced a blocking issue for us with thevsphere.vmware_virtual_machine
provider with which we use afor_each = {…}
map.References
The text was updated successfully, but these errors were encountered: