Skip to content

Fix edition downgrade failure for an ENTERPRISE_PLUS instance with da… #12289

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

Merged

Conversation

skysarthak
Copy link
Contributor

Recently there was an API change to enable data cache by default for ENTERPRISE_PLUS edition (both MySQL and Postgres) instances. When data_cache_config was not a computed attribute this resulted in acceptance test failures that were fixed in #12096.

Now that data_cache_config is computed, it stays in the resource state after a downgrade even though data_cache_config is cleared from the instance metadata. This is a consequence of performing a PATCH (for edition upgrade / downgrade) followed by an UPDATE while ignoring the change in CloudSQL instance settings from the PATCH operation. The downgrade implicitly unsets the data cache config in the API as it is not allowed to be used with ENTERPRISE edition.

This PR fixes this issue (edition downgrade failure for an ENTERPRISE_PLUS instance with data cache enabled) by persisting the data_cache_config received after the PATCH operation for edition upgrade / downgrade. Also fixes hashicorp/terraform-provider-google#20010 as TestAccSqlDatabaseInstance_Edition_Downgrade can now run.

b/375381759

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)

sql: fixed edition downgrade failure for an `ENTERPRISE_PLUS` instance with data cache enabled.

Copy link

github-actions bot commented Nov 9, 2024

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

@rileykarson, 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 github-actions bot requested a review from rileykarson November 9, 2024 10:19
@modular-magician modular-magician added the awaiting-approval Pull requests that need reviewer's approval to run presubmit tests label Nov 9, 2024
Copy link

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

@modular-magician modular-magician added service/sqladmin-cp and removed awaiting-approval Pull requests that need reviewer's approval to run presubmit tests labels Nov 15, 2024
@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.

google provider: Diff ( 2 files changed, 1 insertion(+), 1 deletion(-))
google-beta provider: Diff ( 2 files changed, 1 insertion(+), 1 deletion(-))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 104
Passed tests: 88
Skipped tests: 15
Affected tests: 1

Click here to see the affected service packages
  • sql

Action taken

Found 1 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
  • TestAccSqlDatabaseInstance_Edition_Downgrade

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

🟢 Tests passed during RECORDING mode:
TestAccSqlDatabaseInstance_Edition_Downgrade [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

Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Failing test(s): TestAccSqlDatabaseInstance_Edition_Downgrade
3 participants