Skip to content

fix: Router custom-learned-route-priority undefined behavior #9083

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

Conversation

modular-magician
Copy link
Collaborator

Bug: b/378841773
Issue: custom-learned-route-priority is an optional field .
However, TF would set custom-learned-route-priority to be 0 even if the user has not explicitly set the value to be 0 when there is an update to the resource.

Repro steps:

Create a Router peer resource without custom-learned-route-priority value set.

resource "google_compute_router_peer" "peer" {
  name                      = "tf-test-my-router-peer-1"
  router                    = google_compute_router.router.name
  region                    = google_compute_router.router.region
  interface                 = "interface-1"
  peer_asn                  = 65513
  advertise_mode            = "CUSTOM"
}

Query gcloud to check the value of custom-learned-route-priority, it will be empty
gcloud compute routers describe {router-name}

Update the router peer resource (ex: advertised_route_priority = 100) without acustom-learned-route-priority. However, TF would add custom-learned-route-priority = 0 in the update api call.

resource "google_compute_router_peer" "peer" {
  name                      = "tf-test-my-router-peer-1"
  router                    = google_compute_router.router.name
  region                    = google_compute_router.router.region
  interface                 = "interface-1"
  peer_asn                  = 65513
  advertised_route_priority = 100
  advertise_mode            = "CUSTOM"
}

Query gcloud to check the value of custom-learned-route-priority, it will be 0 even though it is not set by the user.
gcloud compute routers describe {router-name}

Release Note Template for Downstream PRs (will be copied)

compute: fixed a issue where `custom_learned_route_priority` was accidentally set to 0 during updates in 'google_compute_router_peer'
bug: added support for setting `custom_learned_route_priority` to 0 in 'google_compute_router_peer' by adding the `zero_custom_learned_route_priority` field

Derived from GoogleCloudPlatform/magic-modules#12355

Co-authored-by: Sam Levenick <[email protected]>

[upstream:39570f308328245bbb8de7f6bd2d8898bcbf48fc]

Signed-off-by: Modular Magician <[email protected]>
@modular-magician modular-magician requested a review from a team as a code owner January 17, 2025 17:55
@modular-magician modular-magician merged commit 18a08dc into hashicorp:main Jan 17, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant