-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Crash during plan migrating to 0.12 #10135
Comments
@Tirke I think your problem may be the nested list in the
and
when using the module which will result in
or equivalent "Resource": [
["*"]
] There is a problem https://github.com/jen20/awspolicyequivalence/blob/9ebbf3c225b2b9da629263e13c3015a5de7965d1/aws_policy_equivalence.go#L386 in a dependency that causes the panic on Could you please try changing the module output to:
Thanks. |
Submitted upstream PR jen20/awspolicyequivalence#9 to fix the panic, but this won't fix the problem with nested arrays which will probably result in a run time |
Thanks for the PR fixing the panic @ewbankkit. I did found the fix the day after submitting the PR and answered in my original PR. But with your fix, things should be easier for future people encountering that. |
@Tirke Yes, I should have read the original issue's comment: hashicorp/terraform#22813 (comment). |
I'm not sure I can as it was opened by hashibot. |
This should be fixed by upgrading to v1.1.0 of |
This brings in the fix from @ewbankkit for a panic in the case of an incorrect type assertion against nil. Fixes #10135. Fixes #10528.
The fix for this has been merged and will release with version 2.42.0 of the Terraform AWS Provider, likely next week. Thanks @ewbankkit and @jen20 for the implementation. 👍 |
This has been released in version 2.42.0 of the Terraform AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template for triage. 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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks! |
This issue was originally opened by @Tirke as hashicorp/terraform#22813. It was migrated here as a result of the provider split. The original body of the issue is below.
Terraform Version
Terraform Configuration Files
Module outputting IAM policy
Module consuming the policy module
Root consumer
Crash Output
Full crash output :
https://gist.github.com/Tirke/93c82c9a3ba02eb85196861c9119462a
Relevant bits :
Context and expected behavior, fix ...
We are currently migrating our big project from tf 0.11 to tf 0.12.
The first few layers went quite well but we hit a crash during the first 0.12 plan on our two biggest layers. I've done a minimal reproduction on our biggest tfstate (5MO mainly because it contains the swagger definition for our API Gateway).
After discussing some problems we have with the refresh phase on this tfstate (see hashicorp/terraform#22617) we decided to rewrite all our 900
data.aws_iam_policy_document
to a more simple HCL object +jsonencode
. All our previous modules containingdata.aws_iam_policy_document
now contain JSON encoded outputs like you can see in the first snippet I provided.And this refactoring seems to be the exact source of our problem. Making a plan from a empty local tfstate works. Making the plan against our existing tfstate doesn't. And from the crash log I heavily suspect that there is something going on between our old
data.aws_iam_policy_document
and the new JSON encoded modules.I've already found what seems to be a fix but it would cost us a lot of inefficient rewriting of many modules to switch to a working version. The fix is quite simple, I just need to rewrite the second module with an inline policy :
Module consuming the policy module
I also suspect that doing some surgery in our tfstate could fix things. Something like
tf state remove
everything related to our old modules containing thedata.aws_iam_policy_document
but I've not tested that yet because I'm hoping that there is a potential fix to this issue.The text was updated successfully, but these errors were encountered: