hashicorp / terraform

Terraform enables you to safely and predictably create, change, and improve infrastructure. It is a source-available tool that codifies APIs into declarative configuration files that can be shared amongst team members, treated as code, edited, reviewed, and versioned.
https://www.terraform.io/
Other
42.71k stars 9.55k forks source link

Terraform Crash #34089

Closed darrens280 closed 1 year ago

darrens280 commented 1 year ago

Terraform Version

Terraform v1.6.0
on windows_amd64

Your version of Terraform is out of date! The latest version
is 1.6.1. You can update by downloading from https://www.terraform.io/downloads.html

Running on Windows Server 2022 Datacenter Edition

Terraform Configuration Files

terraform {
  required_version = ">=1.0.0"

  required_providers {
    azurerm = {
      source  = "hashicorp/azurerm"
      version = ">=3.0.0"
    }
    azapi = {
      source  = "azure/azapi"
    }
  }
}

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 !!!!!!!!!!!!!!!!!!!!!!!!!!!!

value is marked, so must be unmarked first
goroutine 632 [running]:
runtime/debug.Stack()
    /opt/hostedtoolcache/go/1.21.1/x64/src/runtime/debug/stack.go:24 +0x5e
runtime/debug.PrintStack()
    /opt/hostedtoolcache/go/1.21.1/x64/src/runtime/debug/stack.go:16 +0x13
github.com/hashicorp/terraform/internal/logging.PanicHandler()
    /home/runner/work/terraform/terraform/internal/logging/panic.go:58 +0x13b
panic({0x3177000?, 0x3eb33a0?})
    /opt/hostedtoolcache/go/1.21.1/x64/src/runtime/panic.go:920 +0x270
github.com/zclconf/go-cty/cty.Value.assertUnmarked(...)
    /home/runner/go/pkg/mod/github.com/zclconf/go-cty@v1.14.0/cty/marks.go:141
github.com/zclconf/go-cty/cty.Value.AsString({{{0x3ef0fb0?, 0xc00000ad79?}}, {0x3403ce0?, 0xc0019ea2e8?}})
    /home/runner/go/pkg/mod/github.com/zclconf/go-cty@v1.14.0/cty/value_ops.go:1385 +0x47
github.com/zclconf/go-cty/cty.Value.Range({{{0x3ef0fb0?, 0xc00000ad79?}}, {0x3403ce0?, 0xc0019ea2e8?}})
    /home/runner/go/pkg/mod/github.com/zclconf/go-cty@v1.14.0/cty/value_range.go:53 +0x285
github.com/hashicorp/hcl/v2/hclsyntax.(*ConditionalExpr).Value(0xc00015ca80, 0xc0019ea2d0)

Expected Behavior

Terraform PLAN should succeed

Actual Behavior

Terraform INIT was successful Terraform VALIDATE fails though Terraform PLAN did not proceed due to failure of the VALIDATE task

Steps to Reproduce

Initiate CI/CD Pipeline on self-hosted Azure DevOps agent, which runs the following.

  1. Terraform init - successfully initializes the backend state file etc
  2. Terraform validate - fails with the above crash error
  3. Terraform plan

Additional Context

Running from an Azure DevOps self hosted agent (Windows 2022). This pipeline was working successfully last week on Terraform 1.5.7. Only thing that's changed is the Azure DevOps agents are now using Terraform 1.6.0.


Initializing provider plugins...
- Finding hashicorp/azurerm versions matching ">= 3.0.0, >= 3.45.0"...
- Finding latest version of hashicorp/local...
- Finding latest version of hashicorp/random...
- Finding latest version of hashicorp/time...
- Finding latest version of hashicorp/null...
- Finding latest version of azure/azapi...
- Finding latest version of hashicorp/external...
- Installing hashicorp/azurerm v3.76.0...
- Installed hashicorp/azurerm v3.76.0 (signed by HashiCorp)
- Installing hashicorp/local v2.4.0...
- Installed hashicorp/local v2.4.0 (signed by HashiCorp)
- Installing hashicorp/random v3.5.1...
- Installed hashicorp/random v3.5.1 (signed by HashiCorp)
- Installing hashicorp/time v0.9.1...
- Installed hashicorp/time v0.9.1 (signed by HashiCorp)
- Installing hashicorp/null v3.2.1...
- Installed hashicorp/null v3.2.1 (signed by HashiCorp)
- Installing azure/azapi v1.9.0...
- Installed azure/azapi v1.9.0 (signed by a HashiCorp partner, key ID 6F0B91BDE98478CF)
- Installing hashicorp/external v2.3.1...
- Installed hashicorp/external v2.3.1 (signed by HashiCorp)

