provider/google: remote_traffic_selector for google_compute_vpn_tunnel

This commit is contained in:
Roberto Jung Drebes 2017-01-04 10:35:44 +01:00 committed by Roberto Jung Drebes
parent 017d7ebf4f
commit b41efe7dc7
2 changed files with 28 additions and 6 deletions

View File

@ -72,6 +72,14 @@ func resourceComputeVpnTunnel() *schema.Resource {
Set: schema.HashString,
},
"remote_traffic_selector": &schema.Schema{
Type: schema.TypeSet,
Optional: true,
ForceNew: true,
Elem: &schema.Schema{Type: schema.TypeString},
Set: schema.HashString,
},
"project": &schema.Schema{
Type: schema.TypeString,
Optional: true,
@ -124,15 +132,24 @@ func resourceComputeVpnTunnelCreate(d *schema.ResourceData, meta interface{}) er
}
}
var remoteTrafficSelectors []string
if v := d.Get("remote_traffic_selector").(*schema.Set); v.Len() > 0 {
remoteTrafficSelectors = make([]string, v.Len())
for i, v := range v.List() {
remoteTrafficSelectors[i] = v.(string)
}
}
vpnTunnelsService := compute.NewVpnTunnelsService(config.clientCompute)
vpnTunnel := &compute.VpnTunnel{
Name: name,
PeerIp: peerIp,
SharedSecret: sharedSecret,
TargetVpnGateway: targetVpnGateway,
IkeVersion: int64(ikeVersion),
LocalTrafficSelector: localTrafficSelectors,
Name: name,
PeerIp: peerIp,
SharedSecret: sharedSecret,
TargetVpnGateway: targetVpnGateway,
IkeVersion: int64(ikeVersion),
LocalTrafficSelector: localTrafficSelectors,
RemoteTrafficSelector: remoteTrafficSelectors,
}
if v, ok := d.GetOk("description"); ok {

View File

@ -104,6 +104,11 @@ The following arguments are supported:
custom subnetted network. Refer to Google documentation for more
information.
* `remote_traffic_selector` - (Optional) Specifies which CIDR ranges the VPN
tunnel can route to the remote side. Mandatory if the VPN gateway is attached to a
custom subnetted network. Refer to Google documentation for more
information.
* `project` - (Optional) The project in which the resource belongs. If it
is not provided, the provider project is used.