Skip to content

Commit

Permalink
service/ec2: Finish refactoring to keyvaluetags package (#12289)
Browse files Browse the repository at this point in the history
Reference: #10688

Replaces `testAccCheckTags()` custom `TestCheckFunc` with the standard Terraform Plugin SDK `resource.TestCheckResourceAttr()` -- nowadays we prefer checking the Terraform state values and checking `ImportStateVerify` for state validity compared to the API.

Output from acceptance testing:

```
--- PASS: TestAccDataSourceAwsEip_Id (22.59s)
--- PASS: TestAccDataSourceAwsEip_Instance (144.97s)
--- PASS: TestAccDataSourceAwsEip_NetworkInterface (54.82s)
--- PASS: TestAccDataSourceAwsEip_PublicIP_EC2Classic (14.56s)

--- PASS: TestAccAWSAMI_basic (71.24s)
--- PASS: TestAccAWSAMI_disappears (57.69s)
--- PASS: TestAccAWSAMI_snapshotSize (82.98s)
--- PASS: TestAccAWSAMI_tags (98.21s)

--- PASS: TestAccAWSInstance_tags (145.87s)

--- PASS: TestAccAWSInstancesDataSource_basic (99.26s)
--- PASS: TestAccAWSInstancesDataSource_instance_state_names (94.67s)
--- PASS: TestAccAWSInstancesDataSource_tags (83.91s)

--- PASS: TestAccAWSInternetGateway_tags (67.39s)

--- PASS: TestAccAWSLaunchTemplate_tags (35.69s)

--- PASS: TestAccAWSNatGateway_tags (273.08s)

--- PASS: TestAccAWSNetworkAcl_OnlyEgressRules (43.22s)

--- PASS: TestAccAWSRouteTable_tags (64.47s)

--- PASS: TestAccAWSSecurityGroup_tags (71.51s)

--- PASS: TestAccAWSVPCPeeringConnection_tags (43.86s)

--- PASS: TestAccAWSVpc_tags (74.30s)

--- PASS: TestAccAWSVpnGateway_tags (91.97s)

--- PASS: TestAccDataSourceAwsSubnetIDs (58.36s)
--- PASS: TestAccDataSourceAwsSubnetIDs_filter (48.78s)

--- PASS: TestAccDataSourceAwsSubnet_basic (41.70s)
--- PASS: TestAccDataSourceAwsSubnet_ipv6ByIpv6CidrBlock (69.88s)
--- PASS: TestAccDataSourceAwsSubnet_ipv6ByIpv6Filter (63.06s)

--- PASS: TestAccDataSourceAwsVpc_basic (46.32s)
--- PASS: TestAccDataSourceAwsVpc_ipv6Associated (45.43s)
--- PASS: TestAccDataSourceAwsVpc_multipleCidr (57.43s)

--- PASS: TestAccDataSourceAwsVpcPeeringConnection_basic (36.43s)

--- PASS: TestAccDataSourceAwsVpcs_basic (32.72s)
--- PASS: TestAccDataSourceAwsVpcs_filters (38.44s)
--- PASS: TestAccDataSourceAwsVpcs_tags (41.74s)
```
  • Loading branch information
bflad authored Mar 9, 2020
1 parent a7a73e3 commit 51341ab
Show file tree
Hide file tree
Showing 20 changed files with 93 additions and 160 deletions.
8 changes: 5 additions & 3 deletions aws/data_source_aws_eip.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,11 @@ func dataSourceAwsEipRead(d *schema.ResourceData, meta interface{}) error {
d.Get("filter").(*schema.Set),
)...)

req.Filters = append(req.Filters, buildEC2TagFilterList(
tagsFromMap(d.Get("tags").(map[string]interface{})),
)...)
if tags, tagsOk := d.GetOk("tags"); tagsOk {
req.Filters = append(req.Filters, buildEC2TagFilterList(
keyvaluetags.New(tags.(map[string]interface{})).Ec2Tags(),
)...)
}

