Skip to content

Commit

Permalink
Merge branch 'main' into debug/escape-prune
Browse files Browse the repository at this point in the history
  • Loading branch information
glasnt authored Nov 14, 2023
2 parents af8a601 + cd42da4 commit fce9ab0
Showing 1 changed file with 62 additions and 0 deletions.
62 changes: 62 additions & 0 deletions compute/zonal_mig_set_autoscaling_basic/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/**
* Copyright 2023 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 set-autoscaling example-managed-instance-group \
* --max-num-replicas 20 \
* --target-cpu-utilization 0.60 \
* --cool-down-period 90
*/

# [START compute_zonal_mig_set_autoscaling_basic_parent_tag]
# [START compute_zonal_mig_set_autoscaling]
resource "google_compute_autoscaler" "default" {
name = "exmple-autoscaler"
zone = "us-central1-f"
target = google_compute_instance_group_manager.default.id

autoscaling_policy {
max_replicas = 20
min_replicas = 0
cooldown_period = 90

cpu_utilization {
target = 0.60
}
}
}
# [END compute_zonal_mig_set_autoscaling]

resource "google_compute_instance_template" "default" {
machine_type = "e2-medium"
disk {
source_image = "debian-cloud/debian-11"
}
network_interface {
network = "default"
}
}

resource "google_compute_instance_group_manager" "default" {
name = "example-managed-instance-group"
zone = "us-central1-f"
base_instance_name = "instance"

version {
instance_template = google_compute_instance_template.default.id
}
}
# [END compute_zonal_mig_set_autoscaling_basic_parent_tag]

0 comments on commit fce9ab0

Please sign in to comment.