Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions cloud_sql/mysql_instance_psc_sa/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/**
* Copyright 2022 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
*
* 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.
*/

data "google_project" "project" {
}

# [START vpc_mysql_instance_consumer_network]
resource "google_compute_network" "consumer_network" {
name = "consumer-network"
auto_create_subnetworks = "true"
}
# [END vpc_mysql_instance_consumer_network]

# [START cloud_sql_mysql_instance_psc_sa]
resource "google_sql_database_instance" "default" {
name = "mysql-instance"
region = "us-central1"
database_version = "MYSQL_8_0"
settings {
tier = "db-f1-micro"
availability_type = "REGIONAL"
backup_configuration {
enabled = true
binary_log_enabled = true
}
ip_configuration {
psc_config {
psc_enabled = true
allowed_consumer_projects = [] # Add consumer project IDs here.
psc_auto_connections {
consumer_network = google_compute_network.consumer_network.id
consumer_service_project_id = data.google_project.project.project_id
}
}
ipv4_enabled = false
}
}
}
# [END cloud_sql_mysql_instance_psc_sa]
20 changes: 20 additions & 0 deletions cloud_sql/mysql_instance_psc_sa/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright 2025 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
#
# 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.

apiVersion: blueprints.cloud.google.com/v1alpha1
kind: BlueprintTest
metadata:
name: sql_mysql_instance_psc_sa
spec:
skip: true
51 changes: 51 additions & 0 deletions cloud_sql/postgres_instance_psc_sa/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/**
* Copyright 2022 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
*
* 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.
*/

data "google_project" "project" {
}

# [START vpc_postgres_instance_consumer_network]
resource "google_compute_network" "consumer_network" {
name = "consumer-network"
auto_create_subnetworks = "true"
}
# [END vpc_postgres_instance_consumer_network]

# [START cloud_sql_postgres_instance_psc_sa]
resource "google_sql_database_instance" "default" {
name = "postgres-instance"
region = "us-central1"
database_version = "POSTGRES_14"
settings {
tier = "db-custom-2-7680"
availability_type = "REGIONAL"
backup_configuration {
enabled = true
}
ip_configuration {
psc_config {
psc_enabled = true
allowed_consumer_projects = []
psc_auto_connections {
consumer_network = google_compute_network.consumer_network.id
consumer_service_project_id = data.google_project.project.project_id
}
}
ipv4_enabled = false
}
}
}
# [END cloud_sql_postgres_instance_psc_sa]
20 changes: 20 additions & 0 deletions cloud_sql/postgres_instance_psc_sa/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright 2025 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
#
# 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.

apiVersion: blueprints.cloud.google.com/v1alpha1
kind: BlueprintTest
metadata:
name: sql_postgres_instance_psc_sa
spec:
skip: true
53 changes: 53 additions & 0 deletions cloud_sql/sqlserver_instance_psc_sa/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/**
* Copyright 2022 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
*
* 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.
*/

data "google_project" "project" {
}

# [START vpc_sqlserver_instance_consumer_network]
resource "google_compute_network" "consumer_network" {
name = "consumer-network"
auto_create_subnetworks = "true"
}
# [END vpc_sqlserver_instance_consumer_network]

# [START cloud_sql_sqlserver_instance_psc_sa]
resource "google_sql_database_instance" "default" {
name = "sqlserver-instance"
region = "us-central1"
database_version = "SQLSERVER_2019_ENTERPRISE"
root_password = "INSERT-PASSWORD-HERE"
settings {
tier = "db-custom-2-7680"
availability_type = "REGIONAL"
backup_configuration {
enabled = true
start_time = "20:55"
}
ip_configuration {
psc_config {
psc_enabled = true
allowed_consumer_projects = [] # Add consumer project IDs here.
psc_auto_connections {
consumer_network = google_compute_network.consumer_network.id
consumer_service_project_id = data.google_project.project.project_id
}
}
ipv4_enabled = false
}
}
}
# [END cloud_sql_sqlserver_instance_psc_sa]
20 changes: 20 additions & 0 deletions cloud_sql/sqlserver_instance_psc_sa/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright 2024 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
#
# 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.

apiVersion: blueprints.cloud.google.com/v1alpha1
kind: BlueprintTest
metadata:
name: sql_sqlserver_instance_psc_sa
spec:
skip: true