if len(req.Filters) == 0 {
// Don't send an empty filters list; the EC2 API won't accept it.
Expand Down
3 changes: 2 additions & 1 deletion aws/data_source_aws_instances.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/helper/validation"
"github.com/terraform-providers/terraform-provider-aws/aws/internal/keyvaluetags"
)

func dataSourceAwsInstances() *schema.Resource {
Expand Down Expand Up @@ -82,7 +83,7 @@ func dataSourceAwsInstancesRead(d *schema.ResourceData, meta interface{}) error
}
if tagsOk {
params.Filters = append(params.Filters, buildEC2TagFilterList(
tagsFromMap(tags.(map[string]interface{})),
keyvaluetags.New(tags.(map[string]interface{})).Ec2Tags(),
)...)
}

Expand Down
10 changes: 7 additions & 3 deletions aws/data_source_aws_subnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,13 @@ func dataSourceAwsSubnetRead(d *schema.ResourceData, meta interface{}) error {
}

req.Filters = buildEC2AttributeFilterList(filters)
req.Filters = append(req.Filters, buildEC2TagFilterList(
tagsFromMap(d.Get("tags").(map[string]interface{})),
)...)

if tags, tagsOk := d.GetOk("tags"); tagsOk {
req.Filters = append(req.Filters, buildEC2TagFilterList(
keyvaluetags.New(tags.(map[string]interface{})).Ec2Tags(),
)...)
}

req.Filters = append(req.Filters, buildEC2CustomFilterList(
d.Get("filter").(*schema.Set),
)...)
Expand Down
3 changes: 2 additions & 1 deletion aws/data_source_aws_subnet_ids.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (

"github.com/aws/aws-sdk-go/service/ec2"
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"github.com/terraform-providers/terraform-provider-aws/aws/internal/keyvaluetags"
)

func dataSourceAwsSubnetIDs() *schema.Resource {
Expand Down Expand Up @@ -46,7 +47,7 @@ func dataSourceAwsSubnetIDsRead(d *schema.ResourceData, meta interface{}) error

if tags, tagsOk := d.GetOk("tags"); tagsOk {
req.Filters = append(req.Filters, buildEC2TagFilterList(
tagsFromMap(tags.(map[string]interface{})),
keyvaluetags.New(tags.(map[string]interface{})).Ec2Tags(),
)...)
}

Expand Down
10 changes: 7 additions & 3 deletions aws/data_source_aws_vpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,13 @@ func dataSourceAwsVpcRead(d *schema.ResourceData, meta interface{}) error {
"state": d.Get("state").(string),
},
)
req.Filters = append(req.Filters, buildEC2TagFilterList(
tagsFromMap(d.Get("tags").(map[string]interface{})),
)...)

if tags, tagsOk := d.GetOk("tags"); tagsOk {
req.Filters = append(req.Filters, buildEC2TagFilterList(
keyvaluetags.New(tags.(map[string]interface{})).Ec2Tags(),
)...)
}

req.Filters = append(req.Filters, buildEC2CustomFilterList(
d.Get("filter").(*schema.Set),
)...)
Expand Down
15 changes: 11 additions & 4 deletions aws/data_source_aws_vpc_peering_connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/ec2"
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"github.com/terraform-providers/terraform-provider-aws/aws/internal/keyvaluetags"
)

func dataSourceAwsVpcPeeringConnection() *schema.Resource {
Expand Down Expand Up @@ -102,9 +103,13 @@ func dataSourceAwsVpcPeeringConnectionRead(d *schema.ResourceData, meta interfac
"accepter-vpc-info.cidr-block": d.Get("peer_cidr_block").(string),
},
)
req.Filters = append(req.Filters, buildEC2TagFilterList(
tagsFromMap(d.Get("tags").(map[string]interface{})),
)...)

if tags, tagsOk := d.GetOk("tags"); tagsOk {
req.Filters = append(req.Filters, buildEC2TagFilterList(
keyvaluetags.New(tags.(map[string]interface{})).Ec2Tags(),
)...)
}

