magic-modules icon indicating copy to clipboard operation
magic-modules copied to clipboard

boolean fields in `observability_Config` were being incorrectly omitted from the API request when set to `false`

Open vkanishk15 opened this issue 1 month ago • 23 comments

This change fixes an issue where boolean fields in google_alloydb_instance and google_alloydb_cluster were being incorrectly omitted from the API request when set to false.

The generated Terraform provider code uses IsEmptyValue to determine if a field should be sent. For boolean fields, false is the zero value, causing IsEmptyValue to return true. Without send_empty_value: true in the MMv1 definition, these fields are stripped from the JSON payload. This prevented users from explicitly disabling features (e.g., setting track_active_queries = false resulted in the API applying the server-side default).

This CL adds `send_empty_value: true` to the following configuration blocks/fields:

**Instance:**
* `observability_config` (enabled, track_active_queries, assistive_experiences_enabled, etc.)
* Marked Track_wait_event_types as its output only field

TESTING:
Manually verified using a local build of the provider.

Release Note Template for Downstream PRs (will be copied)

See Write release notes for guidance.

alloydb: Fixed an issue where boolean fields were ignored when set to `false` for alloydb_cluster and alloydb_instance

vkanishk15 avatar Nov 18 '25 09:11 vkanishk15

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

google-cla[bot] avatar Nov 18 '25 09:11 google-cla[bot]

Hello! I am a robot. Tests will require approval from a repository maintainer to run.

Googlers: For automatic test runs see go/terraform-auto-test-runs.

@slevenick, 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.

github-actions[bot] avatar Nov 18 '25 10:11 github-actions[bot]

@slevenick Can you PTAL

vkanishk15 avatar Nov 18 '25 10:11 vkanishk15

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

google provider: Diff ( 3 files changed, 269 insertions(+), 16 deletions(-)) google-beta provider: Diff ( 3 files changed, 276 insertions(+), 23 deletions(-)) terraform-google-conversion: Diff ( 5 files changed, 26 insertions(+), 18 deletions(-))

modular-magician avatar Nov 20 '25 17:11 modular-magician

Tests analytics

Total tests: 88 Passed tests: 53 Skipped tests: 3 Affected tests: 32

Click here to see the affected service packages
  • alloydb

Action taken

Found 32 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
  • TestAccAlloydbCluster_continuousBackup_CMEKIsUpdatable
  • TestAccAlloydbCluster_continuousBackup_enabledByDefault
  • TestAccAlloydbCluster_continuousBackup_noChangeIfRemoved
  • TestAccAlloydbCluster_continuousBackup_update
  • TestAccAlloydbCluster_continuousBackup_update_noChangeIfDefaultsSet
  • TestAccAlloydbCluster_restore
  • TestAccAlloydbCluster_secondaryClusterPromoteAndAddAndDeleteAutomatedBackupPolicyAndInitialUser
  • TestAccAlloydbCluster_secondaryClusterPromoteAndAddContinuousBackupConfig
  • TestAccAlloydbCluster_secondaryClusterPromoteAndDeleteOriginalPrimary
  • TestAccAlloydbCluster_secondaryClusterPromoteAndDeleteTimeBasedRetentionPolicy
  • TestAccAlloydbCluster_secondaryClusterPromoteAndSimultaneousUpdate
  • TestAccAlloydbCluster_secondaryClusterPromoteAndUpdate
  • TestAccAlloydbCluster_secondaryClusterPromoteWithNetworkConfigAndAllocatedIPRange
  • TestAccAlloydbCluster_secondaryClusterUpdate
  • TestAccAlloydbCluster_standardClusterUpdate
  • TestAccAlloydbCluster_standardClusterUpdateFailure
  • TestAccAlloydbCluster_trialClusterUpdate
  • TestAccAlloydbCluster_update
  • TestAccAlloydbCluster_withoutInitialUserUpdate
  • TestAccAlloydbInstance_Update_ObservabilityConfig
  • TestAccAlloydbInstance_Update_QueryInsightsConfig
  • TestAccAlloydbInstance_clientConnectionConfig
  • TestAccAlloydbInstance_createPrimaryAndReadPoolInstanceWithAllocatedIpRangeOverride
  • TestAccAlloydbInstance_networkConfig
  • TestAccAlloydbInstance_secondaryInstanceUpdateDatabaseFlag
  • TestAccAlloydbInstance_secondaryInstanceUpdateMachineConfig
  • TestAccAlloydbInstance_secondaryInstanceUpdateQueryInsightConfig
  • TestAccAlloydbInstance_stopstart
  • TestAccAlloydbInstance_update
  • TestAccAlloydbInstance_updateInstanceWithPscInterfaceConfigs
  • TestAccAlloydbInstance_updatePscAutoConnections
  • TestAccAlloydbInstance_updatePscInstanceConfig

