Loading...
Loading...
### Terraform Version ```shell Terraform v1.15.2 on darwin_arm64 + provider registry.terraform.io/hashicorp/aws v6.42.0 ``` ### Terraform Configuration Files ```terraform locals { # delegations is used to define NS records that delegate subdomains to other # name servers in other AWS accounts. The structure is: # { # "" = { # "" = { # "" = [] # } # } # The "category" is purely for organization and does not affect the Terraform # resource name. delegations = {} # Redacted } resource "aws_route53_record" "delegation" { for_each = { for v in flatten([ for apex, buckets in local.delegations : [ for bucket, entries in buckets : [ for sub, ns in entries : [ { name = "${sub}.${apex}", apex = apex, ns = ns }, # We automatically create a "cname-" delegation, since it is commonly # used by the external-dns controller for TXT heritage records. { name = "cname-${sub}.${apex}", apex = apex, ns = ns }, ] ] ] ]) : v.name => v } zone_id = aws_route53_zone.this[each.value.apex].id name = each.key type = "NS" ttl = 172800 records = each.value.ns } ``` ### Debug Output Sorry I can't get the debug output anymore, since I worked around it already with targeted-applies. ``` Plan: 156 to add, 0 to change, 0 to destroy. Do you want to perform these actions? Terraform will perform the actions described above. Only 'yes' will be accepted to approve. Enter a value: yes !!!!!!!!!!!!!!!!!!!!!!!!!!! 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 !!!!!!!!!!!!!!!!!!!!!!!!!!!! panic: runtime error: invalid memory address or nil pointer dereference goroutine 1355 [running]: runtime/debug.Stack() runtime/debug/stack.go:26 +0x64 github.com/hashicorp/terraform/internal/logging.PanicHandler() github.com/hashicorp/terraform/internal/logging/panic.go:84 +0x16c panic({0x105ec0640?, 0x108b9d820?}) runtime/panic.go:783 +0x120 github.com/hashicorp/terraform/internal/terraform.(*Graph).walk.func1.1() github.com/hashicorp/terraform/internal/terraform/graph.go:59 +0x30c panic({0x105ec0640?, 0x108b9d820?}) runtime/panic.go:783 +0x120 github.com/hashicorp/terraform/internal/terraform.(*NodeAbstractResourceInstance).readDiff(0x14004e96488, {0x1067a9fc0?, 0x1400a45d8c0?}, {{0x0, 0x1400446efc0, 0x0, 0x0}, {0x0, 0x1400446f140, 0x0, ...}, ...}) github.com/hashicorp/terraform/internal/terraform/node_resource_abstract_instance.go:178 +0x1d0 github.com/hashicorp/terraform/internal/terraform.(*NodeApplyableResourceInstance).managedResourceExecute(0x140001a1bc0, {0x1067a9fc0, 0x1400a45d8c0}) github.com/hashicorp/terraform/internal/terraform/node_resource_apply_instance.go:219 +0x234 github.com/hashicorp/terraform/internal/terraform.(*NodeApplyableResourceInstance).Execute(0x1067abe40?, {0x1067a9fc0?, 0x1400a45d8c0?}, 0xc0?) github.com/hashicorp/terraform/internal/terraform/node_resource_apply_instance.go:123 +0x94 github.com/hashicorp/terraform/internal/terraform.(*ContextGraphWalker).Execute(0x14009972420, {0x1067a9fc0, 0x1400a45d8c0}, {0x12fe391b8, 0x140001a1bc0}) github.com/hashicorp/terraform/internal/terraform/graph_walk_context.go:170 +0xa0 github.com/hashicorp/terraform/internal/terraform.(*Graph).walk.func1({0x1066cac60, 0x140001a1bc0}) github.com/hashicorp/terraform/internal/terraform/graph.go:143 +0x598 github.com/hashicorp/terraform/internal/dag.(*Walker).walkVertex(0x14009d0a960, {0x1066cac60, 0x140001a1bc0}, 0x1400721e700) github.com/hashicorp/terraform/internal/dag/walk.go:393 +0x284 created by github.com/hashicorp/terraform/internal/dag.(*Walker).Update in goroutine 935 github.com/hashicorp/terraform/internal/dag/walk.go:316 +0xae4 ``` ### Expected Behavior I am running `terraform apply` to apply a single `aws_route53_record` resource that has 156 instances using `for_each`. The `for_each` depends entirely on static locals. Nothing is derived from resources or data sources. I expect the apply to work. ### Actual Behavior Once the apply starts, Terraform immediately crashes with a nil pointer dereference panic. ### Steps to Reproduce 1. `terraform apply` 2. Type `yes` ### Additional Context I am able to workaround this by applying using `-target`. I got through my 156 instances by working in batches of 10. ### References Possibly related to https://github.com/hashicorp/terraform/issues/38550, but I was directed to open a new issue. ### Generative AI / LLM assisted development? _No response_
Click on a version to see all relevant bugs
Terraform Integration
Learn more about where this data comes from
Bug Scrub Advisor
Streamline upgrades with automated vendor bug scrubs
BugZero Enterprise
Wish you caught this bug sooner? Get proactive today.