mirror of
https://github.com/letic/terraform-provider-google.git
synced 2024-10-01 16:21:06 +00:00
Support IP forwarding on GCE instances
This change exposes the CanIpForward property of the Instance, allowing users to create instances that are allowed to function as NAT or VPN gateways.
This commit is contained in:
parent
f30522f443
commit
ac46b83119
@ -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{
|
||||
Type: schema.TypeList,
|
||||
Optional: true,
|
||||
@ -230,6 +237,7 @@ func resourceComputeInstanceCreate(d *schema.ResourceData, meta interface{}) err
|
||||
|
||||
// Create the instance information
|
||||
instance := compute.Instance{
|
||||
CanIpForward: d.Get("can_ip_forward").(bool),
|
||||
Description: d.Get("description").(string),
|
||||
Disks: disks,
|
||||
MachineType: machineType.SelfLink,
|
||||
@ -305,6 +313,8 @@ func resourceComputeInstanceRead(d *schema.ResourceData, meta interface{}) error
|
||||
return fmt.Errorf("Error reading instance: %s", err)
|
||||
}
|
||||
|
||||
d.Set("can_ip_forward", instance.CanIpForward)
|
||||
|
||||
// Set the networks
|
||||
for i, iface := range instance.NetworkInterfaces {
|
||||
prefix := fmt.Sprintf("network.%d", i)
|
||||
|
@ -225,6 +225,7 @@ resource "google_compute_instance" "foobar" {
|
||||
name = "terraform-test"
|
||||
machine_type = "n1-standard-1"
|
||||
zone = "us-central1-a"
|
||||
can_ip_forward = false
|
||||
tags = ["foo", "bar"]
|
||||
|
||||
disk {
|
||||
|
Loading…
Reference in New Issue
Block a user