-
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
panic, segmentation violation, and crash with Terraform 0.7.8 #9840
Comments
I just downgraded to Terraform 0.7.7 and the same code worked fine. |
Same for us as well. Works as expected on 0.7.5. Haven't had a chance with .6 or .7 yet.
It's a 14M crash log if anyone's interested in seeing the whole thing. |
It's the same for me. |
Hi folks, I'm picking this up now. If anyone can get a reproduction case that'd be a great help. I'm going to try with the config above, too and will update anyone here. |
Got a minimal repro: main.tf
child/main.tf
Shocked we don't have unit test coverage of this. This was caused by new experimental features being tested in the background of Terraform that are actually crashing. Your actual infrastructure was unaffected and actually likely came up properly (your state is probably complete and fine!), but obviously the crash is not what we want to see. I'm going to look at this bug specifically but also protecting against crashes. |
Fixes #9840 The new apply graph wasn't properly nesting provisioners. This resulted in reading the provisioners being nil on apply in the shadow graph which caused the crash in the above issue. The actual cause of this is that the new graphs we're moving towards do not have any "flattening" (they are flat to begin with): all modules are in the root graph from the beginning of construction versus building a number of different graphs and flattening them. The transform that adds the provisioners wasn't modified to handle already-flat graphs and so was only adding provisioners to the root module, not children. The change modifies the `MissingProvisionerTransformer` (primarily) to support already-flat graphs and add provisioners for all module levels. Tests are there to cover this as well. **NOTE:** This PR focuses on fixing that specific issue. I'm going to follow up this PR with another PR that is more focused on being robust against crashing (more nil checks, recover() for shadow graph, etc.). In the interest of focus and keeping a PR reviewable this focuses only on the issue itself.
Fix is in the referenced PR. We'll rush out a 0.7.9 for this this week. |
Fixes hashicorp#9840 The new apply graph wasn't properly nesting provisioners. This resulted in reading the provisioners being nil on apply in the shadow graph which caused the crash in the above issue. The actual cause of this is that the new graphs we're moving towards do not have any "flattening" (they are flat to begin with): all modules are in the root graph from the beginning of construction versus building a number of different graphs and flattening them. The transform that adds the provisioners wasn't modified to handle already-flat graphs and so was only adding provisioners to the root module, not children. The change modifies the `MissingProvisionerTransformer` (primarily) to support already-flat graphs and add provisioners for all module levels. Tests are there to cover this as well. **NOTE:** This PR focuses on fixing that specific issue. I'm going to follow up this PR with another PR that is more focused on being robust against crashing (more nil checks, recover() for shadow graph, etc.). In the interest of focus and keeping a PR reviewable this focuses only on the issue itself.
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 v0.7.8
Affected Resource(s)
I can't tell what causes the crash. The Terraform code I'm running uses the following resources:
Terraform Configuration Files
It's a fairly large amount of code and I can't tell which part is causing the problem. The last log line suggests it had just finished creating the EIP for the EC2 Instance, so perhaps that's the problem. Here are the snippets for those two resources:
Perhaps it's something to do with using
count
orlocal-exec
in theaws_eip
resource?Panic Output
The full crash log is here: https://gist.github.com/brikis98/634699f731539a04e1ff7ec0e8b54d0b
Expected Behavior
terraform apply
should have succeeded.Actual Behavior
It crashed.
Steps to Reproduce
Run
terraform apply
Important Factoids
This code worked fine before upgrading to Terraform 0.7.8
The text was updated successfully, but these errors were encountered: