hashicorp / terraform

Terraform enables you to safely and predictably create, change, and improve infrastructure. It is a source-available tool that codifies APIs into declarative configuration files that can be shared amongst team members, treated as code, edited, reviewed, and versioned.
https://www.terraform.io/
Other
42.31k stars 9.49k forks source link

Terraform Crashing #30132

Closed MattTDickinson closed 2 years ago

MattTDickinson commented 2 years ago

Terraform Version

v1.1.0

Terraform Configuration Files

...

Debug Output

runtime error: invalid memory address or nil pointer dereferencegoroutine 1899 [running]: runtime/debug.Stack() /usr/local/go/src/runtime/debug/stack.go:24 +0x65 runtime/debug.PrintStack() /usr/local/go/src/runtime/debug/stack.go:16 +0x19 github.com/hashicorp/terraform/internal/logging.PanicHandler() /home/circleci/project/project/internal/logging/panic.go:44 +0xb5 panic({0x221d240, 0x3ed5b10}) /usr/local/go/src/runtime/panic.go:1038 +0x215 github.com/hashicorp/terraform/internal/instances.(expanderModule).onlyResourceInstances(0xc005815270, {{}, 0x4d, {0xc000d50c10, 0xb}, {0xc000d50c1c, 0x2}}, {0xc00350e300, 0x18, 0x4}) /home/circleci/project/project/internal/instances/expander.go:392 +0x95 github.com/hashicorp/terraform/internal/instances.(expanderModule).resourceInstances(0x33, {0xc000205f40, 0x0, 0xc00059b400}, {{}, 0x4d, {0xc000d50c10, 0xb}, {0xc000d50c1c, 0x2}}, ...) /home/circleci/project/project/internal/instances/expander.go:387 +0x2e5 github.com/hashicorp/terraform/internal/instances.(expanderModule).resourceInstances(0xc00271bb78, {0xc000205f40, 0x1, 0x1}, {{}, 0x4d, {0xc000d50c10, 0xb}, {0xc000d50c1c, 0x2}}, ...) /home/circleci/project/project/internal/instances/expander.go:385 +0x293 github.com/hashicorp/terraform/internal/instances.(Expander).ExpandResource(0xc002760e60, {{}, {0xc000205f40, 0x1, 0x1}, {{}, 0x4d, {0xc000d50c10, 0xb}, {0xc000d50c1c, ...}}}) /home/circleci/project/project/internal/instances/expander.go:157 +0x16f github.com/hashicorp/terraform/internal/terraform.(NodePlannableResourceInstanceOrphan).deleteActionReason(0xc00067c470, {0x2aecc00, 0xc001ee41c0}) /home/circleci/project/project/internal/terraform/node_resource_plan_orphan.go:204 +0x23b github.com/hashicorp/terraform/internal/terraform.(NodePlannableResourceInstanceOrphan).managedResourceExecute(0xc00067c470, {0x2aecc00, 0xc001ee41c0}) /home/circleci/project/project/internal/terraform/node_resource_plan_orphan.go:140 +0x58c github.com/hashicorp/terraform/internal/terraform.(NodePlannableResourceInstanceOrphan).Execute(0x0, {0x2aecc00, 0xc001ee41c0}, 0x0) /home/circleci/project/project/internal/terraform/node_resource_plan_orphan.go:49 +0x90 github.com/hashicorp/terraform/internal/terraform.(ContextGraphWalker).Execute(0xc0026e80e0, {0x2aecc00, 0xc001ee41c0}, {0x7f3220f4bec0, 0xc00067c470}) /home/circleci/project/project/internal/terraform/graph_walk_context.go:133 +0xc2 github.com/hashicorp/terraform/internal/terraform.(Graph).walk.func1({0x2553ec0, 0xc00067c470}) /home/circleci/project/project/internal/terraform/graph.go:74 +0x2f0 github.com/hashicorp/terraform/internal/dag.(Walker).walkVertex(0xc000ab2e40, {0x2553ec0, 0xc00067c470}, 0xc002a62200) /home/circleci/project/project/internal/dag/walk.go:381 +0x2f1 created by github.com/hashicorp/terraform/internal/dag.(*Walker).Update /home/circleci/project/project/internal/dag/walk.go:304 +0xf85

Expected Behavior

Terraform refresh the state of the resources, Find that 2 of them need destroying and 2 new ones need creating

Actual Behavior

Terraform crashed whilst refreshing the state of the resources

Steps to Reproduce

Please list the full steps required to reproduce the issue, for example: terraform init terraform apply

Additional Context

Terraform is running in a wrapper script which is being deploy by Concourse CI.

References

alisdair commented 2 years ago

Closing as duplicate of #30110. If you can provide some more details about your configuration, that would help. Are you using modules with count/for_each?

github-actions[bot] commented 2 years ago

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.