Get to know how VCR tests work

modular-magician avatar Nov 20 '25 17:11 modular-magician

🟢 Tests passed during RECORDING mode: TestAccAlloydbCluster_continuousBackup_CMEKIsUpdatable [Debug log] TestAccAlloydbCluster_continuousBackup_enabledByDefault [Debug log] TestAccAlloydbCluster_continuousBackup_noChangeIfRemoved [Debug log] TestAccAlloydbCluster_continuousBackup_update [Debug log] TestAccAlloydbCluster_continuousBackup_update_noChangeIfDefaultsSet [Debug log] TestAccAlloydbCluster_restore [Debug log] TestAccAlloydbCluster_secondaryClusterPromoteAndAddAndDeleteAutomatedBackupPolicyAndInitialUser [Debug log] TestAccAlloydbCluster_secondaryClusterPromoteAndAddContinuousBackupConfig [Debug log] TestAccAlloydbCluster_secondaryClusterPromoteAndDeleteOriginalPrimary [Debug log] TestAccAlloydbCluster_secondaryClusterPromoteAndDeleteTimeBasedRetentionPolicy [Debug log] TestAccAlloydbCluster_secondaryClusterPromoteAndSimultaneousUpdate [Debug log] TestAccAlloydbCluster_secondaryClusterPromoteAndUpdate [Debug log] TestAccAlloydbCluster_secondaryClusterPromoteWithNetworkConfigAndAllocatedIPRange [Debug log] TestAccAlloydbCluster_secondaryClusterUpdate [Debug log] TestAccAlloydbCluster_standardClusterUpdate [Debug log] TestAccAlloydbCluster_standardClusterUpdateFailure [Debug log] TestAccAlloydbCluster_trialClusterUpdate [Debug log] TestAccAlloydbCluster_update [Debug log] TestAccAlloydbCluster_withoutInitialUserUpdate [Debug log] TestAccAlloydbInstance_Update_QueryInsightsConfig [Debug log] TestAccAlloydbInstance_clientConnectionConfig [Debug log] TestAccAlloydbInstance_createPrimaryAndReadPoolInstanceWithAllocatedIpRangeOverride [Debug log] TestAccAlloydbInstance_networkConfig [Debug log] TestAccAlloydbInstance_secondaryInstanceUpdateDatabaseFlag [Debug log] TestAccAlloydbInstance_secondaryInstanceUpdateMachineConfig [Debug log] TestAccAlloydbInstance_secondaryInstanceUpdateQueryInsightConfig [Debug log] TestAccAlloydbInstance_stopstart [Debug log] TestAccAlloydbInstance_update [Debug log]

🟢 No issues found for passed tests after REPLAYING rerun.


🔴 Tests failed during RECORDING mode: TestAccAlloydbInstance_Update_ObservabilityConfig [Error message] [Debug log] TestAccAlloydbInstance_updateInstanceWithPscInterfaceConfigs [Error message] [Debug log] TestAccAlloydbInstance_updatePscAutoConnections [Error message] [Debug log] TestAccAlloydbInstance_updatePscInstanceConfig [Error message] [Debug log]

🔴 Errors occurred during RECORDING mode. Please fix them to complete your PR.

View the build log or the debug log for each test

modular-magician avatar Nov 20 '25 18:11 modular-magician

@slevenick updated the code and test .

vkanishk15 avatar Nov 25 '25 00:11 vkanishk15

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

google provider: Diff ( 1 file changed, 125 insertions(+), 4 deletions(-)) google-beta provider: Diff ( 2 files changed, 142 insertions(+), 12 deletions(-)) terraform-google-conversion: Diff ( 2 files changed, 12 insertions(+), 8 deletions(-))

modular-magician avatar Nov 25 '25 02:11 modular-magician

Tests analytics

Total tests: 89 Passed tests: 56 Skipped tests: 3 Affected tests: 30

Click here to see the affected service packages
  • alloydb

Action taken

