-
Notifications
You must be signed in to change notification settings - Fork 10.1k
Open
Description
Terraform Version
v1.13.4Terraform Configuration Files
Any plan file contains ephemeral resource
Debug Output
I have plan file that creates ephemeral resources and when I executed terraform show -json planfile, it crashed with the following error message:
!!!!!!!!!!!!!!!!!!!!!!!!!!! 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: unsupported resource mode 69
goroutine 1 [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({0x34fe320?, 0xc001e3b400?})
runtime/panic.go:792 +0x132
github.com/hashicorp/terraform/internal/command/jsonchecks.makeStaticObjectAddr({0x44a0468, 0xc0005d5440})
github.com/hashicorp/terraform/internal/command/jsonchecks/objects.go:33 +0x925
github.com/hashicorp/terraform/internal/command/jsonchecks.MarshalCheckStates(0xc000724218)
github.com/hashicorp/terraform/internal/command/jsonchecks/checks.go:51 +0x267
github.com/hashicorp/terraform/internal/command/jsonplan.Marshal(0xc0008856c0, 0xc0007e64e0, 0xc0008f06c0, 0xc000b0dbd0)
github.com/hashicorp/terraform/internal/command/jsonplan/plan.go:317 +0x45f
github.com/hashicorp/terraform/internal/command/views.(*ShowJSON).Display(0xc000724020, 0x0?, 0x0?, 0xc002045988?, 0x0?, 0x1800000000000000?)
github.com/hashicorp/terraform/internal/command/views/show.go:143 +0xfa
github.com/hashicorp/terraform/internal/command.(*ShowCommand).Run(0xc000582700, {0xc000070160, 0x2, 0x2})
github.com/hashicorp/terraform/internal/command/show.go:86 +0x543
github.com/hashicorp/cli.(*CLI).Run(0xc0005d2280)
github.com/hashicorp/cli@v1.1.7/cli.go:265 +0x4de
main.realMain()
github.com/hashicorp/terraform/main.go:339 +0x1deb
main.main()
github.com/hashicorp/terraform/main.go:64 +0x13
I have checked the source code:
ret["kind"] = "resource"
switch addr.Resource.Mode {
case addrs.ManagedResourceMode:
ret["mode"] = "managed"
case addrs.DataResourceMode:
ret["mode"] = "data"
default:
panic(fmt.Sprintf("unsupported resource mode %#v", addr.Resource.Mode))
}Looks like we need add logic for ephemeral block?
Expected Behavior
No panic
Actual Behavior
Panic, crashed
Steps to Reproduce
terraform plan -out=file to create a plan with ephemeral in your TF config, then terraform show -json <plan>
Additional Context
No response
References
No response
Generative AI / LLM assisted development?
No response