Merge pull request #375 from jgoldschrafe/feature-google-compute-ip-forward
providers/google: Support IP forwarding on GCE instances
This commit is contained in:
commit
65a054b7c2
|
@ -97,6 +97,13 @@ func resourceComputeInstance() *schema.Resource {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
"can_ip_forward": &schema.Schema{
|
||||||
|
Type: schema.TypeBool,
|
||||||
|
Optional: true,
|
||||||
|
Default: false,
|
||||||
|
ForceNew: true,
|
||||||
|
},
|
||||||
|
|
||||||
"metadata": &schema.Schema{
|
"metadata": &schema.Schema{
|
||||||
Type: schema.TypeList,
|
Type: schema.TypeList,
|
||||||
Optional: true,
|
Optional: true,
|
||||||
|
@ -230,6 +237,7 @@ func resourceComputeInstanceCreate(d *schema.ResourceData, meta interface{}) err
|
||||||
|
|
||||||
// Create the instance information
|
// Create the instance information
|
||||||
instance := compute.Instance{
|
instance := compute.Instance{
|
||||||
|
CanIpForward: d.Get("can_ip_forward").(bool),
|
||||||
Description: d.Get("description").(string),
|
Description: d.Get("description").(string),
|
||||||
Disks: disks,
|
Disks: disks,
|
||||||
MachineType: machineType.SelfLink,
|
MachineType: machineType.SelfLink,
|
||||||
|
@ -305,6 +313,8 @@ func resourceComputeInstanceRead(d *schema.ResourceData, meta interface{}) error
|
||||||
return fmt.Errorf("Error reading instance: %s", err)
|
return fmt.Errorf("Error reading instance: %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
d.Set("can_ip_forward", instance.CanIpForward)
|
||||||
|
|
||||||
// Set the networks
|
// Set the networks
|
||||||
for i, iface := range instance.NetworkInterfaces {
|
for i, iface := range instance.NetworkInterfaces {
|
||||||
prefix := fmt.Sprintf("network.%d", i)
|
prefix := fmt.Sprintf("network.%d", i)
|
||||||
|
|
|
@ -225,6 +225,7 @@ resource "google_compute_instance" "foobar" {
|
||||||
name = "terraform-test"
|
name = "terraform-test"
|
||||||
machine_type = "n1-standard-1"
|
machine_type = "n1-standard-1"
|
||||||
zone = "us-central1-a"
|
zone = "us-central1-a"
|
||||||
|
can_ip_forward = false
|
||||||
tags = ["foo", "bar"]
|
tags = ["foo", "bar"]
|
||||||
|
|
||||||
disk {
|
disk {
|
||||||
|
|
|
@ -47,6 +47,10 @@ The following arguments are supported:
|
||||||
* `disk` - (Required) Disks to attach to the instance. This can be specified
|
* `disk` - (Required) Disks to attach to the instance. This can be specified
|
||||||
multiple times for multiple disks. Structure is documented below.
|
multiple times for multiple disks. Structure is documented below.
|
||||||
|
|
||||||
|
* `can_ip_forward` - (Optional) Whether to allow sending and receiving of
|
||||||
|
packets with non-matching source or destination IPs.
|
||||||
|
This defaults to false.
|
||||||
|
|
||||||
* `metadata` - (Optional) Metadata key/value pairs to make available from
|
* `metadata` - (Optional) Metadata key/value pairs to make available from
|
||||||
within the instance.
|
within the instance.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue