provider/aws: Don't set NatGatewayId with no value
This fixes create aws_route_table resources in regions which do not support the NAT Gateway yet (e.g. eu-central) - unless a value is explicitly set in which case the API call will fail until such time as NAT Gateway is supported. Fixes #4499.
This commit is contained in:
parent
89f71d4ec4
commit
c519ea74c5
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue