From c34fa6de21b20a0f23307756336f9d2f67b89311 Mon Sep 17 00:00:00 2001 From: The Magician Date: Mon, 4 Mar 2019 14:28:06 -0800 Subject: [PATCH] Versioned OiCS Examples / Generated tests (#486) Signed-off-by: Modular Magician --- google-beta/provider_test.go | 9 ++ ...urce_cloud_scheduler_job_generated_test.go | 47 ++++---- ...ource_compute_autoscaler_generated_test.go | 106 +++++++++++++++++- ..._managed_ssl_certificate_generated_test.go | 28 ++++- ...ompute_region_autoscaler_generated_test.go | 106 +++++++++++++++++- ..._container_analysis_note_generated_test.go | 14 ++- .../resource_dns_policy_generated_test.go | 7 +- ...ource_filestore_instance_generated_test.go | 15 +-- .../docs/r/cloud_scheduler_job.html.markdown | 23 ++++ .../docs/r/compute_autoscaler.html.markdown | 88 ++++++++++++++- ...pute_managed_ssl_certificate.html.markdown | 21 ++++ .../r/compute_region_autoscaler.html.markdown | 88 ++++++++++++++- .../r/container_analysis_note.html.markdown | 7 ++ .../docs/r/filestore_instance.html.markdown | 7 ++ 14 files changed, 508 insertions(+), 58 deletions(-) diff --git a/google-beta/provider_test.go b/google-beta/provider_test.go index dacfcac583..601c3d7d01 100644 --- a/google-beta/provider_test.go +++ b/google-beta/provider_test.go @@ -13,6 +13,7 @@ import ( ) var testAccProviders map[string]terraform.ResourceProvider +var testAccProvidersOiCS map[string]terraform.ResourceProvider var testAccProvider *schema.Provider var testAccRandomProvider *schema.Provider @@ -64,6 +65,14 @@ func init() { "google": testAccProvider, "random": testAccRandomProvider, } + + // The OiCS provider map is used to ensure that OiCS examples use `google-beta` + // if the example is versioned as beta; normal beta tests should continue to + // use the standard provider map. + testAccProvidersOiCS = map[string]terraform.ResourceProvider{ + "google-beta": testAccProvider, + "random": testAccRandomProvider, + } } func TestProvider(t *testing.T) { diff --git a/google-beta/resource_cloud_scheduler_job_generated_test.go b/google-beta/resource_cloud_scheduler_job_generated_test.go index a50f9b0436..cb1e1ab240 100644 --- a/google-beta/resource_cloud_scheduler_job_generated_test.go +++ b/google-beta/resource_cloud_scheduler_job_generated_test.go @@ -33,18 +33,12 @@ func TestAccCloudSchedulerJob_schedulerJobPubsubExample(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + Providers: testAccProvidersOiCS, CheckDestroy: testAccCheckCloudSchedulerJobDestroy, Steps: []resource.TestStep{ { Config: testAccCloudSchedulerJob_schedulerJobPubsubExample(context), }, - { - ResourceName: "google_cloud_scheduler_job.job", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"region"}, - }, }, }) } @@ -52,10 +46,14 @@ func TestAccCloudSchedulerJob_schedulerJobPubsubExample(t *testing.T) { func testAccCloudSchedulerJob_schedulerJobPubsubExample(context map[string]interface{}) string { return Nprintf(` resource "google_pubsub_topic" "topic" { + provider = "google-beta" + name = "job-topic-%{random_suffix}" } resource "google_cloud_scheduler_job" "job" { + provider = "google-beta" + name = "test-job-%{random_suffix}" description = "test job" schedule = "*/2 * * * *" @@ -65,6 +63,11 @@ resource "google_cloud_scheduler_job" "job" { data = "${base64encode("test")}" } } + +provider "google-beta"{ + region = "us-central1" + zone = "us-central1-a" +} `, context) } @@ -77,18 +80,12 @@ func TestAccCloudSchedulerJob_schedulerJobHttpExample(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + Providers: testAccProvidersOiCS, CheckDestroy: testAccCheckCloudSchedulerJobDestroy, Steps: []resource.TestStep{ { Config: testAccCloudSchedulerJob_schedulerJobHttpExample(context), }, - { - ResourceName: "google_cloud_scheduler_job.job", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"region"}, - }, }, }) } @@ -96,6 +93,8 @@ func TestAccCloudSchedulerJob_schedulerJobHttpExample(t *testing.T) { func testAccCloudSchedulerJob_schedulerJobHttpExample(context map[string]interface{}) string { return Nprintf(` resource "google_cloud_scheduler_job" "job" { + provider = "google-beta" + name = "test-job-%{random_suffix}" description = "test http job" schedule = "*/8 * * * *" @@ -106,6 +105,11 @@ resource "google_cloud_scheduler_job" "job" { uri = "https://example.com/ping" } } + +provider "google-beta"{ + region = "us-central1" + zone = "us-central1-a" +} `, context) } @@ -118,18 +122,12 @@ func TestAccCloudSchedulerJob_schedulerJobAppEngineExample(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + Providers: testAccProvidersOiCS, CheckDestroy: testAccCheckCloudSchedulerJobDestroy, Steps: []resource.TestStep{ { Config: testAccCloudSchedulerJob_schedulerJobAppEngineExample(context), }, - { - ResourceName: "google_cloud_scheduler_job.job", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"region"}, - }, }, }) } @@ -137,6 +135,8 @@ func TestAccCloudSchedulerJob_schedulerJobAppEngineExample(t *testing.T) { func testAccCloudSchedulerJob_schedulerJobAppEngineExample(context map[string]interface{}) string { return Nprintf(` resource "google_cloud_scheduler_job" "job" { + provider = "google-beta" + name = "test-job-%{random_suffix}" schedule = "*/4 * * * *" description = "test app engine job" @@ -154,6 +154,11 @@ resource "google_cloud_scheduler_job" "job" { relative_uri = "/ping" } } + +provider "google-beta"{ + region = "us-central1" + zone = "us-central1-a" +} `, context) } diff --git a/google-beta/resource_compute_autoscaler_generated_test.go b/google-beta/resource_compute_autoscaler_generated_test.go index 5f1d5e5cdc..e32dbe5b5a 100644 --- a/google-beta/resource_compute_autoscaler_generated_test.go +++ b/google-beta/resource_compute_autoscaler_generated_test.go @@ -24,6 +24,106 @@ import ( "github.com/hashicorp/terraform/terraform" ) +func TestAccComputeAutoscaler_autoscalerBetaExample(t *testing.T) { + t.Parallel() + + context := map[string]interface{}{ + "random_suffix": acctest.RandString(10), + } + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProvidersOiCS, + CheckDestroy: testAccCheckComputeAutoscalerDestroy, + Steps: []resource.TestStep{ + { + Config: testAccComputeAutoscaler_autoscalerBetaExample(context), + }, + }, + }) +} + +func testAccComputeAutoscaler_autoscalerBetaExample(context map[string]interface{}) string { + return Nprintf(` +resource "google_compute_autoscaler" "foobar" { + provider = "google-beta" + + name = "my-autoscaler-%{random_suffix}" + 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-%{random_suffix}" + 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-%{random_suffix}" +} + +resource "google_compute_instance_group_manager" "foobar" { + provider = "google-beta" + + name = "my-igm-%{random_suffix}" + 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" +} +`, context) +} + func TestAccComputeAutoscaler_autoscalerBasicExample(t *testing.T) { t.Parallel() @@ -98,10 +198,8 @@ resource "google_compute_instance_group_manager" "foobar" { name = "my-igm-%{random_suffix}" zone = "us-central1-f" - version { - instance_template = "${google_compute_instance_template.foobar.self_link}" - name = "primary" - } + instance_template = "${google_compute_instance_template.foobar.self_link}" + target_pools = ["${google_compute_target_pool.foobar.self_link}"] base_instance_name = "foobar" } diff --git a/google-beta/resource_compute_managed_ssl_certificate_generated_test.go b/google-beta/resource_compute_managed_ssl_certificate_generated_test.go index 120a5f891a..32ca03ee17 100644 --- a/google-beta/resource_compute_managed_ssl_certificate_generated_test.go +++ b/google-beta/resource_compute_managed_ssl_certificate_generated_test.go @@ -33,17 +33,12 @@ func TestAccComputeManagedSslCertificate_managedSslCertificateBasicExample(t *te resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + Providers: testAccProvidersOiCS, CheckDestroy: testAccCheckComputeManagedSslCertificateDestroy, Steps: []resource.TestStep{ { Config: testAccComputeManagedSslCertificate_managedSslCertificateBasicExample(context), }, - { - ResourceName: "google_compute_managed_ssl_certificate.default", - ImportState: true, - ImportStateVerify: true, - }, }, }) } @@ -51,6 +46,8 @@ func TestAccComputeManagedSslCertificate_managedSslCertificateBasicExample(t *te func testAccComputeManagedSslCertificate_managedSslCertificateBasicExample(context map[string]interface{}) string { return Nprintf(` resource "google_compute_managed_ssl_certificate" "default" { + provider = "google-beta" + name = "test-cert-%{random_suffix}" managed { @@ -59,12 +56,16 @@ resource "google_compute_managed_ssl_certificate" "default" { } resource "google_compute_target_https_proxy" "default" { + provider = "google-beta" + name = "test-proxy-%{random_suffix}" url_map = "${google_compute_url_map.default.self_link}" ssl_certificates = ["${google_compute_managed_ssl_certificate.default.self_link}"] } resource "google_compute_url_map" "default" { + provider = "google-beta" + name = "url-map-%{random_suffix}" description = "a description" @@ -87,6 +88,8 @@ resource "google_compute_url_map" "default" { } resource "google_compute_backend_service" "default" { + provider = "google-beta" + name = "backend-service-%{random_suffix}" port_name = "http" protocol = "HTTP" @@ -96,6 +99,8 @@ resource "google_compute_backend_service" "default" { } resource "google_compute_http_health_check" "default" { + provider = "google-beta" + name = "http-health-check-%{random_suffix}" request_path = "/" check_interval_sec = 1 @@ -103,23 +108,34 @@ resource "google_compute_http_health_check" "default" { } resource "google_dns_managed_zone" "zone" { + provider = "google-beta" + name = "dnszone-%{random_suffix}" dns_name = "sslcert.tf-test.club." } resource "google_compute_global_forwarding_rule" "default" { + provider = "google-beta" + name = "forwarding-rule-%{random_suffix}" target = "${google_compute_target_https_proxy.default.self_link}" port_range = 443 } resource "google_dns_record_set" "set" { + provider = "google-beta" + name = "sslcert.tf-test.club." type = "A" ttl = 3600 managed_zone = "${google_dns_managed_zone.zone.name}" rrdatas = ["${google_compute_global_forwarding_rule.default.ip_address}"] } + +provider "google-beta"{ + region = "us-central1" + zone = "us-central1-a" +} `, context) } diff --git a/google-beta/resource_compute_region_autoscaler_generated_test.go b/google-beta/resource_compute_region_autoscaler_generated_test.go index 3ca3285eec..c0852fe161 100644 --- a/google-beta/resource_compute_region_autoscaler_generated_test.go +++ b/google-beta/resource_compute_region_autoscaler_generated_test.go @@ -24,6 +24,106 @@ import ( "github.com/hashicorp/terraform/terraform" ) +func TestAccComputeRegionAutoscaler_regionAutoscalerBetaExample(t *testing.T) { + t.Parallel() + + context := map[string]interface{}{ + "random_suffix": acctest.RandString(10), + } + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProvidersOiCS, + CheckDestroy: testAccCheckComputeRegionAutoscalerDestroy, + Steps: []resource.TestStep{ + { + Config: testAccComputeRegionAutoscaler_regionAutoscalerBetaExample(context), + }, + }, + }) +} + +func testAccComputeRegionAutoscaler_regionAutoscalerBetaExample(context map[string]interface{}) string { + return Nprintf(` +resource "google_compute_region_autoscaler" "foobar" { + provider = "google-beta" + + name = "my-region-autoscaler-%{random_suffix}" + 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-%{random_suffix}" + 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-%{random_suffix}" +} + +resource "google_compute_region_instance_group_manager" "foobar" { + provider = "google-beta" + + name = "my-region-igm-%{random_suffix}" + 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" +} +`, context) +} + func TestAccComputeRegionAutoscaler_regionAutoscalerBasicExample(t *testing.T) { t.Parallel() @@ -98,10 +198,8 @@ resource "google_compute_region_instance_group_manager" "foobar" { name = "my-region-igm-%{random_suffix}" region = "us-central1" - version { - instance_template = "${google_compute_instance_template.foobar.self_link}" - name = "primary" - } + instance_template = "${google_compute_instance_template.foobar.self_link}" + target_pools = ["${google_compute_target_pool.foobar.self_link}"] base_instance_name = "foobar" } diff --git a/google-beta/resource_container_analysis_note_generated_test.go b/google-beta/resource_container_analysis_note_generated_test.go index 4a603a98ad..42bf05ab34 100644 --- a/google-beta/resource_container_analysis_note_generated_test.go +++ b/google-beta/resource_container_analysis_note_generated_test.go @@ -33,17 +33,12 @@ func TestAccContainerAnalysisNote_containerAnalysisNoteBasicExample(t *testing.T resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + Providers: testAccProvidersOiCS, CheckDestroy: testAccCheckContainerAnalysisNoteDestroy, Steps: []resource.TestStep{ { Config: testAccContainerAnalysisNote_containerAnalysisNoteBasicExample(context), }, - { - ResourceName: "google_container_analysis_note.note", - ImportState: true, - ImportStateVerify: true, - }, }, }) } @@ -51,6 +46,8 @@ func TestAccContainerAnalysisNote_containerAnalysisNoteBasicExample(t *testing.T func testAccContainerAnalysisNote_containerAnalysisNoteBasicExample(context map[string]interface{}) string { return Nprintf(` resource "google_container_analysis_note" "note" { + provider = "google-beta" + name = "test-attestor-note-%{random_suffix}" attestation_authority { hint { @@ -58,6 +55,11 @@ resource "google_container_analysis_note" "note" { } } } + +provider "google-beta"{ + region = "us-central1" + zone = "us-central1-a" +} `, context) } diff --git a/google-beta/resource_dns_policy_generated_test.go b/google-beta/resource_dns_policy_generated_test.go index d29aa98878..a10b2db44e 100644 --- a/google-beta/resource_dns_policy_generated_test.go +++ b/google-beta/resource_dns_policy_generated_test.go @@ -33,17 +33,12 @@ func TestAccDnsPolicy_dnsPolicyBasicExample(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + Providers: testAccProvidersOiCS, CheckDestroy: testAccCheckDnsPolicyDestroy, Steps: []resource.TestStep{ { Config: testAccDnsPolicy_dnsPolicyBasicExample(context), }, - { - ResourceName: "google_dns_policy.example-policy", - ImportState: true, - ImportStateVerify: true, - }, }, }) } diff --git a/google-beta/resource_filestore_instance_generated_test.go b/google-beta/resource_filestore_instance_generated_test.go index d371f25d08..4b481c098c 100644 --- a/google-beta/resource_filestore_instance_generated_test.go +++ b/google-beta/resource_filestore_instance_generated_test.go @@ -33,18 +33,12 @@ func TestAccFilestoreInstance_filestoreInstanceBasicExample(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + Providers: testAccProvidersOiCS, CheckDestroy: testAccCheckFilestoreInstanceDestroy, Steps: []resource.TestStep{ { Config: testAccFilestoreInstance_filestoreInstanceBasicExample(context), }, - { - ResourceName: "google_filestore_instance.instance", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"zone"}, - }, }, }) } @@ -52,6 +46,8 @@ func TestAccFilestoreInstance_filestoreInstanceBasicExample(t *testing.T) { func testAccFilestoreInstance_filestoreInstanceBasicExample(context map[string]interface{}) string { return Nprintf(` resource "google_filestore_instance" "instance" { + provider = "google-beta" + name = "test-instance-%{random_suffix}" zone = "us-central1-b" tier = "PREMIUM" @@ -66,6 +62,11 @@ resource "google_filestore_instance" "instance" { modes = ["MODE_IPV4"] } } + +provider "google-beta"{ + region = "us-central1" + zone = "us-central1-a" +} `, context) } diff --git a/website/docs/r/cloud_scheduler_job.html.markdown b/website/docs/r/cloud_scheduler_job.html.markdown index d87034018c..305247183a 100644 --- a/website/docs/r/cloud_scheduler_job.html.markdown +++ b/website/docs/r/cloud_scheduler_job.html.markdown @@ -44,10 +44,14 @@ To get more information about Job, see: ```hcl resource "google_pubsub_topic" "topic" { + provider = "google-beta" + name = "job-topic" } resource "google_cloud_scheduler_job" "job" { + provider = "google-beta" + name = "test-job" description = "test job" schedule = "*/2 * * * *" @@ -57,6 +61,11 @@ resource "google_cloud_scheduler_job" "job" { data = "${base64encode("test")}" } } + +provider "google-beta"{ + region = "us-central1" + zone = "us-central1-a" +} ```
@@ -68,6 +77,8 @@ resource "google_cloud_scheduler_job" "job" { ```hcl resource "google_cloud_scheduler_job" "job" { + provider = "google-beta" + name = "test-job" description = "test http job" schedule = "*/8 * * * *" @@ -78,6 +89,11 @@ resource "google_cloud_scheduler_job" "job" { uri = "https://example.com/ping" } } + +provider "google-beta"{ + region = "us-central1" + zone = "us-central1-a" +} ```
@@ -89,6 +105,8 @@ resource "google_cloud_scheduler_job" "job" { ```hcl resource "google_cloud_scheduler_job" "job" { + provider = "google-beta" + name = "test-job" schedule = "*/4 * * * *" description = "test app engine job" @@ -106,6 +124,11 @@ resource "google_cloud_scheduler_job" "job" { relative_uri = "/ping" } } + +provider "google-beta"{ + region = "us-central1" + zone = "us-central1-a" +} ``` ## Argument Reference diff --git a/website/docs/r/compute_autoscaler.html.markdown b/website/docs/r/compute_autoscaler.html.markdown index 21a749e6c7..22331c021d 100644 --- a/website/docs/r/compute_autoscaler.html.markdown +++ b/website/docs/r/compute_autoscaler.html.markdown @@ -35,15 +35,17 @@ To get more information about Autoscaler, see: * [Autoscaling Groups of Instances](https://cloud.google.com/compute/docs/autoscaler/) -## Example Usage - Autoscaler Basic +## 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}" @@ -60,6 +62,8 @@ resource "google_compute_autoscaler" "foobar" { } resource "google_compute_instance_template" "foobar" { + provider = "google-beta" + name = "my-instance-template" machine_type = "n1-standard-1" can_ip_forward = false @@ -84,10 +88,14 @@ resource "google_compute_instance_template" "foobar" { } 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" @@ -95,6 +103,82 @@ resource "google_compute_instance_group_manager" "foobar" { 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" +} +``` + +## Example Usage - Autoscaler Basic + + +```hcl +resource "google_compute_autoscaler" "foobar" { + 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" { + 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" { + name = "my-target-pool" +} + +resource "google_compute_instance_group_manager" "foobar" { + name = "my-igm" + 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" } diff --git a/website/docs/r/compute_managed_ssl_certificate.html.markdown b/website/docs/r/compute_managed_ssl_certificate.html.markdown index f4a09acf57..2c6eb0cae9 100644 --- a/website/docs/r/compute_managed_ssl_certificate.html.markdown +++ b/website/docs/r/compute_managed_ssl_certificate.html.markdown @@ -60,6 +60,8 @@ In conclusion: Be extremely cautious. ```hcl resource "google_compute_managed_ssl_certificate" "default" { + provider = "google-beta" + name = "test-cert" managed { @@ -68,12 +70,16 @@ resource "google_compute_managed_ssl_certificate" "default" { } resource "google_compute_target_https_proxy" "default" { + provider = "google-beta" + name = "test-proxy" url_map = "${google_compute_url_map.default.self_link}" ssl_certificates = ["${google_compute_managed_ssl_certificate.default.self_link}"] } resource "google_compute_url_map" "default" { + provider = "google-beta" + name = "url-map" description = "a description" @@ -96,6 +102,8 @@ resource "google_compute_url_map" "default" { } resource "google_compute_backend_service" "default" { + provider = "google-beta" + name = "backend-service" port_name = "http" protocol = "HTTP" @@ -105,6 +113,8 @@ resource "google_compute_backend_service" "default" { } resource "google_compute_http_health_check" "default" { + provider = "google-beta" + name = "http-health-check" request_path = "/" check_interval_sec = 1 @@ -112,23 +122,34 @@ resource "google_compute_http_health_check" "default" { } resource "google_dns_managed_zone" "zone" { + provider = "google-beta" + name = "dnszone" dns_name = "sslcert.tf-test.club." } resource "google_compute_global_forwarding_rule" "default" { + provider = "google-beta" + name = "forwarding-rule" target = "${google_compute_target_https_proxy.default.self_link}" port_range = 443 } resource "google_dns_record_set" "set" { + provider = "google-beta" + name = "sslcert.tf-test.club." type = "A" ttl = 3600 managed_zone = "${google_dns_managed_zone.zone.name}" rrdatas = ["${google_compute_global_forwarding_rule.default.ip_address}"] } + +provider "google-beta"{ + region = "us-central1" + zone = "us-central1-a" +} ``` ## Argument Reference diff --git a/website/docs/r/compute_region_autoscaler.html.markdown b/website/docs/r/compute_region_autoscaler.html.markdown index 542c3e397d..6f3fc8166a 100644 --- a/website/docs/r/compute_region_autoscaler.html.markdown +++ b/website/docs/r/compute_region_autoscaler.html.markdown @@ -35,15 +35,17 @@ To get more information about RegionAutoscaler, see: * [Autoscaling Groups of Instances](https://cloud.google.com/compute/docs/autoscaler/) -## Example Usage - Region Autoscaler Basic +## 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}" @@ -60,6 +62,8 @@ resource "google_compute_region_autoscaler" "foobar" { } resource "google_compute_instance_template" "foobar" { + provider = "google-beta" + name = "my-instance-template" machine_type = "n1-standard-1" can_ip_forward = false @@ -84,10 +88,14 @@ resource "google_compute_instance_template" "foobar" { } 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" @@ -95,6 +103,82 @@ resource "google_compute_region_instance_group_manager" "foobar" { 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" +} +``` + +## Example Usage - Region Autoscaler Basic + + +```hcl +resource "google_compute_region_autoscaler" "foobar" { + 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" { + 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" { + name = "my-target-pool" +} + +resource "google_compute_region_instance_group_manager" "foobar" { + name = "my-region-igm" + 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" } diff --git a/website/docs/r/container_analysis_note.html.markdown b/website/docs/r/container_analysis_note.html.markdown index 0d8c548b0f..175062a806 100644 --- a/website/docs/r/container_analysis_note.html.markdown +++ b/website/docs/r/container_analysis_note.html.markdown @@ -42,6 +42,8 @@ To get more information about Note, see: ```hcl resource "google_container_analysis_note" "note" { + provider = "google-beta" + name = "test-attestor-note" attestation_authority { hint { @@ -49,6 +51,11 @@ resource "google_container_analysis_note" "note" { } } } + +provider "google-beta"{ + region = "us-central1" + zone = "us-central1-a" +} ``` ## Argument Reference diff --git a/website/docs/r/filestore_instance.html.markdown b/website/docs/r/filestore_instance.html.markdown index 916dcdbc63..038bd834e8 100644 --- a/website/docs/r/filestore_instance.html.markdown +++ b/website/docs/r/filestore_instance.html.markdown @@ -44,6 +44,8 @@ To get more information about Instance, see: ```hcl resource "google_filestore_instance" "instance" { + provider = "google-beta" + name = "test-instance" zone = "us-central1-b" tier = "PREMIUM" @@ -58,6 +60,11 @@ resource "google_filestore_instance" "instance" { modes = ["MODE_IPV4"] } } + +provider "google-beta"{ + region = "us-central1" + zone = "us-central1-a" +} ``` ## Argument Reference