Skip to content

Terraform crashes in recent versions - invalid memory address or nil pointer dereference goroutine 3192 #32645

@afzalch

Description

@afzalch

Terraform Version

1.3.7
1.3.6

Terraform Configuration Files

...terraform config...

Debug Output

!!!!!!!!!!!!!!!!!!!!!!!!!!! TERRAFORM CRASH !!!!!!!!!!!!!!!!!!!!!!!!!!!!

Terraform crashed! This is always indicative of a bug within Terraform.
Please report the crash with Terraform1 so that we can fix this.

When reporting bugs, please include your terraform version, the stack trace
shown below, and any additional information which may help replicate the issue.

!!!!!!!!!!!!!!!!!!!!!!!!!!! TERRAFORM CRASH !!!!!!!!!!!!!!!!!!!!!!!!!!!!

runtime error: invalid memory address or nil pointer dereference
goroutine 3192 [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:55 +0x153
panic({0x223cde0, 0x3e36ac0})
/usr/local/go/src/runtime/panic.go:884 +0x212
github.com/hashicorp/terraform/internal/terraform.(*NodePlannableResourceInstanceOrphan).managedResourceExecute(0xc003751440, {0x2b85518, 0xc00283a2a0})
/home/circleci/project/project/internal/terraform/node_resource_plan_orphan.go:128 +0x415
github.com/hashicorp/terraform/internal/terraform.(*NodePlannableResourceInstanceOrphan).Execute(0x0?, {0x2b85518?, 0xc00283a2a0?}, 0x20?)
/home/circleci/project/project/internal/terraform/node_resource_plan_orphan.go:49 +0x90
github.com/hashicorp/terraform/internal/terraform.(*ContextGraphWalker).Execute(0xc002e73c20, {0x2b85518, 0xc00283a2a0}, {0x7f239d5dfc98, 0xc003751440})
/home/circleci/project/project/internal/terraform/graph_walk_context.go:136 +0xc2
github.com/hashicorp/terraform/internal/terraform.(*Graph).walk.func1({0x256df60, 0xc003751440})
/home/circleci/project/project/internal/terraform/graph.go:74 +0x2f0
github.com/hashicorp/terraform/internal/dag.(*Walker).walkVertex(0xc002b09e60, {0x256df60, 0xc003751440}, 0xc006379a80)
/home/circleci/project/project/internal/dag/walk.go:381 +0x2f6
created by github.com/hashicorp/terraform/internal/dag.(*Walker).Update
/home/circleci/project/project/internal/dag/walk.go:304 +0xf65
time=2023-01-18T17:11:55Z level=error msg=1 error occurred:
* exit status 11


APPLY_RESULT = 11


Expected Behavior

Terraform should pass successfully, when downgrading the same code to v1.3.5 the code works

Actual Behavior

Terraform crashes as shown with debug output above

Steps to Reproduce

terraform init
terraform apply

Additional Context

Using terragrunt to wrap the terraform command

References

#30950

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions