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.35k stars 9.49k forks source link

Terraform crash #34023

Closed afrodidact closed 11 months ago

afrodidact commented 11 months ago

Terraform Version

tf version
Terraform v1.6.0
on linux_amd64
+ provider registry.terraform.io/fastly/fastly v3.0.4
+ provider registry.terraform.io/hashicorp/aws v4.54.0
+ provider registry.terraform.io/hashicorp/random v3.4.3

Terraform Configuration Files

This error is vague to me, I'm not sure which parts of my Terraform config can be considered relevant here.

Debug Output

N/A

Expected Behavior

Terraform should have generated an execution plan.

Actual Behavior

                                                                                                                                                                                                             !!!!!!!!!!!!!!!!!!!!!!!!!!! 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 !!!!!!!!!!!!!!!!!!!!!!!!!!!!

value is marked, so must be unmarked first goroutine 4378 [running]: runtime/debug.Stack() /opt/hostedtoolcache/go/1.21.1/x64/src/runtime/debug/stack.go:24 +0x5e runtime/debug.PrintStack() /opt/hostedtoolcache/go/1.21.1/x64/src/runtime/debug/stack.go:16 +0x13 github.com/hashicorp/terraform/internal/logging.PanicHandler() /home/runner/work/terraform/terraform/internal/logging/panic.go:58 +0x13b panic({0x2b92ec0?, 0x38c4c30?}) /opt/hostedtoolcache/go/1.21.1/x64/src/runtime/panic.go:920 +0x270 github.com/zclconf/go-cty/cty.Value.assertUnmarked(...) /home/runner/go/pkg/mod/github.com/zclconf/go-cty@v1.14.0/cty/marks.go:141 github.com/zclconf/go-cty/cty.Value.AsString({{{0x3902720?, 0xc000136be1?}}, {0x2e1de40?, 0xc002a6b080?}}) /home/runner/go/pkg/mod/github.com/zclconf/go-cty@v1.14.0/cty/value_ops.go:1385 +0x47 github.com/zclconf/go-cty/cty.Value.Range({{{0x3902720?, 0xc000136be1?}}, {0x2e1de40?, 0xc002a6b080?}}) /home/runner/go/pkg/mod/github.com/zclconf/go-cty@v1.14.0/cty/value_range.go:53 +0x285 github.com/hashicorp/hcl/v2/hclsyntax.(ConditionalExpr).Value(0xc0002f6540, 0xc002a6b068) /home/runner/go/pkg/mod/github.com/hashicorp/hcl/v2@v2.18.0/hclsyntax/expression.go:746 +0xd6a github.com/hashicorp/terraform/internal/lang.(Scope).EvalExpr(0xc005e20cf0, {0x3902df8?, 0xc0002f6540}, {{0x3902f48?, 0x5130520?}}) /home/runner/work/terraform/terraform/internal/lang/eval.go:175 +0x1bd github.com/hashicorp/terraform/internal/terraform.(BuiltinEvalContext).EvaluateExpr(0x70?, {0x3902df8, 0xc0002f6540}, {{0x3902f48?, 0x5130520?}}, {0x0?, 0x0?}) /home/runner/work/terraform/terraform/internal/terraform/eval_context_builtin.go:289 +0xab github.com/hashicorp/terraform/internal/terraform.(NodeLocal).Execute(0x7ffa4a685500?, {0x391fb60, 0xc003aa02a0}, 0x70?) /home/runner/work/terraform/terraform/internal/terraform/node_local.go:158 +0x592 github.com/hashicorp/terraform/internal/terraform.(ContextGraphWalker).Execute(0xc0035e59e0, {0x391fb60, 0xc003aa02a0}, {0x7ffa4a877860, 0xc005065050}) /home/runner/work/terraform/terraform/internal/terraform/graph_walk_context.go:143 +0xbe github.com/hashicorp/terraform/internal/terraform.(Graph).walk.func1({0x2f593a0, 0xc005065050}) /home/runner/work/terraform/terraform/internal/terraform/graph.go:78 +0x375 github.com/hashicorp/terraform/internal/dag.(Walker).walkVertex(0xc001262180, {0x2f593a0, 0xc005065050}, 0xc005f1c700) /home/runner/work/terraform/terraform/internal/dag/walk.go:384 +0x2e5 created by github.com/hashicorp/terraform/internal/dag.(Walker).Update in goroutine 2120 /home/runner/work/terraform/terraform/internal/dag/walk.go:307 +0xde8

Steps to Reproduce

  1. terraform plan

Additional Context

No response

References

No response

afrodidact commented 11 months ago

Reverting to v1.5.7, has enabled me to run terraform commands again, however I had to reconfigure my state to do so. As well as several force-unlocks because despite crashing immediately after invocation, terraform is still locking the state.

liamcervante commented 11 months ago

Thanks for reporting this!

I believe this is a duplicate of https://github.com/hashicorp/terraform/issues/33977, and a fix has already been merged for release in v1.6.1

github-actions[bot] commented 9 months 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.