Skip to content

Terraform 1.12.0 crashes on terraform init with invalid memory address or nil pointer dereference #37703

@TuanSSM

Description

@TuanSSM

Terraform Version

v1.12.0

Terraform Configuration Files

...terraform config...

Debug Output

!!!!!!!!!!!!!!!!!!!!!!!!!!! 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 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({0x3346320?, 0x5c8e160?})
	runtime/panic.go:792 +0x132
github.com/hashicorp/terraform/internal/configs.(*Module).CheckCoreVersionRequirements(0x419ad4?, {0x0, 0x0, 0x0}, {0x0, 0x0})
	github.com/hashicorp/terraform/internal/configs/module.go:734 +0x45
github.com/hashicorp/terraform/internal/configs.(*Config).CheckCoreVersionRequirements(0xc000870620)
	github.com/hashicorp/terraform/internal/configs/config.go:1051 +0x45
github.com/hashicorp/terraform/internal/terraform.CheckCoreVersionRequirements(0xc000602c40?)
	github.com/hashicorp/terraform/internal/terraform/version_required.go:25 +0x18
github.com/hashicorp/terraform/internal/command.(*InitCommand).Run(0xc000602c40, {0xc000070120?, 0x0?, 0x0?})
	github.com/hashicorp/terraform/internal/command/init.go:248 +0x14e5
github.com/hashicorp/cli.(*CLI).Run(0xc00059d040)
	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

Expected Behavior

terraform init should initialize the working directory without crashing.

Actual Behavior

Terraform crashes with a nil pointer dereference panic.

Steps to Reproduce

  1. Run terraform init

Additional Context

We use terraform-exec library with a orchestrator. Our workers use shared pv for terraform operations. The thing is we face with this behaviour 1-2% of our operations. So we can not reproduce on demand.

Aliyun oss as backend and below openstack provider.

    openstack = {
      source  = "terraform-provider-openstack/openstack"
      version = ">= 1.34.1, < 2.0.0"
    }

References

No response

Generative AI / LLM assisted development?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugnewnew issue not yet triagedwaiting for reproductionunable to reproduce issue without further information

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions