Terraform Version
Terraform v1.15.5
on linux_amd64
Terraform Configuration Files
variable "null" {
default = null
const = true
}
module "main" {
source = var.null
}
Debug Output
2026-06-07T22:59:56.318+0900 [INFO] Terraform version: 1.15.5
2026-06-07T22:59:56.318+0900 [DEBUG] using github.com/hashicorp/go-tfe v1.105.0
2026-06-07T22:59:56.318+0900 [DEBUG] using github.com/hashicorp/hcl/v2 v2.24.0
2026-06-07T22:59:56.318+0900 [DEBUG] using github.com/hashicorp/terraform-svchost v0.2.1
2026-06-07T22:59:56.318+0900 [DEBUG] using github.com/zclconf/go-cty v1.18.0
2026-06-07T22:59:56.318+0900 [INFO] Go runtime version: go1.25.10
2026-06-07T22:59:56.318+0900 [INFO] CLI args: []string{"terraform", "init"}
2026-06-07T22:59:56.318+0900 [DEBUG] Attempting to open CLI config file: /home/wata727/.terraformrc
2026-06-07T22:59:56.318+0900 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2026-06-07T22:59:56.318+0900 [DEBUG] ignoring non-existing provider search directory terraform.d/plugins
2026-06-07T22:59:56.318+0900 [DEBUG] ignoring non-existing provider search directory /home/wata727/.terraform.d/plugins
2026-06-07T22:59:56.319+0900 [DEBUG] ignoring non-existing provider search directory /home/wata727/.local/share/terraform/plugins
2026-06-07T22:59:56.319+0900 [DEBUG] ignoring non-existing provider search directory /usr/local/share/terraform/plugins
2026-06-07T22:59:56.319+0900 [DEBUG] ignoring non-existing provider search directory /usr/share/terraform/plugins
2026-06-07T22:59:56.319+0900 [DEBUG] ignoring non-existing provider search directory /var/lib/snapd/desktop/terraform/plugins
2026-06-07T22:59:56.319+0900 [INFO] CLI command args: []string{"init"}
Initializing modules...
2026-06-07T22:59:56.323+0900 [DEBUG] ReferenceTransformer: "var.null" references: []
2026-06-07T22:59:56.323+0900 [DEBUG] ReferenceTransformer: "module.main" references: [var.null]
2026-06-07T22:59:56.323+0900 [DEBUG] Starting graph walk: walkInit
2026-06-07T22:59:56.324+0900 [ERROR] vertex "module.main" panicked
!!!!!!!!!!!!!!!!!!!!!!!!!!! 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: value is null
goroutine 49 [running]:
runtime/debug.Stack()
runtime/debug/stack.go:26 +0x5e
github.com/hashicorp/terraform/internal/logging.PanicHandler()
github.com/hashicorp/terraform/internal/logging/panic.go:84 +0x16a
panic({0x3bfc8e0?, 0x4da74f0?})
runtime/panic.go:783 +0x132
github.com/hashicorp/terraform/internal/terraform.(*Graph).walk.func1.1()
github.com/hashicorp/terraform/internal/terraform/graph.go:59 +0x4e5
panic({0x3bfc8e0?, 0x4da74f0?})
runtime/panic.go:783 +0x132
github.com/zclconf/go-cty/cty.Value.AsString({{{0x4e11b98?, 0x4d9ad90?}}, {0x0?, 0x0?}})
github.com/zclconf/go-cty@v1.18.0/cty/value_ops.go:1461 +0x10b
github.com/hashicorp/terraform/internal/terraform.evalSource({0x4e124d8, 0xc000c00900}, 0x0, {0x4e4e6a0, 0xc000c1c360})
github.com/hashicorp/terraform/internal/terraform/node_module_install.go:217 +0x539
github.com/hashicorp/terraform/internal/terraform.(*nodeInstallModule).Execute(0xc0006d41e0, {0x4e4e6a0, 0xc000c1c360}, 0x58?)
github.com/hashicorp/terraform/internal/terraform/node_module_install.go:94 +0x2b1
github.com/hashicorp/terraform/internal/terraform.(*ContextGraphWalker).Execute(0xc000788840, {0x4e4e6a0, 0xc000c1c360}, {0x7a49d5312bf0, 0xc0006d41e0})
github.com/hashicorp/terraform/internal/terraform/graph_walk_context.go:170 +0xaf
github.com/hashicorp/terraform/internal/terraform.(*Graph).walk.func1({0x4151480, 0xc0006d41e0})
github.com/hashicorp/terraform/internal/terraform/graph.go:143 +0x755
github.com/hashicorp/terraform/internal/dag.(*Walker).walkVertex(0xc0006f8ae0, {0x4151480, 0xc0006d41e0}, 0xc0006da200)
github.com/hashicorp/terraform/internal/dag/walk.go:393 +0x2d1
created by github.com/hashicorp/terraform/internal/dag.(*Walker).Update in goroutine 1
github.com/hashicorp/terraform/internal/dag/walk.go:316 +0xf13
Expected Behavior
It should result in an error, similar to #38628
Actual Behavior
It will cause panic.
Steps to Reproduce
terraform init
Additional Context
`value.AsString() will cause a panic for marked values.
This is the same issue as #38694. value.AsString() causes a panic for null values.
https://github.com/zclconf/go-cty/blob/v1.18.0/cty/value_ops.go#L1460-L1462
The #38628 fix does not account for the case where the value after evaluation is null.
Just to be clear, this issue did not occur in actual production code. It was discovered during white-box testing when supporting dynamic module sources in TFLint, and such cases are likely to be rare in practice.
References
Generative AI / LLM assisted development?
No response
Terraform Version
Terraform Configuration Files
Debug Output
Expected Behavior
It should result in an error, similar to #38628
Actual Behavior
It will cause panic.
Steps to Reproduce
terraform initAdditional Context
`value.AsString() will cause a panic for marked values.
This is the same issue as #38694.
value.AsString()causes a panic for null values.https://github.com/zclconf/go-cty/blob/v1.18.0/cty/value_ops.go#L1460-L1462
The #38628 fix does not account for the case where the value after evaluation is null.
Just to be clear, this issue did not occur in actual production code. It was discovered during white-box testing when supporting dynamic module sources in TFLint, and such cases are likely to be rare in practice.
References
Generative AI / LLM assisted development?
No response