-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
[WIP] r/aws_route: Correctly handle update of route target #15049
Closed
ewbankkit
wants to merge
52
commits into
hashicorp:master
from
ewbankkit:b-various-aws_route-fixes-MarkIV
Closed
Changes from all commits
Commits
Show all changes
52 commits
Select commit
Hold shift + click to select a range
2848e4b
r/aws_route: Tidy up 'testAccAWSRouteConfigBasic()'.
ewbankkit 99a3774
r/aws_route: Rename 'TestAccAWSRoute_ipv6Support' to 'TestAccAWSRoute…
ewbankkit e300f4c
Remove 'TestAccAWSRoute_noopdiff'. Test steps implicitly test this fu…
ewbankkit 3113117
r/aws_route: Tidy up 'TestAccAWSRoute_doesNotCrashWithVPCEndpoint'.
ewbankkit 320b50a
r/aws_route: Tidy up 'TestAccAWSRoute_ipv6ToInternetGateway'.
ewbankkit 6b3340f
r/aws_route: Tidy up 'TestAccAWSRoute_ipv6ToInstance'.
ewbankkit 444ca9a
r/aws_route: Tidy up 'TestAccAWSRoute_ipv6ToNetworkInterface'.
ewbankkit 8702b54
r/aws_route: Tidy up 'TestAccAWSRoute_ipv6ToVpcPeeringConnection'.
ewbankkit d7b9cc3
r/aws_route: Tidy up 'TestAccAWSRoute_TransitGatewayID_DestinationCid…
ewbankkit f316b53
r/aws_route: Add 'TestAccAWSRoute_IPv4_To_Instance'.
ewbankkit e5e0c24
r/aws_route: Add 'TestAccAWSRoute_IPv4_To_NetworkInterface'.
ewbankkit e4186c8
r/aws_route: Add 'TestAccAWSRoute_IPv4_To_VpcPeeringConnection'.
ewbankkit e8e3e0d
r/aws_route: Add 'TestAccAWSRoute_IPv4_To_NatGateway'.
ewbankkit f79717a
r/aws_route: Comment out failing target update test.
ewbankkit 80389f0
r/aws_route: Add 'TestAccAWSRoute_IPv4_To_VpnGateway'.
ewbankkit 3653129
r/aws_route: Add 'TestAccAWSRoute_IPv6_To_VpnGateway'.
ewbankkit f7d8deb
r/aws_route: Test computed attributes.
ewbankkit f0ea86f
r/aws_route: Changes for #13766, #13771.
ewbankkit 69a8fb7
r/aws_route: 'testAccCheckAWSRouteNumberOfRoutes' -> 'testAccCheckAWS…
ewbankkit 9de465c
r/aws_route: Add 'TestAccAWSRoute_routeTableDisappears'.
ewbankkit 223fe32
r/aws_route: Rework 'TestAccAWSRoute_ConditionalCidrBlock'.
ewbankkit c7e6ac0
r/aws_route: Add 'TestAccAWSRoute_IPv4_To_NetworkInterface_Attached' …
ewbankkit c80e7cf
r/aws_route: Add 'TestAccAWSRoute_IPv4_To_NetworkInterface_TwoAttachm…
ewbankkit 27f943b
r/aws_route: Comment out failing 'TestAccAWSRoute_IPv4_To_NetworkInte…
ewbankkit 627589a
r/aws_route: Use 'available' as the name of the 'aws_availability_zon…
ewbankkit 449cf71
r/aws_route: Use Amazon NAT instance AMI for instance tests.
ewbankkit 14f2e58
Use 'testAccAvailableAZsNoOptInDefaultExcludeConfig'.
ewbankkit 25dc08f
r/aws_route: Add 'TestAccAWSRoute_IPv6_To_TransitGateway'.
ewbankkit 2163d22
r/aws_route: Add 'TestAccAWSRoute_IPv6_To_LocalGateway'.
ewbankkit b51d0bb
r/aws_route: Add 'TestAccAWSRoute_IPv4_Update_Target'. Currently fails.
ewbankkit 70b839b
r/aws_route: Add 'TestAccAWSRoute_IPv6_Update_Target'. Currently fails.
ewbankkit 32aa5ca
r/aws_route: Better validation.
ewbankkit d4ca1f4
r/aws_route: Correctly handle route target updates.
ewbankkit 3ba48be
r/aws_route: Uncommented 'TestAccAWSRoute_IPv4_To_NetworkInterface_Tw…
ewbankkit e94bc67
Acceptance test output:
ewbankkit 059c95f
r/aws_route: Use 'available' as the name of the 'aws_availability_zon…
ewbankkit 99738d8
r/aws_route: Add 'TestAccAWSRoute_LocalRoute' to test ability to impo…
ewbankkit b234a41
r/aws_route: Add error constants to 'aws/internal/service/ec2'. Tweak…
ewbankkit af40160
r/aw3s_route: Move route finders to 'aws/internal/service/ec2/finder'…
ewbankkit 4d06124
r/aws_route: Add 'createRoute' function.
ewbankkit 158d780
Use 'testAccAvailableAZsNoOptInDefaultExcludeConfig'.
ewbankkit d656cba
Use 'RouteCreateID' in 'internal/service/ec2' package.
ewbankkit cc2f8fb
Tweak EC2 error code constants.
ewbankkit 3affa49
Use 'tfnet.CIDRBlocksEqual' for IPv4 destination CIDR blocks.
ewbankkit f0cefd8
Tidy up route destination and target attribute checking in an attempt…
ewbankkit 99f150e
r/aws_route: 'gateway_id', 'egress_only_gateway_id' and 'nat_gateway_…
ewbankkit 67a569d
r/aws_route: Add 'getRouteDestinationAndTargetAttributeKeysFromMap' w…
ewbankkit f4f54b0
r/aws_route: Minor tweak to error messages.
ewbankkit dd110e1
r/aws_route: Tweak route attribute IP version support.
ewbankkit 50234dc
r/aws_route: Use interface to abstract over '*schema.ResourceData' an…
ewbankkit 275b329
r/aws_route: Add 'local_gateway_id' to attribute checking.
ewbankkit 2909c2a
r/aws_route: Add plan-time validation that multiple destination and t…
ewbankkit File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package net | ||
|
||
import ( | ||
"net" | ||
) | ||
|
||
// CIDRBlocksEqual returns whether or not two CIDR blocks are equal: | ||
// - Both CIDR blocks parse to an IP address and network | ||
// - The string representation of the IP addresses are equal | ||
// - The string representation of the networks are equal | ||
// This function is especially useful for IPv6 CIDR blocks which have multiple valid representations. | ||
func CIDRBlocksEqual(cidr1, cidr2 string) bool { | ||
ip1, ipnet1, err := net.ParseCIDR(cidr1) | ||
if err != nil { | ||
return false | ||
} | ||
ip2, ipnet2, err := net.ParseCIDR(cidr2) | ||
if err != nil { | ||
return false | ||
} | ||
|
||
return ip2.String() == ip1.String() && ipnet2.String() == ipnet1.String() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package net | ||
|
||
import ( | ||
"testing" | ||
) | ||
|
||
func Test_CIDRBlocksEqual(t *testing.T) { | ||
for _, ts := range []struct { | ||
cidr1 string | ||
cidr2 string | ||
equal bool | ||
}{ | ||
{"10.2.2.0/24", "10.2.2.0/24", true}, | ||
{"10.2.2.0/1234", "10.2.2.0/24", false}, | ||
{"10.2.2.0/24", "10.2.2.0/1234", false}, | ||
{"2001::/15", "2001::/15", true}, | ||
{"::/0", "2001::/15", false}, | ||
{"::/0", "::0/0", true}, | ||
{"", "", false}, | ||
} { | ||
equal := CIDRBlocksEqual(ts.cidr1, ts.cidr2) | ||
if ts.equal != equal { | ||
t.Fatalf("CIDRBlocksEqual(%q, %q) should be: %t", ts.cidr1, ts.cidr2, ts.equal) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved here temporarily. Will need to clean up when support for managed prefix list IDs added.