Skip to content

Commit

Permalink
Respect subnet region when the user specifies one (#39)
Browse files Browse the repository at this point in the history
  • Loading branch information
a-crate authored Feb 7, 2024
1 parent 4fb5349 commit a283f5d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion subnetwork.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,11 @@ func (sn *Subnetwork) populate(ctx context.Context, s *Step) DError {
sn.Name, errs = sn.Resource.populateWithGlobal(ctx, s, sn.Name)

sn.Description = strOr(sn.Description, defaultDescription("Subnetwork", s.w.Name, s.w.username))
sn.link = fmt.Sprintf("projects/%s/regions/%s/subnetworks/%s", sn.Project, getRegionFromZone(s.w.Zone), sn.Name)
r := sn.Region
if r == "" {
r = getRegionFromZone(s.w.Zone)
}
sn.link = fmt.Sprintf("projects/%s/regions/%s/subnetworks/%s", sn.Project, r, sn.Name)
return errs
}

Expand Down

0 comments on commit a283f5d

Please sign in to comment.