Skip to content

Commit

Permalink
Router peer needs to be able to set advertised route priority to 0. (#…
Browse files Browse the repository at this point in the history
…5297) (#10292)

Signed-off-by: Modular Magician <[email protected]>
  • Loading branch information
modular-magician authored Oct 11, 2021
1 parent b3cbcaf commit 5059fcd
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .changelog/5297.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
compute: fixed bug where `google_compute_router_peer` could not set an advertised route priority of 0, causing permadiff.
```
2 changes: 1 addition & 1 deletion google/resource_compute_router_bgp_peer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ resource "google_compute_router_peer" "foobar" {
region = google_compute_router.foobar.region
peer_ip_address = "169.254.3.3"
peer_asn = 65516
advertised_route_priority = 100
advertised_route_priority = 0
advertise_mode = "CUSTOM"
advertised_groups = ["ALL_SUBNETS"]
advertised_ip_ranges {
Expand Down
4 changes: 2 additions & 2 deletions google/resource_compute_router_peer.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ func resourceComputeRouterBgpPeerCreate(d *schema.ResourceData, meta interface{}
advertisedRoutePriorityProp, err := expandNestedComputeRouterBgpPeerAdvertisedRoutePriority(d.Get("advertised_route_priority"), d, config)
if err != nil {
return err
} else if v, ok := d.GetOkExists("advertised_route_priority"); !isEmptyValue(reflect.ValueOf(advertisedRoutePriorityProp)) && (ok || !reflect.DeepEqual(v, advertisedRoutePriorityProp)) {
} else if v, ok := d.GetOkExists("advertised_route_priority"); ok || !reflect.DeepEqual(v, advertisedRoutePriorityProp) {
obj["advertisedRoutePriority"] = advertisedRoutePriorityProp
}
advertiseModeProp, err := expandNestedComputeRouterBgpPeerAdvertiseMode(d.Get("advertise_mode"), d, config)
Expand Down Expand Up @@ -437,7 +437,7 @@ func resourceComputeRouterBgpPeerUpdate(d *schema.ResourceData, meta interface{}
advertisedRoutePriorityProp, err := expandNestedComputeRouterBgpPeerAdvertisedRoutePriority(d.Get("advertised_route_priority"), d, config)
if err != nil {
return err
} else if v, ok := d.GetOkExists("advertised_route_priority"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, advertisedRoutePriorityProp)) {
} else if v, ok := d.GetOkExists("advertised_route_priority"); ok || !reflect.DeepEqual(v, advertisedRoutePriorityProp) {
obj["advertisedRoutePriority"] = advertisedRoutePriorityProp
}
advertiseModeProp, err := expandNestedComputeRouterBgpPeerAdvertiseMode(d.Get("advertise_mode"), d, config)
Expand Down

0 comments on commit 5059fcd

Please sign in to comment.