Skip to content

Crash in terraform console trying to access module variables #37352

@lapkritinis

Description

@lapkritinis

Terraform Version

terraform -version
Terraform v1.12.2
on darwin_arm64
+ provider registry.terraform.io/hashicorp/aws v6.3.0

Terraform Configuration Files

Sorry, I can't share repository at least publicly, but could share privately
I can't really figure out what is causing this crash - apart that that I try to access module.subnet in console. Apply works fine though.

Debug Output

> module.subnet

!!!!!!!!!!!!!!!!!!!!!!!!!!! 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: no expansion has been registered for module.subnet
goroutine 1 [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 +0x188
panic({0x105a39b60?, 0x140066584d0?})
	runtime/panic.go:792 +0x124
github.com/hashicorp/terraform/internal/instances.(*Expander).ExpandAbsModuleCall(0x14001fbb0f8?, {{0x0, 0x0, 0x0}, {{}, {0x14000e886b0, 0x6}}})
	github.com/hashicorp/terraform/internal/instances/expander.go:175 +0x220
github.com/hashicorp/terraform/internal/terraform.(*evaluationStateData).GetModule(0x14003504360, {{}, {0x14000e886b0?, 0x0?}}, {{0x1050f8a85, 0xf}, {0x1, 0x1, 0x0}, {0x1, ...}})
	github.com/hashicorp/terraform/internal/terraform/evaluate.go:409 +0x610
github.com/hashicorp/terraform/internal/lang.(*Scope).evalContext(0x140035043f0, {0x14000e80008, 0x1, 0x1}, {0x0, 0x0})
	github.com/hashicorp/terraform/internal/lang/eval.go:387 +0x1534
github.com/hashicorp/terraform/internal/lang.(*Scope).EvalContext(...)
	github.com/hashicorp/terraform/internal/lang/eval.go:248
github.com/hashicorp/terraform/internal/lang.(*Scope).EvalExpr(0x140035043f0, {0x1062001c0, 0x140009ba7e0}, {{0x106200678?, 0x107e679e0?}})
	github.com/hashicorp/terraform/internal/lang/eval.go:173 +0x80
github.com/hashicorp/terraform/internal/repl.(*Session).handleEval(0x14001fbd928, {0x14001fbd6f0?, 0x1057b86a8?})
	github.com/hashicorp/terraform/internal/repl/session.go:58 +0x144
github.com/hashicorp/terraform/internal/repl.(*Session).Handle(0x14001fbd928, {0x14001fbd6f0, 0xe})
	github.com/hashicorp/terraform/internal/repl/session.go:43 +0xe8
github.com/hashicorp/terraform/internal/command.(*ConsoleCommand).modeInteractive(0x14000502700, 0x14001fbd928, {0x1062088b0, 0x140007d85d0})
	github.com/hashicorp/terraform/internal/command/console_interactive.go:91 +0x3d0
github.com/hashicorp/terraform/internal/command.(*ConsoleCommand).Run(0x14000502700, {0x1400011c0d0?, 0x105c8ec60?, 0x0?})
	github.com/hashicorp/terraform/internal/command/console.go:184 +0xd08
github.com/hashicorp/cli.(*CLI).Run(0x14000906280)
	github.com/hashicorp/cli@v1.1.7/cli.go:265 +0x450
main.realMain()
	github.com/hashicorp/terraform/main.go:339 +0x18c4
main.main()
	github.com/hashicorp/terraform/main.go:64 +0x1c

Expected Behavior

It should not crash. Sub-module doesn't have any outputs currently.

Actual Behavior

Terraform crashes

Steps to Reproduce

It crashes reliably on a module I am working, but I can share it only privatelly.

Additional Context

No response

References

No response

Generative AI / LLM assisted development?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugcliwaiting for reproductionunable to reproduce issue without further informationwaiting-responseAn issue/pull request is waiting for a response from the community

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy