Skip to content

Add support for enforce_new_sql_network_architecture flag in google_s…#18115

Open
wyiyang-stack wants to merge 1 commit into
GoogleCloudPlatform:mainfrom
wyiyang-stack:enforce_new_sql_network_architecture
Open

Add support for enforce_new_sql_network_architecture flag in google_s…#18115
wyiyang-stack wants to merge 1 commit into
GoogleCloudPlatform:mainfrom
wyiyang-stack:enforce_new_sql_network_architecture

Conversation

@wyiyang-stack

@wyiyang-stack wyiyang-stack commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

Support enforce_new_sql_network_architecture flag in google_sql_database_instance

Description

This pull request adds support for the enforce_new_sql_network_architecture parameter to the google_sql_database_instance resource in the Terraform Google Provider.

The enforce_new_sql_network_architecture attribute is a boolean field that allows users to opt-in to the new SQL network architecture. Once enabled, this change is irreversible, which aligns with the behavior of gcloud. To handle this, a custom diff suppression function, sqlNetworkArchitectureDiffSuppress, is implemented to suppress any plans that try to disable the flag once it is already active.

Changes

1. Resource Implementation

  • mmv1/third_party/terraform/services/sql/resource_sql_database_instance.go.tmpl:
    • Added the schema definition for enforce_new_sql_network_architecture with schema.TypeBool.
    • Added sqlNetworkArchitectureDiffSuppress to suppress diffs when moving from true to false.
    • Updated resource creation to set the API field SqlNetworkArchitecture to "NEW_NETWORK_ARCHITECTURE" if the flag is enabled.
    • Updated resource reading to read back the state of the network architecture.
    • Updated resource updates to support patching the instance settings using the .Instances.Patch call if the flag changes to true.

2. Metadata Mapping

  • mmv1/third_party/terraform/services/sql/resource_sql_database_instance_meta.yaml.tmpl:
    • Added metadata mapping between the API field sqlNetworkArchitecture and the Terraform schema field enforce_new_sql_network_architecture.

3. Tests

  • mmv1/third_party/terraform/services/sql/resource_sql_database_instance_test.go.tmpl:
    • Added an acceptance test TestAccSqlDatabaseInstance_enforceNewSqlNetworkArchitecture to cover creation, import, and verification of the irreversible state behavior.

Added support for `enforce_new_sql_network_architecture` attribute to `google_sql_database_instance`

@modular-magician modular-magician added the awaiting-approval Pull requests that need reviewer's approval to run presubmit tests label Jun 27, 2026
@github-actions github-actions Bot requested a review from roaks3 June 27, 2026 01:27
@github-actions

Copy link
Copy Markdown

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

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

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

Labels

awaiting-approval Pull requests that need reviewer's approval to run presubmit tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants