Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions compute/zonal_mig_standby_policy/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,22 @@
* limitations under the License.
*/
/** Made to resemble
* gcloud beta compute instance-groups managed update standby-mig \
* gcloud compute instance-groups managed update standby-mig \
* --standby-policy-mode=scale-out-pool \
* --standby-policy-initial-delay=50 \
* --target-size=3\
* --zone=us-central1-f
*/

terraform {
required_providers {
google = {
source = "hashicorp/google"
version = ">= 6.16.0"
}
}
}

# [START compute_zonal_instance_group_manager_standby_policy_parent_tag]
resource "google_compute_instance_template" "default" {
name = "an-instance-template"
Expand All @@ -35,7 +46,6 @@ resource "google_compute_instance_template" "default" {

# [START compute_zonal_instance_group_manager_standby_policy_tag]
resource "google_compute_instance_group_manager" "default" {
provider = google-beta
name = "standby-mig"
base_instance_name = "test"
target_size = 3
Expand Down
69 changes: 69 additions & 0 deletions compute/zonal_mig_standby_policy_with_resize/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/**
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/** Made to resemble
* gcloud compute instance-groups managed update standby-mig \
* --standby-policy-mode=scale-out-pool \
* --standby-policy-initial-delay=50 \
* --target-size=1 \
* --suspended-size=1 \
* --stopped-size=2 \
* --zone=us-central1-f
*/

terraform {
required_providers {
google = {
source = "hashicorp/google"
version = ">= 6.16.0"
}
}
}

# [START compute_zonal_mig_standby_policy_with_resize_parent_tag]
resource "google_compute_instance_template" "default" {
name = "standby-mig-instance-template"
machine_type = "e2-medium"

disk {
source_image = "debian-cloud/debian-11"
}

network_interface {
network = "default"
}
}

# [START compute_zonal_mig_standby_policy_with_resize_tag]
resource "google_compute_instance_group_manager" "default" {
name = "standby-mig"
base_instance_name = "test"
target_size = 1
target_suspended_size = 1
target_stopped_size = 2
zone = "us-central1-f"

version {
instance_template = google_compute_instance_template.default.id
name = "primary"
}
standby_policy {
initial_delay_sec = 50
mode = "SCALE_OUT_POOL"
}
}
# [END compute_zonal_mig_standby_policy_with_resize_tag]
# [END compute_zonal_mig_standby_policy_with_resize_parent_tag]
Loading