diff --git a/google-beta/provider_test.go b/google-beta/provider_test.go index 601c3d7d01..dacfcac583 100644 --- a/google-beta/provider_test.go +++ b/google-beta/provider_test.go @@ -13,7 +13,6 @@ import ( ) var testAccProviders map[string]terraform.ResourceProvider -var testAccProvidersOiCS map[string]terraform.ResourceProvider var testAccProvider *schema.Provider var testAccRandomProvider *schema.Provider @@ -65,14 +64,6 @@ 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 cb1e1ab240..a50f9b0436 100644 --- a/google-beta/resource_cloud_scheduler_job_generated_test.go +++ b/google-beta/resource_cloud_scheduler_job_generated_test.go @@ -33,12 +33,18 @@ func TestAccCloudSchedulerJob_schedulerJobPubsubExample(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProvidersOiCS, + Providers: testAccProviders, CheckDestroy: testAccCheckCloudSchedulerJobDestroy, Steps: []resource.TestStep{ { Config: testAccCloudSchedulerJob_schedulerJobPubsubExample(context), }, + { + ResourceName: "google_cloud_scheduler_job.job", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"region"}, + }, }, }) } @@ -46,14 +52,10 @@ 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 * * * *" @@ -63,11 +65,6 @@ resource "google_cloud_scheduler_job" "job" { data = "${base64encode("test")}" } } - -provider "google-beta"{ - region = "us-central1" - zone = "us-central1-a" -} `, context) } @@ -80,12 +77,18 @@ func TestAccCloudSchedulerJob_schedulerJobHttpExample(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProvidersOiCS, + Providers: testAccProviders, CheckDestroy: testAccCheckCloudSchedulerJobDestroy, Steps: []resource.TestStep{ { Config: testAccCloudSchedulerJob_schedulerJobHttpExample(context), }, + { + ResourceName: "google_cloud_scheduler_job.job", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"region"}, + }, }, }) } @@ -93,8 +96,6 @@ 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 * * * *" @@ -105,11 +106,6 @@ resource "google_cloud_scheduler_job" "job" { uri = "https://example.com/ping" } } - -provider "google-beta"{ - region = "us-central1" - zone = "us-central1-a" -} `, context) } @@ -122,12 +118,18 @@ func TestAccCloudSchedulerJob_schedulerJobAppEngineExample(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProvidersOiCS, + Providers: testAccProviders, CheckDestroy: testAccCheckCloudSchedulerJobDestroy, Steps: []resource.TestStep{ { Config: testAccCloudSchedulerJob_schedulerJobAppEngineExample(context), }, + { + ResourceName: "google_cloud_scheduler_job.job", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"region"}, + }, }, }) } @@ -135,8 +137,6 @@ 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,11 +154,6 @@ 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 e32dbe5b5a..5f1d5e5cdc 100644 --- a/google-beta/resource_compute_autoscaler_generated_test.go +++ b/google-beta/resource_compute_autoscaler_generated_test.go @@ -24,106 +24,6 @@ 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() @@ -198,8 +98,10 @@ resource "google_compute_instance_group_manager" "foobar" { name = "my-igm-%{random_suffix}" zone = "us-central1-f" - instance_template = "${google_compute_instance_template.foobar.self_link}" - + 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" } 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 32ca03ee17..120a5f891a 100644 --- a/google-beta/resource_compute_managed_ssl_certificate_generated_test.go +++ b/google-beta/resource_compute_managed_ssl_certificate_generated_test.go @@ -33,12 +33,17 @@ func TestAccComputeManagedSslCertificate_managedSslCertificateBasicExample(t *te resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProvidersOiCS, + Providers: testAccProviders, CheckDestroy: testAccCheckComputeManagedSslCertificateDestroy, Steps: []resource.TestStep{ { Config: testAccComputeManagedSslCertificate_managedSslCertificateBasicExample(context), }, + { + ResourceName: "google_compute_managed_ssl_certificate.default", + ImportState: true, + ImportStateVerify: true, + }, }, }) } @@ -46,8 +51,6 @@ 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 { @@ -56,16 +59,12 @@ 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" @@ -88,8 +87,6 @@ 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" @@ -99,8 +96,6 @@ 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 @@ -108,34 +103,23 @@ 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 c0852fe161..3ca3285eec 100644 --- a/google-beta/resource_compute_region_autoscaler_generated_test.go +++ b/google-beta/resource_compute_region_autoscaler_generated_test.go @@ -24,106 +24,6 @@ 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() @@ -198,8 +98,10 @@ resource "google_compute_region_instance_group_manager" "foobar" { name = "my-region-igm-%{random_suffix}" region = "us-central1" - instance_template = "${google_compute_instance_template.foobar.self_link}" - + 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" } diff --git a/google-beta/resource_container_analysis_note_generated_test.go b/google-beta/resource_container_analysis_note_generated_test.go index 42bf05ab34..4a603a98ad 100644 --- a/google-beta/resource_container_analysis_note_generated_test.go +++ b/google-beta/resource_container_analysis_note_generated_test.go @@ -33,12 +33,17 @@ func TestAccContainerAnalysisNote_containerAnalysisNoteBasicExample(t *testing.T resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProvidersOiCS, + Providers: testAccProviders, CheckDestroy: testAccCheckContainerAnalysisNoteDestroy, Steps: []resource.TestStep{ { Config: testAccContainerAnalysisNote_containerAnalysisNoteBasicExample(context), }, + { + ResourceName: "google_container_analysis_note.note", + ImportState: true, + ImportStateVerify: true, + }, }, }) } @@ -46,8 +51,6 @@ 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 { @@ -55,11 +58,6 @@ 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 a10b2db44e..d29aa98878 100644 --- a/google-beta/resource_dns_policy_generated_test.go +++ b/google-beta/resource_dns_policy_generated_test.go @@ -33,12 +33,17 @@ func TestAccDnsPolicy_dnsPolicyBasicExample(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProvidersOiCS, + Providers: testAccProviders, 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 4b481c098c..d371f25d08 100644 --- a/google-beta/resource_filestore_instance_generated_test.go +++ b/google-beta/resource_filestore_instance_generated_test.go @@ -33,12 +33,18 @@ func TestAccFilestoreInstance_filestoreInstanceBasicExample(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProvidersOiCS, + Providers: testAccProviders, CheckDestroy: testAccCheckFilestoreInstanceDestroy, Steps: []resource.TestStep{ { Config: testAccFilestoreInstance_filestoreInstanceBasicExample(context), }, + { + ResourceName: "google_filestore_instance.instance", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"zone"}, + }, }, }) } @@ -46,8 +52,6 @@ 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" @@ -62,11 +66,6 @@ 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 305247183a..d87034018c 100644 --- a/website/docs/r/cloud_scheduler_job.html.markdown +++ b/website/docs/r/cloud_scheduler_job.html.markdown @@ -44,14 +44,10 @@ 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 * * * *" @@ -61,11 +57,6 @@ resource "google_cloud_scheduler_job" "job" { data = "${base64encode("test")}" } } - -provider "google-beta"{ - region = "us-central1" - zone = "us-central1-a" -} ```