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.71k stars 9.55k forks source link

Terraform crashes on 1.6.0 #33978

Closed Erouan50 closed 1 year ago

Erouan50 commented 1 year ago

Terraform Version

Terraform v1.6.0
on linux_amd64
+ provider registry.terraform.io/hashicorp/google v4.80.0
+ provider registry.terraform.io/hashicorp/vault v3.19.0
+ provider registry.terraform.io/integrations/github v5.34.0

Terraform Configuration Files

The infrastructure uses some private modules that I have to extract before I can share the code, so if you can guess the issue with the stack trace and the traces in the meantime, that will be helpful; otherwise, I'll try to extract the code as fast as I can (while hopping I can reproduce the issue). 

Debug Output

https://gist.github.com/Erouan50/8158995d97df305015bbea034d3a5363

Expected Behavior

Terraform shouldn't crash during a terraform plan on version 1.6.0

Actual Behavior

When I execute a terraform plan Terraform crashes with the following stack trace:

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

Terraform crashed! This is always indicative of a bug within Terraform.
Please report the crash with Terraform[1] 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.

[1]: https://github.com/hashicorp/terraform/issues

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

value is marked, so must be unmarked first
goroutine 662 [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?, 0xc000156bd1?}}, {0x2e1de40?, 0xc001d65f68?}})
        /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?, 0xc000156bd1?}}, {0x2e1de40?, 0xc001d65f68?}})
        /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(0xc000304620, 0xc001d65f38)
        /home/runner/go/pkg/mod/github.com/hashicorp/hcl/v2@v2.18.0/hclsyntax/expression.go:745 +0xd35
github.com/hashicorp/hcl/v2/hclsyntax.(*ConditionalExpr).Value(0xc000304690, 0xc001d65f38)
        /home/runner/go/pkg/mod/github.com/hashicorp/hcl/v2@v2.18.0/hclsyntax/expression.go:635 +0x8d
github.com/hashicorp/terraform/internal/lang.(*Scope).EvalExpr(0xc002cf0f30, {0x7f786c0f2018?, 0xc000dd3ae0}, {{0x3902f48?, 0x5130520?}})
        /home/runner/work/terraform/terraform/internal/lang/eval.go:175 +0x1bd
github.com/hashicorp/terraform/internal/terraform.(*BuiltinEvalContext).EvaluateExpr(0x86?, {0x7f786c0f2018, 0xc000dd3ae0}, {{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(0x7f786bf84200?, {0x391fb60, 0xc000fd3ce0}, 0x40?)
        /home/runner/work/terraform/terraform/internal/terraform/node_local.go:158 +0x592
github.com/hashicorp/terraform/internal/terraform.(*ContextGraphWalker).Execute(0xc00159f0e0, {0x391fb60, 0xc000fd3ce0}, {0x7f786bf340e8, 0xc002180f90})
        /home/runner/work/terraform/terraform/internal/terraform/graph_walk_context.go:143 +0xbe
github.com/hashicorp/terraform/internal/terraform.(*Graph).walk.func1({0x2f593a0, 0xc002180f90})
        /home/runner/work/terraform/terraform/internal/terraform/graph.go:78 +0x375
github.com/hashicorp/terraform/internal/dag.(*Walker).walkVertex(0xc00081ec00, {0x2f593a0, 0xc002180f90}, 0xc00110a340)
        /home/runner/work/terraform/terraform/internal/dag/walk.go:384 +0x2e5
created by github.com/hashicorp/terraform/internal/dag.(*Walker).Update in goroutine 373
        /home/runner/work/terraform/terraform/internal/dag/walk.go:307 +0xde8

Steps to Reproduce

  1. Update Terraform from 1.5.7 to 1.6.0
  2. Execute terraform plan

Additional Context

The terraform plan works on Terraform 1.5.7.

References

No response

Erouan50 commented 1 year ago

Duplicate of #33977

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