...

Text file src/github.com/GoogleCloudPlatform/k8s-config-connector/scripts/resource-autogen/generated/samples/Compute-ComputeAutoscaler-autoscaler_basic/main.tf

Documentation: github.com/GoogleCloudPlatform/k8s-config-connector/scripts/resource-autogen/generated/samples/Compute-ComputeAutoscaler-autoscaler_basic

     1/**
     2 * Copyright 2022 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```hcl
    18resource "google_compute_autoscaler" "foobar" {
    19  name   = "my-autoscaler"
    20  zone   = "us-central1-f"
    21  target = google_compute_instance_group_manager.foobar.id
    22
    23  autoscaling_policy {
    24    max_replicas    = 5
    25    min_replicas    = 1
    26    cooldown_period = 60
    27
    28    cpu_utilization {
    29      target = 0.5
    30    }
    31  }
    32}
    33
    34resource "google_compute_instance_template" "foobar" {
    35  name           = "my-instance-template"
    36  machine_type   = "e2-medium"
    37  can_ip_forward = false
    38
    39  tags = ["foo", "bar"]
    40
    41  disk {
    42    source_image = data.google_compute_image.debian_9.id
    43  }
    44
    45  network_interface {
    46    network = "default"
    47  }
    48
    49  metadata = {
    50    foo = "bar"
    51  }
    52
    53  service_account {
    54    scopes = ["userinfo-email", "compute-ro", "storage-ro"]
    55  }
    56}
    57
    58resource "google_compute_target_pool" "foobar" {
    59  name = "my-target-pool"
    60}
    61
    62resource "google_compute_instance_group_manager" "foobar" {
    63  name = "my-igm"
    64  zone = "us-central1-f"
    65
    66  version {
    67    instance_template  = google_compute_instance_template.foobar.id
    68    name               = "primary"
    69  }
    70
    71  target_pools       = [google_compute_target_pool.foobar.id]
    72  base_instance_name = "foobar"
    73}
    74
    75data "google_compute_image" "debian_9" {
    76  family  = "debian-11"
    77  project = "debian-cloud"
    78}
    79```

View as plain text