Skip to content

Commit

Permalink
Fix next_instance_zone for google_compute_route (hashicorp#341)
Browse files Browse the repository at this point in the history
<!-- This change is generated by MagicModules. -->
/cc @rileykarson
  • Loading branch information
modular-magician authored and rileykarson committed Jan 14, 2019
1 parent b36792c commit c1d22d0
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions google-beta/resource_compute_route.go
Original file line number Diff line number Diff line change
Expand Up @@ -454,11 +454,18 @@ func expandComputeRouteNextHopGateway(v interface{}, d *schema.ResourceData, con
}

func expandComputeRouteNextHopInstance(v interface{}, d *schema.ResourceData, config *Config) (interface{}, error) {
f, err := parseZonalFieldValue("instances", v.(string), "project", "zone", d, config, true)
if v == "" {
return v, nil
}
val, err := parseZonalFieldValue("instances", v.(string), "project", "next_hop_instance_zone", d, config, true)
if err != nil {
return nil, fmt.Errorf("Invalid value for next_hop_instance: %s", err)
return nil, err
}
return f.RelativeLink(), nil
nextInstance, err := config.clientCompute.Instances.Get(val.Project, val.Zone, val.Name).Do()
if err != nil {
return nil, err
}
return nextInstance.SelfLink, nil
}

func expandComputeRouteNextHopIp(v interface{}, d *schema.ResourceData, config *Config) (interface{}, error) {
Expand Down

0 comments on commit c1d22d0

Please sign in to comment.