Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

provider/google: Mark next_hop_network as read only. #5564

Merged
merged 1 commit into from
Mar 10, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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