boolean fields in `observability_Config` were being incorrectly omitted from the API request when set to `false`
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
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.
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.
@slevenick Can you PTAL
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(-))
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
🟢 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.
@slevenick updated the code and test .
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(-))
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
🟢 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.
Test failure for above is unrelated to the changes
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.
@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.
@slevenick is anything else required in this ?
@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.
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_typesbecame Computed only ongoogle_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.
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
🟢 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!
@slevenick , Since it says wait for the major changes release. Is there any other changes required in the PR or from my side . ?
@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
Got it fixed as recommmended. In future with the major version will fix the TrackWaitEventTypes as output only
/assign @slevenick
fixed the merge conflicts
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
}
}
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
🟢 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!
@slevenick , Can you PTAL.
@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.