Support context interpolation for psc_allowed_consumer_projects in module cloudsql-instance (#3894)
This commit is contained in:
@@ -117,9 +117,10 @@ resource "google_sql_database_instance" "primary" {
|
||||
)
|
||||
content {
|
||||
psc_enabled = true
|
||||
allowed_consumer_projects = (
|
||||
var.network_config.connectivity.psc_allowed_consumer_projects
|
||||
)
|
||||
allowed_consumer_projects = [
|
||||
for p in var.network_config.connectivity.psc_allowed_consumer_projects :
|
||||
lookup(local.ctx.project_ids, p, p)
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -316,9 +317,10 @@ resource "google_sql_database_instance" "replicas" {
|
||||
)
|
||||
content {
|
||||
psc_enabled = true
|
||||
allowed_consumer_projects = (
|
||||
var.network_config.connectivity.psc_allowed_consumer_projects
|
||||
)
|
||||
allowed_consumer_projects = [
|
||||
for p in var.network_config.connectivity.psc_allowed_consumer_projects :
|
||||
lookup(local.ctx.project_ids, p, p)
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -392,3 +394,4 @@ resource "google_sql_ssl_cert" "client_certificates" {
|
||||
instance = google_sql_database_instance.primary.name
|
||||
common_name = each.key
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ database_version = "POSTGRES_13"
|
||||
tier = "db-g1-small"
|
||||
network_config = {
|
||||
connectivity = {
|
||||
psc_allowed_consumer_projects = ["$project_ids:myprj"]
|
||||
psa_config = {
|
||||
private_network = "$networks:myvpc"
|
||||
}
|
||||
|
||||
@@ -23,6 +23,10 @@ values:
|
||||
- ip_configuration:
|
||||
- ipv4_enabled: false
|
||||
private_network: projects/myprj/global/networks/myvpc
|
||||
psc_config:
|
||||
- allowed_consumer_projects:
|
||||
- my-project
|
||||
psc_enabled: true
|
||||
|
||||
counts:
|
||||
google_sql_database_instance: 1
|
||||
|
||||
Reference in New Issue
Block a user