Skip to content

Commit

Permalink
extract vpn tunnel region/project from vpn gateway
Browse files Browse the repository at this point in the history
  • Loading branch information
danawillow authored and modular-magician committed Dec 12, 2018
1 parent f6a5d69 commit dc7fab9
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 16 deletions.
15 changes: 0 additions & 15 deletions .gometalinter.json

This file was deleted.

20 changes: 20 additions & 0 deletions google/resource_compute_vpn_tunnel.go
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,11 @@ func resourceComputeVpnTunnelCreate(d *schema.ResourceData, meta interface{}) er
obj["region"] = regionProp
}

obj, err = resourceComputeVpnTunnelEncoder(d, meta, obj)
if err != nil {
return err
}

url, err := replaceVars(d, config, "https://www.googleapis.com/compute/v1/projects/{{project}}/regions/{{region}}/vpnTunnels")
if err != nil {
return err
Expand Down Expand Up @@ -694,3 +699,18 @@ func expandComputeVpnTunnelRegion(v interface{}, d *schema.ResourceData, config
}
return f.RelativeLink(), nil
}

func resourceComputeVpnTunnelEncoder(d *schema.ResourceData, meta interface{}, obj map[string]interface{}) (map[string]interface{}, error) {
config := meta.(*Config)
f, err := parseRegionalFieldValue("targetVpnGateways", d.Get("target_vpn_gateway").(string), "project", "region", "zone", d, config, true)
if err != nil {
return nil, err
}
if _, ok := d.GetOk("project"); !ok {
d.Set("project", f.Project)
}
if _, ok := d.GetOk("region"); !ok {
d.Set("region", f.Region)
}
return obj, nil
}
2 changes: 1 addition & 1 deletion website/docs/r/compute_vpn_tunnel.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ The following arguments are supported:

* `region` -
(Optional)
The region where the tunnel is located.
The region where the tunnel is located. If unset, is set to the region of `target_vpn_gateway`.
* `project` - (Optional) The ID of the project in which the resource belongs.
If it is not provided, the provider project is used.

Expand Down
4 changes: 4 additions & 0 deletions website/docs/r/container_cluster.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,10 @@ exported:
be different than the `min_master_version` set in the config if the master
has been updated by GKE.

* `tpu_ipv4_cidr_block` - The IP address range of the Cloud TPUs in this cluster, in
[CIDR](http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing)
notation (e.g. `1.2.3.4/29`).

<a id="timeouts"></a>
## Timeouts

Expand Down

0 comments on commit dc7fab9

Please sign in to comment.