Found 30 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
  • TestAccAlloydbCluster_continuousBackup_CMEKIsUpdatable
  • TestAccAlloydbCluster_continuousBackup_enabledByDefault
  • TestAccAlloydbCluster_continuousBackup_noChangeIfRemoved
  • TestAccAlloydbCluster_continuousBackup_update
  • TestAccAlloydbCluster_continuousBackup_update_noChangeIfDefaultsSet
  • TestAccAlloydbCluster_restore
  • TestAccAlloydbCluster_secondaryClusterPromoteAndAddAndDeleteAutomatedBackupPolicyAndInitialUser
  • TestAccAlloydbCluster_secondaryClusterPromoteAndAddContinuousBackupConfig
  • TestAccAlloydbCluster_secondaryClusterPromoteAndDeleteOriginalPrimary
  • TestAccAlloydbCluster_secondaryClusterPromoteAndDeleteTimeBasedRetentionPolicy
  • TestAccAlloydbCluster_secondaryClusterPromoteAndSimultaneousUpdate
  • TestAccAlloydbCluster_secondaryClusterPromoteAndUpdate
  • TestAccAlloydbCluster_secondaryClusterPromoteWithNetworkConfigAndAllocatedIPRange
  • TestAccAlloydbCluster_secondaryClusterUpdate
  • TestAccAlloydbCluster_standardClusterUpdate
  • TestAccAlloydbCluster_standardClusterUpdateFailure
  • TestAccAlloydbCluster_trialClusterUpdate
  • TestAccAlloydbCluster_update
  • TestAccAlloydbCluster_withoutInitialUserUpdate
  • TestAccAlloydbInstance_ObservabilityConfig_Update
  • TestAccAlloydbInstance_clientConnectionConfig
  • TestAccAlloydbInstance_createPrimaryAndReadPoolInstanceWithAllocatedIpRangeOverride
  • TestAccAlloydbInstance_networkConfig
  • TestAccAlloydbInstance_secondaryInstanceUpdateDatabaseFlag
  • TestAccAlloydbInstance_secondaryInstanceUpdateMachineConfig
  • TestAccAlloydbInstance_secondaryInstanceUpdateQueryInsightConfig
  • TestAccAlloydbInstance_stopstart
  • TestAccAlloydbInstance_update
  • TestAccAlloydbInstance_updateInstanceWithPscInterfaceConfigs
  • TestAccAlloydbInstance_updatePscInstanceConfig

Get to know how VCR tests work

modular-magician avatar Nov 25 '25 02:11 modular-magician

🟢 Tests passed during RECORDING mode: TestAccAlloydbCluster_continuousBackup_CMEKIsUpdatable [Debug log] TestAccAlloydbCluster_continuousBackup_enabledByDefault [Debug log] TestAccAlloydbCluster_continuousBackup_noChangeIfRemoved [Debug log] TestAccAlloydbCluster_continuousBackup_update [Debug log] TestAccAlloydbCluster_continuousBackup_update_noChangeIfDefaultsSet [Debug log] TestAccAlloydbCluster_restore [Debug log] TestAccAlloydbCluster_secondaryClusterPromoteAndAddContinuousBackupConfig [Debug log] TestAccAlloydbCluster_secondaryClusterPromoteAndDeleteOriginalPrimary [Debug log] TestAccAlloydbCluster_secondaryClusterPromoteAndDeleteTimeBasedRetentionPolicy [Debug log] TestAccAlloydbCluster_secondaryClusterPromoteAndSimultaneousUpdate [Debug log] TestAccAlloydbCluster_secondaryClusterPromoteAndUpdate [Debug log] TestAccAlloydbCluster_secondaryClusterPromoteWithNetworkConfigAndAllocatedIPRange [Debug log] TestAccAlloydbCluster_secondaryClusterUpdate [Debug log] TestAccAlloydbCluster_standardClusterUpdate [Debug log] TestAccAlloydbCluster_standardClusterUpdateFailure [Debug log] TestAccAlloydbCluster_trialClusterUpdate [Debug log] TestAccAlloydbCluster_update [Debug log] TestAccAlloydbCluster_withoutInitialUserUpdate [Debug log] TestAccAlloydbInstance_ObservabilityConfig_Update [Debug log] TestAccAlloydbInstance_clientConnectionConfig [Debug log] TestAccAlloydbInstance_createPrimaryAndReadPoolInstanceWithAllocatedIpRangeOverride [Debug log] TestAccAlloydbInstance_networkConfig [Debug log] TestAccAlloydbInstance_secondaryInstanceUpdateDatabaseFlag [Debug log] TestAccAlloydbInstance_secondaryInstanceUpdateMachineConfig [Debug log] TestAccAlloydbInstance_secondaryInstanceUpdateQueryInsightConfig [Debug log] TestAccAlloydbInstance_stopstart [Debug log] TestAccAlloydbInstance_update [Debug log] TestAccAlloydbInstance_updateInstanceWithPscInterfaceConfigs [Debug log] TestAccAlloydbInstance_updatePscInstanceConfig [Debug log]

