Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vpc/route_table: Allow local inline routes #32794

Merged
merged 12 commits into from
Aug 3, 2023

Conversation

YakDriver
Copy link
Member

@YakDriver YakDriver commented Aug 1, 2023

Description

This PR is similar to the changes made in #24507, which addressed aws_route. This PR addresses aws_route_table inline routes.

Because aws_route_table performs dual functions 1) as a parent in the parent-child relationship with aws_route, and 2) as a means of managing routes inline with route blocks, this enhancement is a bit more complicated than the scenario in aws_route.

Normally, aws_route_table ignores default local routes. In order to not introduce a massive breaking change, these changes preserve the previous behavior of typically ignoring the local routes created by AWS. However, now we want to manage these routes a bit more. We use hasLocalConfig() along with flattenRoutes() to prevent default local routes from being stored in state (the previous behavior), while allowing configured local routes to be updated and kept in state (preventing perpetual diffs) like other routes. hasLocalConfig() checks the ResourceData to distinguish default local routes from configured local routes. Normally, you can't count on ResourceData to represent config. However, in this case, a local gateway route in ResourceData must come from the config because of the gatekeeping done by hasLocalConfig() and flattenRoutes() to prevent default local routes from being stored in state as ResourceData.

This PR is likely a step on the road to fully support all the possibilities described in AWS's Deployment models for AWS Network Firewall. After this is merged, please open new issues to describe what yet remains to make your route/firewall dreams come true.

Import Example

Adopt Example

With this PR, in addition to importing a local route, you can now adopt a local route.

Step 1. Create an aws_route_table and adopt an existing local route

Here, the local route is created for you by AWS. Therefore, this configuration creates the route table but adopts the existing local route into management.

CAUTION: Since you cannot create local-target routes, if you use the wrong CIDR block, you will get an error.
Apply:

resource "aws_vpc" "test" {
  cidr_block = "10.1.0.0/16"

  tags = {
    Name = "lihaspoj"
  }
}

resource "aws_route_table" "test" {
  vpc_id = aws_vpc.test.id

  # since this is exactly the route AWS will create, the route will be adopted
  route { 
    cidr_block = "10.1.0.0/16"
    gateway_id = "local"
  }

  tags = {
    Name = "lihaspoj"
  }
}

Step 2. Change the route to have an ENI target

Here, the route (the AWS created route) will be updated to have an ENI target.

Apply:

resource "aws_vpc" "test" {
  cidr_block = "10.1.0.0/16"

  tags = {
    Name = "lihaspoj"
  }
}

resource "aws_route_table" "test" {
  vpc_id = aws_vpc.test.id

  route {
    cidr_block           = aws_vpc.test.cidr_block
    network_interface_id = aws_network_interface.test.id
  }

  tags = {
    Name = "lihaspoj"
  }
}

resource "aws_subnet" "test" {
  cidr_block = "10.1.1.0/24"
  vpc_id     = aws_vpc.test.id

  tags = {
    Name = "lihaspoj"
  }
}

resource "aws_network_interface" "test" {
  subnet_id = aws_subnet.test.id

  tags = {
    Name = "lihaspoj"
  }
}

Step 3. Update the route again to have a local target

Apply:

resource "aws_vpc" "test" {
  cidr_block = "10.1.0.0/16"

  tags = {
    Name = "lihaspoj"
  }
}

resource "aws_route_table" "test" {
  vpc_id = aws_vpc.test.id

  route {
    cidr_block = "10.1.0.0/16"
    gateway_id = "local"
  }

  tags = {
    Name = "lihaspoj"
  }
}

Relations

Closes #21350
Relates #24507

References

Output from Acceptance Testing

% make t T=TestAccVPCRoute K=vpc P=10           
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/ec2/... -v -count 1 -parallel 10 -run='TestAccVPCRoute'  -timeout 180m
=== NAME  TestAccVPCRoute_ipv4ToLocalGateway
    acctest.go:1105: skipping since no Outposts found
--- SKIP: TestAccVPCRoute_ipv4ToLocalGateway (0.87s)
=== NAME  TestAccVPCRoute_prefixListToCarrierGateway
    wavelength_carrier_gateway_test.go:196: skipping since no Wavelength Zones are available
--- SKIP: TestAccVPCRoute_prefixListToCarrierGateway (1.03s)
=== NAME  TestAccVPCRoute_prefixListToLocalGateway
    acctest.go:1105: skipping since no Outposts found
--- SKIP: TestAccVPCRoute_prefixListToLocalGateway (1.13s)
--- PASS: TestAccVPCRoute_basic (41.10s)
--- PASS: TestAccVPCRoute_prefixListToVPCPeeringConnection (49.09s)
--- PASS: TestAccVPCRoute_PrefixListToNetworkInterface_unattached (51.59s)
--- PASS: TestAccVPCRoute_prefixListToEgressOnlyInternetGateway (60.33s)
--- PASS: TestAccVPCRouteDataSource_basic (76.26s)
--- PASS: TestAccVPCRoute_prefixListToInternetGateway (42.21s)
--- PASS: TestAccVPCRouteTablesDataSource_basic (31.82s)
--- PASS: TestAccVPCRoute_PrefixListToNetworkInterface_attached (94.75s)
--- PASS: TestAccVPCRoute_prefixListToInstance (102.24s)
--- PASS: TestAccVPCRouteTable_localRoute (36.68s)
--- PASS: TestAccVPCRoute_localRoute (38.17s)
--- PASS: TestAccVPCRoute_localRouteUpdate (88.19s)
--- PASS: TestAccVPCRoute_prefixListToVPNGateway (164.17s)
--- PASS: TestAccVPCRouteTable_prefixListToInternetGateway (41.54s)
--- PASS: TestAccVPCRouteTable_localRouteUpdate (131.53s)
--- PASS: TestAccVPCRoute_prefixListToTransitGateway (211.16s)
--- PASS: TestAccVPCRoute_prefixListToNatGateway (218.97s)
--- PASS: TestAccVPCRouteTable_gatewayVPCEndpoint (45.36s)
--- PASS: TestAccVPCRouteTable_vpcMultipleCIDRs (55.88s)
--- PASS: TestAccVPCRouteTable_IPv6ToNetworkInterface_unattached (49.39s)
--- PASS: TestAccVPCRouteTable_IPv4ToNetworkInterfaces_unattached (109.72s)
--- PASS: TestAccVPCRouteTable_conditionalCIDRBlock (67.32s)
    acctest.go:1105: skipping since no Outposts found
