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

Fix permadiff when edition field is added to configuration of a google_sql_database_instance resource #16215

Conversation

modular-magician
Copy link
Collaborator

Fixes #15553

This PR adds a diff suppress that helps the provider handle a problem with the Cloud SQL API. If you create a database instance without specifying an edition it will default to ENTERPRISE. However the edition field is not returned in GET requests to the API. If you create the resource and specify the edition in the initial create action then the edition field is returned as part of the API response. As a result "" and "ENTERPRISE" are equivalent values of edition for a google_sql_database_instance resource.

See #15553 (comment) for more info.

Release Note Template for Downstream PRs (will be copied)

sql: Fixed a bug where adding the `edition` field to a `google_sql_database_instance` resource that already existed and used ENTERPRISE edition resulted in a permant diff in plans

Derived from GoogleCloudPlatform/magic-modules#9198

…ogle_sql_database_instance` resource (hashicorp#9198)

* Suppress diff on `google_sql_database_instance`'s `edition` field when state contains `""` and config contains `"ENTERPRISE"`

* Remove `DiffSuppressFunc`, add flattener and expander to handle conversion of `""` to `"ENTERPRISE"`

* Remove duplicate import

* Set default value of `edition` to `"ENTERPRISE"`

* Remove expander, add state upgrader

* Add acceptance test step that provisions an instance without `edition` set

* Update tests to assert the value in state matches the edition used, including when edition is not set in config

* Remove state upgrader
[upstream:241a15cb0ed6ae99c3290825051f168deda648fd]

Signed-off-by: Modular Magician <magic-modules@google.com>
@modular-magician modular-magician merged commit dba09c1 into hashicorp:main Oct 11, 2023
Copy link

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 12, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cloud SQL Edition setting does not persist
1 participant