🟢 No issues found for passed tests after REPLAYING rerun.


🔴 Tests failed during RECORDING mode: TestAccAlloydbCluster_secondaryClusterPromoteAndAddAndDeleteAutomatedBackupPolicyAndInitialUser [Error message] [Debug log]

🔴 Errors occurred during RECORDING mode. Please fix them to complete your PR.

View the build log or the debug log for each test

modular-magician avatar Nov 25 '25 03:11 modular-magician

Test failure for above is unrelated to the changes

vkanishk15 avatar Nov 25 '25 03:11 vkanishk15

Hi, I’ve added the test cases for both scenarios:

Enabled = true and updating the other boolean fields.

Enabled = false, while verifying how the other sub-fields behave.

When enabled = false, the behavior is driven by default_from_api. Even though we send empty values (because of send_empty_value = true), the API returns the default values for these fields, and Terraform stores those in state. I’ve added assertions for this behavior.

Practically, this means that to disable the feature, the user only needs to set enabled = false. The other fields will be overwritten by API defaults anyway, and since observability is disabled, their values don’t have functional impact.

The only time this becomes visible is if a user specifies a non-default sub-field (e.g., maxQueryStringLength = X) together with enabled = false. Because the API still returns default values when disabled, Terraform will see a diff on the next apply. But this is expected because the API itself does not honor custom values when the feature is turned off.

For the “enabled = true” flow, everything works normally — all sub-fields can be set and are preserved as expected.

vkanishk15 avatar Nov 26 '25 09:11 vkanishk15

@slevenick This PR has been waiting for review for 3 weekdays. Please take a look! Use the label disable-review-reminders to disable these notifications.

github-actions[bot] avatar Nov 28 '25 09:11 github-actions[bot]

@slevenick is anything else required in this ?

vkanishk15 avatar Dec 01 '25 03:12 vkanishk15

@GoogleCloudPlatform/terraform-team @slevenick This PR has been waiting for review for 1 week. Please take a look! Use the label disable-review-reminders to disable these notifications.

github-actions[bot] avatar Dec 02 '25 09:12 github-actions[bot]

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

google provider: Diff ( 2 files changed, 144 insertions(+), 5 deletions(-)) google-beta provider: Diff ( 3 files changed, 164 insertions(+), 24 deletions(-)) terraform-google-conversion: Diff ( 2 files changed, 11 insertions(+), 14 deletions(-))

Breaking Change(s) Detected

The following breaking change(s) were detected within your pull request.

  • Field observability_config.track_wait_event_types became Computed only on google_alloydb_instance - reference

If you believe this detection to be incorrect please raise the concern with your reviewer. If you intend to make this change you will need to wait for a major release window. An override-breaking-change label can be added to allow merging.

modular-magician avatar Dec 02 '25 17:12 modular-magician

Tests analytics

Total tests: 89 Passed tests: 75 Skipped tests: 3 Affected tests: 11

Click here to see the affected service packages
  • alloydb

Action taken

Found 11 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
  • TestAccAlloydbCluster_secondaryClusterPromoteAndAddAndDeleteAutomatedBackupPolicyAndInitialUser
  • TestAccAlloydbInstance_ObservabilityConfig_Update
  • TestAccAlloydbInstance_clientConnectionConfig
  • TestAccAlloydbInstance_networkConfig
  • TestAccAlloydbInstance_secondaryInstanceUpdateDatabaseFlag
  • TestAccAlloydbInstance_secondaryInstanceUpdateMachineConfig
  • TestAccAlloydbInstance_secondaryInstanceUpdateQueryInsightConfig
  • TestAccAlloydbInstance_stopstart
  • TestAccAlloydbInstance_update
  • TestAccAlloydbInstance_updateInstanceWithPscInterfaceConfigs
  • TestAccAlloydbInstance_updatePscInstanceConfig

Get to know how VCR tests work

modular-magician avatar Dec 02 '25 17:12 modular-magician

