Skip to content

Terraform crash planning a diff between Null and empty Sets #29382

@ewbankkit

Description

@ewbankkit

Terraform Version

% terraform version
Terraform v1.0.4
on darwin_amd64

Terraform Configuration Files

resource "aws_kms_key" "test" {
  key_policy = jsonencode({
    Id = "kms-tf-1"
    Statement = [
      {
        Action = "kms:*"
        Effect = "Allow"
        Principal = {
          AWS = "*"
        }

        Resource = "*"
        Sid      = "Enable IAM User Permissions"
      },
    ]
    Version = "2012-10-17"
  })

  pending_window_in_days = 8
}

Debug Output

Crash Output

% terraform plan 
╷
│ Warning: Provider development overrides are in effect
│ 
│ The following provider development overrides are set in the CLI configuration:
│  - hashicorp/aws in /Users/ewbankkit/go/bin
│  - hashicorp/aws-xxxxxxxx in /Users/ewbankkit/go/bin
│ 
│ The behavior may therefore not match any released version of the provider and applying changes may cause the state to become incompatible with published releases.
╵
aws_kms_key.test: Refreshing state... [id=2ce9555e-fa82-4510-88dd-e304e519b2b8]
panic: must not call SetVal with empty slice

goroutine 15 [running]:
github.com/zclconf/go-cty/cty.SetVal(0x47ee998, 0x0, 0x0, 0x47ee998, 0x0, 0x0, 0x0)
	/Users/distiller/go/pkg/mod/github.com/zclconf/go-cty@v1.9.0/cty/value_init.go:267 +0x865
github.com/hashicorp/terraform/internal/command/format.(*blockBodyDiffPrinter).writeNestedAttrDiff(0xc000e712a8, 0xc000174e88, 0x4, 0xc000dc6320, 0x3749130, 0xc0005c6e70, 0x0, 0x0, 0x3749130, 0xc001105080, ...)
	/Users/distiller/project/project/internal/command/format/diff.go:615 +0x246a
github.com/hashicorp/terraform/internal/command/format.(*blockBodyDiffPrinter).writeAttrDiff(0xc000adf2a8, 0xc000174e88, 0x4, 0xc000e04280, 0x3749130, 0xc0005c6e70, 0x0, 0x0, 0x3749130, 0xc001105080, ...)
	/Users/distiller/project/project/internal/command/format/diff.go:473 +0x7a7
github.com/hashicorp/terraform/internal/command/format.(*blockBodyDiffPrinter).writeAttrsDiff(0xc000e712a8, 0xc000f0bb00, 0x37490f8, 0xc0011053e0, 0x2f418e0, 0xc000e20ab0, 0x37490f8, 0xc001105770, 0x2f418e0, 0xc000e20bd0, ...)
	/Users/distiller/project/project/internal/command/format/diff.go:434 +0x685
github.com/hashicorp/terraform/internal/command/format.(*blockBodyDiffPrinter).writeBlockBodyDiff(0xc000e712a8, 0xc000f0bbf0, 0x37490f8, 0xc0011053e0, 0x2f418e0, 0xc000e20ab0, 0x37490f8, 0xc001105770, 0x2f418e0, 0xc000e20bd0, ...)
	/Users/distiller/project/project/internal/command/format/diff.go:358 +0x12f
github.com/hashicorp/terraform/internal/command/format.ResourceInstanceDrift(0x0, 0x0, 0x0, 0x4d, 0xc00072da40, 0xb, 0xc00072da4c, 0x4, 0x0, 0x0, ...)
	/Users/distiller/project/project/internal/command/format/diff.go:273 +0x6c5
github.com/hashicorp/terraform/internal/command/views.renderChangesDetectedByRefresh(0xc0005a3ae0, 0xc0005a3ae8, 0xc0002768b0, 0xc000612840, 0xc0000aac78)
	/Users/distiller/project/project/internal/command/views/plan.go:385 +0x5d4
github.com/hashicorp/terraform/internal/command/views.renderPlan(0xc0002e7d60, 0xc0002768b0, 0xc000612840)
	/Users/distiller/project/project/internal/command/views/plan.go:100 +0x70
github.com/hashicorp/terraform/internal/command/views.(*OperationHuman).Plan(0xc000797b90, 0xc0002e7d60, 0xc0002768b0)
	/Users/distiller/project/project/internal/command/views/operation.go:92 +0x45
github.com/hashicorp/terraform/internal/backend/local.(*Local).opPlan(0xc0002e72c0, 0x3747418, 0xc0003d4340, 0x3747418, 0xc0003d4380, 0xc00079afc0, 0xc0003d4300)
	/Users/distiller/project/project/internal/backend/local/backend_plan.go:147 +0x8fc
github.com/hashicorp/terraform/internal/backend/local.(*Local).Operation.func1(0xc000797cf0, 0xc000797d00, 0xc000797d10, 0xc0002e72c0, 0xc000797ce0, 0x3747418, 0xc0003d4340, 0x3747418, 0xc0003d4380, 0xc00079afc0, ...)
	/Users/distiller/project/project/internal/backend/local/backend.go:321 +0xe8
created by github.com/hashicorp/terraform/internal/backend/local.(*Local).Operation
	/Users/distiller/project/project/internal/backend/local/backend.go:315 +0x2f2




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

Terraform crashed! This is always indicative of a bug within Terraform.
A crash log has been placed at "crash.209140014.log" relative to your current
working directory. It would be immensely helpful if you could please
report the crash with Terraform[1] so that we can fix this.

When reporting bugs, please include your terraform version. That
information is available on the first line of crash.log. You can also
get it by running 'terraform --version' on the command line.

SECURITY WARNING: the "crash.209140014.log" file that was created may contain 
sensitive information that must be redacted before it is safe to share 
on the issue tracker.

[1]: https://github.com/hashicorp/terraform/issues

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

crash.209140014.log

Expected Behavior

Actual Behavior

Steps to Reproduce

Additional Context

N.B. This is not the usual AWS Provider but is an under-development version using https://github.com/hashicorp/terraform-plugin-framework (and hence protocol v6).

The resource's schema includes a Set of Objects (the resource's tags) which I have not specified in configuration but are returned from AWS as an empty array :"tags": [],.

References

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions