Skip to content
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

Deleted immutable attributes for initialUser and weeklySchedule so th… #7552

Merged
merged 5 commits into from
Apr 3, 2023

Conversation

GauravJain21
Copy link
Contributor

@GauravJain21 GauravJain21 commented Mar 29, 2023

…at deleting/adding these properties doesn't force new cluster creation

Creating a cluster with the minimum fields works fine the first time. On re-running the same .tf file, it deletes the existing cluster and creates a new one.

We get the default values for automated backup policy from the API. This includes many fields. One of them is the weekly schedule. This field is marked as forceNew. The first time when we create the cluster without providing any automated backup policy, we get the default from the API. This default value gets persisted in the .tfstate file. On subsequent runs of terraform, Terraform sees that the automated backup policy is present in the state file but not in the .tf file. Since this field is marked as forceNew, the old cluster is deleted and a new one is created. This is highly undesirable.

Similarly, initialUser is marked as immutable while it is a mutable field. Addition/Deletion to this field causes existing cluster deletion and creation of a new one which is highly undesirable.

If this PR is for Terraform, I acknowledge that I have:

  • Searched through the issue tracker for an open issue that this either resolves or contributes to, commented on it to claim it, and written "fixes {url}" or "part of {url}" in this PR description. If there were no relevant open issues, I opened one and commented that I would like to work on it (not necessary for very small changes).
  • Ensured that all new fields I added that can be set by a user appear in at least one example (for generated resources) or third_party test (for handwritten resources or update tests).
  • Generated Terraform providers, and ran make test and make lint in the generated providers to ensure it passes unit and linter tests.
  • Ran relevant acceptance tests using my own Google Cloud project and credentials (If the acceptance tests do not yet pass or you are unable to run them, please let your reviewer know).
  • Read the Release Notes Guide before writing my release note below.

Release Note Template for Downstream PRs (will be copied)

     AlloyDB: Deleted immutable flag for initalUser and weeklySchedule 

…at deleting/adding these properties doesn't force new cluster creation
@GauravJain21 GauravJain21 requested a review from a team as a code owner March 29, 2023 14:05
@GauravJain21 GauravJain21 requested review from melinath and removed request for a team March 29, 2023 14:05
@melinath melinath self-assigned this Mar 29, 2023
@melinath
Copy link
Member

/gcbrun

@modular-magician
Copy link
Collaborator

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.

Terraform GA: Diff ( 1 file changed, 10 insertions(+), 2 deletions(-))
Terraform Beta: Diff ( 1 file changed, 10 insertions(+), 2 deletions(-))
TF Validator: Diff ( 2 files changed, 3 insertions(+), 3 deletions(-))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 2576
Passed tests 2300
Skipped tests: 267
Affected tests: 9

Action taken

Found 9 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
TestAccFirebaserulesRelease_BasicRelease|TestAccApigeeKeystoresAliasesKeyCertFile_apigeeKeystoresAliasesKeyCertFileTestExample|TestAccFrameworkProviderBasePath_setBasePath|TestAccFrameworkProviderMeta_setModuleName|TestAccDataSourceGoogleFirebaseAppleAppConfig|TestAccDataSourceDNSKeys_basic|TestAccDataSourceDnsRecordSet_basic|TestAccDataSourceDnsManagedZone_basic|TestAccDataSourceDNSKeys_noDnsSec

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

Tests passed during RECORDING mode:
TestAccFirebaserulesRelease_BasicRelease[Debug log]
TestAccApigeeKeystoresAliasesKeyCertFile_apigeeKeystoresAliasesKeyCertFileTestExample[Debug log]
TestAccFrameworkProviderBasePath_setBasePath[Debug log]
TestAccFrameworkProviderMeta_setModuleName[Debug log]
TestAccDataSourceGoogleFirebaseAppleAppConfig[Debug log]
TestAccDataSourceDNSKeys_basic[Debug log]
TestAccDataSourceDnsRecordSet_basic[Debug log]
TestAccDataSourceDnsManagedZone_basic[Debug log]
TestAccDataSourceDNSKeys_noDnsSec[Debug log]

All tests passed
View the build log or the debug log for each test

Copy link
Member

@melinath melinath left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks fairly straightforward and it looks like the downstream code for in-place updates is getting generated. However, it would be good to add additional update tests to make sure that all the fields we think are updatable can actually be updated. There is already an update test for alloydb, which can be extended to exercise a larger number of fields, for example to ensure that this issue is actually resolved and prevent it from recurring. See