req.Filters = append(req.Filters, buildEC2CustomFilterList(
d.Get("filter").(*schema.Set),
)...)
Expand Down Expand Up @@ -137,7 +142,9 @@ func dataSourceAwsVpcPeeringConnectionRead(d *schema.ResourceData, meta interfac
d.Set("peer_owner_id", pcx.AccepterVpcInfo.OwnerId)
d.Set("peer_cidr_block", pcx.AccepterVpcInfo.CidrBlock)
d.Set("peer_region", pcx.AccepterVpcInfo.Region)
d.Set("tags", tagsToMap(pcx.Tags))
if err := d.Set("tags", keyvaluetags.Ec2KeyValueTags(pcx.Tags).IgnoreAws().Map()); err != nil {
return fmt.Errorf("error setting tags: %s", err)
}

if pcx.AccepterVpcInfo.PeeringOptions != nil {
if err := d.Set("accepter", flattenVpcPeeringConnectionOptions(pcx.AccepterVpcInfo.PeeringOptions)[0]); err != nil {
Expand Down
14 changes: 6 additions & 8 deletions aws/data_source_aws_vpcs.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/ec2"
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"github.com/terraform-providers/terraform-provider-aws/aws/internal/keyvaluetags"
)

func dataSourceAwsVpcs() *schema.Resource {
Expand All @@ -31,18 +32,15 @@ func dataSourceAwsVpcs() *schema.Resource {
func dataSourceAwsVpcsRead(d *schema.ResourceData, meta interface{}) error {
conn := meta.(*AWSClient).ec2conn

filters, filtersOk := d.GetOk("filter")
tags, tagsOk := d.GetOk("tags")

req := &ec2.DescribeVpcsInput{}

if tagsOk {
req.Filters = buildEC2TagFilterList(
tagsFromMap(tags.(map[string]interface{})),
)
if tags, tagsOk := d.GetOk("tags"); tagsOk {
req.Filters = append(req.Filters, buildEC2TagFilterList(
keyvaluetags.New(tags.(map[string]interface{})).Ec2Tags(),
)...)
}

if filtersOk {
if filters, filtersOk := d.GetOk("filter"); filtersOk {
req.Filters = append(req.Filters, buildEC2CustomFilterList(
filters.(*schema.Set),
)...)
Expand Down
4 changes: 3 additions & 1 deletion aws/resource_aws_ami.go
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,9 @@ func resourceAwsAmiRead(d *schema.ResourceData, meta interface{}) error {
d.Set("ebs_block_device", ebsBlockDevs)
d.Set("ephemeral_block_device", ephemeralBlockDevs)

d.Set("tags", tagsToMap(image.Tags))
if err := d.Set("tags", keyvaluetags.Ec2KeyValueTags(image.Tags).IgnoreAws().Map()); err != nil {
return fmt.Errorf("error setting tags: %s", err)
}

return nil
}
Expand Down
9 changes: 4 additions & 5 deletions aws/resource_aws_instance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1131,9 +1131,8 @@ func TestAccAWSInstance_tags(t *testing.T) {
Config: testAccCheckInstanceConfigTags,
Check: resource.ComposeTestCheckFunc(
testAccCheckInstanceExists(resourceName, &v),
testAccCheckTags(&v.Tags, "test", "test2"),
// Guard against regression of https://github.com/hashicorp/terraform/issues/914
testAccCheckTags(&v.Tags, "#", ""),
resource.TestCheckResourceAttr(resourceName, "tags.%", "1"),
resource.TestCheckResourceAttr(resourceName, "tags.test", "test2"),
),
},
{
Expand All @@ -1145,8 +1144,8 @@ func TestAccAWSInstance_tags(t *testing.T) {
Config: testAccCheckInstanceConfigTagsUpdate,
Check: resource.ComposeTestCheckFunc(
testAccCheckInstanceExists(resourceName, &v),
testAccCheckTags(&v.Tags, "test", ""),
testAccCheckTags(&v.Tags, "test2", "test3"),
resource.TestCheckResourceAttr(resourceName, "tags.%", "1"),
resource.TestCheckResourceAttr(resourceName, "tags.test2", "test3"),
),
},
},
Expand Down
11 changes: 6 additions & 5 deletions aws/resource_aws_internet_gateway_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,9 @@ func TestAccAWSInternetGateway_tags(t *testing.T) {
Config: testAccCheckInternetGatewayConfigTags,
Check: resource.ComposeTestCheckFunc(
testAccCheckInternetGatewayExists(resourceName, &v),
testAccCheckTags(&v.Tags, "Name", "terraform-testacc-internet-gateway-tags"),
testAccCheckTags(&v.Tags, "test", "bar"),
resource.TestCheckResourceAttr(resourceName, "tags.%", "2"),
resource.TestCheckResourceAttr(resourceName, "tags.Name", "terraform-testacc-internet-gateway-tags"),
resource.TestCheckResourceAttr(resourceName, "tags.test", "bar"),
testAccCheckResourceAttrAccountID(resourceName, "owner_id"),
),
},
Expand All @@ -232,9 +233,9 @@ func TestAccAWSInternetGateway_tags(t *testing.T) {
Config: testAccCheckInternetGatewayConfigTagsUpdate,
Check: resource.ComposeTestCheckFunc(
testAccCheckInternetGatewayExists(resourceName, &v),
testAccCheckTags(&v.Tags, "Name", "terraform-testacc-internet-gateway-tags"),
testAccCheckTags(&v.Tags, "test", ""),
testAccCheckTags(&v.Tags, "bar", "baz"),
resource.TestCheckResourceAttr(resourceName, "tags.%", "2"),
resource.TestCheckResourceAttr(resourceName, "tags.Name", "terraform-testacc-internet-gateway-tags"),
resource.TestCheckResourceAttr(resourceName, "tags.bar", "baz"),
testAccCheckResourceAttrAccountID(resourceName, "owner_id"),
),
},
Expand Down
7 changes: 4 additions & 3 deletions aws/resource_aws_launch_template_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,8 @@ func TestAccAWSLaunchTemplate_tags(t *testing.T) {
Config: testAccAWSLaunchTemplateConfig_basic(rInt),
Check: resource.ComposeTestCheckFunc(
testAccCheckAWSLaunchTemplateExists(resourceName, &template),
testAccCheckTags(&template.Tags, "test", "bar"),
resource.TestCheckResourceAttr(resourceName, "tags.%", "1"),
resource.TestCheckResourceAttr(resourceName, "tags.test", "bar"),
),
},
{
Expand All @@ -426,8 +427,8 @@ func TestAccAWSLaunchTemplate_tags(t *testing.T) {
Config: testAccAWSLaunchTemplateConfig_tagsUpdate(rInt),
Check: resource.ComposeTestCheckFunc(
testAccCheckAWSLaunchTemplateExists(resourceName, &template),
testAccCheckTags(&template.Tags, "test", ""),
testAccCheckTags(&template.Tags, "bar", "baz"),
resource.TestCheckResourceAttr(resourceName, "tags.%", "1"),
resource.TestCheckResourceAttr(resourceName, "tags.bar", "baz"),
),
},
},
Expand Down
11 changes: 6 additions & 5 deletions aws/resource_aws_nat_gateway_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,18 +94,19 @@ func TestAccAWSNatGateway_tags(t *testing.T) {
Config: testAccNatGatewayConfigTags,
Check: resource.ComposeTestCheckFunc(
testAccCheckNatGatewayExists(resourceName, &natGateway),
testAccCheckTags(&natGateway.Tags, "Name", "terraform-testacc-nat-gw-tags"),
testAccCheckTags(&natGateway.Tags, "foo", "bar"),
resource.TestCheckResourceAttr(resourceName, "tags.%", "2"),
resource.TestCheckResourceAttr(resourceName, "tags.Name", "terraform-testacc-nat-gw-tags"),
resource.TestCheckResourceAttr(resourceName, "tags.foo", "bar"),
),
},

{
Config: testAccNatGatewayConfigTagsUpdate,
Check: resource.ComposeTestCheckFunc(
testAccCheckNatGatewayExists(resourceName, &natGateway),
testAccCheckTags(&natGateway.Tags, "Name", "terraform-testacc-nat-gw-tags"),
testAccCheckTags(&natGateway.Tags, "foo", ""),
testAccCheckTags(&natGateway.Tags, "bar", "baz"),
resource.TestCheckResourceAttr(resourceName, "tags.%", "2"),
resource.TestCheckResourceAttr(resourceName, "tags.Name", "terraform-testacc-nat-gw-tags"),
resource.TestCheckResourceAttr(resourceName, "tags.bar", "baz"),
),
},
{
Expand Down
4 changes: 3 additions & 1 deletion aws/resource_aws_network_acl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,9 @@ func TestAccAWSNetworkAcl_OnlyEgressRules(t *testing.T) {
Config: testAccAWSNetworkAclEgressConfig,
Check: resource.ComposeTestCheckFunc(
testAccCheckAWSNetworkAclExists(resourceName, &networkAcl),
testAccCheckTags(&networkAcl.Tags, "foo", "bar"),
resource.TestCheckResourceAttr(resourceName, "tags.%", "2"),
resource.TestCheckResourceAttr(resourceName, "tags.Name", "tf-acc-acl-egress"),
resource.TestCheckResourceAttr(resourceName, "tags.foo", "bar"),
),
},
{
Expand Down
16 changes: 9 additions & 7 deletions aws/resource_aws_route_table_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,31 +241,33 @@ func TestAccAWSRouteTable_ipv6(t *testing.T) {

func TestAccAWSRouteTable_tags(t *testing.T) {
var route_table ec2.RouteTable
resourceName := "aws_route_table.foo"

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
IDRefreshName: "aws_route_table.foo",
IDRefreshName: resourceName,
Providers: testAccProviders,
CheckDestroy: testAccCheckRouteTableDestroy,
Steps: []resource.TestStep{
{
Config: testAccRouteTableConfigTags,
Check: resource.ComposeTestCheckFunc(
testAccCheckRouteTableExists("aws_route_table.foo", &route_table),
testAccCheckTags(&route_table.Tags, "foo", "bar"),
testAccCheckRouteTableExists(resourceName, &route_table),
resource.TestCheckResourceAttr(resourceName, "tags.%", "1"),
resource.TestCheckResourceAttr(resourceName, "tags.foo", "bar"),
),
},
{
ResourceName: "aws_route_table.foo",
ResourceName: resourceName,
ImportState: true,
ImportStateVerify: true,
},
{
Config: testAccRouteTableConfigTagsUpdate,
Check: resource.ComposeTestCheckFunc(
testAccCheckRouteTableExists("aws_route_table.foo", &route_table),
testAccCheckTags(&route_table.Tags, "foo", ""),
testAccCheckTags(&route_table.Tags, "bar", "baz"),
testAccCheckRouteTableExists(resourceName, &route_table),
resource.TestCheckResourceAttr(resourceName, "tags.%", "1"),
resource.TestCheckResourceAttr(resourceName, "tags.bar", "baz"),
),
},
},
Expand Down
9 changes: 5 additions & 4 deletions aws/resource_aws_security_group_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1695,7 +1695,8 @@ func TestAccAWSSecurityGroup_tags(t *testing.T) {
Config: testAccAWSSecurityGroupConfigTags,
Check: resource.ComposeTestCheckFunc(
testAccCheckAWSSecurityGroupExists(resourceName, &group),
testAccCheckTags(&group.Tags, "foo", "bar"),
resource.TestCheckResourceAttr(resourceName, "tags.%", "1"),
resource.TestCheckResourceAttr(resourceName, "tags.foo", "bar"),
),
},
{
Expand All @@ -1709,9 +1710,9 @@ func TestAccAWSSecurityGroup_tags(t *testing.T) {
Config: testAccAWSSecurityGroupConfigTagsUpdate,
Check: resource.ComposeTestCheckFunc(
testAccCheckAWSSecurityGroupExists(resourceName, &group),
testAccCheckTags(&group.Tags, "foo", ""),
testAccCheckTags(&group.Tags, "bar", "baz"),
testAccCheckTags(&group.Tags, "env", "Production"),
resource.TestCheckResourceAttr(resourceName, "tags.%", "2"),
resource.TestCheckResourceAttr(resourceName, "tags.env", "Production"),
resource.TestCheckResourceAttr(resourceName, "tags.bar", "baz"),
),
},
},
Expand Down
5 changes: 3 additions & 2 deletions aws/resource_aws_vpc_peering_connection_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,9 @@ func TestAccAWSVPCPeeringConnection_tags(t *testing.T) {
resourceName,
&connection,
),
testAccCheckTags(&connection.Tags, "Name", rName),
testAccCheckTags(&connection.Tags, "test", "bar"),
resource.TestCheckResourceAttr(resourceName, "tags.%", "2"),
resource.TestCheckResourceAttr(resourceName, "tags.Name", rName),
resource.TestCheckResourceAttr(resourceName, "tags.test", "bar"),
),
},
{
Expand Down
9 changes: 6 additions & 3 deletions aws/resource_aws_vpc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,9 @@ func TestAccAWSVpc_tags(t *testing.T) {
testAccCheckVpcExists(resourceName, &vpc),
testAccCheckVpcCidr(&vpc, "10.1.0.0/16"),
resource.TestCheckResourceAttr(resourceName, "cidr_block", "10.1.0.0/16"),
testAccCheckTags(&vpc.Tags, "foo", "bar"),
resource.TestCheckResourceAttr(resourceName, "tags.%", "2"),
resource.TestCheckResourceAttr(resourceName, "tags.Name", "terraform-testacc-vpc-tags"),
resource.TestCheckResourceAttr(resourceName, "tags.foo", "bar"),
),
},
{
Expand All @@ -307,8 +309,9 @@ func TestAccAWSVpc_tags(t *testing.T) {
Config: testAccVpcConfigTagsUpdate,
Check: resource.ComposeTestCheckFunc(
testAccCheckVpcExists(resourceName, &vpc),
testAccCheckTags(&vpc.Tags, "foo", ""),
testAccCheckTags(&vpc.Tags, "bar", "baz"),
resource.TestCheckResourceAttr(resourceName, "tags.%", "2"),
resource.TestCheckResourceAttr(resourceName, "tags.Name", "terraform-testacc-vpc-tags"),
resource.TestCheckResourceAttr(resourceName, "tags.bar", "baz"),
),
},
},
Expand Down
7 changes: 4 additions & 3 deletions aws/resource_aws_vpn_gateway_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,8 @@ func TestAccAWSVpnGateway_tags(t *testing.T) {
Config: testAccCheckVpnGatewayConfigTags,
Check: resource.ComposeTestCheckFunc(
testAccCheckVpnGatewayExists(resourceName, &v),
testAccCheckTags(&v.Tags, "Name", "terraform-testacc-vpn-gateway-tags"),
resource.TestCheckResourceAttr(resourceName, "tags.%", "1"),
resource.TestCheckResourceAttr(resourceName, "tags.Name", "terraform-testacc-vpn-gateway-tags"),
),
},
{
Expand All @@ -381,8 +382,8 @@ func TestAccAWSVpnGateway_tags(t *testing.T) {
Config: testAccCheckVpnGatewayConfigTagsUpdate,
Check: resource.ComposeTestCheckFunc(
testAccCheckVpnGatewayExists(resourceName, &v),
testAccCheckTags(&v.Tags, "test", ""),
testAccCheckTags(&v.Tags, "Name", "terraform-testacc-vpn-gateway-tags-updated"),
resource.TestCheckResourceAttr(resourceName, "tags.%", "1"),
resource.TestCheckResourceAttr(resourceName, "tags.Name", "terraform-testacc-vpn-gateway-tags-updated"),
),
},
},
Expand Down
Loading

0 comments on commit 51341ab

Please sign in to comment.