Skip to content

Commit

Permalink
Merge pull request #5564 from lwander/b-gcp-route-network
Browse files Browse the repository at this point in the history
provider/google: Mark next_hop_network as read only.
  • Loading branch information
lwander committed Mar 10, 2016
2 parents 914fd48 + f8784df commit 0254f95
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 16 deletions.
16 changes: 3 additions & 13 deletions builtin/providers/google/resource_compute_route.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down Expand Up @@ -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)
Expand All @@ -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
Expand All @@ -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,
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down

0 comments on commit 0254f95

Please sign in to comment.