-
-
Notifications
You must be signed in to change notification settings - Fork 1.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
Get default aws subnet ids #1131
Conversation
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.
👍
modules/aws/vpc.go
Outdated
} | ||
|
||
for _, subnet := range vpc.Subnets { | ||
if subnet.DefaultForAz == true { |
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.
I was wondering if is required to check for true
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.
oh yea, this is not necessary. removed in 864adce and added a new check in the tests for excluding recently created subnets too
Thanks for approving this @denis256! PS: I don't have the powers to re-run the CI tests nor merge PRs in this repo :) |
Kicked off test after rebasing on |
Confirmed the test failures are unrelated to this change, so will go ahead and merge + release this! |
@yorinasub17 Lovely, thanks for merging! |
Description
Resolves #1130.
The VPC object obtained when running aws.GetDefaultVpc includes all subnets in the default VPC, and not just the default subnets. This is a problem because often this is used with the intention to get the default subnets in a region, as by default the default VPC has a default subnet in each availability zone. However, there are occasions where more subnets are created in the default VPC causing unintended effects.
For example:
TestGetVpcsE
sometimes fails due to unmatching AZ & subnet numberThis PR
aws.GetDefaultSubnetIDsForVpc
to retrieve default subnet idsaws.IsPublicSubnet
to check implicit association with the main route table in VPC when the subnet does not have any explicitly associated route tablesTestGetVpcsE
test to check for greater or equal number of subnets and availability zones instead of equal.TODOs
Read the Gruntwork contribution guidelines.
Release Notes
aws.GetDefaultSubnetIDsForVpc
to retrieve default subnet idsaws.IsPublicSubnet
to check implicit association with the main route table in VPC when the subnet does not have any explicitly associated route tables