Skip to content

Terraform 1.3.6 crashes when using optional types for list(map(any)) #32396

@rajatvig

Description

@rajatvig

Terraform Version

1.3.6

Terraform Configuration Files

Using a module with a nested type like

taints                      = optional(list(map(any)), [])

Debug Output

Runs in TF Cloud

Expected Behavior

Works in TF 1.3.1

Actual Behavior

Terraform Crashed

Steps to Reproduce

Plan crashes

Additional Context

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

inconsistent list element types (cty.Object(map[string]cty.Type{"auto_repair":cty.Bool, "auto_upgrade":cty.Bool, "disk_size_gb":cty.Number, "disk_type":cty.String, "enable_integrity_monitoring":cty.Bool, "enable_secure_boot":cty.Bool, "image_type":cty.String, "initial_count":cty.Number, "labels":cty.Map(cty.String), "machine_type":cty.String, "max_count":cty.Number, "max_pods_per_node":cty.Number, "max_surge":cty.Number, "max_unavailable":cty.Number, "metadata":cty.Map(cty.String), "min_count":cty.Number, "min_cpu_platform":cty.String, "name":cty.String, "node_locations":cty.List(cty.String), "node_metadata":cty.String, "preemptible":cty.Bool, "service_account":cty.String, "tags":cty.List(cty.String), "taints":cty.List(cty.Map(cty.String)), "version":cty.String}) then cty.Object(map[string]cty.Type{"auto_repair":cty.Bool, "auto_upgrade":cty.Bool, "disk_size_gb":cty.Number, "disk_type":cty.String, "enable_integrity_monitoring":cty.Bool, "enable_secure_boot":cty.Bool, "image_type":cty.String, "initial_count":cty.Number, "labels":cty.Map(cty.String), "machine_type":cty.String, "max_count":cty.Number, "max_pods_per_node":cty.Number, "max_surge":cty.Number, "max_unavailable":cty.Number, "metadata":cty.Map(cty.String), "min_count":cty.Number, "min_cpu_platform":cty.String, "name":cty.String, "node_locations":cty.List(cty.String), "node_metadata":cty.String, "preemptible":cty.Bool, "service_account":cty.String, "tags":cty.List(cty.String), "taints":cty.List(cty.Map(cty.DynamicPseudoType)), "version":cty.String}))
goroutine 58 [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({0x21e4380, 0xc000d420a0})
/usr/local/go/src/runtime/panic.go:884 +0x212
github.com/zclconf/go-cty/cty.ListVal({0xc002030400, 0x8, 0x1?})
/home/circleci/go/pkg/mod/github.com/zclconf/go-cty@v1.12.1/cty/value_init.go:166 +0x42e
github.com/zclconf/go-cty/cty.transform({0x0?, 0x0, 0x0}, {{{0x2b6dc50?, 0xc0011934f0?}}, {0x20f31c0?, 0xc0010e45e8?}}, {0x2b55020, 0xc00012f1a0})
/home/circleci/go/pkg/mod/github.com/zclconf/go-cty@v1.12.1/cty/walk.go:175 +0xf4a
github.com/zclconf/go-cty/cty.TransformWithTransformer(...)
/home/circleci/go/pkg/mod/github.com/zclconf/go-cty@v1.12.1/cty/walk.go:130
github.com/hashicorp/hcl/v2/ext/typeexpr.(*Defaults).Apply(0xc000d0fa40?, {{{0x2b6dc50?, 0xc0011934f0?}}, {0x20f31c0?, 0xc0010e45e8?}})
/home/circleci/go/pkg/mod/github.com/hashicorp/hcl/v2@v2.15.0/ext/typeexpr/defaults.go:38 +0xa7
github.com/hashicorp/terraform/internal/terraform.prepareFinalInputVariableValue({{0xc000c3e200, 0x1, 0x1}, {{}, {0xc000c13bd0, 0xa}}}, 0xc001e17a58, 0xc000f5bba0)
/home/circleci/project/project/internal/terraform/eval_variable.go:140 +0xaed
github.com/hashicorp/terraform/internal/terraform.(*nodeModuleVariable).evalModuleVariable(0xc000982720?, {0x2b84138?, 0xc00029d420?}, 0x8?)
/home/circleci/project/project/internal/terraform/node_module_variable.go:239 +0x545
github.com/hashicorp/terraform/internal/terraform.(*nodeModuleVariable).Execute(0xc000982720, {0x2b84138, 0xc00029d420}, 0x4)
/home/circleci/project/project/internal/terraform/node_module_variable.go:152 +0xd0
github.com/hashicorp/terraform/internal/terraform.(*ContextGraphWalker).Execute(0xc000ebd950, {0x2b84138, 0xc00029d420}, {0x7fd3ff8b1000, 0xc000982720})
/home/circleci/project/project/internal/terraform/graph_walk_context.go:136 +0xc2
github.com/hashicorp/terraform/internal/terraform.(*Graph).walk.func1({0x23b2e20, 0xc000982720})
/home/circleci/project/project/internal/terraform/graph.go:74 +0x2f0
github.com/hashicorp/terraform/internal/dag.(*Walker).walkVertex(0xc000982780, {0x23b2e20, 0xc000982720}, 0xc00173ef40)
/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
Operation failed: failed running terraform plan (exit 11)

References

No response

Metadata

Metadata

Assignees

Labels

bugconfigconfirmeda Terraform Core team member has reproduced this issuectyUse in conjunction with "upstream" when cty is the relevant upstreamexplaineda Terraform Core team member has described the root cause of this issue in code

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions