Open rchildress87 opened 2 years ago
Cloud Control API resources return empty lists of tags ([]
) when none have been configured (null
):
% aws ec2 describe-vpcs --vpc-ids vpc-07001c5ffc0c12783
{
"Vpcs": [
{
"CidrBlock": "10.0.0.0/16",
"DhcpOptionsId": "dopt-11ac7e74",
"State": "available",
"VpcId": "vpc-07001c5ffc0c12783",
"OwnerId": "187416307283",
"InstanceTenancy": "default",
"CidrBlockAssociationSet": [
{
"AssociationId": "vpc-cidr-assoc-0f4017a7b8f3f3c3a",
"CidrBlock": "10.0.0.0/16",
"CidrBlockState": {
"State": "associated"
}
}
],
"IsDefault": false
}
]
}
% aws cloudcontrol get-resource --type-name AWS::EC2::VPC --identifier vpc-07001c5ffc0c12783
{
"TypeName": "AWS::EC2::VPC",
"ResourceDescription": {
"Identifier": "vpc-07001c5ffc0c12783",
"Properties": "{\"VpcId\":\"vpc-07001c5ffc0c12783\",\"InstanceTenancy\":\"default\",\"CidrBlockAssociations\":[\"vpc-cidr-assoc-0f4017a7b8f3f3c3a\"],\"CidrBlock\":\"10.0.0.0/16\",\"DefaultNetworkAcl\":\"acl-064bcd06d8cee8724\",\"EnableDnsSupport\":true,\"Ipv6CidrBlocks\":[],\"DefaultSecurityGroup\":\"sg-04a64882152661d6b\",\"EnableDnsHostnames\":false,\"Tags\":[]}"
}
}
In general Terraform treats null
and []
differently (and since we are generating resources generically from CFN schemas, everything is "general"), so https://github.com/hashicorp/terraform-provider-awscc/pull/368 was implemented to map a returned empty list ([]
) to null.
So, if the configured value is an empty list ([]
) the Terraform will report a diff wanting to convert this to a non-configured value (null
).
Community Note
Terraform CLI and Terraform AWS Cloud Control Provider Version
Affected Resource(s)
Terraform Configuration Files
Please include all Terraform configurations required to reproduce the bug. Bug reports without a functional reproduction may be closed without investigation.
Debug Output
https://gist.github.com/rchildress87/1fdfe85c8b981bc6809e24fd58733e1d
Expected Behavior
Actual Behavior
Steps to Reproduce
terraform plan
Important Factoids
awscc
provider version 0.33.0, I am unable to destroy the same resources using the same HCL with any version of the provider I have tested (0.9.0, 0.10.0, 0.20.0, 0.30.0, 0.33.0, and 0.35.0). Onceterraform apply -destroy
orterraform destroy
fails, I receive the exact same error as documented above:References