diff --git a/google/resource_compute_vpn_gateway.go b/google/resource_compute_vpn_gateway.go index a0406952803..5ad2e3badd3 100644 --- a/google/resource_compute_vpn_gateway.go +++ b/google/resource_compute_vpn_gateway.go @@ -18,6 +18,7 @@ import ( "fmt" "log" "reflect" + "strconv" "time" "github.com/hashicorp/terraform/helper/schema" @@ -67,6 +68,10 @@ func resourceComputeVpnGateway() *schema.Resource { Type: schema.TypeString, Computed: true, }, + "gateway_id": { + Type: schema.TypeInt, + Computed: true, + }, "project": { Type: schema.TypeString, Optional: true, @@ -183,6 +188,9 @@ func resourceComputeVpnGatewayRead(d *schema.ResourceData, meta interface{}) err if err := d.Set("name", flattenComputeVpnGatewayName(res["name"], d)); err != nil { return fmt.Errorf("Error reading VpnGateway: %s", err) } + if err := d.Set("gateway_id", flattenComputeVpnGatewayGateway_id(res["id"], d)); err != nil { + return fmt.Errorf("Error reading VpnGateway: %s", err) + } if err := d.Set("network", flattenComputeVpnGatewayNetwork(res["network"], d)); err != nil { return fmt.Errorf("Error reading VpnGateway: %s", err) } @@ -268,6 +276,16 @@ func flattenComputeVpnGatewayName(v interface{}, d *schema.ResourceData) interfa return v } +func flattenComputeVpnGatewayGateway_id(v interface{}, d *schema.ResourceData) interface{} { + // Handles the string fixed64 format + if strVal, ok := v.(string); ok { + if intVal, err := strconv.ParseInt(strVal, 10, 64); err == nil { + return intVal + } // let terraform core handle it if we can't convert the string to an int. + } + return v +} + func flattenComputeVpnGatewayNetwork(v interface{}, d *schema.ResourceData) interface{} { if v == nil { return v diff --git a/google/resource_compute_vpn_tunnel.go b/google/resource_compute_vpn_tunnel.go index fbc41d40f84..70fa93d6425 100644 --- a/google/resource_compute_vpn_tunnel.go +++ b/google/resource_compute_vpn_tunnel.go @@ -225,6 +225,10 @@ func resourceComputeVpnTunnel() *schema.Resource { Type: schema.TypeString, Computed: true, }, + "tunnel_id": { + Type: schema.TypeString, + Computed: true, + }, "project": { Type: schema.TypeString, Optional: true, @@ -373,6 +377,9 @@ func resourceComputeVpnTunnelRead(d *schema.ResourceData, meta interface{}) erro return fmt.Errorf("Error reading VpnTunnel: %s", err) } + if err := d.Set("tunnel_id", flattenComputeVpnTunnelTunnel_id(res["id"], d)); err != nil { + return fmt.Errorf("Error reading VpnTunnel: %s", err) + } if err := d.Set("creation_timestamp", flattenComputeVpnTunnelCreationTimestamp(res["creationTimestamp"], d)); err != nil { return fmt.Errorf("Error reading VpnTunnel: %s", err) } @@ -476,6 +483,10 @@ func resourceComputeVpnTunnelImport(d *schema.ResourceData, meta interface{}) ([ return []*schema.ResourceData{d}, nil } +func flattenComputeVpnTunnelTunnel_id(v interface{}, d *schema.ResourceData) interface{} { + return v +} + func flattenComputeVpnTunnelCreationTimestamp(v interface{}, d *schema.ResourceData) interface{} { return v } diff --git a/website/docs/r/compute_vpn_gateway.html.markdown b/website/docs/r/compute_vpn_gateway.html.markdown index 9abb2ea318f..4d3dd0588af 100644 --- a/website/docs/r/compute_vpn_gateway.html.markdown +++ b/website/docs/r/compute_vpn_gateway.html.markdown @@ -140,6 +140,9 @@ In addition to the arguments listed above, the following computed attributes are * `creation_timestamp` - Creation timestamp in RFC3339 text format. + +* `gateway_id` - + The unique identifier for the resource. * `self_link` - The URI of the created resource. diff --git a/website/docs/r/compute_vpn_tunnel.html.markdown b/website/docs/r/compute_vpn_tunnel.html.markdown index 0eb6d215c62..9cf7a38c7d5 100644 --- a/website/docs/r/compute_vpn_tunnel.html.markdown +++ b/website/docs/r/compute_vpn_tunnel.html.markdown @@ -263,6 +263,9 @@ The following arguments are supported: In addition to the arguments listed above, the following computed attributes are exported: +* `tunnel_id` - + The unique identifier for the resource. This identifier is defined by the server. + * `creation_timestamp` - Creation timestamp in RFC3339 text format.