--- SKIP: TestAccVPCRouteTable_ipv4ToLocalGateway (0.41s)
    wavelength_carrier_gateway_test.go:196: skipping since no Wavelength Zones are available
--- SKIP: TestAccVPCRouteTable_ipv4ToCarrierGateway (0.19s)
--- PASS: TestAccVPCRouteTable_ipv4ToVPCPeeringConnection (36.10s)
--- PASS: TestAccVPCRouteTable_multipleRoutes (195.65s)
--- PASS: TestAccVPCRouteTable_requireRouteDestination (322.87s)
    acctest.go:1105: skipping since no Outposts found
--- SKIP: TestAccVPCRoute_ipv6ToLocalGateway (0.19s)
--- PASS: TestAccVPCRoute_IPv6Update_target (291.22s)
--- PASS: TestAccVPCRouteTable_ipv4ToNatGateway (194.17s)
--- PASS: TestAccVPCRoute_conditionalCIDRBlock (72.10s)
--- PASS: TestAccVPCRouteTable_requireRouteTarget (18.70s)
--- PASS: TestAccVPCRouteTableAssociation_disappears (38.43s)
--- PASS: TestAccVPCRouteTable_Route_mode (85.13s)
--- PASS: TestAccVPCRouteDataSource_gatewayVPCEndpoint (47.98s)
--- PASS: TestAccVPCRouteTableAssociation_Gateway_changeRouteTable (64.74s)
--- PASS: TestAccVPCRouteTableAssociation_Gateway_basic (43.11s)
--- PASS: TestAccVPCRoute_ipv6ToVPCEndpoint (418.76s)
--- PASS: TestAccVPCRouteTableAssociation_Subnet_basic (39.63s)
--- PASS: TestAccVPCRoute_ipv4ToVPCEndpoint (419.09s)
--- PASS: TestAccVPCRouteTableAssociation_Subnet_changeRouteTable (62.78s)
--- PASS: TestAccVPCRouteTable_Disappears_subnetAssociation (35.62s)
--- PASS: TestAccVPCRouteTable_disappears (34.99s)
--- PASS: TestAccVPCRouteTableDataSource_main (31.80s)
--- PASS: TestAccVPCRouteTable_basic (38.98s)
    acctest.go:1105: skipping since no Outposts found
--- SKIP: TestAccVPCRouteDataSource_localGatewayID (0.42s)
--- PASS: TestAccVPCRouteTable_ipv6ToEgressOnlyInternetGateway (67.35s)
--- PASS: TestAccVPCRouteTable_tags (88.49s)
    wavelength_carrier_gateway_test.go:196: skipping since no Wavelength Zones are available
--- SKIP: TestAccVPCRoute_ipv4ToCarrierGateway (0.40s)
--- PASS: TestAccVPCRouteTableDataSource_basic (35.32s)
--- PASS: TestAccVPCRouteTable_vgwRoutePropagation (334.67s)
--- PASS: TestAccVPCRoute_IPv4ToNetworkInterface_unattached (40.78s)
--- PASS: TestAccVPCRouteTable_ipv4ToInternetGateway (64.16s)
--- PASS: TestAccVPCRouteTable_ipv4ToInstance (130.70s)
--- PASS: TestAccVPCRouteTable_ipv4ToTransitGateway (286.77s)
--- PASS: TestAccVPCRoute_doesNotCrashWithVPCEndpoint (46.89s)
--- PASS: TestAccVPCRoute_ipv4ToVPCPeeringConnection (33.96s)
    wavelength_carrier_gateway_test.go:196: skipping since no Wavelength Zones are available
