From f8784df82b30515b1ff7dd380709564758c91077 Mon Sep 17 00:00:00 2001 From: Lars Wander Date: Thu, 10 Mar 2016 13:57:26 -0500 Subject: [PATCH] provider/google: Mark next_hop_network as read only. --- .../providers/google/resource_compute_route.go | 16 +++------------- .../google/r/compute_route.html.markdown | 3 --- 2 files changed, 3 insertions(+), 16 deletions(-) diff --git a/builtin/providers/google/resource_compute_route.go b/builtin/providers/google/resource_compute_route.go index 2688bd7b8..603373142 100644 --- a/builtin/providers/google/resource_compute_route.go +++ b/builtin/providers/google/resource_compute_route.go @@ -60,8 +60,7 @@ func resourceComputeRoute() *schema.Resource { "next_hop_network": &schema.Schema{ Type: schema.TypeString, - Optional: true, - ForceNew: true, + Computed: true, }, "next_hop_vpn_tunnel": &schema.Schema{ @@ -103,7 +102,7 @@ func resourceComputeRouteCreate(d *schema.ResourceData, meta interface{}) error } // Next hop data - var nextHopInstance, nextHopIp, nextHopNetwork, nextHopGateway, + var nextHopInstance, nextHopIp, nextHopGateway, nextHopVpnTunnel string if v, ok := d.GetOk("next_hop_ip"); ok { nextHopIp = v.(string) @@ -125,15 +124,6 @@ func resourceComputeRouteCreate(d *schema.ResourceData, meta interface{}) error nextHopInstance = nextInstance.SelfLink } - if v, ok := d.GetOk("next_hop_network"); ok { - nextNetwork, err := config.clientCompute.Networks.Get( - config.Project, v.(string)).Do() - if err != nil { - return fmt.Errorf("Error reading network: %s", err) - } - - nextHopNetwork = nextNetwork.SelfLink - } // Tags var tags []string @@ -152,7 +142,6 @@ func resourceComputeRouteCreate(d *schema.ResourceData, meta interface{}) error NextHopInstance: nextHopInstance, NextHopVpnTunnel: nextHopVpnTunnel, NextHopIp: nextHopIp, - NextHopNetwork: nextHopNetwork, NextHopGateway: nextHopGateway, Priority: int64(d.Get("priority").(int)), Tags: tags, @@ -192,6 +181,7 @@ func resourceComputeRouteRead(d *schema.ResourceData, meta interface{}) error { return fmt.Errorf("Error reading route: %#v", err) } + d.Set("next_hop_network", route.NextHopNetwork) d.Set("self_link", route.SelfLink) return nil diff --git a/website/source/docs/providers/google/r/compute_route.html.markdown b/website/source/docs/providers/google/r/compute_route.html.markdown index aee70a90f..5a0dacfe1 100644 --- a/website/source/docs/providers/google/r/compute_route.html.markdown +++ b/website/source/docs/providers/google/r/compute_route.html.markdown @@ -51,9 +51,6 @@ The following arguments are supported: * `next_hop_gateway` - (Optional) The name of the internet gateway to route to if this route is matched. -* `next_hop_network` - (Optional) The name of the network to route to if this - route is matched. - * `next_hop_vpn_gateway` - (Optional) The name of the VPN to route to if this route is matched.