Skip to content

Commit 9d3b82d

Browse files
Merge branch 'main' into newbr
2 parents f015241 + 9856e2a commit 9d3b82d

File tree

9 files changed

+343
-1
lines changed

9 files changed

+343
-1
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
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
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 compute_preview_feature_disable]
18+
19+
resource "google_compute_preview_feature" "default" {
20+
name = "alpha-api-access"
21+
activation_status = "ACTIVATION_STATE_UNSPECIFIED"
22+
rollout_operation {
23+
rollout_input {
24+
predefined_rollout_plan = "ROLLOUT_PLAN_FAST_ROLLOUT"
25+
}
26+
}
27+
}
28+
29+
# [END compute_preview_feature_disable]
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
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 compute_preview_feature_enable]
18+
19+
resource "google_compute_preview_feature" "default" {
20+
name = "alpha-api-access"
21+
activation_status = "ENABLED"
22+
rollout_operation {
23+
rollout_input {
24+
predefined_rollout_plan = "ROLLOUT_PLAN_FAST_ROLLOUT"
25+
}
26+
}
27+
}
28+
29+
# [END compute_preview_feature_enable]
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: compute_preview_feature_enable
19+
spec:
20+
skip: true
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
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+
/**
18+
* Made to resemble:
19+
* gcloud beta compute instance-groups managed create czr-rmig \
20+
* --region us-central1 \
21+
* --size 3 \
22+
* --template example-template \
23+
* --target-distribution-shape balanced \
24+
* --instance-redistribution-type none \
25+
* --default-action-on-vm-failure=repair \
26+
* --on-repair-allow-changing-zone=YES \
27+
* --force-update-on-repair
28+
*/
29+
# [START compute_rmig_cross_zone_repair_parent_tag]
30+
terraform {
31+
required_providers {
32+
google = {
33+
source = "hashicorp/google-beta"
34+
version = ">= 7.8.0"
35+
}
36+
}
37+
}
38+
39+
resource "google_compute_instance_template" "default" {
40+
name = "example-template"
41+
machine_type = "n2-standard-2"
42+
disk {
43+
source_image = "debian-cloud/debian-12"
44+
}
45+
network_interface {
46+
network = "default"
47+
}
48+
}
49+
50+
# [START compute_rmig_cross_zone_repair]
51+
resource "google_compute_region_instance_group_manager" "default" {
52+
provider = google-beta
53+
name = "example-rmig"
54+
base_instance_name = "example-rmig-instance"
55+
region = "us-central1"
56+
57+
target_size = 3
58+
distribution_policy_target_shape = "BALANCED"
59+
60+
version {
61+
instance_template = google_compute_instance_template.default.id
62+
}
63+
64+
instance_lifecycle_policy {
65+
default_action_on_failure = "REPAIR"
66+
force_update_on_repair = "YES"
67+
on_repair {
68+
allow_changing_zone = "YES"
69+
}
70+
}
71+
72+
update_policy {
73+
instance_redistribution_type = "NONE"
74+
type = "OPPORTUNISTIC"
75+
minimal_action = "REPLACE"
76+
max_surge_fixed = 0
77+
max_unavailable_fixed = 6
78+
}
79+
}
80+
# [END compute_rmig_cross_zone_repair]
81+
# [END compute_rmig_cross_zone_repair_parent_tag]

test/integration/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ module github.com/terraform-google-modules/terraform-docs-samples/test/integrati
22

33
go 1.23.0
44

5-
toolchain go1.24.7
5+
toolchain go1.24.9
66

77
require (
88
github.com/GoogleCloudPlatform/cloud-foundation-toolkit/infra/blueprint-test v0.17.9

0 commit comments

Comments
 (0)