Skip to content

Commit 474cc88

Browse files
authored
Merge branch 'main' into psc_vpc
2 parents 1f8c73b + 47a39d8 commit 474cc88

File tree

3 files changed

+71
-18
lines changed
  • compute
    • disk_async_replication
    • rmig_instance_flexibility_policy_without_preferences
    • rmig_instance_flexibility_policy

3 files changed

+71
-18
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
/**
2+
* Copyright 2024 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_disk_async_replication_parent_tag]
18+
# [START compute_disk_primary]
19+
resource "google_compute_disk" "primary_disk" {
20+
name = "primary-disk"
21+
type = "pd-ssd"
22+
zone = "europe-west4-a"
23+
24+
physical_block_size_bytes = 4096
25+
}
26+
# [END compute_disk_primary]
27+
28+
# [START compute_disk_secondary]
29+
resource "google_compute_disk" "secondary_disk" {
30+
name = "secondary-disk"
31+
type = "pd-ssd"
32+
zone = "europe-west3-a"
33+
34+
async_primary_disk {
35+
disk = google_compute_disk.primary_disk.id
36+
}
37+
38+
physical_block_size_bytes = 4096
39+
}
40+
# [END compute_disk_secondary]
41+
42+
43+
# [START compute_disk_async_replication]
44+
resource "google_compute_disk_async_replication" "default" {
45+
primary_disk = google_compute_disk.primary_disk.id
46+
secondary_disk {
47+
disk = google_compute_disk.secondary_disk.id
48+
}
49+
}
50+
# [END compute_disk_async_replication]
51+
# [END compute_disk_async_replication_parent_tag]

compute/rmig_instance_flexibility_policy/main.tf

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,25 +16,27 @@
1616

1717
/**
1818
* Made to resemble:
19-
* gcloud alpha compute instance-groups managed create flex-igm --project=$PROJECT --region=us-central1 \
20-
* --target-distribution-shape=any-single-zone --instance-redistribution-type NONE \
21-
* --template example-template --size 3 \
22-
* --instance-selection "rank=1,name=best-choice,machine-type=n1-standard-1,n1-standard-2" \
23-
* --instance-selection "rank=2,name=still-ok,machine-type=n2-standard-1" \
24-
* --instance-selection "rank=3,name=if-nothing-else,machine-type=e2-standard-2"
19+
* gcloud compute instance-groups managed create flex-igm \
20+
* --region us-central1 \
21+
* --size 3 \
22+
* --template example-template \
23+
* --target-distribution-shape any-single-zone \
24+
* --instance-redistribution-type none \
25+
* --instance-selection "name=best-choice,machine-type=n1-standard-1,machine-type=n1-standard-2,rank=1" \
26+
* --instance-selection "name=still-ok,machine-type=n2-standard-1,rank=2" \
27+
* --instance-selection "name=if-nothing-else,machine-type=e2-standard-2,rank=3"
2528
*/
2629

27-
2830
terraform {
2931
required_providers {
3032
google = {
31-
source = "hashicorp/google-beta"
32-
version = ">= 6.12.0"
33+
source = "hashicorp/google"
34+
version = ">= 6.13.0"
3335
}
3436
}
3537
}
3638

37-
# [START compute_region_igm_instance_flexibility_policy_parent_tag]
39+
# [START compute_rmig_instance_flexibility_policy_parent_tag]
3840
resource "google_compute_instance_template" "default" {
3941
name = "example-template"
4042
machine_type = "e2-medium"
@@ -46,7 +48,7 @@ resource "google_compute_instance_template" "default" {
4648
}
4749
}
4850

49-
# [START compute_region_igm_instance_flexibility_policy]
51+
# [START compute_rmig_instance_flexibility_policy]
5052
resource "google_compute_region_instance_group_manager" "default" {
5153
name = "flex-igm"
5254
base_instance_name = "tf-test-flex-igm"
@@ -85,5 +87,5 @@ resource "google_compute_region_instance_group_manager" "default" {
8587
max_unavailable_fixed = 6
8688
}
8789
}
88-
# [END compute_region_igm_instance_flexibility_policy]
89-
# [END compute_region_igm_instance_flexibility_policy_parent_tag]
90+
# [END compute_rmig_instance_flexibility_policy]
91+
# [END compute_rmig_instance_flexibility_policy_parent_tag]

compute/rmig_instance_flexibility_policy_without_preferences/main.tf

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
* --region us-central1 \
2121
* --size 3 \
2222
* --template example-template \
23-
* --target-distribution-shape=any-single-zone \
23+
* --target-distribution-shape any-single-zone \
2424
* --instance-redistribution-type none \
2525
* --instance-selection-machine-types "machine-type=n1-standard-16,n2-standard-16,e2-standard-16"
2626
*/
@@ -34,7 +34,7 @@ terraform {
3434
}
3535
}
3636

37-
# [START compute_region_igm_instance_flexibility_policy_parent_tag]
37+
# [START compute_rmig_instance_flexibility_policy_without_preference_parent_tag]
3838
resource "google_compute_instance_template" "default" {
3939
name = "example-template"
4040
machine_type = "e2-medium"
@@ -46,7 +46,7 @@ resource "google_compute_instance_template" "default" {
4646
}
4747
}
4848

49-
# [START compute_region_igm_instance_flexibility_policy]
49+
# [START compute_rmig_instance_flexibility_policy_without_preference]
5050
resource "google_compute_region_instance_group_manager" "default" {
5151
name = "flex-igm"
5252
base_instance_name = "tf-test-flex-igm"
@@ -74,5 +74,5 @@ resource "google_compute_region_instance_group_manager" "default" {
7474
max_unavailable_fixed = 6
7575
}
7676
}
77-
# [END compute_region_igm_instance_flexibility_policy]
78-
# [END compute_region_igm_instance_flexibility_policy_parent_tag]
77+
# [END compute_rmig_instance_flexibility_policy_without_preference]
78+
# [END compute_rmig_instance_flexibility_policy_without_preference_parent_tag]

0 commit comments

Comments
 (0)