Fix IAP oauth2_client_id perpetual diff in BackendService and RegionBackendService#16639
Conversation
|
Googlers: For automatic test runs see go/terraform-auto-test-runs. @trodge, a repository maintainer, has been assigned to review your changes. If you have not received review feedback within 2 business days, please leave a comment on this PR asking them to take a look. You can help make sure that review is quick by doing a self-review and by running impacted tests locally. |
df412ee to
09c6912
Compare
|
Hi there, I'm the Modular magician. I've detected the following information about your changes: Diff reportYour PR generated some diffs in downstreams - here they are.
|
Tests analyticsTotal tests: 1380 Click here to see the affected service packages
Action takenFound 2 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
|
Fixes hashicorp/terraform-provider-google#26378
Problem
When using
google_compute_backend_serviceorgoogle_compute_region_backend_servicewith IAP enabled and then disabling IAP by removingoauth2_client_idandoauth2_client_secret, everyterraform planproduces a perpetual diff:This happens because the provider's expand function skips sending empty values for
oauth2ClientId(guarded byIsEmptyValue), so the API retains the old value and the diff reappears on every plan.Root Cause
There is an asymmetry between
oauth2ClientIdandoauth2ClientSecretin the resource YAML definitions.oauth2ClientSecrethassend_empty_value: true(added during the handwritten-to-generated migration in #7463), butoauth2ClientIddoes not. This became a problem when #9581 removedrequired: truefrom both fields.Fix
Added
send_empty_value: truetooauth2ClientIdin bothBackendService.yamlandRegionBackendService.yaml, matching the existingoauth2ClientSecretbehavior. A unit test is also included to guard against future regressions.Release Note Template for Downstream PRs (will be copied)
See Write release notes for guidance.