Merge pull request #4500 from hashicorp/b-route-table-nat-gateway

provider/aws: Don't set NatGatewayId with no value
This commit is contained in:
Paul Hinze 2016-01-04 16:10:47 -06:00
commit 7326633060
1 changed files with 4 additions and 1 deletions

View File

@ -290,12 +290,15 @@ func resourceAwsRouteTableUpdate(d *schema.ResourceData, meta interface{}) error
RouteTableId: aws.String(d.Id()),
DestinationCidrBlock: aws.String(m["cidr_block"].(string)),
GatewayId: aws.String(m["gateway_id"].(string)),
NatGatewayId: aws.String(m["nat_gateway_id"].(string)),
InstanceId: aws.String(m["instance_id"].(string)),
VpcPeeringConnectionId: aws.String(m["vpc_peering_connection_id"].(string)),
NetworkInterfaceId: aws.String(m["network_interface_id"].(string)),
}
if m["nat_gateway_id"].(string) != "" {
opts.NatGatewayId = aws.String(m["nat_gateway_id"].(string))
}
log.Printf("[INFO] Creating route for %s: %#v", d.Id(), opts)
if _, err := conn.CreateRoute(&opts); err != nil {
return err