Skip to content

Commit

Permalink
provider/aws: fix panic when route has no cidr_block
Browse files Browse the repository at this point in the history
While cidr_block is required for static route creation, there are
apparently cases (involving some combination of VPNs, Customer Gateways,
and automatic route propogation) where the cidr_block can come back nil.
This means we cannot assume it's there in the set hash calculation.
  • Loading branch information
phinze committed Jun 3, 2015
1 parent 300839d commit 1caef30
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion builtin/providers/aws/resource_aws_route_table.go
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,10 @@ func resourceAwsRouteTableDelete(d *schema.ResourceData, meta interface{}) error
func resourceAwsRouteTableHash(v interface{}) int {
var buf bytes.Buffer
m := v.(map[string]interface{})
buf.WriteString(fmt.Sprintf("%s-", m["cidr_block"].(string)))

if v, ok := m["cidr_block"]; ok {
buf.WriteString(fmt.Sprintf("%s-", v.(string)))
}

if v, ok := m["gateway_id"]; ok {
buf.WriteString(fmt.Sprintf("%s-", v.(string)))
Expand Down

0 comments on commit 1caef30

Please sign in to comment.