--- SKIP: TestAccVPCRouteDataSource_carrierGatewayID (0.37s)
--- PASS: TestAccVPCRouteDataSource_destinationPrefixListID (201.60s)
--- PASS: TestAccVPCRoute_IPv4ToNetworkInterface_attached (123.77s)
--- PASS: TestAccVPCRoute_IPv4Update_target (646.95s)
--- PASS: TestAccVPCRoute_IPv4ToNetworkInterface_twoAttachments (131.73s)
--- PASS: TestAccVPCRouteTable_ipv4ToVPCEndpoint (449.46s)
--- PASS: TestAccVPCRoute_ipv6ToInternetGateway (47.32s)
--- PASS: TestAccVPCRoute_ipv6ToEgressOnlyInternetGateway (61.53s)
--- PASS: TestAccVPCRoute_ipv4ToTransitGateway (251.38s)
--- PASS: TestAccVPCRoute_ipv6ToTransitGateway (261.44s)
--- PASS: TestAccVPCRoute_ipv6ToNatGateway (233.33s)
--- PASS: TestAccVPCRouteDataSource_ipv6DestinationCIDR (32.21s)
--- PASS: TestAccVPCRoute_ipv4ToNatGateway (232.79s)
--- PASS: TestAccVPCRoute_disappears (32.21s)
--- PASS: TestAccVPCRoute_ipv6ToInstance (114.96s)
--- PASS: TestAccVPCRoute_Disappears_routeTable (32.04s)
--- PASS: TestAccVPCRoute_ipv6ToVPCPeeringConnection (46.76s)
--- PASS: TestAccVPCRoute_IPv6ToNetworkInterface_unattached (48.98s)
--- PASS: TestAccVPCRoute_ipv4ToInstance (124.39s)
--- PASS: TestAccVPCRoute_ipv4ToVPNGateway (136.11s)
--- PASS: TestAccVPCRouteDataSource_transitGatewayID (259.20s)
--- PASS: TestAccVPCRoute_ipv6ToVPNGateway (143.99s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/ec2	971.548s

@github-actions
Copy link

github-actions bot commented Aug 1, 2023

Community Note

Voting for Prioritization

  • Please vote on this pull request by adding a 👍 reaction to the original post to help the community and maintainers prioritize this pull request.
  • Please see our prioritization guide for information on how we prioritize.
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.

For Submitters

  • Review the contribution guide relating to the type of change you are making to ensure all of the necessary steps have been taken.
  • For new resources and data sources, use skaff to generate scaffolding with comments detailing common expectations.
  • Whether or not the branch has been rebased will not impact prioritization, but doing so is always a welcome surprise.

@github-actions github-actions bot added tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. service/vpc Issues and PRs that pertain to the vpc service. size/L Managed by automation to categorize the size of a PR. prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. and removed tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. service/vpc Issues and PRs that pertain to the vpc service. labels Aug 1, 2023
@github-actions github-actions bot added size/XL Managed by automation to categorize the size of a PR. and removed size/L Managed by automation to categorize the size of a PR. labels Aug 2, 2023
@github-actions github-actions bot added size/L Managed by automation to categorize the size of a PR. and removed size/XL Managed by automation to categorize the size of a PR. labels Aug 2, 2023
@github-actions github-actions bot added size/XL Managed by automation to categorize the size of a PR. and removed size/L Managed by automation to categorize the size of a PR. labels Aug 2, 2023
@YakDriver YakDriver requested review from ewbankkit and gdavison August 2, 2023 22:39
@@ -811,7 +820,7 @@ func flattenRoute(apiObject *ec2.Route) map[string]interface{} {
return tfMap
}

func flattenRoutes(ctx context.Context, conn *ec2.EC2, apiObjects []*ec2.Route) []interface{} {
func flattenRoutes(ctx context.Context, d *schema.ResourceData, conn *ec2.EC2, apiObjects []*ec2.Route) []interface{} {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Swap *schema.ResourceData and *ec2.EC2 arguments as the most common pattern is f(ctx, conn, other-args...).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, absolutely! Careless...

@ewbankkit
Copy link
Contributor

ewbankkit commented Aug 3, 2023

% make testacc TESTARGS='-run=TestAccVPCRoute' PKG=ec2 ACCTEST_PARALLELISM=2
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/ec2/... -v -count 1 -parallel 2  -run=TestAccVPCRoute -timeout 180m
=== RUN   TestAccVPCRouteDataSource_basic
=== PAUSE TestAccVPCRouteDataSource_basic
=== RUN   TestAccVPCRouteDataSource_transitGatewayID
=== PAUSE TestAccVPCRouteDataSource_transitGatewayID
=== RUN   TestAccVPCRouteDataSource_ipv6DestinationCIDR
=== PAUSE TestAccVPCRouteDataSource_ipv6DestinationCIDR
=== RUN   TestAccVPCRouteDataSource_localGatewayID
=== PAUSE TestAccVPCRouteDataSource_localGatewayID
=== RUN   TestAccVPCRouteDataSource_carrierGatewayID
=== PAUSE TestAccVPCRouteDataSource_carrierGatewayID
=== RUN   TestAccVPCRouteDataSource_destinationPrefixListID
=== PAUSE TestAccVPCRouteDataSource_destinationPrefixListID
=== RUN   TestAccVPCRouteDataSource_gatewayVPCEndpoint
=== PAUSE TestAccVPCRouteDataSource_gatewayVPCEndpoint
=== RUN   TestAccVPCRouteTableAssociation_Subnet_basic
=== PAUSE TestAccVPCRouteTableAssociation_Subnet_basic
=== RUN   TestAccVPCRouteTableAssociation_Subnet_changeRouteTable
=== PAUSE TestAccVPCRouteTableAssociation_Subnet_changeRouteTable
=== RUN   TestAccVPCRouteTableAssociation_Gateway_basic
=== PAUSE TestAccVPCRouteTableAssociation_Gateway_basic
=== RUN   TestAccVPCRouteTableAssociation_Gateway_changeRouteTable
=== PAUSE TestAccVPCRouteTableAssociation_Gateway_changeRouteTable
=== RUN   TestAccVPCRouteTableAssociation_disappears
=== PAUSE TestAccVPCRouteTableAssociation_disappears
=== RUN   TestAccVPCRouteTableDataSource_basic
=== PAUSE TestAccVPCRouteTableDataSource_basic
=== RUN   TestAccVPCRouteTableDataSource_main
=== PAUSE TestAccVPCRouteTableDataSource_main
=== RUN   TestAccVPCRouteTable_basic
=== PAUSE TestAccVPCRouteTable_basic
=== RUN   TestAccVPCRouteTable_disappears
=== PAUSE TestAccVPCRouteTable_disappears
=== RUN   TestAccVPCRouteTable_Disappears_subnetAssociation
=== PAUSE TestAccVPCRouteTable_Disappears_subnetAssociation
=== RUN   TestAccVPCRouteTable_ipv4ToInternetGateway
=== PAUSE TestAccVPCRouteTable_ipv4ToInternetGateway
=== RUN   TestAccVPCRouteTable_ipv4ToInstance
=== PAUSE TestAccVPCRouteTable_ipv4ToInstance
=== RUN   TestAccVPCRouteTable_ipv6ToEgressOnlyInternetGateway
=== PAUSE TestAccVPCRouteTable_ipv6ToEgressOnlyInternetGateway
=== RUN   TestAccVPCRouteTable_tags
=== PAUSE TestAccVPCRouteTable_tags
=== RUN   TestAccVPCRouteTable_requireRouteDestination
=== PAUSE TestAccVPCRouteTable_requireRouteDestination
=== RUN   TestAccVPCRouteTable_requireRouteTarget
=== PAUSE TestAccVPCRouteTable_requireRouteTarget
=== RUN   TestAccVPCRouteTable_Route_mode
=== PAUSE TestAccVPCRouteTable_Route_mode
=== RUN   TestAccVPCRouteTable_ipv4ToTransitGateway
=== PAUSE TestAccVPCRouteTable_ipv4ToTransitGateway
=== RUN   TestAccVPCRouteTable_ipv4ToVPCEndpoint
=== PAUSE TestAccVPCRouteTable_ipv4ToVPCEndpoint
=== RUN   TestAccVPCRouteTable_ipv4ToCarrierGateway
=== PAUSE TestAccVPCRouteTable_ipv4ToCarrierGateway
=== RUN   TestAccVPCRouteTable_ipv4ToLocalGateway
=== PAUSE TestAccVPCRouteTable_ipv4ToLocalGateway
=== RUN   TestAccVPCRouteTable_ipv4ToVPCPeeringConnection
=== PAUSE TestAccVPCRouteTable_ipv4ToVPCPeeringConnection
=== RUN   TestAccVPCRouteTable_vgwRoutePropagation
=== PAUSE TestAccVPCRouteTable_vgwRoutePropagation
=== RUN   TestAccVPCRouteTable_conditionalCIDRBlock
=== PAUSE TestAccVPCRouteTable_conditionalCIDRBlock
=== RUN   TestAccVPCRouteTable_ipv4ToNatGateway
=== PAUSE TestAccVPCRouteTable_ipv4ToNatGateway
=== RUN   TestAccVPCRouteTable_IPv6ToNetworkInterface_unattached
=== PAUSE TestAccVPCRouteTable_IPv6ToNetworkInterface_unattached
=== RUN   TestAccVPCRouteTable_IPv4ToNetworkInterfaces_unattached
=== PAUSE TestAccVPCRouteTable_IPv4ToNetworkInterfaces_unattached
=== RUN   TestAccVPCRouteTable_vpcMultipleCIDRs
=== PAUSE TestAccVPCRouteTable_vpcMultipleCIDRs
=== RUN   TestAccVPCRouteTable_gatewayVPCEndpoint
=== PAUSE TestAccVPCRouteTable_gatewayVPCEndpoint
=== RUN   TestAccVPCRouteTable_multipleRoutes
=== PAUSE TestAccVPCRouteTable_multipleRoutes
=== RUN   TestAccVPCRouteTable_prefixListToInternetGateway
=== PAUSE TestAccVPCRouteTable_prefixListToInternetGateway
=== RUN   TestAccVPCRouteTable_localRoute
=== PAUSE TestAccVPCRouteTable_localRoute
=== RUN   TestAccVPCRouteTable_localRouteUpdate
=== PAUSE TestAccVPCRouteTable_localRouteUpdate
=== RUN   TestAccVPCRouteTablesDataSource_basic
=== PAUSE TestAccVPCRouteTablesDataSource_basic
=== RUN   TestAccVPCRoute_basic
=== PAUSE TestAccVPCRoute_basic
=== RUN   TestAccVPCRoute_disappears
=== PAUSE TestAccVPCRoute_disappears
=== RUN   TestAccVPCRoute_Disappears_routeTable
=== PAUSE TestAccVPCRoute_Disappears_routeTable
=== RUN   TestAccVPCRoute_ipv6ToEgressOnlyInternetGateway
=== PAUSE TestAccVPCRoute_ipv6ToEgressOnlyInternetGateway
=== RUN   TestAccVPCRoute_ipv6ToInternetGateway
=== PAUSE TestAccVPCRoute_ipv6ToInternetGateway
=== RUN   TestAccVPCRoute_ipv6ToInstance
=== PAUSE TestAccVPCRoute_ipv6ToInstance
=== RUN   TestAccVPCRoute_IPv6ToNetworkInterface_unattached
=== PAUSE TestAccVPCRoute_IPv6ToNetworkInterface_unattached
=== RUN   TestAccVPCRoute_ipv6ToVPCPeeringConnection
=== PAUSE TestAccVPCRoute_ipv6ToVPCPeeringConnection
=== RUN   TestAccVPCRoute_ipv6ToVPNGateway
=== PAUSE TestAccVPCRoute_ipv6ToVPNGateway
=== RUN   TestAccVPCRoute_ipv4ToVPNGateway
=== PAUSE TestAccVPCRoute_ipv4ToVPNGateway
=== RUN   TestAccVPCRoute_ipv4ToInstance
=== PAUSE TestAccVPCRoute_ipv4ToInstance
=== RUN   TestAccVPCRoute_IPv4ToNetworkInterface_unattached
=== PAUSE TestAccVPCRoute_IPv4ToNetworkInterface_unattached
=== RUN   TestAccVPCRoute_IPv4ToNetworkInterface_attached
=== PAUSE TestAccVPCRoute_IPv4ToNetworkInterface_attached
=== RUN   TestAccVPCRoute_IPv4ToNetworkInterface_twoAttachments
=== PAUSE TestAccVPCRoute_IPv4ToNetworkInterface_twoAttachments
=== RUN   TestAccVPCRoute_ipv4ToVPCPeeringConnection
=== PAUSE TestAccVPCRoute_ipv4ToVPCPeeringConnection
=== RUN   TestAccVPCRoute_ipv4ToNatGateway
=== PAUSE TestAccVPCRoute_ipv4ToNatGateway
=== RUN   TestAccVPCRoute_ipv6ToNatGateway
=== PAUSE TestAccVPCRoute_ipv6ToNatGateway
=== RUN   TestAccVPCRoute_doesNotCrashWithVPCEndpoint
=== PAUSE TestAccVPCRoute_doesNotCrashWithVPCEndpoint
=== RUN   TestAccVPCRoute_ipv4ToTransitGateway
=== PAUSE TestAccVPCRoute_ipv4ToTransitGateway
=== RUN   TestAccVPCRoute_ipv6ToTransitGateway
=== PAUSE TestAccVPCRoute_ipv6ToTransitGateway
=== RUN   TestAccVPCRoute_ipv4ToCarrierGateway
=== PAUSE TestAccVPCRoute_ipv4ToCarrierGateway
=== RUN   TestAccVPCRoute_ipv4ToLocalGateway
=== PAUSE TestAccVPCRoute_ipv4ToLocalGateway
=== RUN   TestAccVPCRoute_ipv6ToLocalGateway
=== PAUSE TestAccVPCRoute_ipv6ToLocalGateway
=== RUN   TestAccVPCRoute_conditionalCIDRBlock
=== PAUSE TestAccVPCRoute_conditionalCIDRBlock
=== RUN   TestAccVPCRoute_IPv4Update_target
=== PAUSE TestAccVPCRoute_IPv4Update_target
=== RUN   TestAccVPCRoute_IPv6Update_target
=== PAUSE TestAccVPCRoute_IPv6Update_target
=== RUN   TestAccVPCRoute_ipv4ToVPCEndpoint
=== PAUSE TestAccVPCRoute_ipv4ToVPCEndpoint
=== RUN   TestAccVPCRoute_ipv6ToVPCEndpoint
=== PAUSE TestAccVPCRoute_ipv6ToVPCEndpoint
=== RUN   TestAccVPCRoute_localRoute
=== PAUSE TestAccVPCRoute_localRoute
=== RUN   TestAccVPCRoute_localRouteUpdate
=== PAUSE TestAccVPCRoute_localRouteUpdate
=== RUN   TestAccVPCRoute_prefixListToInternetGateway
=== PAUSE TestAccVPCRoute_prefixListToInternetGateway
=== RUN   TestAccVPCRoute_prefixListToVPNGateway
=== PAUSE TestAccVPCRoute_prefixListToVPNGateway
=== RUN   TestAccVPCRoute_prefixListToInstance
=== PAUSE TestAccVPCRoute_prefixListToInstance
=== RUN   TestAccVPCRoute_PrefixListToNetworkInterface_unattached
=== PAUSE TestAccVPCRoute_PrefixListToNetworkInterface_unattached
=== RUN   TestAccVPCRoute_PrefixListToNetworkInterface_attached
=== PAUSE TestAccVPCRoute_PrefixListToNetworkInterface_attached
=== RUN   TestAccVPCRoute_prefixListToVPCPeeringConnection
=== PAUSE TestAccVPCRoute_prefixListToVPCPeeringConnection
=== RUN   TestAccVPCRoute_prefixListToNatGateway
=== PAUSE TestAccVPCRoute_prefixListToNatGateway
=== RUN   TestAccVPCRoute_prefixListToTransitGateway
=== PAUSE TestAccVPCRoute_prefixListToTransitGateway
=== RUN   TestAccVPCRoute_prefixListToCarrierGateway
=== PAUSE TestAccVPCRoute_prefixListToCarrierGateway
=== RUN   TestAccVPCRoute_prefixListToLocalGateway
=== PAUSE TestAccVPCRoute_prefixListToLocalGateway
=== RUN   TestAccVPCRoute_prefixListToEgressOnlyInternetGateway
=== PAUSE TestAccVPCRoute_prefixListToEgressOnlyInternetGateway
=== CONT  TestAccVPCRouteDataSource_basic
=== CONT  TestAccVPCRoute_basic
--- PASS: TestAccVPCRoute_basic (32.75s)
=== CONT  TestAccVPCRouteTable_requireRouteDestination
--- PASS: TestAccVPCRouteDataSource_basic (126.85s)
=== CONT  TestAccVPCRouteTablesDataSource_basic
--- PASS: TestAccVPCRouteTablesDataSource_basic (26.52s)
=== CONT  TestAccVPCRouteTable_localRouteUpdate
--- PASS: TestAccVPCRouteTable_localRouteUpdate (108.11s)
=== CONT  TestAccVPCRouteTable_localRoute
--- PASS: TestAccVPCRouteTable_localRoute (28.69s)
=== CONT  TestAccVPCRouteTable_prefixListToInternetGateway
--- PASS: TestAccVPCRouteTable_prefixListToInternetGateway (36.52s)
=== CONT  TestAccVPCRouteTable_multipleRoutes
--- PASS: TestAccVPCRouteTable_requireRouteDestination (324.66s)
=== CONT  TestAccVPCRouteTable_gatewayVPCEndpoint
--- PASS: TestAccVPCRouteTable_gatewayVPCEndpoint (42.43s)
=== CONT  TestAccVPCRouteTable_vpcMultipleCIDRs
--- PASS: TestAccVPCRouteTable_vpcMultipleCIDRs (51.18s)
=== CONT  TestAccVPCRouteTable_IPv4ToNetworkInterfaces_unattached
--- PASS: TestAccVPCRouteTable_IPv4ToNetworkInterfaces_unattached (100.72s)
=== CONT  TestAccVPCRouteTable_IPv6ToNetworkInterface_unattached
--- PASS: TestAccVPCRouteTable_multipleRoutes (231.26s)
=== CONT  TestAccVPCRouteTable_ipv4ToNatGateway
--- PASS: TestAccVPCRouteTable_IPv6ToNetworkInterface_unattached (44.58s)
=== CONT  TestAccVPCRouteTable_conditionalCIDRBlock
--- PASS: TestAccVPCRouteTable_conditionalCIDRBlock (62.19s)
=== CONT  TestAccVPCRouteTable_vgwRoutePropagation
--- PASS: TestAccVPCRouteTable_ipv4ToNatGateway (199.92s)
=== CONT  TestAccVPCRouteTable_ipv4ToVPCPeeringConnection
--- PASS: TestAccVPCRouteTable_ipv4ToVPCPeeringConnection (31.81s)
=== CONT  TestAccVPCRouteTable_ipv4ToLocalGateway
    acctest.go:1105: skipping since no Outposts found
--- SKIP: TestAccVPCRouteTable_ipv4ToLocalGateway (0.64s)
=== CONT  TestAccVPCRouteTable_ipv4ToCarrierGateway
--- PASS: TestAccVPCRouteTable_ipv4ToCarrierGateway (31.75s)
=== CONT  TestAccVPCRouteTable_ipv4ToVPCEndpoint
--- PASS: TestAccVPCRouteTable_vgwRoutePropagation (293.06s)
=== CONT  TestAccVPCRouteTable_ipv4ToTransitGateway
--- PASS: TestAccVPCRouteTable_ipv4ToTransitGateway (241.97s)
=== CONT  TestAccVPCRouteTable_requireRouteTarget
--- PASS: TestAccVPCRouteTable_requireRouteTarget (15.88s)
=== CONT  TestAccVPCRoute_ipv4ToLocalGateway
    acctest.go:1105: skipping since no Outposts found
--- SKIP: TestAccVPCRoute_ipv4ToLocalGateway (0.41s)
=== CONT  TestAccVPCRoute_prefixListToEgressOnlyInternetGateway
--- PASS: TestAccVPCRouteTable_ipv4ToVPCEndpoint (404.33s)
=== CONT  TestAccVPCRoute_prefixListToLocalGateway
    acctest.go:1105: skipping since no Outposts found
--- SKIP: TestAccVPCRoute_prefixListToLocalGateway (0.67s)
=== CONT  TestAccVPCRoute_prefixListToCarrierGateway
--- PASS: TestAccVPCRoute_prefixListToEgressOnlyInternetGateway (48.57s)
=== CONT  TestAccVPCRoute_prefixListToTransitGateway
--- PASS: TestAccVPCRoute_prefixListToCarrierGateway (37.78s)
=== CONT  TestAccVPCRoute_prefixListToNatGateway
--- PASS: TestAccVPCRoute_prefixListToNatGateway (199.06s)
=== CONT  TestAccVPCRoute_prefixListToVPCPeeringConnection
--- PASS: TestAccVPCRoute_prefixListToVPCPeeringConnection (39.70s)
=== CONT  TestAccVPCRoute_PrefixListToNetworkInterface_attached
--- PASS: TestAccVPCRoute_prefixListToTransitGateway (261.60s)
=== CONT  TestAccVPCRoute_PrefixListToNetworkInterface_unattached
--- PASS: TestAccVPCRoute_PrefixListToNetworkInterface_unattached (40.83s)
=== CONT  TestAccVPCRoute_prefixListToInstance
--- PASS: TestAccVPCRoute_PrefixListToNetworkInterface_attached (133.29s)
=== CONT  TestAccVPCRoute_prefixListToVPNGateway
=== NAME  TestAccVPCRoute_prefixListToInstance
    testing_new.go:88: Error running post-test destroy, there may be dangling resources: exit status 1
        
        Error: reading Route Table (rtb-05e01615a95de82cd): couldn't find resource
        
--- FAIL: TestAccVPCRoute_prefixListToInstance (125.01s)
=== CONT  TestAccVPCRoute_prefixListToInternetGateway
--- PASS: TestAccVPCRoute_prefixListToVPNGateway (119.83s)
=== CONT  TestAccVPCRoute_localRouteUpdate
--- PASS: TestAccVPCRoute_prefixListToInternetGateway (84.44s)
=== CONT  TestAccVPCRoute_localRoute
--- PASS: TestAccVPCRoute_localRoute (56.29s)
=== CONT  TestAccVPCRoute_ipv6ToVPCEndpoint
=== NAME  TestAccVPCRoute_localRouteUpdate
    vpc_route_test.go:1626: Step 4/4 error: After applying this test step and performing a `terraform refresh`, the plan was not empty.
        stdout
        
        
        Terraform used the selected providers to generate the following execution
        plan. Resource actions are indicated with the following symbols:
          + create
        
        Terraform will perform the following actions:
        
          # aws_network_interface.test will be created
          + resource "aws_network_interface" "test" {
              + arn                       = (known after apply)
              + id                        = (known after apply)
              + interface_type            = (known after apply)
              + ipv4_prefix_count         = (known after apply)
              + ipv4_prefixes             = (known after apply)
              + ipv6_address_count        = (known after apply)
              + ipv6_address_list         = (known after apply)
              + ipv6_address_list_enabled = false
              + ipv6_addresses            = (known after apply)
              + ipv6_prefix_count         = (known after apply)
              + ipv6_prefixes             = (known after apply)
              + mac_address               = (known after apply)
              + outpost_arn               = (known after apply)
              + owner_id                  = (known after apply)
              + private_dns_name          = (known after apply)
              + private_ip                = (known after apply)
              + private_ip_list           = (known after apply)
              + private_ip_list_enabled   = false
              + private_ips               = (known after apply)
              + private_ips_count         = (known after apply)
              + security_groups           = (known after apply)
              + source_dest_check         = true
              + subnet_id                 = (known after apply)
              + tags                      = {
                  + "Name" = "tf-acc-test-1740478483555398537"
                }
              + tags_all                  = {
                  + "Name" = "tf-acc-test-1740478483555398537"
                }
        
              + attachment {
                  + attachment_id = (known after apply)
                  + device_index  = (known after apply)
                  + instance      = (known after apply)
                }
            }
        
          # aws_subnet.test will be created
          + resource "aws_subnet" "test" {
              + arn                                            = (known after apply)
              + assign_ipv6_address_on_creation                = false
              + availability_zone                              = (known after apply)
              + availability_zone_id                           = (known after apply)
              + cidr_block                                     = "10.1.1.0/24"
              + enable_dns64                                   = false
              + enable_resource_name_dns_a_record_on_launch    = false
              + enable_resource_name_dns_aaaa_record_on_launch = false
              + id                                             = (known after apply)
              + ipv6_cidr_block_association_id                 = (known after apply)
              + ipv6_native                                    = false
              + map_public_ip_on_launch                        = false
              + owner_id                                       = (known after apply)
              + private_dns_hostname_type_on_launch            = (known after apply)
              + tags                                           = {
                  + "Name" = "tf-acc-test-1740478483555398537"
                }
              + tags_all                                       = {
                  + "Name" = "tf-acc-test-1740478483555398537"
                }
              + vpc_id                                         = "vpc-0e413db9011528b95"
            }
        
        Plan: 2 to add, 0 to change, 0 to destroy.
--- FAIL: TestAccVPCRoute_localRouteUpdate (147.76s)
=== CONT  TestAccVPCRouteTable_Route_mode
--- PASS: TestAccVPCRouteTable_Route_mode (143.59s)
=== CONT  TestAccVPCRouteTableAssociation_disappears
--- PASS: TestAccVPCRouteTableAssociation_disappears (35.41s)
=== CONT  TestAccVPCRouteTable_tags
--- PASS: TestAccVPCRouteTable_tags (70.34s)
=== CONT  TestAccVPCRouteTable_ipv6ToEgressOnlyInternetGateway
--- PASS: TestAccVPCRouteTable_ipv6ToEgressOnlyInternetGateway (58.09s)
=== CONT  TestAccVPCRouteTable_ipv4ToInstance
--- PASS: TestAccVPCRoute_ipv6ToVPCEndpoint (452.94s)
=== CONT  TestAccVPCRouteTable_ipv4ToInternetGateway
--- PASS: TestAccVPCRouteTable_ipv4ToInternetGateway (55.69s)
=== CONT  TestAccVPCRouteTable_Disappears_subnetAssociation
--- PASS: TestAccVPCRouteTable_ipv4ToInstance (128.40s)
=== CONT  TestAccVPCRouteTable_disappears
--- PASS: TestAccVPCRouteTable_Disappears_subnetAssociation (31.42s)
=== CONT  TestAccVPCRoute_ipv4ToVPCEndpoint
--- PASS: TestAccVPCRouteTable_disappears (30.27s)
=== CONT  TestAccVPCRoute_IPv6Update_target
--- PASS: TestAccVPCRoute_IPv6Update_target (330.43s)
=== CONT  TestAccVPCRoute_IPv4Update_target
--- PASS: TestAccVPCRoute_ipv4ToVPCEndpoint (540.71s)
=== CONT  TestAccVPCRoute_conditionalCIDRBlock
--- PASS: TestAccVPCRoute_conditionalCIDRBlock (60.09s)
=== CONT  TestAccVPCRoute_ipv6ToLocalGateway
    acctest.go:1105: skipping since no Outposts found
--- SKIP: TestAccVPCRoute_ipv6ToLocalGateway (0.40s)
=== CONT  TestAccVPCRouteTable_basic
--- PASS: TestAccVPCRouteTable_basic (28.62s)
=== CONT  TestAccVPCRouteTableDataSource_main
--- PASS: TestAccVPCRouteTableDataSource_main (24.02s)
=== CONT  TestAccVPCRoute_IPv4ToNetworkInterface_unattached
--- PASS: TestAccVPCRoute_IPv4ToNetworkInterface_unattached (33.27s)
=== CONT  TestAccVPCRoute_ipv4ToNatGateway
--- PASS: TestAccVPCRoute_ipv4ToNatGateway (177.13s)
=== CONT  TestAccVPCRoute_ipv4ToVPCPeeringConnection
--- PASS: TestAccVPCRoute_ipv4ToVPCPeeringConnection (33.87s)
=== CONT  TestAccVPCRoute_IPv4ToNetworkInterface_twoAttachments
--- PASS: TestAccVPCRoute_IPv4Update_target (624.09s)
=== CONT  TestAccVPCRoute_ipv6ToNatGateway
--- PASS: TestAccVPCRoute_IPv4ToNetworkInterface_twoAttachments (169.90s)
=== CONT  TestAccVPCRoute_ipv4ToCarrierGateway
--- PASS: TestAccVPCRoute_ipv4ToCarrierGateway (30.12s)
=== CONT  TestAccVPCRoute_ipv6ToTransitGateway
--- PASS: TestAccVPCRoute_ipv6ToNatGateway (228.07s)
=== CONT  TestAccVPCRoute_ipv4ToTransitGateway
--- PASS: TestAccVPCRoute_ipv6ToTransitGateway (250.58s)
=== CONT  TestAccVPCRoute_doesNotCrashWithVPCEndpoint
--- PASS: TestAccVPCRoute_doesNotCrashWithVPCEndpoint (43.92s)
=== CONT  TestAccVPCRouteTableDataSource_basic
--- PASS: TestAccVPCRouteTableDataSource_basic (28.96s)
=== CONT  TestAccVPCRoute_ipv6ToEgressOnlyInternetGateway
--- PASS: TestAccVPCRoute_ipv4ToTransitGateway (250.71s)
=== CONT  TestAccVPCRoute_IPv4ToNetworkInterface_attached
--- PASS: TestAccVPCRoute_ipv6ToEgressOnlyInternetGateway (55.78s)
=== CONT  TestAccVPCRoute_IPv6ToNetworkInterface_unattached
--- PASS: TestAccVPCRoute_IPv6ToNetworkInterface_unattached (45.25s)
=== CONT  TestAccVPCRouteDataSource_gatewayVPCEndpoint
--- PASS: TestAccVPCRoute_IPv4ToNetworkInterface_attached (123.84s)
=== CONT  TestAccVPCRoute_ipv4ToInstance
--- PASS: TestAccVPCRouteDataSource_gatewayVPCEndpoint (46.37s)
=== CONT  TestAccVPCRouteTableAssociation_Gateway_changeRouteTable
--- PASS: TestAccVPCRouteTableAssociation_Gateway_changeRouteTable (58.18s)
=== CONT  TestAccVPCRoute_ipv4ToVPNGateway
--- PASS: TestAccVPCRoute_ipv4ToInstance (127.45s)
=== CONT  TestAccVPCRouteTableAssociation_Gateway_basic
--- PASS: TestAccVPCRouteTableAssociation_Gateway_basic (35.96s)
=== CONT  TestAccVPCRoute_ipv6ToVPNGateway
--- PASS: TestAccVPCRoute_ipv4ToVPNGateway (121.25s)
=== CONT  TestAccVPCRoute_ipv6ToVPCPeeringConnection
--- PASS: TestAccVPCRoute_ipv6ToVPCPeeringConnection (40.95s)
=== CONT  TestAccVPCRoute_ipv6ToInstance
--- PASS: TestAccVPCRoute_ipv6ToVPNGateway (151.01s)
=== CONT  TestAccVPCRoute_Disappears_routeTable
--- PASS: TestAccVPCRoute_Disappears_routeTable (27.59s)
=== CONT  TestAccVPCRouteTableAssociation_Subnet_changeRouteTable
--- PASS: TestAccVPCRoute_ipv6ToInstance (130.47s)
=== CONT  TestAccVPCRouteTableAssociation_Subnet_basic
--- PASS: TestAccVPCRouteTableAssociation_Subnet_basic (34.34s)
=== CONT  TestAccVPCRouteDataSource_localGatewayID
    acctest.go:1105: skipping since no Outposts found
--- SKIP: TestAccVPCRouteDataSource_localGatewayID (0.45s)
=== CONT  TestAccVPCRoute_ipv6ToInternetGateway
--- PASS: TestAccVPCRouteTableAssociation_Subnet_changeRouteTable (52.86s)
=== CONT  TestAccVPCRouteDataSource_destinationPrefixListID
--- PASS: TestAccVPCRoute_ipv6ToInternetGateway (41.52s)
=== CONT  TestAccVPCRouteDataSource_carrierGatewayID
--- PASS: TestAccVPCRouteDataSource_carrierGatewayID (28.81s)
=== CONT  TestAccVPCRoute_disappears
--- PASS: TestAccVPCRoute_disappears (26.95s)
=== CONT  TestAccVPCRouteDataSource_ipv6DestinationCIDR
--- PASS: TestAccVPCRouteDataSource_ipv6DestinationCIDR (28.67s)
=== CONT  TestAccVPCRouteDataSource_transitGatewayID
--- PASS: TestAccVPCRouteDataSource_destinationPrefixListID (227.13s)
--- PASS: TestAccVPCRouteDataSource_transitGatewayID (258.71s)
FAIL
FAIL	github.com/hashicorp/terraform-provider-aws/internal/service/ec2	4710.970s
FAIL
make: *** [testacc] Error 1
% make testacc TESTARGS='-run=TestAccVPCRoute_prefixListToInstance\|TestAccVPCRoute_localRouteUpdate' PKG=ec2 ACCTEST_PARALLELISM=2
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/ec2/... -v -count 1 -parallel 2  -run=TestAccVPCRoute_prefixListToInstance\|TestAccVPCRoute_localRouteUpdate -timeout 180m
=== RUN   TestAccVPCRoute_localRouteUpdate
=== PAUSE TestAccVPCRoute_localRouteUpdate
=== RUN   TestAccVPCRoute_prefixListToInstance
=== PAUSE TestAccVPCRoute_prefixListToInstance
=== CONT  TestAccVPCRoute_localRouteUpdate
=== CONT  TestAccVPCRoute_prefixListToInstance
--- PASS: TestAccVPCRoute_localRouteUpdate (74.38s)
--- PASS: TestAccVPCRoute_prefixListToInstance (93.19s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/ec2	97.995s

Copy link
Contributor

@ewbankkit ewbankkit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🚀.

@github-actions github-actions bot added the documentation Introduces or discusses updates to documentation. label Aug 3, 2023
@YakDriver YakDriver merged commit 68281a9 into main Aug 3, 2023
@YakDriver YakDriver deleted the f-add-local-gateway-to-route-table branch August 3, 2023 16:56
@github-actions github-actions bot added this to the v5.11.0 milestone Aug 3, 2023
github-actions bot pushed a commit that referenced this pull request Aug 3, 2023
@github-actions
Copy link

github-actions bot commented Aug 3, 2023

This functionality has been released in v5.11.0 of the Terraform AWS Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

@github-actions
Copy link

github-actions bot commented Sep 3, 2023

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Introduces or discusses updates to documentation. prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. service/vpc Issues and PRs that pertain to the vpc service. size/XL Managed by automation to categorize the size of a PR. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

aws_route: Add support for "local" route target
2 participants