Skip to content

Commit 86050fa

Browse files
authored
Merge branch 'main' into chayanr-czr
2 parents f2dd6ac + 0e92c0e commit 86050fa

File tree

4 files changed

+183
-0
lines changed

4 files changed

+183
-0
lines changed
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
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_read_pool_auto_scale]
18+
19+
resource "google_sql_database_instance" "primary" {
20+
name = "mysql-primary"
21+
database_version = "MYSQL_8_4"
22+
region = "europe-west4"
23+
24+
instance_type = "CLOUD_SQL_INSTANCE"
25+
26+
settings {
27+
tier = "db-perf-optimized-N-2"
28+
edition = "ENTERPRISE_PLUS"
29+
30+
backup_configuration {
31+
enabled = true
32+
binary_log_enabled = true
33+
}
34+
35+
ip_configuration {
36+
ipv4_enabled = true
37+
}
38+
}
39+
}
40+
41+
resource "google_sql_database_instance" "replica" {
42+
name = "mysql-replica"
43+
database_version = "MYSQL_8_4"
44+
region = "europe-west4"
45+
46+
master_instance_name = google_sql_database_instance.primary.name
47+
instance_type = "READ_POOL_INSTANCE"
48+
node_count = 2
49+
50+
settings {
51+
tier = "db-perf-optimized-N-2"
52+
edition = "ENTERPRISE_PLUS"
53+
54+
ip_configuration {
55+
ipv4_enabled = true
56+
}
57+
read_pool_auto_scale_config {
58+
enabled = true
59+
disable_scale_in = false
60+
max_node_count = 20
61+
min_node_count = 2
62+
scale_in_cooldown_seconds = 600
63+
scale_out_cooldown_seconds = 600
64+
target_metrics {
65+
metric = "AVERAGE_CPU_UTILIZATION"
66+
target_value = 0.5
67+
}
68+
}
69+
}
70+
}
71+
72+
# [END cloud_sql_mysql_read_pool_auto_scale]
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: cloudsql_mysql_instance_read_pool_auto_scale
19+
spec:
20+
skip: true
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
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_read_pool_auto_scale]
18+
19+
resource "google_sql_database_instance" "primary" {
20+
name = "postgres-primary"
21+
database_version = "POSTGRES_17"
22+
region = "europe-west4"
23+
24+
instance_type = "CLOUD_SQL_INSTANCE"
25+
26+
settings {
27+
tier = "db-perf-optimized-N-2"
28+
edition = "ENTERPRISE_PLUS"
29+
30+
backup_configuration {
31+
enabled = true
32+
}
33+
34+
ip_configuration {
35+
ipv4_enabled = true
36+
}
37+
}
38+
}
39+
40+
resource "google_sql_database_instance" "replica" {
41+
name = "postgres-replica"
42+
database_version = "POSTGRES_17"
43+
region = "europe-west4"
44+
45+
master_instance_name = google_sql_database_instance.primary.name
46+
instance_type = "READ_POOL_INSTANCE"
47+
node_count = 2
48+
49+
settings {
50+
tier = "db-perf-optimized-N-2"
51+
edition = "ENTERPRISE_PLUS"
52+
53+
ip_configuration {
54+
ipv4_enabled = true
55+
}
56+
read_pool_auto_scale_config {
57+
enabled = true
58+
disable_scale_in = false
59+
max_node_count = 20
60+
min_node_count = 2
61+
scale_in_cooldown_seconds = 600
62+
scale_out_cooldown_seconds = 600
63+
target_metrics {
64+
metric = "AVERAGE_CPU_UTILIZATION"
65+
target_value = 0.5
66+
}
67+
}
68+
}
69+
}
70+
71+
# [END cloud_sql_postgres_read_pool_auto_scale]
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: cloudsql_postgres_instance_read_pool_auto_scale
19+
spec:
20+
skip: true

0 commit comments

Comments
 (0)