/* Validate that read replica is enabled on the instance without recreate
for a more mature example of an update test.

@GauravJain21
Copy link
Contributor Author

Hey Stephen,
As the bug is pretty bad (causes DB to be torn down for minor config changes), we're requesting exception to go ahead with the fix. Kindly request your help to make this exception.

Once the current code is stabilised and doesn't have any glaring bugs (max 1-2 weeks), we will switch focus to writing sufficient automated tests to ensure these issues are caught early in development.

@melinath
Copy link
Member

melinath commented Apr 3, 2023

responded elsewhere.

@modular-magician modular-magician added awaiting-approval Pull requests that needs reviewer's approval to run presubmit tests and removed awaiting-approval Pull requests that needs reviewer's approval to run presubmit tests labels Apr 3, 2023
@modular-magician
Copy link
Collaborator

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.

Terraform GA: Diff ( 2 files changed, 160 insertions(+), 2 deletions(-))
Terraform Beta: Diff ( 2 files changed, 160 insertions(+), 2 deletions(-))
TF Validator: Diff ( 2 files changed, 3 insertions(+), 3 deletions(-))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 2588
Passed tests 2304
Skipped tests: 268
Affected tests: 16

Action taken

Found 16 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
TestAccFrameworkProviderMeta_setModuleName|TestAccFrameworkProviderBasePath_setBasePath|TestAccFirebaserulesRelease_BasicRelease|TestAccFirebaseWebApp_firebaseWebAppBasicExample|TestAccFirebaseWebApp_firebaseWebAppFull|TestAccDataSourceGoogleFirebaseAppleAppConfig|TestAccComputeForwardingRule_update|TestAccAlloydbCluster_deleteAutomatedBackupPolicyAndInitialUser|TestAccAlloydbCluster_addAutomatedBackupPolicyAndInitialUser|TestAccApigeeEnvKeystoreAliasPkcs12_apigeeEnvKeystoreAliasPkcs12Example|TestAccDataSourceDNSKeys_basic|TestAccDataSourceDnsRecordSet_basic|TestAccDataSourceDNSKeys_noDnsSec|TestAccDataSourceDnsManagedZone_basic|TestAccComposerEnvironment_withEncryptionConfigComposer2|TestAccApigeeKeystoresAliasesKeyCertFile_apigeeKeystoresAliasesKeyCertFileTestExample

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

Tests passed during RECORDING mode:
TestAccFrameworkProviderMeta_setModuleName[Debug log]
TestAccFrameworkProviderBasePath_setBasePath[Debug log]
TestAccFirebaserulesRelease_BasicRelease[Debug log]
TestAccFirebaseWebApp_firebaseWebAppBasicExample[Debug log]
TestAccFirebaseWebApp_firebaseWebAppFull[Debug log]
TestAccDataSourceGoogleFirebaseAppleAppConfig[Debug log]
TestAccComputeForwardingRule_update[Debug log]
TestAccAlloydbCluster_deleteAutomatedBackupPolicyAndInitialUser[Debug log]
TestAccAlloydbCluster_addAutomatedBackupPolicyAndInitialUser[Debug log]
TestAccApigeeEnvKeystoreAliasPkcs12_apigeeEnvKeystoreAliasPkcs12Example[Debug log]
TestAccDataSourceDNSKeys_basic[Debug log]
TestAccDataSourceDnsRecordSet_basic[Debug log]
TestAccDataSourceDNSKeys_noDnsSec[Debug log]
TestAccDataSourceDnsManagedZone_basic[Debug log]
TestAccComposerEnvironment_withEncryptionConfigComposer2[Debug log]
TestAccApigeeKeystoresAliasesKeyCertFile_apigeeKeystoresAliasesKeyCertFileTestExample[Debug log]

All tests passed
View the build log or the debug log for each test

@modular-magician
Copy link
Collaborator

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.

Terraform GA: Diff ( 2 files changed, 160 insertions(+), 2 deletions(-))
Terraform Beta: Diff ( 2 files changed, 160 insertions(+), 2 deletions(-))
TF Validator: Diff ( 2 files changed, 3 insertions(+), 3 deletions(-))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 2588
Passed tests 2307
Skipped tests: 268
Affected tests: 13

Action taken

Found 13 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
TestAccFirebaserulesRelease_BasicRelease|TestAccFirebaseWebApp_firebaseWebAppFull|TestAccFirebaseWebApp_firebaseWebAppBasicExample|TestAccComposerEnvironment_withEncryptionConfigComposer2|TestAccApigeeKeystoresAliasesKeyCertFile_apigeeKeystoresAliasesKeyCertFileTestExample|TestAccApigeeEnvKeystoreAliasPkcs12_apigeeEnvKeystoreAliasPkcs12Example|TestAccDataSourceGoogleFirebaseAppleAppConfig|TestAccFrameworkProviderMeta_setModuleName|TestAccDataSourceDNSKeys_basic|TestAccFrameworkProviderBasePath_setBasePath|TestAccDataSourceDnsRecordSet_basic|TestAccDataSourceDnsManagedZone_basic|TestAccDataSourceDNSKeys_noDnsSec

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

Tests passed during RECORDING mode:
TestAccFirebaserulesRelease_BasicRelease[Debug log]
TestAccFirebaseWebApp_firebaseWebAppFull[Debug log]
TestAccFirebaseWebApp_firebaseWebAppBasicExample[Debug log]
TestAccApigeeKeystoresAliasesKeyCertFile_apigeeKeystoresAliasesKeyCertFileTestExample[Debug log]
TestAccApigeeEnvKeystoreAliasPkcs12_apigeeEnvKeystoreAliasPkcs12Example[Debug log]
TestAccDataSourceGoogleFirebaseAppleAppConfig[Debug log]
TestAccFrameworkProviderMeta_setModuleName[Debug log]
TestAccDataSourceDNSKeys_basic[Debug log]
TestAccFrameworkProviderBasePath_setBasePath[Debug log]
TestAccDataSourceDnsRecordSet_basic[Debug log]
TestAccDataSourceDnsManagedZone_basic[Debug log]
TestAccDataSourceDNSKeys_noDnsSec[Debug log]

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

Please fix these to complete your PR
View the build log or the debug log for each test

Copy link
Member

@melinath melinath left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - thanks for adding tests!

@melinath
Copy link
Member

melinath commented Apr 3, 2023

Failing test seems unrelated.

kimihrr pushed a commit to kimihrr/kimiah-magic-modules that referenced this pull request Apr 4, 2023
GoogleCloudPlatform#7552)

* Deleted immutable attributes for initialUser and weeklySchedule so that deleting/adding these properties doesn't force new cluster creation

* Automated tests for initialUser and automatedBackupPolicy

* Add ImportStateVerifyIgnore for non-changing fields

* gofmt fixes

---------

Co-authored-by: Stephen Lewis (Burrows) <stephen.r.burrows@gmail.com>
@rileykarson
Copy link
Member

@melinath: Please make sure you review the changelog note in the future! I've adjusted this to:

IMPROVEMENTS:
* alloydb: added update support for `initial_user` and `automated_backup_policy.weekly_schedule` to `google_alloydb_cluster`

hao-nan-li pushed a commit to hao-nan-li/magic-modules that referenced this pull request Apr 11, 2023
GoogleCloudPlatform#7552)

* Deleted immutable attributes for initialUser and weeklySchedule so that deleting/adding these properties doesn't force new cluster creation

* Automated tests for initialUser and automatedBackupPolicy

* Add ImportStateVerifyIgnore for non-changing fields

* gofmt fixes

---------

Co-authored-by: Stephen Lewis (Burrows) <stephen.r.burrows@gmail.com>
maphad pushed a commit to maphad/magic-modules that referenced this pull request Apr 12, 2023
GoogleCloudPlatform#7552)

* Deleted immutable attributes for initialUser and weeklySchedule so that deleting/adding these properties doesn't force new cluster creation

* Automated tests for initialUser and automatedBackupPolicy

* Add ImportStateVerifyIgnore for non-changing fields

* gofmt fixes

---------

Co-authored-by: Stephen Lewis (Burrows) <stephen.r.burrows@gmail.com>
ericayyliu pushed a commit to ericayyliu/magic-modules that referenced this pull request Jul 26, 2023
GoogleCloudPlatform#7552)

* Deleted immutable attributes for initialUser and weeklySchedule so that deleting/adding these properties doesn't force new cluster creation

* Automated tests for initialUser and automatedBackupPolicy

* Add ImportStateVerifyIgnore for non-changing fields

* gofmt fixes

---------

Co-authored-by: Stephen Lewis (Burrows) <stephen.r.burrows@gmail.com>
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.

4 participants