Starting: Terraform VALIDATE
==============================================================================
Task         : Terraform CLI
Description  : Execute terraform cli commands
Version      : 1.0.5
Author       : Charles Zipp
Help         : 
==============================================================================
C:\Tools\terraform.exe version
Terraform v1.6.0
on windows_amd64
+ provider registry.terraform.io/azure/azapi v1.9.0
+ provider registry.terraform.io/hashicorp/azurerm v3.76.0
+ provider registry.terraform.io/hashicorp/external v2.3.1
+ provider registry.terraform.io/hashicorp/local v2.4.0
+ provider registry.terraform.io/hashicorp/null v3.2.1
+ provider registry.terraform.io/hashicorp/random v3.5.1
+ provider registry.terraform.io/hashicorp/time v0.9.1

Your version of Terraform is out of date! The latest version
is 1.6.1. You can update by downloading from https://www.terraform.io/downloads.html
C:\Tools\terraform.exe validate

!!!!!!!!!!!!!!!!!!!!!!!!!!! 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 !!!!!!!!!!!!!!!!!!!!!!!!!!!!

value is marked, so must be unmarked first
goroutine 626 [running]:
runtime/debug.Stack()
    /opt/hostedtoolcache/go/1.21.1/x64/src/runtime/debug/stack.go:24 +0x5e
runtime/debug.PrintStack()
    /opt/hostedtoolcache/go/1.21.1/x64/src/runtime/debug/stack.go:16 +0x13
github.com/hashicorp/terraform/internal/logging.PanicHandler()
    /home/runner/work/terraform/terraform/internal/logging/panic.go:58 +0x13b
panic({0x3177000?, 0x3eb33a0?})
    /opt/hostedtoolcache/go/1.21.1/x64/src/runtime/panic.go:920 +0x270
github.com/zclconf/go-cty/cty.Value.assertUnmarked(...)
    /home/runner/go/pkg/mod/github.com/zclconf/go-cty@v1.14.0/cty/marks.go:141
github.com/zclconf/go-cty/cty.Value.AsString({{{0x3ef0fb0?, 0xc000120c89?}}, {0x3403ce0?, 0xc00238ac00?}})
    /home/runner/go/pkg/mod/github.com/zclconf/go-cty@v1.14.0/cty/value_ops.go:1385 +0x47
github.com/zclconf/go-cty/cty.Value.Range({{{0x3ef0fb0?, 0xc000120c89?}}, {0x3403ce0?, 0xc00238ac00?}})
    /home/runner/go/pkg/mod/github.com/zclconf/go-cty@v1.14.0/cty/value_range.go:53 +0x285
github.com/hashicorp/hcl/v2/hclsyntax.(*ConditionalExpr).Value(0xc000396a10, 0xc00238abe8)
    /home/runner/go/pkg/mod/github.com/hashicorp/hcl/v2@v2.18.0/hclsyntax/expression.go:745 +0xd35
github.com/hashicorp/terraform/internal/lang.(*Scope).EvalExpr(0xc0012f7290, {0x3ef1678?, 0xc000396a10}, {{0x3ef17c8?, 0x5762260?}})
    /home/runner/work/terraform/terraform/internal/lang/eval.go:175 +0x1bd
github.com/hashicorp/terraform/internal/terraform.(*nodeModuleVariable).evalModuleVariable(0xc000c72480, {0x3f0e640?, 0xc000e5a2a0?}, 0x80?)
    /home/runner/work/terraform/terraform/internal/terraform/node_module_variable.go:248 +0x225
github.com/hashicorp/terraform/internal/terraform.(*nodeModuleVariable).Execute(0xc000c72480, {0x3f0e640, 0xc000e5a2a0}, 0x4)
    /home/runner/work/terraform/terraform/internal/terraform/node_module_variable.go:183 +0x12c
github.com/hashicorp/terraform/internal/terraform.(*ContextGraphWalker).Execute(0xc000ab9680, {0x3f0e640, 0xc000e5a2a0}, {0x1bec644a970, 0xc000c72480})
    /home/runner/work/terraform/terraform/internal/terraform/graph_walk_context.go:143 +0xbe
github.com/hashicorp/terraform/internal/terraform.(*Graph).walk.func1({0x34ee340, 0xc000c72480})
    /home/runner/work/terraform/terraform/internal/terraform/graph.go:78 +0x375
github.com/hashicorp/terraform/internal/dag.(*Walker).walkVertex(0xc000c72540, {0x34ee340, 0xc000c72480}, 0xc000a9d300)
    /home/runner/work/terraform/terraform/internal/dag/walk.go:384 +0x2e5
created by github.com/hashicorp/terraform/internal/dag.(*Walker).Update in goroutine 449
    /home/runner/work/terraform/terraform/internal/dag/walk.go:307 +0xde8
##[error]Terraform command 'validate' failed with exit code '11'.
##[error]

References

No response

liamcervante commented 1 year ago

Duplicate of https://github.com/hashicorp/terraform/issues/33977

@darrens280, if you upgrade to v1.6.1 this should be fixed for you.

darrens280 commented 1 year ago

Thank you @liamcervante Confirmed working with TF v1.6.1

github-actions[bot] commented 11 months ago

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.