hashicorp / terraform-provider-awscc

Terraform AWS Cloud Control provider
https://registry.terraform.io/providers/hashicorp/awscc/latest/docs
Mozilla Public License 2.0
264 stars 121 forks source link

`awscc_cloudformation_stack_set`: Resource doesn't work with StackInstancesGroup attribute #1451

Open ericofusco opened 9 months ago

ericofusco commented 9 months ago

Community Note

Terraform CLI and Terraform AWS Cloud Control Provider Version

Terraform v1.7.3
on darwin_arm64
+ provider registry.terraform.io/hashicorp/awscc v0.71.0

Affected Resource(s)

Terraform Configuration Files

resource "awscc_cloudformation_stack_set" "stackset" {
  stack_set_name   = "network-stackset"
  permission_model = "SERVICE_MANAGED"

  auto_deployment = {
    enabled                          = true
    retain_stacks_on_account_removal = false
  }

  stack_instances_group = [{
    deployment_targets = {
      organizational_unit_ids = ["ou-u7vc-ex6e8h34"]
    }
    regions = ["us-east-1"]
  }]

  template_body = jsonencode({
    Resources = {
      myVpc = {
        Type = "AWS::EC2::VPC"
        Properties = {
          CidrBlock = "10.0.0.0/16"
        }
      }
    }
  })
}

terraform {
  required_providers {
    awscc = {
      source  = "hashicorp/awscc"
      version = "0.71.0"
    }
  }
}

provider "awscc" {}

Debug Output

https://gist.github.com/ericofusco/8fc48b6da09f7e0ee5b1f146e2e015d1

Expected Behavior

State and attributes are stored accordingly based on the stacksets deployed.

Actual Behavior

╷
│ Error: Provider produced inconsistent result after apply
│
│ When applying changes to awscc_cloudformation_stack_set.stackset, provider "provider[\"registry.terraform.io/hashicorp/awscc\"]" produced an unexpected new value:
│ .stack_instances_group: was
│ cty.SetVal([]cty.Value{cty.ObjectVal(map[string]cty.Value{"deployment_targets":cty.ObjectVal(map[string]cty.Value{"account_filter_type":cty.UnknownVal(cty.String),
│ "accounts":cty.UnknownVal(cty.Set(cty.String)), "accounts_url":cty.UnknownVal(cty.String), "organizational_unit_ids":cty.SetVal([]cty.Value{cty.StringVal("ou-u7vc-ex6e8h34")})}),
│ "parameter_overrides":cty.UnknownVal(cty.Set(cty.Object(map[string]cty.Type{"parameter_key":cty.String, "parameter_value":cty.String}))),
│ "regions":cty.SetVal([]cty.Value{cty.StringVal("us-east-1")})})}), but now null.
│
│ This is a bug in the provider, which should be reported in the provider's own issue tracker.

Steps to Reproduce

  1. terraform apply

References

wellsiau-aws commented 6 months ago

Related to #1586

I can consistently replicate this problem when I include attribute stack_instances_group.