Enable remaining PSC config options in modules/cloudsql-instance (#3982)

* Enable remaining PSC config options

* Windows slashes

* Updates from review; slim down locals; obsolete psc_allowed_consumer_projects

* Windows slashes

* tfvars; examples

* Copy-paste bug

* Proper list check

* Updates from Automated PR Review

* Slahes

* null psc fix; regenerate custom test inventory

* fmt

* Correct fixtures; remove deletion_policy from instance resources

* Fix test

* Remove deletio policy

---------

Co-authored-by: Julio Castillo <jccb@google.com>
This commit is contained in:
Brandon Tucker
2026-05-30 11:38:55 -06:00
committed by GitHub
parent f0325fc0c4
commit 3ee1cc7ab3
7 changed files with 287 additions and 34 deletions

View File

@@ -11,10 +11,12 @@ database_version = "POSTGRES_13"
tier = "db-g1-small"
network_config = {
connectivity = {
psc_allowed_consumer_projects = ["$project_ids:myprj"]
psa_config = {
private_network = "$networks:myvpc"
}
psc_config = {
allowed_consumer_projects = ["$project_ids:myprj"]
}
}
}
encryption_key_name = "$kms_keys:mykey"

View File

@@ -1,10 +1,10 @@
# Copyright 2023 Google LLC
# Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
@@ -14,36 +14,100 @@
values:
module.db.google_sql_database.databases["departments"]:
deletion_policy: DELETE
instance: db
name: departments
project: project-id
timeouts: null
module.db.google_sql_database.databases["people"]:
deletion_policy: DELETE
instance: db
name: people
project: project-id
module.db.google_sql_database_instance.primary: {}
timeouts: null
module.db.google_sql_database_instance.primary:
backupdr_backup: null
clone: []
database_version: MYSQL_8_0
deletion_protection: false
final_backup_description: null
name: db
point_in_time_restore_context: []
project: project-id
region: europe-west8
restore_backup_context: []
root_password: null
root_password_wo: null
root_password_wo_version: null
settings:
- activation_policy: ALWAYS
active_directory_config: []
advanced_machine_features: []
auto_upgrade_enabled: null
availability_type: ZONAL
collation: null
database_flags:
- name: cloudsql_iam_authentication
value: 'on'
- name: disconnect_on_expired_password
value: 'on'
deletion_protection_enabled: false
deny_maintenance_period: []
disk_autoresize: true
disk_autoresize_limit: 0
disk_type: PD_SSD
edition: ENTERPRISE
enable_dataplex_integration: null
enable_google_ml_integration: null
entraid_config: []
final_backup_config: []
ip_configuration:
- allocated_ip_range: null
authorized_networks: []
custom_subject_alternative_names: null
enable_private_path_for_google_cloud_services: false
ipv4_enabled: false
private_network: https://www.googleapis.com/compute/v1/projects/xxx/global/networks/aaa
psc_config: []
server_ca_pool: null
server_certificate_rotation_mode: null
maintenance_window: []
password_validation_policy: []
pricing_plan: PER_USE
retain_backups_on_delete: null
sql_server_audit_config: []
tier: db-g1-small
time_zone: null
timeouts: null
module.db.google_sql_user.users["fixture-service-account@project-id.iam.gserviceaccount.com"]:
database_roles: null
instance: db
name: fixture-service-account@project-id.iam.gserviceaccount.com
password: null
password_policy: []
password_wo: null
password_wo_version: null
project: project-id
timeouts: null
type: CLOUD_IAM_SERVICE_ACCOUNT
module.db.google_sql_user.users["user1"]:
deletion_policy: null
database_roles: null
instance: db
name: user1
password_policy: []
password_wo: null
password_wo_version: null
project: project-id
timeouts: null
type: null
module.db.google_sql_user.users["user2"]:
deletion_policy: null
database_roles: null
instance: db
name: user2
password: mypassword
password_policy: []
password_wo: null
password_wo_version: null
project: project-id
timeouts: null
type: null
module.db.random_password.passwords["user1"]:
keepers: null
@@ -58,9 +122,24 @@ values:
override_special: null
special: true
upper: true
module.iam-service-account.google_service_account.service_account[0]:
account_id: fixture-service-account
create_ignore_already_exists: null
description: null
disabled: false
display_name: Terraform-managed.
email: fixture-service-account@project-id.iam.gserviceaccount.com
member: serviceAccount:fixture-service-account@project-id.iam.gserviceaccount.com
project: project-id
timeouts: null
counts:
google_service_account: 1
google_sql_database: 2
google_sql_database_instance: 1
google_sql_user: 3
modules: 2
random_password: 1
resources: 8
outputs: {}

View File

@@ -0,0 +1,78 @@
# Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
values:
module.db.google_sql_database_instance.primary:
backupdr_backup: null
clone: []
database_version: POSTGRES_13
final_backup_description: null
name: myprefix-db
point_in_time_restore_context: []
project: project-id
region: europe-west8
restore_backup_context: []
root_password: null
root_password_wo: null
root_password_wo_version: null
settings:
- activation_policy: ALWAYS
active_directory_config: []
advanced_machine_features: []
auto_upgrade_enabled: null
availability_type: REGIONAL
collation: null
database_flags: []
deletion_protection_enabled: false
deny_maintenance_period: []
disk_autoresize: true
disk_autoresize_limit: 0
disk_type: PD_SSD
edition: ENTERPRISE
enable_dataplex_integration: null
enable_google_ml_integration: null
entraid_config: []
final_backup_config: []
ip_configuration:
- allocated_ip_range: null
authorized_networks: []
custom_subject_alternative_names: null
enable_private_path_for_google_cloud_services: false
ipv4_enabled: false
private_network: null
psc_config:
- allowed_consumer_projects:
- project-id
network_attachment_uri: ''
psc_auto_connections:
- consumer_network: https://www.googleapis.com/compute/v1/projects/xxx/global/networks/aaa
consumer_service_project_id: project-id
psc_enabled: true
server_ca_pool: null
server_certificate_rotation_mode: null
maintenance_window: []
password_validation_policy: []
pricing_plan: PER_USE
retain_backups_on_delete: null
sql_server_audit_config: []
tier: db-g1-small
time_zone: null
timeouts: null
counts:
google_sql_database_instance: 1
modules: 1
resources: 1
outputs: {}