...

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

Documentation: github.com/GoogleCloudPlatform/k8s-config-connector/scripts/resource-autogen/generated/samples/Compute-ComputeRegionAutoscaler-region_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_region_autoscaler" "foobar" {
    19  name   = "my-region-autoscaler"
    20  region = "us-central1"
    21  target = google_compute_region_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-standard-4"
    37
    38  disk {
    39    source_image = "debian-cloud/debian-11"
    40    disk_size_gb = 250
    41  }
    42
    43  network_interface {
    44    network = "default"
    45
    46    # secret default
    47    access_config {
    48      network_tier = "PREMIUM"
    49    }
    50  }
    51
    52  # secret default
    53  service_account {
    54    scopes = [
    55      "https://www.googleapis.com/auth/devstorage.read_only",
    56      "https://www.googleapis.com/auth/logging.write",
    57      "https://www.googleapis.com/auth/monitoring.write",
    58      "https://www.googleapis.com/auth/pubsub",
    59      "https://www.googleapis.com/auth/service.management.readonly",
    60      "https://www.googleapis.com/auth/servicecontrol",
    61      "https://www.googleapis.com/auth/trace.append",
    62    ]
    63  }
    64}
    65
    66resource "google_compute_target_pool" "foobar" {
    67  name = "my-target-pool"
    68}
    69
    70resource "google_compute_region_instance_group_manager" "foobar" {
    71  name   = "my-region-igm"
    72  region = "us-central1"
    73
    74  version {
    75    instance_template  = google_compute_instance_template.foobar.id
    76    name               = "primary"
    77  }
    78
    79  target_pools       = [google_compute_target_pool.foobar.id]
    80  base_instance_name = "foobar"
    81}
    82
    83data "google_compute_image" "debian_9" {
    84  family  = "debian-11"
    85  project = "debian-cloud"
    86}
    87```

View as plain text