Skip to content

Commit f671620

Browse files
committed
feat(cloud_sql): add MCP instances examples
1 parent fa19511 commit f671620

File tree

4 files changed

+215
-0
lines changed

4 files changed

+215
-0
lines changed
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
/**
2+
* Copyright 2025 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
# [START cloud_sql_mysql_instance_mcp_creation]
18+
resource "google_sql_database_instance" "mysql_mcp_creation" {
19+
name = "mysql-instance-mcp-creation"
20+
region = "us-central1"
21+
database_version = "MYSQL_8_0"
22+
23+
settings {
24+
tier = "db-perf-optimized-N-2"
25+
connection_pool_config {
26+
connection_pooling_enabled = true
27+
}
28+
}
29+
}
30+
# [END cloud_sql_mysql_instance_mcp_creation]
31+
32+
# [START cloud_sql_mysql_instance_mcp_enable]
33+
# This example shows creating an instance with MCP enabled and custom flags set.
34+
resource "google_sql_database_instance" "mysql_mcp_enable" {
35+
name = "mysql-instance-mcp-enable"
36+
region = "us-central1"
37+
database_version = "MYSQL_8_0"
38+
39+
settings {
40+
tier = "db-perf-optimized-N-2"
41+
connection_pool_config {
42+
connection_pooling_enabled = true
43+
}
44+
}
45+
}
46+
# [END cloud_sql_mysql_instance_mcp_enable]
47+
48+
# [START cloud_sql_mysql_instance_mcp_modify]
49+
# This example shows modifying the flags of an existing MCP configuration.
50+
resource "google_sql_database_instance" "mysql_mcp_modify" {
51+
name = "mysql-instance-mcp-modify"
52+
region = "us-central1"
53+
database_version = "MYSQL_8_0"
54+
55+
settings {
56+
tier = "db-perf-optimized-N-2"
57+
connection_pool_config {
58+
connection_pooling_enabled = true
59+
flags {
60+
name = "max_client_connections" # Modify or add the value of an flag
61+
value = "1980"
62+
}
63+
}
64+
}
65+
}
66+
# [END cloud_sql_mysql_instance_mcp_modify]
67+
68+
# [START cloud_sql_mysql_instance_mcp_disable]
69+
# This example shows disabling MCP on an existing instance.
70+
resource "google_sql_database_instance" "mysql_mcp_disable" {
71+
name = "mysql-instance-mcp-disable"
72+
region = "us-central1"
73+
database_version = "MYSQL_8_0"
74+
75+
settings {
76+
tier = "db-perf-optimized-N-2"
77+
connection_pool_config {
78+
# Set to false to disable MCP. You can also remove the block entirely.
79+
connection_pooling_enabled = false
80+
}
81+
}
82+
}
83+
# [END cloud_sql_mysql_instance_mcp_disable]
84+
85+
# [START cloud_sql_mysql_instance_mcp_view]
86+
# To view the current status, you can use the `terraform show` command after applying
87+
# your configuration. The `connection_pool_config` block will reflect the current state.
88+
terraform show
89+
# [END cloud_sql_mysql_instance_mcp_view]
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Copyright 2025 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
apiVersion: blueprints.cloud.google.com/v1alpha1
16+
kind: BlueprintTest
17+
metadata:
18+
name: sql_mysql_instance_mcp
19+
spec:
20+
skip: true
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
/**
2+
* Copyright 2025 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
# [START cloud_sql_postgres_instance_mcp_creation]
18+
resource "google_sql_database_instance" "postgres_mcp_creation" {
19+
name = "postgres-instance-mcp-creation"
20+
region = "us-central1"
21+
database_version = "POSTGRES_16"
22+
23+
settings {
24+
tier = "db-perf-optimized-N-2"
25+
connection_pool_config {
26+
connection_pooling_enabled = true
27+
}
28+
}
29+
}
30+
# [END cloud_sql_postgres_instance_mcp_creation]
31+
32+
# [START cloud_sql_postgres_instance_mcp_enable]
33+
resource "google_sql_database_instance" "postgres_mcp_enable" {
34+
name = "postgres-instance-mcp-enable"
35+
region = "us-central1"
36+
database_version = "POSTGRES_16"
37+
38+
settings {
39+
tier = "db-perf-optimized-N-2"
40+
connection_pool_config {
41+
connection_pooling_enabled = true # Set to true here
42+
}
43+
}
44+
}
45+
# [END cloud_sql_postgres_instance_mcp_enable]
46+
47+
# [START cloud_sql_postgres_instance_mcp_modify]
48+
resource "google_sql_database_instance" "postgres_mcp_modify" {
49+
name = "postgres-instance-mcp-modify"
50+
region = "us-central1"
51+
database_version = "POSTGRES_16"
52+
53+
settings {
54+
tier = "db-perf-optimized-N-2"
55+
connection_pool_config {
56+
connection_pooling_enabled = true
57+
flags {
58+
name = "max_client_connections" # Modify the value of an existing flag
59+
value = "2000"
60+
}
61+
}
62+
}
63+
}
64+
# [END cloud_sql_postgres_instance_mcp_modify]
65+
66+
# [START cloud_sql_postgres_instance_mcp_disable]
67+
resource "google_sql_database_instance" "postgres_mcp_disable" {
68+
name = "postgres-instance-mcp-disable"
69+
region = "us-central1"
70+
database_version = "POSTGRES_16"
71+
72+
settings {
73+
tier = "db-perf-optimized-N-2"
74+
connection_pool_config {
75+
# Set to false to disable MCP. You can also remove the block entirely.
76+
connection_pooling_enabled = false
77+
}
78+
}
79+
}
80+
# [END cloud_sql_postgres_instance_mcp_disable]
81+
82+
# [START cloud_sql_postgres_instance_mcp_view]
83+
# To view the current status, you can use the `terraform show` command after applying
84+
# your configuration. The `connection_pool_config` block will reflect the current state.
85+
terraform show
86+
# [END cloud_sql_postgres_instance_mcp_view]
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Copyright 2025 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
apiVersion: blueprints.cloud.google.com/v1alpha1
16+
kind: BlueprintTest
17+
metadata:
18+
name: sql_postgres_instance_mcp
19+
spec:
20+
skip: true

0 commit comments

Comments
 (0)