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.35k stars 9.49k forks source link

Terraform Crashed #34050

Closed u207615 closed 11 months ago

u207615 commented 11 months ago

Terraform Version

2023-10-10T16:08:54.987Z [INFO]  Terraform version: 1.6.0

Terraform Configuration Files

  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = "~> 5.0"
    }
  }
}

module "rds" {
  source  = "terraform-aws-modules/rds/aws"
  version = "6.1.1"
  # insert the 1 required variable here
  # only lowercase alphanumeric characters and hyphens allowed in "identifier"
  identifier = "my-database"

#apply changes immediately
apply_immediately = "true"

# optional Database variable values - as defined in the modules
allocated_storage = 50
availability_zone = "eu-west-1a"    #force to be same az as EC2 instance
create_db_option_group = "false"
create_db_parameter_group = "true"
create_db_subnet_group = "true"

create_cloudwatch_log_group = "true"
#enabled_cloudwatch_logs_exports = ["alert", "audit", "error", "general", "listener", "slowquery", "trace", "postgresql", "upgrade"]
enabled_cloudwatch_logs_exports = ["postgresql", "upgrade"]

create_monitoring_role = "true"

subnet_ids = data.terraform_remote_state.vpc.outputs.vpc_private_subnets
vpc_security_group_ids = [data.terraform_remote_state.vpc.outputs.ec2-sg.id, data.terraform_remote_state.vpc.outputs.rds-sg.id]
db_name = "mydb"
engine = "postgres"
engine_version = "15.3"
major_engine_version = "15"        
family               = "postgres15"
instance_class       = "db.t4g.small"

iam_database_authentication_enabled = "true"
manage_master_user_password = "false"
username = "xxxxxxxxxx"
password = "xxxxxxxxxx"
port     = 5432

backup_retention_period = 7
backup_window = "00:02-00:32"
#maintenance_window = "sun:02:00-sun:02:30"

Debug Output

!!!!!!!!!!!!!!!!!!!!!!!!!!! TERRAFORM CRASH !!!!!!!!!!!!!!!!!!!!!!!!!!!!

Terraform crashed! This is always indicative of a bug within Terraform. Please report the crash with Terraform1 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.

!!!!!!!!!!!!!!!!!!!!!!!!!!! TERRAFORM CRASH !!!!!!!!!!!!!!!!!!!!!!!!!!!!

value is marked, so must be unmarked first goroutine 1080 [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({0x2b92ec0?, 0x38c4c30?}) /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({{{0x3902720?, 0xc000140bd1?}}, {0x2e1de40?, 0xc0011d9158?}}) /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({{{0x3902720?, 0xc000140bd1?}}, {0x2e1de40?, 0xc0011d9158?}}) /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(0xc0006ca000, 0xc0011d9140) /home/runner/go/pkg/mod/github.com/hashicorp/hcl/v2@v2.18.0/hclsyntax/expression.go:746 +0xd6a github.com/hashicorp/terraform/internal/lang.(Scope).EvalExpr(0xc0004f3e60, {0x3902df8?, 0xc0006ca000}, {{0x3902f48?, 0x5130520?}}) /home/runner/work/terraform/terraform/internal/lang/eval.go:175 +0x1bd github.com/hashicorp/terraform/internal/terraform.(nodeModuleVariable).evalModuleVariable(0xc000c11ce0, {0x391fb60?, 0xc001c8a460?}, 0x80?) /home/runner/work/terraform/terraform/internal/terraform/node_module_variable.go:248 +0x225 github.com/hashicorp/terraform/internal/terraform.(nodeModuleVariable).Execute(0xc000c11ce0, {0x391fb60, 0xc001c8a460}, 0x4) /home/runner/work/terraform/terraform/internal/terraform/node_module_variable.go:183 +0x12c github.com/hashicorp/terraform/internal/terraform.(ContextGraphWalker).Execute(0xc003883200, {0x391fb60, 0xc001c8a460}, {0x7f0730338160, 0xc000c11ce0}) /home/runner/work/terraform/terraform/internal/terraform/graph_walk_context.go:143 +0xbe github.com/hashicorp/terraform/internal/terraform.(Graph).walk.func1({0x2f07ca0, 0xc000c11ce0}) /home/runner/work/terraform/terraform/internal/terraform/graph.go:78 +0x375 github.com/hashicorp/terraform/internal/dag.(Walker).walkVertex(0xc000c11da0, {0x2f07ca0, 0xc000c11ce0}, 0xc000dd9e40) /home/runner/work/terraform/terraform/internal/dag/walk.go:384 +0x2e5 created by github.com/hashicorp/terraform/internal/dag.(Walker).Update in goroutine 547 /home/runner/work/terraform/terraform/internal/dag/walk.go:307 +0xde8 Error: Terraform exited with code 11. Error: Process completed with exit code 1.

Expected Behavior

my yml pipeline build as below - to get at least to PLAN stage

 - name: Setup Terraform
    uses: hashicorp/setup-terraform@v2
    with:
      terraform_version: latest

  - name: Terraform fmt
    id: fmt
    run: terraform fmt -check
    continue-on-error: true

  - name: Terraform Init
    id: init
    run: terraform init

  - name: Terraform Validate
    id: validate
    run: terraform validate -no-color

  - name: Terraform Plan
    id: plan
    run: terraform plan -out "planfile" -input=false -var-file="../DEV.tfvars"

  - name: Terraform Apply
    id: apply
    run: terraform apply -input=false "planfile"

Actual Behavior

it crashed at the Validate stage

 - name: Setup Terraform
    uses: hashicorp/setup-terraform@v2
    with:
      terraform_version: latest

  - name: Terraform fmt
    id: fmt
    run: terraform fmt -check
    continue-on-error: true

  - name: Terraform Init
    id: init
    run: terraform init

  - name: Terraform Validate
    id: validate
    run: terraform validate -no-color

  - name: Terraform Plan
    id: plan
    run: terraform plan -out "planfile" -input=false -var-file="../DEV.tfvars"

  - name: Terraform Apply
    id: apply
    run: terraform apply -input=false "planfile"

Steps to Reproduce

See above

Additional Context

No response

References

No response

jbardin commented 11 months ago

Duplicate of #33977

github-actions[bot] commented 9 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.