Skip to content

Terraform crash on plan after upgrading to 1.6.1 (value is unknown) #34060

@adebande

Description

@adebande

Terraform Version

Terraform v1.6.1
on darwin_arm64

Terraform Configuration Files

terraform {
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = "~> 5.0"
    }
  }

  backend "s3" {
    region         = "xxxxx"
    bucket         = "xxxxx"
    key            = "xxxxx"
    dynamodb_table = "xxxxx"
    profile        = "xxxxx"
  }
}
...

Debug Output

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

value is unknown
goroutine 621 [running]:
runtime/debug.Stack()
        /Users/runner/hostedtoolcache/go/1.21.1/x64/src/runtime/debug/stack.go:24 +0x64
runtime/debug.PrintStack()
        /Users/runner/hostedtoolcache/go/1.21.1/x64/src/runtime/debug/stack.go:16 +0x1c
github.com/hashicorp/terraform/internal/logging.PanicHandler()
        /Users/runner/work/terraform/terraform/internal/logging/panic.go:58 +0x164
panic({0x10738a8a0?, 0x10797a820?})
        /Users/runner/hostedtoolcache/go/1.21.1/x64/src/runtime/panic.go:920 +0x26c
github.com/zclconf/go-cty/cty.Value.AsBigFloat({{{0x1079b7bc8?, 0x140001aabd8?}}, {0x107469240?, 0x140030e9700?}})
        /Users/runner/go/pkg/mod/github.com/zclconf/go-cty@v1.14.1/cty/value_ops.go:1413 +0x110
github.com/hashicorp/hcl/v2/hclsyntax.(*ConditionalExpr).Value(0x1400086d9d0, 0x14002679770)
        /Users/runner/go/pkg/mod/github.com/hashicorp/hcl/v2@v2.18.1/hclsyntax/expression.go:728 +0x868
github.com/hashicorp/hcl/v2/ext/dynblock.(*expandBody).decodeSpec(0x1400278c4e0, 0x14002f00490, 0x14002957040)
        /Users/runner/go/pkg/mod/github.com/hashicorp/hcl/v2@v2.18.1/ext/dynblock/expand_spec.go:44 +0x168
github.com/hashicorp/hcl/v2/ext/dynblock.(*expandBody).expandBlocks(0x1400278c4e0, 0x1400278d200, {0x1400267fe80, 0x6, 0x0?}, 0x1)
        /Users/runner/go/pkg/mod/github.com/hashicorp/hcl/v2@v2.18.1/ext/dynblock/expand_body.go:186 +0x4b8
github.com/hashicorp/hcl/v2/ext/dynblock.(*expandBody).PartialContent(0x1400278c4e0, 0x1400278d200)
        /Users/runner/go/pkg/mod/github.com/hashicorp/hcl/v2@v2.18.1/ext/dynblock/expand_body.go:55 +0x7c
github.com/hashicorp/hcl/v2/ext/dynblock.WalkVariablesNode.Visit({{0x1079b89d0?, 0x1400278c4e0?}, 0x0?, 0x68?}, 0x1400278cf00)
        /Users/runner/go/pkg/mod/github.com/hashicorp/hcl/v2@v2.18.1/ext/dynblock/variables.go:75 +0x1dc
github.com/hashicorp/terraform/internal/lang/blocktoattr.walkVariables({{0x1079b89d0?, 0x1400278c4e0?}, 0x0?, 0x0?}, {0x1079b89d0, 0x1400278c4e0}, 0x14005aab2f0)
        /Users/runner/work/terraform/terraform/internal/lang/blocktoattr/variables.go:34 +0x90
github.com/hashicorp/terraform/internal/lang/blocktoattr.ExpandedVariables(...)
        /Users/runner/work/terraform/terraform/internal/lang/blocktoattr/variables.go:27
github.com/hashicorp/terraform/internal/lang.ReferencesInBlock(0x14005aab2f0?, {0x1079b89d0?, 0x1400278c4e0?}, 0x1051c5448?)
        /Users/runner/work/terraform/terraform/internal/lang/references.go:72 +0x4c
github.com/hashicorp/terraform/internal/lang.(*Scope).EvalBlock(0x1400267c240, {0x1079b89d0, 0x1400278c4e0}, 0x14002f01168?)
        /Users/runner/work/terraform/terraform/internal/lang/eval.go:53 +0x58
github.com/hashicorp/terraform/internal/terraform.(*BuiltinEvalContext).EvaluateBlock(0x0?, {0x1079b81b8, 0x14000e856b0}, 0x107699640?, {0x0?, 0x0?}, {{{{0x0, 0x0}}, {0x0, 0x0}}, ...})
        /Users/runner/work/terraform/terraform/internal/terraform/eval_context_builtin.go:282 +0xe0
github.com/hashicorp/terraform/internal/terraform.(*NodeValidatableResource).validateResource(0x14000b8a630, {0x1079d2490, 0x140015208c0})
        /Users/runner/work/terraform/terraform/internal/terraform/node_resource_validate.go:372 +0x4bc
github.com/hashicorp/terraform/internal/terraform.(*NodeValidatableResource).Execute(0x14000b8a630, {0x1079d2490, 0x140015208c0}, 0x80?)
        /Users/runner/work/terraform/terraform/internal/terraform/node_resource_validate.go:52 +0x40
github.com/hashicorp/terraform/internal/terraform.(*ContextGraphWalker).Execute(0x14006c96b40, {0x1079d2490, 0x140015208c0}, {0x150b0a098, 0x14000b8a630})
        /Users/runner/work/terraform/terraform/internal/terraform/graph_walk_context.go:143 +0xa0
github.com/hashicorp/terraform/internal/terraform.(*Graph).walk.func1({0x1078d35e0, 0x14000b8a630})
        /Users/runner/work/terraform/terraform/internal/terraform/graph.go:78 +0x280
github.com/hashicorp/terraform/internal/dag.(*Walker).walkVertex(0x140010d28a0, {0x1078d35e0, 0x14000b8a630}, 0x14002a49c00)
        /Users/runner/work/terraform/terraform/internal/dag/walk.go:384 +0x2a8
created by github.com/hashicorp/terraform/internal/dag.(*Walker).Update in goroutine 28
        /Users/runner/work/terraform/terraform/internal/dag/walk.go:307 +0xb0c

Expected Behavior

Successful terraform plan

Actual Behavior

terraform plan results in a crash

Steps to Reproduce

  1. terraform init -reconfigure
  2. terraform plan

Additional Context

This issue appears after upgrading to Terraform 1.6 (existing project, works fine on 1.5.7).
Big project with a lot of conditional expressions and dynamic blocks, backend on S3 with DynamoDB lock and multiple AWS provider aliases.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions