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]
0 commit comments