Merge pull request #1575 from freshbooks/aws-eni-route
provider/aws: Add Elastic Network Interfaces as route destination
This commit is contained in:
commit
412a2dca0b
|
@ -53,6 +53,11 @@ func resourceAwsRouteTable() *schema.Resource {
|
|||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
},
|
||||
|
||||
"network_interface_id": &schema.Schema{
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
Set: resourceAwsRouteTableHash,
|
||||
|
@ -141,6 +146,9 @@ func resourceAwsRouteTableRead(d *schema.ResourceData, meta interface{}) error {
|
|||
if r.VPCPeeringConnectionID != nil {
|
||||
m["vpc_peering_connection_id"] = *r.VPCPeeringConnectionID
|
||||
}
|
||||
if r.NetworkInterfaceID != nil {
|
||||
m["network_interface_id"] = *r.NetworkInterfaceID
|
||||
}
|
||||
|
||||
route.Add(m)
|
||||
}
|
||||
|
@ -192,6 +200,7 @@ func resourceAwsRouteTableUpdate(d *schema.ResourceData, meta interface{}) error
|
|||
GatewayID: aws.String(m["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)),
|
||||
}
|
||||
|
||||
log.Printf("[INFO] Creating route for %s: %#v", d.Id(), opts)
|
||||
|
@ -289,6 +298,10 @@ func resourceAwsRouteTableHash(v interface{}) int {
|
|||
buf.WriteString(fmt.Sprintf("%s-", v.(string)))
|
||||
}
|
||||
|
||||
if v, ok := m["network_interface_id"]; ok {
|
||||
buf.WriteString(fmt.Sprintf("%s-", v.(string)))
|
||||
}
|
||||
|
||||
return hashcode.String(buf.String())
|
||||
}
|
||||
|
||||
|
|
|
@ -40,10 +40,11 @@ Each route supports the following:
|
|||
* `gateway_id` - (Optional) The Internet Gateway ID.
|
||||
* `instance_id` - (Optional) The EC2 instance ID.
|
||||
* `vpc_peering_connection_id` - (Optional) The VPC Peering ID.
|
||||
* `network_interface_id` - (Optional) The ID of the elastic network interface (eni) to use.
|
||||
|
||||
Each route must contain either a `gateway_id`, an `instance_id` or a `vpc_peering_connection_id`. Note that the
|
||||
default route, mapping the VPC's CIDR block to "local", is created implicitly and
|
||||
cannot be specified.
|
||||
Each route must contain either a `gateway_id`, an `instance_id` or a `vpc_peering_connection_id`
|
||||
or a `network_interface_id`. Note that the default route, mapping the VPC's CIDR block to "local",
|
||||
is created implicitly and cannot be specified.
|
||||
|
||||
## Attributes Reference
|
||||
|
||||
|
|
Loading…
Reference in New Issue