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

Add enable_private_path_for_google_cloud_services field to google_sql_database_instance resource #13668

Conversation

modular-magician
Copy link
Collaborator

This PR adds a new field enable_private_path_for_google_cloud_services (settings.ip_configuration.enable_private_path_for_google_cloud_services) to the google_sql_database_instance resource.

The Cloud SQL for MySQL and PostgreSQL now supports a new IP configuration option, enablePrivatePathForGoogleCloudServices.

You can now allow other Google Cloud services such as BigQuery to access data in Cloud SQL for MySQL and make queries against this data over a private connection.

https://cloud.google.com/sql/docs/release-notes#December_15_2022

POST https://sqladmin.googleapis.com/v1/projects/project-id/instances

# request JSON body:
{
  "name": "instance-id",
  ...,
  "settings": {
    ...,
    "ipConfiguration": {
      "ipv4Enabled": false,
      "privateNetwork": "projects/project-id/global/networks/vpc-name",
      "allocatedIpRange": "allocated-ip-range"
      "authorizedNetworks": [authorized-networks],
      
      "enablePrivatePathForGoogleCloudServices": true 🆕 
      
    }
  }
}

Before this new GA feature was introduced, we needed to enable a public IP for Cloud SQL instances for BigQuery Data Transfer Service to reach Cloud SQL. This is no longer needed.

The Golang google.golang.org/api/sqladmin/v1 SDK supports the IpConfiguration.EnablePrivatePathForGoogleCloudServices field since v0.104.0.

type IpConfiguration struct {
        ...
	// EnablePrivatePathForGoogleCloudServices: Controls connectivity to
	// private IP instances from Google services, such as BigQuery.
	EnablePrivatePathForGoogleCloudServices [bool](https://pkg.go.dev/builtin#bool) `json:"enablePrivatePathForGoogleCloudServices,omitempty"`
}

https://pkg.go.dev/google.golang.org/api@v0.104.0/sqladmin/v1#IpConfiguration

The version of the Go library google.golang.org/api that this repository currently uses is v0.102.0. So this PR is blocked by PR #6962, which upgrades the library to v0.105.0.

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).
  • Generated Terraform, and ran make test and make lint to ensure it passes unit and linter tests.
  • 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).
  • Ran relevant acceptance tests (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: added `enable_private_path_for_google_cloud_services` field to `google_sql_database_instance` resource

Derived from GoogleCloudPlatform/magic-modules#6986

…sql_database_instance` resource (hashicorp#6986)

* Add `enable_private_path_for_google_cloud_services` property to `google_sql_database_instance`

* Add a test case for third-party tests

* Add usage examples

* Connect with the VCR test

* Fix test

* Add note

* Make fail-safe

* format

* Upgrade the tier of POSTGRES instances for faster instance creation

* Fix type error

* Also upgrade mysql tier to non shared core in another tiimeout sensitive flaky test

* Revert "Also upgrade mysql tier to non shared core in another timeout sensitive flaky test"

This reverts commit 9c2cb7934dc6e7cebb421451809394e05ed859aa.

* Revert "Upgrade the tier of POSTGRES instances for faster instance creation"

This reverts commit 52e8a4aad56ece0ca16b8f98638c63a5c6dc41f8.

* Merge TestAccSqlDatabaseInstance_withPrivateNetwork_withEnablePrivatePathForGoogleCloudServices into an existing test case step

* Remove the custom pre-apply validation logic and let users face the bad request error for invalid combination of parameters returned from the SQL Admin API

* Remove an extra blank line

* Revert unnecessary edit to the no-longer-used go template file

* Fix indent

* Revert unnecessary edit to mmv1/products/sql/api.yaml

Signed-off-by: Modular Magician <magic-modules@google.com>
@modular-magician modular-magician merged commit 04e347b into hashicorp:main Feb 6, 2023
@github-actions
Copy link

github-actions bot commented Mar 9, 2023

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 Mar 9, 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.

None yet

1 participant