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
Empty file added .terraform.lock
Empty file.
92 changes: 92 additions & 0 deletions cloud_sql/mysql_instance_managed_connection_pooling/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
/**
* 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.
*/

# [START cloud_sql_mysql_instance_managed_connection_pooling_creation]
# This example shows creating an instance with Managed Connection Pooling.
resource "google_sql_database_instance" "mysql_managed_connection_pooling_creation" {
name = "mysql-instance-managed-connection-pooling-creation"
region = "us-central1"
database_version = "MYSQL_8_0"
deletion_protection = false

settings {
tier = "db-perf-optimized-N-2"
edition = "ENTERPRISE_PLUS"
connection_pool_config {
connection_pooling_enabled = true
}
}
}
# [END cloud_sql_mysql_instance_managed_connection_pooling_creation]

# [START cloud_sql_mysql_instance_managed_connection_pooling_enable]
# This example shows creating an instance with Managed Connection Pooling enabled and custom flags set.
resource "google_sql_database_instance" "mysql_managed_connection_pooling_enable" {
name = "mysql-instance-managed-connection-pooling-enable"
region = "us-central1"
database_version = "MYSQL_8_0"
deletion_protection = false

settings {
tier = "db-perf-optimized-N-2"
edition = "ENTERPRISE_PLUS"
connection_pool_config {
connection_pooling_enabled = true
}
}
}
# [END cloud_sql_mysql_instance_managed_connection_pooling_enable]

# [START cloud_sql_mysql_instance_managed_connection_pooling_modify]
# This example shows modifying the flags of an existing Managed Connection Pooling configuration.
resource "google_sql_database_instance" "mysql_managed_connection_pooling_modify" {
name = "mysql-instance-managed-connection-pooling-modify"
region = "us-central1"
database_version = "MYSQL_8_0"
deletion_protection = false

settings {
tier = "db-perf-optimized-N-2"
edition = "ENTERPRISE_PLUS"
connection_pool_config {
connection_pooling_enabled = true
flags {
name = "max_pool_size" # Modify or add the name and value of an flag
value = "10"
}
}
}
}
# [END cloud_sql_mysql_instance_managed_connection_pooling_modify]

# [START cloud_sql_mysql_instance_managed_connection_pooling_disable]
# This example shows disabling Managed Connection Pooling on an existing instance.
resource "google_sql_database_instance" "mysql_managed_connection_pooling_disable" {
name = "mysql-instance-managed-connection-pooling-disable"
region = "us-central1"
database_version = "MYSQL_8_0"
deletion_protection = false

settings {
tier = "db-perf-optimized-N-2"
edition = "ENTERPRISE_PLUS"
connection_pool_config {
# Set to false to disable Managed Connection Pooling. You can also remove the block entirely.
connection_pooling_enabled = false
}
}
}
# [END cloud_sql_mysql_instance_managed_connection_pooling_disable]
20 changes: 20 additions & 0 deletions cloud_sql/mysql_instance_managed_connection_pooling/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_managed_connection_pooling
spec:
skip: true
88 changes: 88 additions & 0 deletions cloud_sql/postgres_instance_managed_connection_pooling/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
/**
* 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.
*/

# [START cloud_sql_postgres_instance_managed_connection_pooling_creation]
resource "google_sql_database_instance" "postgres_managed_connection_pooling_creation" {
name = "postgres-instance-managed-connection-pooling-creation"
region = "us-central1"
database_version = "POSTGRES_16"
deletion_protection = false

settings {
tier = "db-perf-optimized-N-2"
edition = "ENTERPRISE_PLUS"
connection_pool_config {
connection_pooling_enabled = true
}
}
}
# [END cloud_sql_postgres_instance_managed_connection_pooling_creation]

# [START cloud_sql_postgres_instance_managed_connection_pooling_enable]
resource "google_sql_database_instance" "postgres_managed_connection_pooling_enable" {
name = "postgres-instance-managed-connection-pooling-enable"
region = "us-central1"
database_version = "POSTGRES_16"
deletion_protection = false

settings {
tier = "db-perf-optimized-N-2"
edition = "ENTERPRISE_PLUS"
connection_pool_config {
connection_pooling_enabled = true # Set to true here
}
}
}
# [END cloud_sql_postgres_instance_managed_connection_pooling_enable]

# [START cloud_sql_postgres_instance_managed_connection_pooling_modify]
resource "google_sql_database_instance" "postgres_managed_connection_pooling_modify" {
name = "postgres-instance-managed-connection-pooling-modify"
region = "us-central1"
database_version = "POSTGRES_16"
deletion_protection = false

settings {
tier = "db-perf-optimized-N-2"
edition = "ENTERPRISE_PLUS"
connection_pool_config {
connection_pooling_enabled = true
flags {
name = "max_pool_size" # Modify the value of an existing flag
value = "10"
}
}
}
}
# [END cloud_sql_postgres_instance_managed_connection_pooling_modify]

# [START cloud_sql_postgres_instance_managed_connection_pooling_disable]
resource "google_sql_database_instance" "postgres_managed_connection_pooling_disable" {
name = "postgres-instance-managed-connection-pooling-disable"
region = "us-central1"
database_version = "POSTGRES_16"
deletion_protection = false

settings {
tier = "db-perf-optimized-N-2"
edition = "ENTERPRISE_PLUS"
connection_pool_config {
# Set to false to disable Managed Connection Pooling. You can also remove the block entirely.
connection_pooling_enabled = false
}
}
}
# [END cloud_sql_postgres_instance_managed_connection_pooling_disable]
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_managed_connection_pooling
spec:
skip: true