Fix accidentally reverted OiCS changes (#3186)

Signed-off-by: Modular Magician <magic-modules@google.com>
This commit is contained in:
The Magician 2019-03-04 16:11:03 -08:00 committed by Riley Karson
parent 946f3b77c7
commit e0704943fc
4 changed files with 176 additions and 0 deletions

View File

@ -99,6 +99,7 @@ resource "google_compute_instance_group_manager" "foobar" {
zone = "us-central1-f"
instance_template = "${google_compute_instance_template.foobar.self_link}"
target_pools = ["${google_compute_target_pool.foobar.self_link}"]
base_instance_name = "foobar"
}

View File

@ -99,6 +99,7 @@ resource "google_compute_region_instance_group_manager" "foobar" {
region = "us-central1"
instance_template = "${google_compute_instance_template.foobar.self_link}"
target_pools = ["${google_compute_target_pool.foobar.self_link}"]
base_instance_name = "foobar"
}

View File

@ -34,6 +34,92 @@ To get more information about Autoscaler, see:
* How-to Guides
* [Autoscaling Groups of Instances](https://cloud.google.com/compute/docs/autoscaler/)
<div class = "oics-button" style="float: right; margin: 0 0 -15px">
<a href="https://console.cloud.google.com/cloudshell/open?cloudshell_git_repo=https%3A%2F%2Fgithub.com%2Fterraform-google-modules%2Fdocs-examples.git&cloudshell_working_dir=autoscaler_beta&cloudshell_image=gcr.io%2Fgraphite-cloud-shell-images%2Fterraform%3Alatest&open_in_editor=main.tf&cloudshell_print=.%2Fmotd&cloudshell_tutorial=.%2Ftutorial.md" target="_blank">
<img alt="Open in Cloud Shell" src="//gstatic.com/cloudssh/images/open-btn.svg" style="max-height: 44px; margin: 32px auto; max-width: 100%;">
</a>
</div>
## Example Usage - Autoscaler Beta
```hcl
resource "google_compute_autoscaler" "foobar" {
provider = "google-beta"
name = "my-autoscaler"
zone = "us-central1-f"
target = "${google_compute_instance_group_manager.foobar.self_link}"
autoscaling_policy {
max_replicas = 5
min_replicas = 1
cooldown_period = 60
cpu_utilization {
target = 0.5
}
}
}
resource "google_compute_instance_template" "foobar" {
provider = "google-beta"
name = "my-instance-template"
machine_type = "n1-standard-1"
can_ip_forward = false
tags = ["foo", "bar"]
disk {
source_image = "${data.google_compute_image.debian_9.self_link}"
}
network_interface {
network = "default"
}
metadata = {
foo = "bar"
}
service_account {
scopes = ["userinfo-email", "compute-ro", "storage-ro"]
}
}
resource "google_compute_target_pool" "foobar" {
provider = "google-beta"
name = "my-target-pool"
}
resource "google_compute_instance_group_manager" "foobar" {
provider = "google-beta"
name = "my-igm"
zone = "us-central1-f"
version {
instance_template = "${google_compute_instance_template.foobar.self_link}"
name = "primary"
}
target_pools = ["${google_compute_target_pool.foobar.self_link}"]
base_instance_name = "foobar"
}
data "google_compute_image" "debian_9" {
provider = "google-beta"
family = "debian-9"
project = "debian-cloud"
}
provider "google-beta"{
region = "us-central1"
zone = "us-central1-a"
}
```
<div class = "oics-button" style="float: right; margin: 0 0 -15px">
<a href="https://console.cloud.google.com/cloudshell/open?cloudshell_git_repo=https%3A%2F%2Fgithub.com%2Fterraform-google-modules%2Fdocs-examples.git&cloudshell_working_dir=autoscaler_basic&cloudshell_image=gcr.io%2Fgraphite-cloud-shell-images%2Fterraform%3Alatest&open_in_editor=main.tf&cloudshell_print=.%2Fmotd&cloudshell_tutorial=.%2Ftutorial.md" target="_blank">
<img alt="Open in Cloud Shell" src="//gstatic.com/cloudssh/images/open-btn.svg" style="max-height: 44px; margin: 32px auto; max-width: 100%;">
@ -92,6 +178,7 @@ resource "google_compute_instance_group_manager" "foobar" {
zone = "us-central1-f"
instance_template = "${google_compute_instance_template.foobar.self_link}"
target_pools = ["${google_compute_target_pool.foobar.self_link}"]
base_instance_name = "foobar"
}

View File

@ -34,6 +34,92 @@ To get more information about RegionAutoscaler, see:
* How-to Guides
* [Autoscaling Groups of Instances](https://cloud.google.com/compute/docs/autoscaler/)
<div class = "oics-button" style="float: right; margin: 0 0 -15px">
<a href="https://console.cloud.google.com/cloudshell/open?cloudshell_git_repo=https%3A%2F%2Fgithub.com%2Fterraform-google-modules%2Fdocs-examples.git&cloudshell_working_dir=region_autoscaler_beta&cloudshell_image=gcr.io%2Fgraphite-cloud-shell-images%2Fterraform%3Alatest&open_in_editor=main.tf&cloudshell_print=.%2Fmotd&cloudshell_tutorial=.%2Ftutorial.md" target="_blank">
<img alt="Open in Cloud Shell" src="//gstatic.com/cloudssh/images/open-btn.svg" style="max-height: 44px; margin: 32px auto; max-width: 100%;">
</a>
</div>
## Example Usage - Region Autoscaler Beta
```hcl
resource "google_compute_region_autoscaler" "foobar" {
provider = "google-beta"
name = "my-region-autoscaler"
region = "us-central1"
target = "${google_compute_region_instance_group_manager.foobar.self_link}"
autoscaling_policy {
max_replicas = 5
min_replicas = 1
cooldown_period = 60
cpu_utilization {
target = 0.5
}
}
}
resource "google_compute_instance_template" "foobar" {
provider = "google-beta"
name = "my-instance-template"
machine_type = "n1-standard-1"
can_ip_forward = false
tags = ["foo", "bar"]
disk {
source_image = "${data.google_compute_image.debian_9.self_link}"
}
network_interface {
network = "default"
}
metadata = {
foo = "bar"
}
service_account {
scopes = ["userinfo-email", "compute-ro", "storage-ro"]
}
}
resource "google_compute_target_pool" "foobar" {
provider = "google-beta"
name = "my-target-pool"
}
resource "google_compute_region_instance_group_manager" "foobar" {
provider = "google-beta"
name = "my-region-igm"
region = "us-central1"
version {
instance_template = "${google_compute_instance_template.foobar.self_link}"
name = "primary"
}
target_pools = ["${google_compute_target_pool.foobar.self_link}"]
base_instance_name = "foobar"
}
data "google_compute_image" "debian_9" {
provider = "google-beta"
family = "debian-9"
project = "debian-cloud"
}
provider "google-beta"{
region = "us-central1"
zone = "us-central1-a"
}
```
<div class = "oics-button" style="float: right; margin: 0 0 -15px">
<a href="https://console.cloud.google.com/cloudshell/open?cloudshell_git_repo=https%3A%2F%2Fgithub.com%2Fterraform-google-modules%2Fdocs-examples.git&cloudshell_working_dir=region_autoscaler_basic&cloudshell_image=gcr.io%2Fgraphite-cloud-shell-images%2Fterraform%3Alatest&open_in_editor=main.tf&cloudshell_print=.%2Fmotd&cloudshell_tutorial=.%2Ftutorial.md" target="_blank">
<img alt="Open in Cloud Shell" src="//gstatic.com/cloudssh/images/open-btn.svg" style="max-height: 44px; margin: 32px auto; max-width: 100%;">
@ -92,6 +178,7 @@ resource "google_compute_region_instance_group_manager" "foobar" {
region = "us-central1"
instance_template = "${google_compute_instance_template.foobar.self_link}"
target_pools = ["${google_compute_target_pool.foobar.self_link}"]
base_instance_name = "foobar"
}