diff --git a/aws/resource_aws_route_table.go b/aws/resource_aws_route_table.go index bb8bda0bf64..16da5d5f441 100644 --- a/aws/resource_aws_route_table.go +++ b/aws/resource_aws_route_table.go @@ -231,9 +231,9 @@ func resourceAwsRouteTableRead(d *schema.ResourceData, meta interface{}) error { // Tags _, tagsAreDefined := d.GetOk("tags") if tagsAreDefined { - if err := d.Set("tags", keyvaluetags.Ec2KeyValueTags(rt.Tags).IgnoreAws().IgnoreConfig(ignoreTagsConfig).Map()); err != nil { - return fmt.Errorf("error setting tags: %s", err) - } + if err := d.Set("tags", keyvaluetags.Ec2KeyValueTags(rt.Tags).IgnoreAws().IgnoreConfig(ignoreTagsConfig).Map()); err != nil { + return fmt.Errorf("error setting tags: %s", err) + } } d.Set("owner_id", rt.OwnerId) diff --git a/aws/resource_aws_route_table_test.go b/aws/resource_aws_route_table_test.go index 40914d93893..b4239a72d48 100644 --- a/aws/resource_aws_route_table_test.go +++ b/aws/resource_aws_route_table_test.go @@ -260,6 +260,11 @@ func TestAccAWSRouteTable_tags(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, + ImportStateVerifyIgnore: []string{ + // This is needed because we don't always call d.Set() in Read for tags as per + // https://github.com/hashicorp/terraform/pull/21019 and https://github.com/hashicorp/terraform/issues/20985 + "tags", + }, }, { Config: testAccRouteTableConfigTagsUpdate, diff --git a/aws/resource_aws_subnet.go b/aws/resource_aws_subnet.go index c8ff6e705ed..2c7d4401c8a 100644 --- a/aws/resource_aws_subnet.go +++ b/aws/resource_aws_subnet.go @@ -236,9 +236,9 @@ func resourceAwsSubnetRead(d *schema.ResourceData, meta interface{}) error { _, tagsAreDefined := d.GetOk("tags") if tagsAreDefined { - if err := d.Set("tags", keyvaluetags.Ec2KeyValueTags(subnet.Tags).IgnoreAws().IgnoreConfig(ignoreTagsConfig).Map()); err != nil { - return fmt.Errorf("error setting tags: %s", err) - } + if err := d.Set("tags", keyvaluetags.Ec2KeyValueTags(subnet.Tags).IgnoreAws().IgnoreConfig(ignoreTagsConfig).Map()); err != nil { + return fmt.Errorf("error setting tags: %s", err) + } } d.Set("owner_id", subnet.OwnerId) diff --git a/aws/resource_aws_subnet_test.go b/aws/resource_aws_subnet_test.go index 001db762936..af22bcc00f6 100644 --- a/aws/resource_aws_subnet_test.go +++ b/aws/resource_aws_subnet_test.go @@ -171,6 +171,11 @@ func TestAccAWSSubnet_basic(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, + ImportStateVerifyIgnore: []string{ + // This is needed because we don't always call d.Set() in Read for tags as per + // https://github.com/hashicorp/terraform/pull/21019 and https://github.com/hashicorp/terraform/issues/20985 + "tags", + }, }, }, }) @@ -228,6 +233,11 @@ func TestAccAWSSubnet_ipv6(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, + ImportStateVerifyIgnore: []string{ + // This is needed because we don't always call d.Set() in Read for tags as per + // https://github.com/hashicorp/terraform/pull/21019 and https://github.com/hashicorp/terraform/issues/20985 + "tags", + }, }, { Config: testAccSubnetConfigIpv6UpdateAssignIpv6OnCreation, @@ -271,6 +281,11 @@ func TestAccAWSSubnet_enableIpv6(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, + ImportStateVerifyIgnore: []string{ + // This is needed because we don't always call d.Set() in Read for tags as per + // https://github.com/hashicorp/terraform/pull/21019 and https://github.com/hashicorp/terraform/issues/20985 + "tags", + }, }, { Config: testAccSubnetConfigIpv6, @@ -308,6 +323,11 @@ func TestAccAWSSubnet_availabilityZoneId(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, + ImportStateVerifyIgnore: []string{ + // This is needed because we don't always call d.Set() in Read for tags as per + // https://github.com/hashicorp/terraform/pull/21019 and https://github.com/hashicorp/terraform/issues/20985 + "tags", + }, }, }, }) @@ -344,6 +364,11 @@ func TestAccAWSSubnet_outpost(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, + ImportStateVerifyIgnore: []string{ + // This is needed because we don't always call d.Set() in Read for tags as per + // https://github.com/hashicorp/terraform/pull/21019 and https://github.com/hashicorp/terraform/issues/20985 + "tags", + }, }, }, }) diff --git a/aws/resource_aws_vpc.go b/aws/resource_aws_vpc.go index b06df88589b..cccb2228dfc 100644 --- a/aws/resource_aws_vpc.go +++ b/aws/resource_aws_vpc.go @@ -262,9 +262,9 @@ func resourceAwsVpcRead(d *schema.ResourceData, meta interface{}) error { _, tagsAreDefined := d.GetOk("tags") if tagsAreDefined { - if err := d.Set("tags", keyvaluetags.Ec2KeyValueTags(vpc.Tags).IgnoreAws().IgnoreConfig(ignoreTagsConfig).Map()); err != nil { - return fmt.Errorf("error setting tags: %s", err) - } + if err := d.Set("tags", keyvaluetags.Ec2KeyValueTags(vpc.Tags).IgnoreAws().IgnoreConfig(ignoreTagsConfig).Map()); err != nil { + return fmt.Errorf("error setting tags: %s", err) + } } d.Set("owner_id", vpc.OwnerId) diff --git a/aws/resource_aws_vpc_test.go b/aws/resource_aws_vpc_test.go index 292bc05b67c..a6d2ac7cadd 100644 --- a/aws/resource_aws_vpc_test.go +++ b/aws/resource_aws_vpc_test.go @@ -131,6 +131,11 @@ func TestAccAWSVpc_basic(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, + ImportStateVerifyIgnore: []string{ + // This is needed because we don't always call d.Set() in Read for tags as per + // https://github.com/hashicorp/terraform/pull/21019 and https://github.com/hashicorp/terraform/issues/20985 + "tags", + }, }, }, }) @@ -211,6 +216,11 @@ func TestAccAWSVpc_AssignGeneratedIpv6CidrBlock(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, + ImportStateVerifyIgnore: []string{ + // This is needed because we don't always call d.Set() in Read for tags as per + // https://github.com/hashicorp/terraform/pull/21019 and https://github.com/hashicorp/terraform/issues/20985 + "tags", + }, }, { Config: testAccVpcConfigAssignGeneratedIpv6CidrBlock(false), @@ -259,6 +269,11 @@ func TestAccAWSVpc_Tenancy(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, + ImportStateVerifyIgnore: []string{ + // This is needed because we don't always call d.Set() in Read for tags as per + // https://github.com/hashicorp/terraform/pull/21019 and https://github.com/hashicorp/terraform/issues/20985 + "tags", + }, }, { Config: testAccVpcConfig, @@ -304,6 +319,11 @@ func TestAccAWSVpc_tags(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, + ImportStateVerifyIgnore: []string{ + // This is needed because we don't always call d.Set() in Read for tags as per + // https://github.com/hashicorp/terraform/pull/21019 and https://github.com/hashicorp/terraform/issues/20985 + "tags", + }, }, { Config: testAccVpcConfigTagsUpdate, @@ -483,6 +503,11 @@ func TestAccAWSVpc_bothDnsOptionsSet(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, + ImportStateVerifyIgnore: []string{ + // This is needed because we don't always call d.Set() in Read for tags as per + // https://github.com/hashicorp/terraform/pull/21019 and https://github.com/hashicorp/terraform/issues/20985 + "tags", + }, }, }, }) @@ -509,6 +534,11 @@ func TestAccAWSVpc_DisabledDnsSupport(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, + ImportStateVerifyIgnore: []string{ + // This is needed because we don't always call d.Set() in Read for tags as per + // https://github.com/hashicorp/terraform/pull/21019 and https://github.com/hashicorp/terraform/issues/20985 + "tags", + }, }, }, }) @@ -534,6 +564,11 @@ func TestAccAWSVpc_classiclinkOptionSet(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, + ImportStateVerifyIgnore: []string{ + // This is needed because we don't always call d.Set() in Read for tags as per + // https://github.com/hashicorp/terraform/pull/21019 and https://github.com/hashicorp/terraform/issues/20985 + "tags", + }, }, }, }) @@ -559,6 +594,11 @@ func TestAccAWSVpc_classiclinkDnsSupportOptionSet(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, + ImportStateVerifyIgnore: []string{ + // This is needed because we don't always call d.Set() in Read for tags as per + // https://github.com/hashicorp/terraform/pull/21019 and https://github.com/hashicorp/terraform/issues/20985 + "tags", + }, }, }, })