Skip to content

Commit

Permalink
Filter out CIDR not in "associated" state (#50)
Browse files Browse the repository at this point in the history
  • Loading branch information
lbernail authored and theatrus committed Jul 18, 2018
1 parent 2873a71 commit 00b0c74
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions aws/vpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ func (v *vpcclient) DescribeVPCCIDRs(vpcID string) ([]*net.IPNet, error) {

for _, vpc := range res.Vpcs {
for _, cblock := range vpc.CidrBlockAssociationSet {
// Avoid adding non associated CIDRs to routes
if *cblock.CidrBlockState.State != "associated" {
continue
}
_, parsed, err := net.ParseCIDR(*cblock.CidrBlock)
if err != nil {
return nil, err
Expand Down

0 comments on commit 00b0c74

Please sign in to comment.