-
Notifications
You must be signed in to change notification settings - Fork 9.5k
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
runtime error: invalid memory address or nil pointer -- v1.1.0-rc1 #30110
Comments
For whatever reason, if I add in a |
Debugging further, this seems kinda like an issue with using If I leave my module as is...
plan works fine on v1.1.0-rc1. If I add a
This usage of Also, this is with no
there is no crash as I'd expect. Is v1.1.0-rc1 forcing the usage of |
Hi @rymancl! Thanks for trying the release candidate and reporting this crash. A panic like this is never correct Terraform behavior, so indeed this is not a symptom of us trying to force any particular usage of We've spent a little time investigating this so far and haven't yet achieved a reproduction, though your latest comment arrived after we'd already been working for a while and so it will hopefully give us some more information to work with on a second attempt. Unfortunately we're getting very close to the v1.1.0 final release now and so out of pragmatism we're going to leave this one unsolved for v1.1.0 and instead hope to have it solved in time for v1.1.1. While we never like to leave known bugs in final releases, it seems like this is a problem encountered during the plan step rather than the apply step, and so it fails prior to making any changes to remote objects and thus only blocks upgrading to Terraform v1.1, as opposed to causing difficult-to-resolve problems in production. With that said then, we will prioritize debugging this as soon as possible, but we'll have to ask for you and anyone else who encounters a similar problem to remain on the latest Terraform v1.0.x release until we've been able to resolve this bug. Thanks again for reporting this! We'll share more updates when we have them. |
Thanks for reporting this! I'm glad you were able to find the I have a minimal reproduction, with the following config: main.tf: module "foo" {
source = "./modules/foo"
# count = 1
} modules/foo/main.tf: resource "null_resource" "default" {
count = 1
} Steps to reproduce:
The use of |
Thanks for the info @apparentlymart & @alisdair ! @alisdair - Sadly my workaround doesn't work 100%. If I'm on a workspace where my module doesn't get deployed , it'll still panic.
Unfortunately, this setup of applying modules conditionally based on workspace, and not having to destroy active resources, was my whole reason for testing the
EDIT: I think the dynamic moves may be a little deeper of a topic. Assuming everything is fixed, what should actually be the result of
when I try to plan on the |
Also having this issue. My code works fine on 1.0.11. We do have a few |
In our situation it leads to a difficult problem to be solved. The upgrade to Terraform 1.1.0 went well the first times, but since a change in our parameter make the plan to fail with the same error than this issue. I'm not sure I can downgrade Terraform since my state is already written by 1.1.0 I have a minimal repro case
variable "param" {
type = string
}
module "m1" {
source = "./m1/"
for_each = toset([var.param])
}
resource "null_resource" "provision" {
for_each = toset(["test"])
} Then terraform init
terraform apply -auto-approve '-var=param=test'
terraform plan '-var=param=test'
---> works
terraform plan '-var=param=test2'
---> crash! |
Hi @xfournet, The state snapshot format has not changed between Terraform v1.0 and Terraform v1.1, so in principle you should still be able to downgrade back to v1.0 at this point. If you try that and find that it doesn't work, please let me know and I will investigate a different workaround. |
Thanks @apparentlymart i was able to downgrade without problem |
Closed #30139 as a dupe of this issue. |
Chiming in that I'm seeing a similar crash on v1.1.0 after adding a
|
Similar crash if I modify an existing set used in a for_each such as adding or removing an item. |
@zswanson Not as far as I can tell. Please submit a new issue with a reproduction case and a stack trace and we can investigate. Thanks! |
Workaround:
Now that plan no longer have to remove the module the |
I had the same crash when I tried to do a plan with |
We've merged the fix for this issue, which will be included in the upcoming 1.1.1 release. Thanks all for your reports! |
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
(running on wsl if it matters)
Terraform Configuration Files
I'm not able to post the code for this, but essentially it's a large project that references about 60 [local] modules. Inside those modules are various IAM resources (roles, policies, attachments, etc).
Debug Output
Expected Behavior
Plan should succeed
Actual Behavior
Plan crashes
Steps to Reproduce
Additional Context
This is my first time testing out a non-main release, apologies if I'm just missing something obvious. I'm happy to provide any additional info/context if I'm able to.
References
The text was updated successfully, but these errors were encountered: