From 53743c9cbb869b4fcf5d9f86ae0e7fe7457a0373 Mon Sep 17 00:00:00 2001 From: The Magician Date: Wed, 4 Sep 2024 11:45:09 -0700 Subject: [PATCH] fix: Router advertised-route-priority undefined behavior (#11613) (#19366) [upstream:293c3ca1b6f2de4ce5d731aa8f0c3a65969cc9ac] Signed-off-by: Modular Magician --- .changelog/11613.txt | 3 +++ google/services/compute/resource_compute_router_peer.go | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 .changelog/11613.txt diff --git a/.changelog/11613.txt b/.changelog/11613.txt new file mode 100644 index 00000000000..3908b15e8b9 --- /dev/null +++ b/.changelog/11613.txt @@ -0,0 +1,3 @@ +```release-note:bug +compute: fixed a bug where `advertised_route_priority` was accidentally set to 0 during updates in 'google_compute_router_peer' +``` \ No newline at end of file diff --git a/google/services/compute/resource_compute_router_peer.go b/google/services/compute/resource_compute_router_peer.go index 83570a92fc1..bba2d95f0ca 100644 --- a/google/services/compute/resource_compute_router_peer.go +++ b/google/services/compute/resource_compute_router_peer.go @@ -395,7 +395,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"); ok || !reflect.DeepEqual(v, advertisedRoutePriorityProp) { + } else if v, ok := d.GetOk("advertised_route_priority"); ok || !reflect.DeepEqual(v, advertisedRoutePriorityProp) { obj["advertisedRoutePriority"] = advertisedRoutePriorityProp } advertiseModeProp, err := expandNestedComputeRouterBgpPeerAdvertiseMode(d.Get("advertise_mode"), d, config) @@ -726,7 +726,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"); ok || !reflect.DeepEqual(v, advertisedRoutePriorityProp) { + } else if v, ok := d.GetOk("advertised_route_priority"); ok || !reflect.DeepEqual(v, advertisedRoutePriorityProp) { obj["advertisedRoutePriority"] = advertisedRoutePriorityProp } advertiseModeProp, err := expandNestedComputeRouterBgpPeerAdvertiseMode(d.Get("advertise_mode"), d, config)