🟢 Tests passed during RECORDING mode: TestAccAlloydbCluster_secondaryClusterPromoteAndAddAndDeleteAutomatedBackupPolicyAndInitialUser [Debug log] TestAccAlloydbInstance_ObservabilityConfig_Update [Debug log] TestAccAlloydbInstance_clientConnectionConfig [Debug log] TestAccAlloydbInstance_networkConfig [Debug log] TestAccAlloydbInstance_secondaryInstanceUpdateDatabaseFlag [Debug log] TestAccAlloydbInstance_secondaryInstanceUpdateMachineConfig [Debug log] TestAccAlloydbInstance_secondaryInstanceUpdateQueryInsightConfig [Debug log] TestAccAlloydbInstance_stopstart [Debug log] TestAccAlloydbInstance_update [Debug log] TestAccAlloydbInstance_updateInstanceWithPscInterfaceConfigs [Debug log] TestAccAlloydbInstance_updatePscInstanceConfig [Debug log]

🟢 No issues found for passed tests after REPLAYING rerun.


🟢 All tests passed!

View the build log or the debug log for each test

modular-magician avatar Dec 02 '25 18:12 modular-magician

@slevenick , Since it says wait for the major changes release. Is there any other changes required in the PR or from my side . ?

vkanishk15 avatar Dec 08 '25 17:12 vkanishk15

@slevenick , Since it says wait for the major changes release. Is there any other changes required in the PR or from my side . ?

So, here's what we should do. Changing to output_only: true is a breaking change per https://googlecloudplatform.github.io/magic-modules/breaking-changes/breaking-changes/#field-level-breaking-changes

Lets remove the change to make that output_only in this PR, then we can proceed with this.

You can make the change separately to add output_only in another PR and we can wait until 8.0 to merge that

slevenick avatar Dec 08 '25 21:12 slevenick

Got it fixed as recommmended. In future with the major version will fix the TrackWaitEventTypes as output only

vkanishk15 avatar Dec 09 '25 07:12 vkanishk15

/assign @slevenick

vkanishk15 avatar Dec 10 '25 17:12 vkanishk15

fixed the merge conflicts

vkanishk15 avatar Dec 11 '25 02:12 vkanishk15

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

google provider: Diff ( 1 file changed, 143 insertions(+), 4 deletions(-)) google-beta provider: Diff ( 2 files changed, 159 insertions(+), 18 deletions(-)) terraform-google-conversion: Diff ( 2 files changed, 10 insertions(+), 14 deletions(-))

Missing test report

Your PR includes resource fields which are not covered by any test.

Resource: google_alloydb_instance (110 total tests) Please add an acceptance test which includes these fields. The test should include the following:

resource "google_alloydb_instance" "primary" {
  observability_config {
    track_wait_event_types = # value needed
  }
}


modular-magician avatar Dec 12 '25 22:12 modular-magician

Tests analytics

Total tests: 88 Passed tests: 78 Skipped tests: 3 Affected tests: 7

Click here to see the affected service packages
  • alloydb

Action taken

Found 7 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
  • TestAccAlloydbCluster_continuousBackup_enabledByDefault
  • TestAccAlloydbCluster_continuousBackup_noChangeIfRemoved
  • TestAccAlloydbCluster_continuousBackup_update
  • TestAccAlloydbCluster_continuousBackup_update_noChangeIfDefaultsSet
  • TestAccAlloydbCluster_standardClusterUpdate
  • TestAccAlloydbCluster_update
  • TestAccAlloydbInstance_connectionPoolConfig

Get to know how VCR tests work

modular-magician avatar Dec 12 '25 23:12 modular-magician

🟢 Tests passed during RECORDING mode: TestAccAlloydbCluster_continuousBackup_enabledByDefault [Debug log] TestAccAlloydbCluster_continuousBackup_noChangeIfRemoved [Debug log] TestAccAlloydbCluster_continuousBackup_update [Debug log] TestAccAlloydbCluster_continuousBackup_update_noChangeIfDefaultsSet [Debug log] TestAccAlloydbCluster_standardClusterUpdate [Debug log] TestAccAlloydbCluster_update [Debug log] TestAccAlloydbInstance_connectionPoolConfig [Debug log]

🟢 No issues found for passed tests after REPLAYING rerun.


🟢 All tests passed!

View the build log or the debug log for each test

modular-magician avatar Dec 12 '25 23:12 modular-magician

@slevenick , Can you PTAL.

vkanishk15 avatar Dec 15 '25 05:12 vkanishk15

@slevenick This PR has been waiting for review for 3 weekdays. Please take a look! Use the label disable-review-reminders to disable these notifications.

github-actions[bot] avatar Dec 15 '25 09:12 github-actions[bot]