From 275b329a01a08d29b7297bfd0d205b12fdd38586 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Sat, 5 Sep 2020 20:56:11 -0400 Subject: [PATCH] r/aws_route: Add 'local_gateway_id' to attribute checking. --- aws/resource_aws_route.go | 4 ++-- aws/resource_aws_route_test.go | 23 +++++++++++++++++++++++ 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/aws/resource_aws_route.go b/aws/resource_aws_route.go index 4dc60d939fd..c935c112076 100644 --- a/aws/resource_aws_route.go +++ b/aws/resource_aws_route.go @@ -90,7 +90,6 @@ func resourceAwsRoute() *schema.Resource { "local_gateway_id": { Type: schema.TypeString, Optional: true, - Computed: true, }, "instance_id": { @@ -436,9 +435,10 @@ var ( "egress_only_gateway_id": {false, true}, "gateway_id": {true, true}, "instance_id": {true, true}, + "local_gateway_id": {true, true}, "nat_gateway_id": {true, false}, "network_interface_id": {true, true}, - "transit_gateway_id": {true, false}, + "transit_gateway_id": {true, true}, "vpc_peering_connection_id": {true, true}, }) diff --git a/aws/resource_aws_route_test.go b/aws/resource_aws_route_test.go index 623015370d3..6c1c95da3d8 100644 --- a/aws/resource_aws_route_test.go +++ b/aws/resource_aws_route_test.go @@ -45,6 +45,14 @@ func TestGetRouteDestinationAndTargetAttributeKeys(t *testing.T) { destinationKey: "destination_cidr_block", targetKey: "transit_gateway_id", }, + { + m: map[string]interface{}{ + "destination_ipv6_cidr_block": "::/0", + "transit_gateway_id": "tgw-0000000000000000", + }, + destinationKey: "destination_ipv6_cidr_block", + targetKey: "transit_gateway_id", + }, { m: map[string]interface{}{ "destination_cidr_block": "0.0.0.0/0", @@ -647,6 +655,7 @@ func TestAccAWSRoute_IPv4_To_NetworkInterface_TwoAttachments(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "gateway_id", ""), resource.TestCheckResourceAttrPair(resourceName, "instance_id", instanceResourceName, "id"), testAccCheckResourceAttrAccountID(resourceName, "instance_owner_id"), + resource.TestCheckResourceAttr(resourceName, "local_gateway_id", ""), resource.TestCheckResourceAttr(resourceName, "nat_gateway_id", ""), resource.TestCheckResourceAttrPair(resourceName, "network_interface_id", eni1ResourceName, "id"), resource.TestCheckResourceAttr(resourceName, "origin", ec2.RouteOriginCreateRoute), @@ -666,6 +675,7 @@ func TestAccAWSRoute_IPv4_To_NetworkInterface_TwoAttachments(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "gateway_id", ""), resource.TestCheckResourceAttrPair(resourceName, "instance_id", instanceResourceName, "id"), testAccCheckResourceAttrAccountID(resourceName, "instance_owner_id"), + resource.TestCheckResourceAttr(resourceName, "local_gateway_id", ""), resource.TestCheckResourceAttr(resourceName, "nat_gateway_id", ""), resource.TestCheckResourceAttrPair(resourceName, "network_interface_id", eni2ResourceName, "id"), resource.TestCheckResourceAttr(resourceName, "origin", ec2.RouteOriginCreateRoute), @@ -1033,6 +1043,7 @@ func TestAccAWSRoute_IPv4_Update_Target(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "gateway_id", ""), resource.TestCheckResourceAttrPair(resourceName, "instance_id", instanceResourceName, "id"), testAccCheckResourceAttrAccountID(resourceName, "instance_owner_id"), + resource.TestCheckResourceAttr(resourceName, "local_gateway_id", ""), resource.TestCheckResourceAttr(resourceName, "nat_gateway_id", ""), resource.TestCheckResourceAttrPair(resourceName, "network_interface_id", instanceResourceName, "primary_network_interface_id"), resource.TestCheckResourceAttr(resourceName, "origin", ec2.RouteOriginCreateRoute), @@ -1052,6 +1063,7 @@ func TestAccAWSRoute_IPv4_Update_Target(t *testing.T) { resource.TestCheckResourceAttrPair(resourceName, "gateway_id", vgwResourceName, "id"), resource.TestCheckResourceAttr(resourceName, "instance_id", ""), resource.TestCheckResourceAttr(resourceName, "instance_owner_id", ""), + resource.TestCheckResourceAttr(resourceName, "local_gateway_id", ""), resource.TestCheckResourceAttr(resourceName, "nat_gateway_id", ""), resource.TestCheckResourceAttr(resourceName, "network_interface_id", ""), resource.TestCheckResourceAttr(resourceName, "origin", ec2.RouteOriginCreateRoute), @@ -1071,6 +1083,7 @@ func TestAccAWSRoute_IPv4_Update_Target(t *testing.T) { resource.TestCheckResourceAttrPair(resourceName, "gateway_id", igwResourceName, "id"), resource.TestCheckResourceAttr(resourceName, "instance_id", ""), resource.TestCheckResourceAttr(resourceName, "instance_owner_id", ""), + resource.TestCheckResourceAttr(resourceName, "local_gateway_id", ""), resource.TestCheckResourceAttr(resourceName, "nat_gateway_id", ""), resource.TestCheckResourceAttr(resourceName, "network_interface_id", ""), resource.TestCheckResourceAttr(resourceName, "origin", ec2.RouteOriginCreateRoute), @@ -1090,6 +1103,7 @@ func TestAccAWSRoute_IPv4_Update_Target(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "gateway_id", ""), resource.TestCheckResourceAttr(resourceName, "instance_id", ""), resource.TestCheckResourceAttr(resourceName, "instance_owner_id", ""), + resource.TestCheckResourceAttr(resourceName, "local_gateway_id", ""), resource.TestCheckResourceAttrPair(resourceName, "nat_gateway_id", ngwResourceName, "id"), resource.TestCheckResourceAttr(resourceName, "network_interface_id", ""), resource.TestCheckResourceAttr(resourceName, "origin", ec2.RouteOriginCreateRoute), @@ -1110,6 +1124,7 @@ func TestAccAWSRoute_IPv4_Update_Target(t *testing.T) { resource.TestCheckResourceAttrPair(resourceName, "instance_id", instanceResourceName, "id"), testAccCheckResourceAttrAccountID(resourceName, "instance_owner_id"), resource.TestCheckResourceAttr(resourceName, "nat_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "local_gateway_id", ""), resource.TestCheckResourceAttrPair(resourceName, "network_interface_id", eniResourceName, "id"), resource.TestCheckResourceAttr(resourceName, "origin", ec2.RouteOriginCreateRoute), resource.TestCheckResourceAttr(resourceName, "state", ec2.RouteStateActive), @@ -1128,6 +1143,7 @@ func TestAccAWSRoute_IPv4_Update_Target(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "gateway_id", ""), resource.TestCheckResourceAttr(resourceName, "instance_id", ""), resource.TestCheckResourceAttr(resourceName, "instance_owner_id", ""), + resource.TestCheckResourceAttr(resourceName, "local_gateway_id", ""), resource.TestCheckResourceAttr(resourceName, "nat_gateway_id", ""), resource.TestCheckResourceAttr(resourceName, "network_interface_id", ""), resource.TestCheckResourceAttr(resourceName, "origin", ec2.RouteOriginCreateRoute), @@ -1147,6 +1163,7 @@ func TestAccAWSRoute_IPv4_Update_Target(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "gateway_id", ""), resource.TestCheckResourceAttr(resourceName, "instance_id", ""), resource.TestCheckResourceAttr(resourceName, "instance_owner_id", ""), + resource.TestCheckResourceAttr(resourceName, "local_gateway_id", ""), resource.TestCheckResourceAttr(resourceName, "nat_gateway_id", ""), resource.TestCheckResourceAttr(resourceName, "network_interface_id", ""), resource.TestCheckResourceAttr(resourceName, "origin", ec2.RouteOriginCreateRoute), @@ -1193,6 +1210,7 @@ func TestAccAWSRoute_IPv6_Update_Target(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "gateway_id", ""), resource.TestCheckResourceAttrPair(resourceName, "instance_id", instanceResourceName, "id"), testAccCheckResourceAttrAccountID(resourceName, "instance_owner_id"), + resource.TestCheckResourceAttr(resourceName, "local_gateway_id", ""), resource.TestCheckResourceAttr(resourceName, "nat_gateway_id", ""), resource.TestCheckResourceAttrPair(resourceName, "network_interface_id", instanceResourceName, "primary_network_interface_id"), resource.TestCheckResourceAttr(resourceName, "origin", ec2.RouteOriginCreateRoute), @@ -1212,6 +1230,7 @@ func TestAccAWSRoute_IPv6_Update_Target(t *testing.T) { resource.TestCheckResourceAttrPair(resourceName, "gateway_id", vgwResourceName, "id"), resource.TestCheckResourceAttr(resourceName, "instance_id", ""), resource.TestCheckResourceAttr(resourceName, "instance_owner_id", ""), + resource.TestCheckResourceAttr(resourceName, "local_gateway_id", ""), resource.TestCheckResourceAttr(resourceName, "nat_gateway_id", ""), resource.TestCheckResourceAttr(resourceName, "network_interface_id", ""), resource.TestCheckResourceAttr(resourceName, "origin", ec2.RouteOriginCreateRoute), @@ -1231,6 +1250,7 @@ func TestAccAWSRoute_IPv6_Update_Target(t *testing.T) { resource.TestCheckResourceAttrPair(resourceName, "gateway_id", igwResourceName, "id"), resource.TestCheckResourceAttr(resourceName, "instance_id", ""), resource.TestCheckResourceAttr(resourceName, "instance_owner_id", ""), + resource.TestCheckResourceAttr(resourceName, "local_gateway_id", ""), resource.TestCheckResourceAttr(resourceName, "nat_gateway_id", ""), resource.TestCheckResourceAttr(resourceName, "network_interface_id", ""), resource.TestCheckResourceAttr(resourceName, "origin", ec2.RouteOriginCreateRoute), @@ -1250,6 +1270,7 @@ func TestAccAWSRoute_IPv6_Update_Target(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "gateway_id", ""), resource.TestCheckResourceAttr(resourceName, "instance_id", ""), resource.TestCheckResourceAttr(resourceName, "instance_owner_id", ""), + resource.TestCheckResourceAttr(resourceName, "local_gateway_id", ""), resource.TestCheckResourceAttr(resourceName, "nat_gateway_id", ""), resource.TestCheckResourceAttr(resourceName, "network_interface_id", ""), resource.TestCheckResourceAttr(resourceName, "origin", ec2.RouteOriginCreateRoute), @@ -1269,6 +1290,7 @@ func TestAccAWSRoute_IPv6_Update_Target(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "gateway_id", ""), resource.TestCheckResourceAttr(resourceName, "instance_id", ""), resource.TestCheckResourceAttr(resourceName, "instance_owner_id", ""), + resource.TestCheckResourceAttr(resourceName, "local_gateway_id", ""), resource.TestCheckResourceAttr(resourceName, "nat_gateway_id", ""), resource.TestCheckResourceAttrPair(resourceName, "network_interface_id", eniResourceName, "id"), resource.TestCheckResourceAttr(resourceName, "origin", ec2.RouteOriginCreateRoute), @@ -1288,6 +1310,7 @@ func TestAccAWSRoute_IPv6_Update_Target(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "gateway_id", ""), resource.TestCheckResourceAttr(resourceName, "instance_id", ""), resource.TestCheckResourceAttr(resourceName, "instance_owner_id", ""), + resource.TestCheckResourceAttr(resourceName, "local_gateway_id", ""), resource.TestCheckResourceAttr(resourceName, "nat_gateway_id", ""), resource.TestCheckResourceAttr(resourceName, "network_interface_id", ""), resource.TestCheckResourceAttr(resourceName, "origin", ec2.RouteOriginCreateRoute),