From 05961a716f5f5a85f1192a781096ed8aec0b6810 Mon Sep 17 00:00:00 2001 From: Shuya Ma <87669292+shuyama1@users.noreply.github.com> Date: Wed, 28 Jun 2023 09:34:42 -0700 Subject: [PATCH 01/55] fix `Get to know general workflow for VCR tests` details shortcodes for MM docsite (#8225) --- docs/content/get-started/contributing.md | 25 ++++++++++++------------ 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/docs/content/get-started/contributing.md b/docs/content/get-started/contributing.md index fe14834e2450..5d6b396271a2 100644 --- a/docs/content/get-started/contributing.md +++ b/docs/content/get-started/contributing.md @@ -33,19 +33,18 @@ aliases: 1. Get approval to start Clould Builder jobs from the reviewer if you're an community contributor 1. Wait for the the modules magician to generate downstream diff (which should take about 15 mins after creating the PR) to make sure all changes are generated correctly in downstream repos. 1. Wait for the VCR test results. - {{< details "Get to know general workflow for VCR tests" >}} - - 1. Submit your change. - 1. The recorded tests are ran against your changes by the `modular-magician`. Tests will fail if: - 1. Your PR has changed the HTTP request values sent by the provider - 1. Your PR does not change the HTTP request values, but fails on the values returned in an old recording - 1. The recordings are out of sync with the merge-base of your PR, and an unrelated contributor's change has caused a false positive - 1. The `modular-magician` will leave a message indicating the number of passing and failing VCR tests. If there is a failure, the `modular-magician` user will leave a message indicating the "`Triggering VCR tests in RECORDING mode for the following tests that failed during VCR:`" marking which tests failed. - 1. If a test does not appear related to your PR, it probably isn't! - 1. The `modular-magician` will kick off a second test run targeting only the failed tests, this time hitting the live GCP APIs. If there are tests that fail at this point, a message stating `Tests failed during RECORDING mode:` will be left indicating the tests. - 1. If a test that appears to be related to your change has failed here, it's likely your change has introduced an issue. You can view the debug logs for the test by clicking the "view" link beside the test case to attempt to debug what's going wrong. - 1. If a test that appears to be completely unrelated has failed, it's possible that a GCP API has changed in a way that broke the provider or our environment capped on a quota. - {{< /details >}} +{{< details "Get to know general workflow for VCR tests" >}} + 1. Submit your change. + 1. The recorded tests are ran against your changes by the `modular-magician`. Tests will fail if: + * Your PR has changed the HTTP request values sent by the provider + * Your PR does not change the HTTP request values, but fails on the values returned in an old recording + * The recordings are out of sync with the merge-base of your PR, and an unrelated contributor's change has caused a false positive + 1. The `modular-magician` will leave a message indicating the number of passing and failing VCR tests. If there is a failure, the `modular-magician` user will leave a message indicating the "`Triggering VCR tests in RECORDING mode for the following tests that failed during VCR:`" marking which tests failed. + * If a test does not appear related to your PR, it probably isn't! + 1. The `modular-magician` will kick off a second test run targeting only the failed tests, this time hitting the live GCP APIs. If there are tests that fail at this point, a message stating `Tests failed during RECORDING mode:` will be left indicating the tests. + * If a test that appears to be related to your change has failed here, it's likely your change has introduced an issue. You can view the debug logs for the test by clicking the "view" link beside the test case to attempt to debug what's going wrong. + * If a test that appears to be completely unrelated has failed, it's possible that a GCP API has changed in a way that broke the provider or our environment capped on a quota. +{{< /details >}} Where possible, take a look at the logs and see if you can figure out what needs to be fixed related to your change. The false positive rate on these tests is extremely high between changes in the API, Cloud Build bugs, and eventual consistency issues in test recordings so we don't expect contributors to wholly interpret the results — that's the responsibility of your reviewer. From 6736c445d84584f66b0f6f0f76d58d4e61c542dc Mon Sep 17 00:00:00 2001 From: golemiso <3282656+golemiso@users.noreply.github.com> Date: Thu, 29 Jun 2023 01:40:27 +0900 Subject: [PATCH 02/55] Fix condition to fetch id token from API (#8195) --- .../data_source_google_service_account_id_token.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/mmv1/third_party/terraform/services/resourcemanager/data_source_google_service_account_id_token.go b/mmv1/third_party/terraform/services/resourcemanager/data_source_google_service_account_id_token.go index 0983d5f97a8a..efbd3f46d0f2 100644 --- a/mmv1/third_party/terraform/services/resourcemanager/data_source_google_service_account_id_token.go +++ b/mmv1/third_party/terraform/services/resourcemanager/data_source_google_service_account_id_token.go @@ -77,12 +77,13 @@ func dataSourceGoogleServiceAccountIdTokenRead(d *schema.ResourceData, meta inte return fmt.Errorf("error calling getCredentials(): %v", err) } - // If the source credential is not a service account key, use the API to generate the idToken - if creds.JSON == nil { + targetServiceAccount := d.Get("target_service_account").(string) + // If a target service account is provided, use the API to generate the idToken + if targetServiceAccount != "" { // Use // https://cloud.google.com/iam/docs/reference/credentials/rest/v1/projects.serviceAccounts/generateIdToken service := config.NewIamCredentialsClient(userAgent) - name := fmt.Sprintf("projects/-/serviceAccounts/%s", d.Get("target_service_account").(string)) + name := fmt.Sprintf("projects/-/serviceAccounts/%s", targetServiceAccount) tokenRequest := &iamcredentials.GenerateIdTokenRequest{ Audience: targetAudience, IncludeEmail: d.Get("include_email").(bool), @@ -93,7 +94,7 @@ func dataSourceGoogleServiceAccountIdTokenRead(d *schema.ResourceData, meta inte return fmt.Errorf("error calling iamcredentials.GenerateIdToken: %v", err) } - d.SetId(d.Get("target_service_account").(string)) + d.SetId(targetServiceAccount) if err := d.Set("id_token", at.Token); err != nil { return fmt.Errorf("Error setting id_token: %s", err) } From 19b6cb5d7296b305f0523cef989eded98afbf83f Mon Sep 17 00:00:00 2001 From: Riley Karson Date: Wed, 28 Jun 2023 11:10:03 -0700 Subject: [PATCH 03/55] Remove several GKE version constraints in tests, bump those <1.25 to 1.27 (#8218) --- .../resource_container_cluster_test.go.erb | 32 ++++--------------- .../resource_container_node_pool_test.go.erb | 12 +++---- .../using_gke_with_terraform.html.markdown | 2 +- 3 files changed, 13 insertions(+), 33 deletions(-) diff --git a/mmv1/third_party/terraform/tests/resource_container_cluster_test.go.erb b/mmv1/third_party/terraform/tests/resource_container_cluster_test.go.erb index 103798dab105..b6bd192375ca 100644 --- a/mmv1/third_party/terraform/tests/resource_container_cluster_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_container_cluster_test.go.erb @@ -2630,7 +2630,7 @@ func TestAccContainerCluster_withMonitoringConfig(t *testing.T) { CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccContainerCluster_basic_1_23_16(clusterName), + Config: testAccContainerCluster_basic(clusterName), }, { ResourceName: "google_container_cluster.primary", @@ -2656,7 +2656,6 @@ func TestAccContainerCluster_withMonitoringConfig(t *testing.T) { ImportStateVerify: true, ImportStateVerifyIgnore: []string{"min_master_version"}, }, - <% if version == "beta" -%> { Config: testAccContainerCluster_withMonitoringConfigUpdated(clusterName), }, @@ -2666,7 +2665,6 @@ func TestAccContainerCluster_withMonitoringConfig(t *testing.T) { ImportStateVerify: true, ImportStateVerifyIgnore: []string{"min_master_version"}, }, - <% end -%> { Config: testAccContainerCluster_withMonitoringConfigPrometheusUpdated(clusterName), }, @@ -2678,7 +2676,7 @@ func TestAccContainerCluster_withMonitoringConfig(t *testing.T) { }, // Back to basic settings to test setting Prometheus on its own { - Config: testAccContainerCluster_basic_1_23_16(clusterName), + Config: testAccContainerCluster_basic(clusterName), }, { ResourceName: "google_container_cluster.primary", @@ -2696,7 +2694,7 @@ func TestAccContainerCluster_withMonitoringConfig(t *testing.T) { ImportStateVerifyIgnore: []string{"min_master_version"}, }, { - Config: testAccContainerCluster_basic_1_23_16(clusterName), + Config: testAccContainerCluster_basic(clusterName), }, { ResourceName: "google_container_cluster.primary", @@ -6473,7 +6471,7 @@ resource "google_container_cluster" "with_pco_disabled" { network = google_compute_network.container_network.name subnetwork = google_compute_subnetwork.container_subnetwork.name - min_master_version = "1.23" + min_master_version = "1.27" initial_node_count = 1 datapath_provider = "ADVANCED_DATAPATH" @@ -7375,17 +7373,6 @@ resource "google_container_cluster" "primary" { `, name) } -func testAccContainerCluster_basic_1_23_16(name string) string { - return fmt.Sprintf(` -resource "google_container_cluster" "primary" { - name = "%s" - location = "us-central1-a" - initial_node_count = 1 - min_master_version = "1.23.16-gke.200" -} -`, name) -} - func testAccContainerCluster_withMonitoringConfigEnabled(name string) string { return fmt.Sprintf(` data "google_container_engine_versions" "uscentral1a" { @@ -7396,7 +7383,6 @@ resource "google_container_cluster" "primary" { name = "%s" location = "us-central1-a" initial_node_count = 1 - min_master_version = "1.23.16-gke.200" monitoring_config { enable_components = [ "SYSTEM_COMPONENTS", "APISERVER", "CONTROLLER_MANAGER", "SCHEDULER" ] } @@ -7417,21 +7403,18 @@ resource "google_container_cluster" "primary" { `, name) } -<% if version == "beta" -%> func testAccContainerCluster_withMonitoringConfigUpdated(name string) string { return fmt.Sprintf(` resource "google_container_cluster" "primary" { name = "%s" location = "us-central1-a" initial_node_count = 1 - min_master_version = "1.23.16-gke.200" monitoring_config { - enable_components = [ "SYSTEM_COMPONENTS", "APISERVER", "CONTROLLER_MANAGER", "SCHEDULER", "WORKLOADS" ] + enable_components = [ "SYSTEM_COMPONENTS", "APISERVER", "CONTROLLER_MANAGER" ] } } `, name) } -<% end -%> func testAccContainerCluster_withMonitoringConfigPrometheusUpdated(name string) string { return fmt.Sprintf(` @@ -7439,7 +7422,6 @@ resource "google_container_cluster" "primary" { name = "%s" location = "us-central1-a" initial_node_count = 1 - min_master_version = "1.23.16-gke.200" monitoring_config { enable_components = [ "SYSTEM_COMPONENTS", "APISERVER", "CONTROLLER_MANAGER", "SCHEDULER" ] managed_prometheus { @@ -7456,7 +7438,6 @@ resource "google_container_cluster" "primary" { name = "%s" location = "us-central1-a" initial_node_count = 1 - min_master_version = "1.23.16-gke.200" monitoring_config { enable_components = [] managed_prometheus { @@ -7499,7 +7480,6 @@ resource "google_container_cluster" "primary" { `, name, name, name) } - <% unless version == 'ga' -%> func testAccContainerCluster_withTPUConfig(network, cluster string) string { return fmt.Sprintf(` @@ -7634,4 +7614,4 @@ resource "google_container_cluster" "primary" { location = "us-central1" enable_autopilot = true }`, name) -} \ No newline at end of file +} diff --git a/mmv1/third_party/terraform/tests/resource_container_node_pool_test.go.erb b/mmv1/third_party/terraform/tests/resource_container_node_pool_test.go.erb index 2dc8b8b59745..b6af82c4ddb0 100644 --- a/mmv1/third_party/terraform/tests/resource_container_node_pool_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_container_node_pool_test.go.erb @@ -585,7 +585,7 @@ resource "google_compute_subnetwork" "container_subnetwork" { resource "google_container_cluster" "cluster" { name = "%s" location = "us-central1-a" - min_master_version = "1.23" + min_master_version = "1.27" initial_node_count = 1 network = google_compute_network.container_network.name @@ -1876,7 +1876,7 @@ resource "google_container_cluster" "cluster" { name = "%s" location = "us-central1" initial_node_count = 3 - min_master_version = "1.24" + min_master_version = "1.27" } resource "google_container_node_pool" "np" { @@ -1899,7 +1899,7 @@ resource "google_container_cluster" "cluster" { name = "%s" location = "us-central1" initial_node_count = 3 - min_master_version = "1.24" + min_master_version = "1.27" } resource "google_container_node_pool" "np" { @@ -1928,7 +1928,7 @@ resource "google_container_cluster" "cluster" { name = "%s" location = "us-central1" initial_node_count = 3 - min_master_version = "1.24" + min_master_version = "1.27" } resource "google_container_node_pool" "np" { @@ -3015,7 +3015,7 @@ resource "google_container_node_pool" "np1" { location = "us-central1-a" cluster = google_container_cluster.cluster.name initial_node_count = 2 - version = "1.23.13-gke.900" + version = "1.25.10-gke.1400" } resource "google_container_node_pool" "np2" { @@ -3023,7 +3023,7 @@ resource "google_container_node_pool" "np2" { location = "us-central1-a" cluster = google_container_cluster.cluster.name initial_node_count = 2 - version = "1.23.13-gke.900" + version = "1.25.10-gke.1400" } `, cluster, np1, np2) } diff --git a/mmv1/third_party/terraform/website/docs/guides/using_gke_with_terraform.html.markdown b/mmv1/third_party/terraform/website/docs/guides/using_gke_with_terraform.html.markdown index c44d37b284a3..b165da73b6af 100644 --- a/mmv1/third_party/terraform/website/docs/guides/using_gke_with_terraform.html.markdown +++ b/mmv1/third_party/terraform/website/docs/guides/using_gke_with_terraform.html.markdown @@ -227,7 +227,7 @@ resource "google_container_cluster" "demo_cluster" { name = "demo-cluster" location = "us-west1-a" - min_master_version = "1.16" + min_master_version = "1.27" # Enable Alias IPs to allow Windows Server networking. ip_allocation_policy { From e55cd4656c9168bcd450b7aa556371efcf31e36b Mon Sep 17 00:00:00 2001 From: Riley Karson Date: Wed, 28 Jun 2023 11:22:50 -0700 Subject: [PATCH 04/55] Put workstation test key ring in workstation location (#8223) --- .../workstation_config_encryption_key.tf.erb | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/mmv1/templates/terraform/examples/workstation_config_encryption_key.tf.erb b/mmv1/templates/terraform/examples/workstation_config_encryption_key.tf.erb index c734fe83ca01..bedf3aad7c2d 100644 --- a/mmv1/templates/terraform/examples/workstation_config_encryption_key.tf.erb +++ b/mmv1/templates/terraform/examples/workstation_config_encryption_key.tf.erb @@ -1,11 +1,13 @@ resource "google_compute_network" "default" { - provider = google-beta + provider = google-beta + name = "<%= ctx[:vars]['workstation_cluster_name'] %>" auto_create_subnetworks = false } resource "google_compute_subnetwork" "default" { - provider = google-beta + provider = google-beta + name = "<%= ctx[:vars]['workstation_cluster_name'] %>" ip_cidr_range = "10.0.0.0/24" region = "us-central1" @@ -13,7 +15,8 @@ resource "google_compute_subnetwork" "default" { } resource "google_workstations_workstation_cluster" "<%= ctx[:primary_resource_id] %>" { - provider = google-beta + provider = google-beta + workstation_cluster_id = "<%= ctx[:vars]['workstation_cluster_name'] %>" network = google_compute_network.default.id subnetwork = google_compute_subnetwork.default.id @@ -29,25 +32,29 @@ resource "google_workstations_workstation_cluster" "<%= ctx[:primary_resource_id } resource "google_kms_key_ring" "default" { - name = "<%= ctx[:vars]['workstation_cluster_name'] %>" - location = "global" provider = google-beta + + name = "<%= ctx[:vars]['workstation_cluster_name'] %>" + location = "us-central1" } resource "google_kms_crypto_key" "default" { + provider = google-beta + name = "<%= ctx[:vars]['workstation_cluster_name'] %>" key_ring = google_kms_key_ring.default.id - provider = google-beta } resource "google_service_account" "default" { + provider = google-beta + account_id = "<%= ctx[:vars]['account_id'] %>" display_name = "Service Account" - provider = google-beta } resource "google_workstations_workstation_config" "<%= ctx[:primary_resource_id] %>" { provider = google-beta + workstation_config_id = "<%= ctx[:vars]['workstation_config_name'] %>" workstation_cluster_id = google_workstations_workstation_cluster.<%= ctx[:primary_resource_id] %>.workstation_cluster_id location = "us-central1" From d28b745f71640b702e91379080acf2e0df8bce53 Mon Sep 17 00:00:00 2001 From: Cameron Thornton Date: Wed, 28 Jun 2023 14:29:36 -0500 Subject: [PATCH 05/55] 5.0.0 upgrade guide template (#8224) --- .../guides/version_5_upgrade.html.markdown | 109 ++++++++++++++++++ 1 file changed, 109 insertions(+) create mode 100644 mmv1/third_party/terraform/website/docs/guides/version_5_upgrade.html.markdown diff --git a/mmv1/third_party/terraform/website/docs/guides/version_5_upgrade.html.markdown b/mmv1/third_party/terraform/website/docs/guides/version_5_upgrade.html.markdown new file mode 100644 index 000000000000..fb112b382e8e --- /dev/null +++ b/mmv1/third_party/terraform/website/docs/guides/version_5_upgrade.html.markdown @@ -0,0 +1,109 @@ +--- +page_title: "Terraform Google Provider 5.0.0 Upgrade Guide" +description: |- + Terraform Google Provider 5.0.0 Upgrade Guide +--- + +# Terraform Google Provider 5.0.0 Upgrade Guide + +The `5.0.0` release of the Google provider for Terraform is a major version and +includes some changes that you will need to consider when upgrading. This guide +is intended to help with that process and focuses only on the changes necessary +to upgrade from the final `4.X` series release to `5.0.0`. + +Most of the changes outlined in this guide have been previously marked as +deprecated in the Terraform `plan`/`apply` output throughout previous provider +releases, up to and including the final `4.X` series release. These changes, +such as deprecation notices, can always be found in the CHANGELOG of the +affected providers. [google](https://github.com/hashicorp/terraform-provider-google/blob/main/CHANGELOG.md) +[google-beta](https://github.com/hashicorp/terraform-provider-google-beta/blob/main/CHANGELOG.md) + +## I accidentally upgraded to 5.0.0, how do I downgrade to `4.X`? + +If you've inadvertently upgraded to `5.0.0`, first see the +[Provider Version Configuration Guide](#provider-version-configuration) to lock +your provider version; if you've constrained the provider to a lower version +such as shown in the previous version example in that guide, Terraform will pull +in a `4.X` series release on `terraform init`. + +If you've only ran `terraform init` or `terraform plan`, your state will not +have been modified and downgrading your provider is sufficient. + +If you've ran `terraform refresh` or `terraform apply`, Terraform may have made +state changes in the meantime. + +* If you're using a local state, or a remote state backend that does not support +versioning, `terraform refresh` with a downgraded provider is likely sufficient +to revert your state. The Google provider generally refreshes most state +information from the API, and the properties necessary to do so have been left +unchanged. + +* If you're using a remote state backend that supports versioning such as +[Google Cloud Storage](https://developer.hashicorp.com/terraform/language/settings/backends/gcs), +you can revert the Terraform state file to a previous version. If you do +so and Terraform had created resources as part of a `terraform apply` in the +meantime, you'll need to either delete them by hand or `terraform import` them +so Terraform knows to manage them. + +## Provider Version Configuration + +-> Before upgrading to version 5.0.0, it is recommended to upgrade to the most +recent `4.X` series release of the provider, make the changes noted in this guide, +and ensure that your environment successfully runs +[`terraform plan`](https://developer.hashicorp.com/terraform/cli/commands/plan) +without unexpected changes or deprecation notices. + +It is recommended to use [version constraints](https://developer.hashicorp.com/terraform/language/providers/requirements#requiring-providers) +when configuring Terraform providers. If you are following that recommendation, +update the version constraints in your Terraform configuration and run +[`terraform init`](https://developer.hashicorp.com/terraform/cli/commands/init) to download +the new version. + +If you aren't using version constraints, you can use `terraform init -upgrade` +in order to upgrade your provider to the latest released version. + +For example, given this previous configuration: + +```hcl +terraform { + required_providers { + google = { + version = "~> 4.70.0" + } + } +} +``` + +An updated configuration: + +```hcl +terraform { + required_providers { + google = { + version = "~> 5.0.0" + } + } +} +``` + +## Provider + +### Provider-level change example header + +Description of the change and how users should adjust their configuration (if needed). + +## Datasources + +## Datasource: `google_product_datasource` + +### Datasource-level change example header + +Description of the change and how users should adjust their configuration (if needed). + +## Resources + +## Resource: `google_product_resource` + +### Resource-level change example header + +Description of the change and how users should adjust their configuration (if needed). \ No newline at end of file From 54d11c1c1911f38e8d2fe97d62c9fe6e108bf567 Mon Sep 17 00:00:00 2001 From: Riley Karson Date: Wed, 28 Jun 2023 13:40:16 -0700 Subject: [PATCH 06/55] Use latest ACM version in GKE Hub Tests (#8221) --- ...rce_gke_hub_feature_membership_test.go.erb | 28 +++++++++---------- .../gke_hub_feature_membership.html.markdown | 2 +- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/mmv1/third_party/terraform/tests/resource_gke_hub_feature_membership_test.go.erb b/mmv1/third_party/terraform/tests/resource_gke_hub_feature_membership_test.go.erb index 4ea2968cee5e..4a4460b52939 100644 --- a/mmv1/third_party/terraform/tests/resource_gke_hub_feature_membership_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_gke_hub_feature_membership_test.go.erb @@ -107,7 +107,7 @@ resource "google_gke_hub_feature_membership" "feature_member_1" { feature = google_gke_hub_feature.feature.name membership = google_gke_hub_membership.membership.membership_id configmanagement { - version = "1.12.0" + version = "1.15.1" config_sync { source_format = "hierarchy" git { @@ -125,7 +125,7 @@ resource "google_gke_hub_feature_membership" "feature_member_2" { feature = google_gke_hub_feature.feature.name membership = google_gke_hub_membership.membership_second.membership_id configmanagement { - version = "1.12.0" + version = "1.15.1" config_sync { source_format = "hierarchy" git { @@ -159,7 +159,7 @@ resource "google_gke_hub_feature_membership" "feature_member_1" { feature = google_gke_hub_feature.feature.name membership = google_gke_hub_membership.membership.membership_id configmanagement { - version = "1.12.0" + version = "1.15.1" config_sync { source_format = "hierarchy" git { @@ -177,7 +177,7 @@ resource "google_gke_hub_feature_membership" "feature_member_2" { feature = google_gke_hub_feature.feature.name membership = google_gke_hub_membership.membership_second.membership_id configmanagement { - version = "1.12.0" + version = "1.15.1" config_sync { source_format = "hierarchy" git { @@ -217,7 +217,7 @@ resource "google_gke_hub_feature_membership" "feature_member_2" { feature = google_gke_hub_feature.feature.name membership = google_gke_hub_membership.membership_second.membership_id configmanagement { - version = "1.12.0" + version = "1.15.1" config_sync { source_format = "unstructured" git { @@ -246,7 +246,7 @@ resource "google_gke_hub_feature_membership" "feature_member_3" { feature = google_gke_hub_feature.feature.name membership = google_gke_hub_membership.membership_third.membership_id configmanagement { - version = "1.12.0" + version = "1.15.1" config_sync { source_format = "hierarchy" git { @@ -275,7 +275,7 @@ resource "google_gke_hub_feature_membership" "feature_member_4" { feature = google_gke_hub_feature.feature.name membership = google_gke_hub_membership.membership_fourth.membership_id configmanagement { - version = "1.12.0" + version = "1.15.1" policy_controller { enabled = true audit_interval_seconds = "100" @@ -314,7 +314,7 @@ resource "google_gke_hub_feature_membership" "feature_member_3" { feature = google_gke_hub_feature.feature.name membership = google_gke_hub_membership.membership_third.membership_id configmanagement { - version = "1.12.0" + version = "1.15.1" policy_controller { enabled = true audit_interval_seconds = "100" @@ -432,7 +432,7 @@ resource "google_gke_hub_feature_membership" "feature_member" { feature = google_gke_hub_feature.feature.name membership = google_gke_hub_membership.membership.membership_id configmanagement { - version = "1.12.0" + version = "1.15.1" config_sync { git { sync_repo = "https://github.com/hashicorp/terraform" @@ -499,7 +499,7 @@ resource "google_gke_hub_feature_membership" "feature_member" { feature = google_gke_hub_feature.feature.name membership = google_gke_hub_membership.membership.membership_id configmanagement { - version = "1.12.0" + version = "1.15.1" config_sync { git { sync_repo = "https://github.com/hashicorp/terraform" @@ -573,7 +573,7 @@ resource "google_gke_hub_feature_membership" "feature_member" { feature = google_gke_hub_feature.feature.name membership = google_gke_hub_membership.membership.membership_id configmanagement { - version = "1.12.0" + version = "1.15.1" config_sync { git { sync_repo = "https://github.com/hashicorp/terraform" @@ -665,7 +665,7 @@ resource "google_gke_hub_feature_membership" "feature_member" { feature = google_gke_hub_feature.feature.name membership = google_gke_hub_membership.membership_acmoci.membership_id configmanagement { - version = "1.12.0" + version = "1.15.1" config_sync { source_format = "unstructured" oci { @@ -717,7 +717,7 @@ resource "google_gke_hub_feature_membership" "feature_member" { feature = google_gke_hub_feature.feature.name membership = google_gke_hub_membership.membership_acmoci.membership_id configmanagement { - version = "1.12.0" + version = "1.15.1" config_sync { source_format = "hierarchy" oci { @@ -769,7 +769,7 @@ resource "google_gke_hub_feature_membership" "feature_member" { feature = google_gke_hub_feature.feature.name membership = google_gke_hub_membership.membership_acmoci.membership_id configmanagement { - version = "1.12.0" + version = "1.15.1" policy_controller { enabled = true audit_interval_seconds = "100" diff --git a/mmv1/third_party/terraform/website/docs/r/gke_hub_feature_membership.html.markdown b/mmv1/third_party/terraform/website/docs/r/gke_hub_feature_membership.html.markdown index b367e6dfba16..314fc1f706a2 100644 --- a/mmv1/third_party/terraform/website/docs/r/gke_hub_feature_membership.html.markdown +++ b/mmv1/third_party/terraform/website/docs/r/gke_hub_feature_membership.html.markdown @@ -92,7 +92,7 @@ resource "google_gke_hub_feature_membership" "feature_member" { feature = google_gke_hub_feature.feature.name membership = google_gke_hub_membership.membership.membership_id configmanagement { - version = "1.12.0" + version = "1.15.1" config_sync { oci { sync_repo = "us-central1-docker.pkg.dev/sample-project/config-repo/config-sync-gke:latest" From 24977f31287257347604262b304c8b2d8e01692e Mon Sep 17 00:00:00 2001 From: "Stephen Lewis (Burrows)" Date: Wed, 28 Jun 2023 13:57:17 -0700 Subject: [PATCH 07/55] Made make-in-container script always use latest container (#8213) * Made make-in-container script always use latest container Also added a check to ensure GOPATH is set properly * Updated docs * Clarified that the command must be run in the root of a magic-modules clone --- .ci/containers/magic-modules-dev/Dockerfile | 3 - docs/content/reference/make-commands.md | 26 ++++-- scripts/make-in-container.sh | 88 ++++++++++++++------- 3 files changed, 80 insertions(+), 37 deletions(-) delete mode 100644 .ci/containers/magic-modules-dev/Dockerfile diff --git a/.ci/containers/magic-modules-dev/Dockerfile b/.ci/containers/magic-modules-dev/Dockerfile deleted file mode 100644 index 82b3fe286388..000000000000 --- a/.ci/containers/magic-modules-dev/Dockerfile +++ /dev/null @@ -1,3 +0,0 @@ -FROM gcr.io/graphite-docker-images/downstream-builder:latest -WORKDIR /magic-modules -ENTRYPOINT ["/usr/bin/make"] \ No newline at end of file diff --git a/docs/content/reference/make-commands.md b/docs/content/reference/make-commands.md index 254429fc08db..4da3c758ac31 100644 --- a/docs/content/reference/make-commands.md +++ b/docs/content/reference/make-commands.md @@ -53,16 +53,32 @@ git checkout -- . && git clean -f google/ google-beta/ website/ {{< hint warning >}}This approach is in beta and still collecting feedback. Please [file an issue](https://github.com/hashicorp/terraform-provider-google/issues/new/choose) if you encounter challenges.{{< /hint >}} -For ease of contribution, we provide containers with the required dependencies for building magic-modules, as well as the option to build them yourself. +[`./scripts/make-in-container.sh`](https://github.com/GoogleCloudPlatform/magic-modules/blob/main/scripts/make-in-container.sh) runs `make` with the provided arguments inside a container with all necessary dependencies preinstalled. It uses [Docker](https://docker.io/) if available and [Podman](https://podman.io/) otherwise. Like `make`, this script must be run in the root of a `magic-modules` repository clone. -[scripts/make-in-container.sh](https://github.com/GoogleCloudPlatform/magic-modules/blob/main/scripts/make-in-container.sh) acts as a drop-in replacement for magic-modules `make` commands by setting up the containers and running `make` inside the container. +If you run into any problems, please [file an issue](https://github.com/hashicorp/terraform-provider-google/issues/new/choose). -For example, to build the `google` provider: +#### Before you begin + +1. Ensure that `GOPATH` is set on your host machine. + + ```bash + printenv | grep GOPATH + ``` + + If not, add `export GOPATH=$HOME/go` to your terminal's startup script and restart your terminal. +1. Clone the `google` and `google-beta` provider repositories with the following commands: + + ```bash + git clone https://github.com/hashicorp/terraform-provider-google.git $GOPATH/src/github.com/hashicorp/terraform-provider-google + git clone https://github.com/hashicorp/terraform-provider-google-beta.git $GOPATH/src/github.com/hashicorp/terraform-provider-google-beta + ``` + +#### Example + +To build the `google` provider, run the following command in the root of a `magic-modules` repository clone: ```bash ./scripts/make-in-container.sh \ terraform VERSION=ga \ OUTPUT_PATH="$GOPATH/src/github.com/hashicorp/terraform-provider-google" ``` - -`make-in-container.sh` will use [Docker](https://docker.io/) if available and otherwise attempt to fall back to [Podman](https://podman.io/). If you run into any problems, try pulling the latest version of `gcr.io/graphite-docker-images/downstream-builder`. If that doesn't resolve your problem, please [file an issue](https://github.com/hashicorp/terraform-provider-google/issues/new/choose). diff --git a/scripts/make-in-container.sh b/scripts/make-in-container.sh index 77e263a0070f..4867cdd68cf8 100755 --- a/scripts/make-in-container.sh +++ b/scripts/make-in-container.sh @@ -6,44 +6,74 @@ set -e BUILDER_IMAGE="gcr.io/graphite-docker-images/downstream-builder:latest" -DEV_IMAGE="gcr.io/graphite-docker-images/magic-modules-dev:latest" -main() { - if which docker > /dev/null; then - CONTAINER_EXECUTABLE="docker" - elif which podman > /dev/null; then - CONTAINER_EXECUTABLE="podman" - else - echo "Unable to find podman or docker executable. Please install podman or docker and try again." && exit 1; - fi +if [ -t 1 ]; then + red=$'\e[1;31m' + grn=$'\e[1;32m' + yel=$'\e[1;33m' + blu=$'\e[1;34m' + mag=$'\e[1;35m' + cyn=$'\e[1;36m' + end=$'\e[0m' +else + red='' + grn='' + yel='' + blu='' + mag='' + cyn='' + end='' +fi - echo "Found ${CONTAINER_EXECUTABLE}, using it to run commands." +warn() { + printf "%s\n" "${!1}${2}${end}" +} - if ! ${CONTAINER_EXECUTABLE} images | grep "gcr.io/graphite-docker-images/magic-modules-dev" > /dev/null; then - echo "unable to find magic-modules-dev container" - build_dev_container +main() { + exitcode=0 + + if [[ -z "${GOPATH}" ]]; then + warn "red" "GOPATH is not set on the host machine. Add 'export GOPATH=\$HOME/go' to your terminal's startup script and restart your terminal." + exitcode=1 + else + echo "Host GOPATH=${GOPATH}" fi - ${CONTAINER_EXECUTABLE} run --rm \ - -v "$PWD:/magic-modules" -v "$GOPATH:$GOPATH" \ - -it "${DEV_IMAGE}" "$@" -} + if which docker > /dev/null || which podman > /dev/null; then + if which docker > /dev/null; then + CONTAINER_EXECUTABLE="docker" + else + CONTAINER_EXECUTABLE="podman" + fi + echo "Found ${CONTAINER_EXECUTABLE}, using it to run commands." -build_dev_container() { - echo "building containers...." - echo "NOTE: this may take a while." - sleep 1 - if ! ${CONTAINER_EXECUTABLE} images | grep "${BUILDER_IMAGE}" > /dev/null; then - if ! ${CONTAINER_EXECUTABLE} pull "${BUILDER_IMAGE}"; then - ${CONTAINER_EXECUTABLE} build \ - .ci/containers/downstream-builder/ \ - -t "${BUILDER_IMAGE}" + echo "Updating containers..." + echo "NOTE: this may take a while." + sleep 1 + if ! ${CONTAINER_EXECUTABLE} images | grep "${BUILDER_IMAGE}" > /dev/null; then + if ! ${CONTAINER_EXECUTABLE} pull "${BUILDER_IMAGE}"; then + ${CONTAINER_EXECUTABLE} build \ + .ci/containers/downstream-builder/ \ + -t "${BUILDER_IMAGE}" + fi fi + else + warn "red" "Unable to find podman or docker executable. Please install podman or docker and try again."; + exitcode=1 fi - ${CONTAINER_EXECUTABLE} build \ - .ci/containers/magic-modules-dev/ \ - -t "${DEV_IMAGE}" + + if [ $exitcode -eq 0 ]; then + ${CONTAINER_EXECUTABLE} run --rm \ + -v "$PWD:/magic-modules" -v "$GOPATH:$GOPATH" \ + --entrypoint "/usr/bin/make" \ + -w "/magic-modules" \ + -it "${BUILDER_IMAGE}" "$@" + else + warn "red" "Found errors; exiting" + fi + + exit $exitcode } main "$@" \ No newline at end of file From 15d89e1188a3eb76948c87815cf0fe3b5324d5ef Mon Sep 17 00:00:00 2001 From: Riley Karson Date: Wed, 28 Jun 2023 15:04:40 -0700 Subject: [PATCH 08/55] Ensure that the networksecurity p4sa is permissioned in tests (#8222) Co-authored-by: Shuya Ma <87669292+shuyama1@users.noreply.github.com> --- ...ecurity_policy_tls_inspection_basic.tf.erb | 16 +++++++++++- ...ecurity_tls_inspection_policy_basic.tf.erb | 18 +++++++++++-- ...security_tls_inspection_policy_test.go.erb | 26 ++++++++++++++++--- 3 files changed, 54 insertions(+), 6 deletions(-) diff --git a/mmv1/templates/terraform/examples/network_security_gateway_security_policy_tls_inspection_basic.tf.erb b/mmv1/templates/terraform/examples/network_security_gateway_security_policy_tls_inspection_basic.tf.erb index 8df695237848..8d821082313e 100644 --- a/mmv1/templates/terraform/examples/network_security_gateway_security_policy_tls_inspection_basic.tf.erb +++ b/mmv1/templates/terraform/examples/network_security_gateway_security_policy_tls_inspection_basic.tf.erb @@ -61,12 +61,26 @@ resource "google_privateca_certificate_authority" "default" { } } +resource "google_project_service_identity" "ns_sa" { + provider = google-beta + + service = "networksecurity.googleapis.com" +} + +resource "google_privateca_ca_pool_iam_member" "tls_inspection_permission" { + provider = google-beta + + ca_pool = google_privateca_ca_pool.default.id + role = "roles/privateca.certificateManager" + member = "serviceAccount:${google_project_service_identity.ns_sa.email}" +} + resource "google_network_security_tls_inspection_policy" "default" { provider = google-beta name = "<%= ctx[:vars]['privateca_ca_tls_name'] %>" location = "us-central1" ca_pool = google_privateca_ca_pool.default.id - depends_on = [google_privateca_ca_pool.default, google_privateca_certificate_authority.default] + depends_on = [google_privateca_ca_pool.default, google_privateca_certificate_authority.default, google_privateca_ca_pool_iam_member.tls_inspection_permission] } resource "google_network_security_gateway_security_policy" "<%= ctx[:primary_resource_id] %>" { diff --git a/mmv1/templates/terraform/examples/network_security_tls_inspection_policy_basic.tf.erb b/mmv1/templates/terraform/examples/network_security_tls_inspection_policy_basic.tf.erb index 667e794eb717..2e4a48c8d149 100644 --- a/mmv1/templates/terraform/examples/network_security_tls_inspection_policy_basic.tf.erb +++ b/mmv1/templates/terraform/examples/network_security_tls_inspection_policy_basic.tf.erb @@ -61,11 +61,25 @@ resource "google_privateca_certificate_authority" "default" { } } +resource "google_project_service_identity" "ns_sa" { + provider = google-beta + + service = "networksecurity.googleapis.com" +} + +resource "google_privateca_ca_pool_iam_member" "tls_inspection_permission" { + provider = google-beta + + ca_pool = google_privateca_ca_pool.default.id + role = "roles/privateca.certificateManager" + member = "serviceAccount:${google_project_service_identity.ns_sa.email}" +} + resource "google_network_security_tls_inspection_policy" "<%= ctx[:primary_resource_id] %>" { provider = google-beta name = "<%= ctx[:vars]['resource_name'] %>" location = "us-central1" ca_pool = google_privateca_ca_pool.default.id exclude_public_ca_set = false - depends_on = [google_privateca_ca_pool.default, google_privateca_certificate_authority.default] -} \ No newline at end of file + depends_on = [google_privateca_ca_pool.default, google_privateca_certificate_authority.default, google_privateca_ca_pool_iam_member.tls_inspection_permission] +} diff --git a/mmv1/third_party/terraform/tests/resource_network_security_tls_inspection_policy_test.go.erb b/mmv1/third_party/terraform/tests/resource_network_security_tls_inspection_policy_test.go.erb index c6c7fd0b12f2..e22187a31b55 100644 --- a/mmv1/third_party/terraform/tests/resource_network_security_tls_inspection_policy_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_network_security_tls_inspection_policy_test.go.erb @@ -104,11 +104,21 @@ resource "google_privateca_certificate_authority" "default" { } } +resource "google_project_service_identity" "ns_sa" { + service = "networksecurity.googleapis.com" +} + +resource "google_privateca_ca_pool_iam_member" "tls_inspection_permission" { + ca_pool = google_privateca_ca_pool.default.id + role = "roles/privateca.certificateManager" + member = "serviceAccount:${google_project_service_identity.ns_sa.email}" +} + resource "google_network_security_tls_inspection_policy" "foobar" { name = "%s" location = "us-central1" ca_pool = google_privateca_ca_pool.default.id - depends_on = [google_privateca_ca_pool.default, google_privateca_certificate_authority.default] + depends_on = [google_privateca_ca_pool.default, google_privateca_certificate_authority.default, google_privateca_ca_pool_iam_member.tls_inspection_permission] } `, caPoolName, certificateAuthorityName, tlsInspectionPolicyName) } @@ -176,14 +186,24 @@ resource "google_privateca_certificate_authority" "default" { } } +resource "google_project_service_identity" "ns_sa" { + service = "networksecurity.googleapis.com" +} + +resource "google_privateca_ca_pool_iam_member" "tls_inspection_permission" { + ca_pool = google_privateca_ca_pool.default.id + role = "roles/privateca.certificateManager" + member = "serviceAccount:${google_project_service_identity.ns_sa.email}" +} + resource "google_network_security_tls_inspection_policy" "foobar" { name = "%s" location = "us-central1" description = "my tls inspection policy updated" ca_pool = google_privateca_ca_pool.default.id - depends_on = [google_privateca_ca_pool.default, google_privateca_certificate_authority.default] + depends_on = [google_privateca_ca_pool.default, google_privateca_certificate_authority.default, google_privateca_ca_pool_iam_member.tls_inspection_permission] } `, caPoolName, certificateAuthorityName, tlsInspectionPolicyName) } -<% end -%> \ No newline at end of file +<% end -%> From bafab75a7709ea6be79d94289030906b779085ba Mon Sep 17 00:00:00 2001 From: Riley Karson Date: Wed, 28 Jun 2023 15:04:54 -0700 Subject: [PATCH 09/55] Skip TestAccComputeNetworkEndpoints_networkEndpointsBasic in VCR (#8220) --- .../tests/resource_compute_network_endpoints_test.go.erb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mmv1/third_party/terraform/tests/resource_compute_network_endpoints_test.go.erb b/mmv1/third_party/terraform/tests/resource_compute_network_endpoints_test.go.erb index 627f8b9d27c6..258ced283c35 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_network_endpoints_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_compute_network_endpoints_test.go.erb @@ -16,6 +16,9 @@ import ( func TestAccComputeNetworkEndpoints_networkEndpointsBasic(t *testing.T) { t.Parallel() + // detachNetworkEndpoints call ordering is not guaranteed, causing VCR to rerecord + acctest.SkipIfVcr(t) + context := map[string]interface{}{ "random_suffix": RandString(t, 10), "default_port": 90, From be214b0fd1f1465a9729e5e69282839430558325 Mon Sep 17 00:00:00 2001 From: Lingkai Shen Date: Thu, 29 Jun 2023 11:33:19 -0400 Subject: [PATCH 10/55] Add Firebase Extensions Instance resource (#8133) * Add Firebase Extensions Instance resource * rename file from Extension to Instance * Change serviceAccountEmail to output * Make extensionRef trigger replacement --- .../products/firebaseextensions/Instance.yaml | 258 ++++++++++++++++++ mmv1/products/firebaseextensions/product.yaml | 26 ++ ...se_extentions_instance_resize_image.tf.erb | 47 ++++ ...e_firebase_extensions_instance_test.go.erb | 151 ++++++++++ 4 files changed, 482 insertions(+) create mode 100644 mmv1/products/firebaseextensions/Instance.yaml create mode 100644 mmv1/products/firebaseextensions/product.yaml create mode 100644 mmv1/templates/terraform/examples/firebase_extentions_instance_resize_image.tf.erb create mode 100644 mmv1/third_party/terraform/tests/resource_firebase_extensions_instance_test.go.erb diff --git a/mmv1/products/firebaseextensions/Instance.yaml b/mmv1/products/firebaseextensions/Instance.yaml new file mode 100644 index 000000000000..a0d0243b0dee --- /dev/null +++ b/mmv1/products/firebaseextensions/Instance.yaml @@ -0,0 +1,258 @@ +# Copyright 2023 Google Inc. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +--- !ruby/object:Api::Resource +name: 'Instance' +min_version: beta +base_url: projects/{{project}}/instances/ +self_link: projects/{{project}}/instances/{{instance_id}} +create_url: projects/{{project}}/instances?instanceId={{instance_id}} +description: An Instance is an installation of an Extension into a user's project. +references: !ruby/object:Api::Resource::ReferenceLinks + guides: + 'Official Documentation': 'https://firebase.google.com/products/extensions' + # TODO: add API field once documentation is ready +import_format: + [ + 'projects/{{project}}/instances/{{instance_id}}', + '{{project}}/{{instance_id}}', + '{{instance_id}}', + ] +async: !ruby/object:Api::OpAsync + actions: ['create', 'update', 'delete'] + operation: !ruby/object:Api::OpAsync::Operation + path: 'name' + base_url: '{{op_id}}' + wait_ms: 1000 + result: !ruby/object:Api::OpAsync::Result + path: 'response' + resource_inside_response: true + status: !ruby/object:Api::OpAsync::Status + path: 'done' + complete: true + allowed: + - true + - false + error: !ruby/object:Api::OpAsync::Error + path: 'error' + message: 'message' +autogen_async: true +update_verb: :PATCH +update_mask: true +examples: + - !ruby/object:Provider::Terraform::Examples + name: 'firebase_extentions_instance_resize_image' + min_version: 'beta' + primary_resource_id: 'resize_image' + vars: + # using a hyphen "-"" because underscore is not a valid instance ID + instance-id: 'storage-resize-images' + bucket_id: 'bucket-id' + service-account-id: 's-a' + test_env_vars: + project_id: :PROJECT_NAME + test_vars_overrides: + location: '"us-central1"' +parameters: + - !ruby/object:Api::Type::String + name: 'instance_id' + description: | + The ID to use for the Extension Instance, which will become the final + component of the instance's name. + required: true + immutable: true + url_param_only: true +properties: + - !ruby/object:Api::Type::String + name: name + description: | + The fully-qualified resource name of the Extension Instance. + output: true + pattern: projects/{{project}}/instances/{{instance_id}} + - !ruby/object:Api::Type::Time + name: createTime + description: The time at which the Extension Instance was created. + output: true + - !ruby/object:Api::Type::Time + name: updateTime + description: The time at which the Extension Instance was updated. + output: true + - !ruby/object:Api::Type::NestedObject + name: config + description: | + The current Config of the Extension Instance. + required: true + update_mask_fields: + - 'config.params' + - 'config.system_params' + - 'config.extension_ref' + - 'config.extension_version' + - 'config.allowed_event_types' + - 'config.eventarc_channel' + properties: + - !ruby/object:Api::Type::String + name: name + description: The unique identifier for this configuration. + output: true + pattern: projects/{{project}}/instances/{{instance_id}}/configs/{{config_id}} + - !ruby/object:Api::Type::Time + name: createTime + description: The time at which the Extension Instance Config was created. + output: true + - !ruby/object:Api::Type::KeyValuePairs + name: params + description: | + Environment variables that may be configured for the Extension + required: true + - !ruby/object:Api::Type::KeyValuePairs + name: systemParams + description: | + Params whose values are only available at deployment time. + Unlike other params, these will not be set as environment variables on + functions. + default_from_api: true + - !ruby/object:Api::Type::String + name: extensionRef + description: The ref of the Extension from the Registry (e.g. publisher-id/awesome-extension) + # Installing from an extensionRef is the only way for now + required: true + immutable: true + - !ruby/object:Api::Type::String + name: extensionVersion + description: | + The version of the Extension from the Registry (e.g. 1.0.3). If left blank, latest is assumed. + default_from_api: true + - !ruby/object:Api::Type::Array + item_type: Api::Type::String + name: allowedEventTypes + description: | + List of extension events selected by consumer that extension is allowed to + emit, identified by their types. + - !ruby/object:Api::Type::String + name: eventarcChannel + description: | + Fully qualified Eventarc resource name that consumers should use for event triggers. + pattern: projects/{{project}}/locations/{{location}}/channels/{{channel_id}} + default_from_api: true + - !ruby/object:Api::Type::String + name: populatedPostinstallContent + description: | + Postinstall instructions to be shown for this Extension, with + template strings representing function and parameter values substituted + with actual values. These strings include: ${param:FOO}, + ${function:myFunc.url}, + ${function:myFunc.name}, and ${function:myFunc.location} + output: true + - !ruby/object:Api::Type::Enum + name: state + description: | + The current state of the Extension Instance. + DEPLOYING: + The Extension Instance is waiting on an Operation to complete. Could + resolve to `ACTIVE`, `PAUSED`, `ERRORED`. + UNINSTALLING: + The Extension Instance is being removed from the project. Could resolve + to `ERRORED`, but more likely the instance will soon cease to exist. + ACTIVE: + The Extension Instance is installed and ready. + ERRORED: + The Extension Instance encountered an error while `DEPLOYING` or + `UNINSTALLING`. + PAUSED: + The Extension's resources have been removed from the project, but the + Config remains so the Instance can be restored. + output: true + values: + - :DEPLOYING + - :UNINSTALLING + - :ACTIVE + - :ERRORED + - :PAUSED + - !ruby/object:Api::Type::NestedObject + name: errorStatus + output: true + description: | + If this Instance has `state: ERRORED`, the error messages + will be found here. + properties: + - !ruby/object:Api::Type::Integer + name: 'code' + description: | + The status code, which should be an enum value of google.rpc.Code. + - !ruby/object:Api::Type::String + name: 'message' + description: | + A developer-facing error message, which should be in English. + - !ruby/object:Api::Type::Array + name: 'details' + description: | + A list of messages that carry the error details. + item_type: Api::Type::KeyValuePairs + - !ruby/object:Api::Type::String + name: serviceAccountEmail + description: | + The email of the service account to be used at runtime by compute resources + created for the operation of the Extension instance. + output: true + - !ruby/object:Api::Type::String + name: lastOperationName + output: true + description: | + The name of the last operation that acted on this Extension + Instance + pattern: projects/{{project}}/operations/{{operation_id}} + - !ruby/object:Api::Type::String + name: lastOperationType + output: true + description: | + The type of the last operation that acted on the Extension Instance. + - !ruby/object:Api::Type::Fingerprint + name: etag + description: | + A weak etag that is computed by the server based on other configuration + values and may be sent on update and delete requests to ensure the + client has an up-to-date value before proceeding. + output: true + - !ruby/object:Api::Type::NestedObject + name: runtimeData + description: Data set by the extension instance at runtime. + output: true + properties: + - !ruby/object:Api::Type::Time + name: stateUpdateTime + description: The time of the last state update. + - !ruby/object:Api::Type::NestedObject + name: processingState + description: The processing state for the extension instance + properties: + - !ruby/object:Api::Type::String + name: state + description: The processing state of the extension instance. + - !ruby/object:Api::Type::String + name: detailMessage + description: | + Details about the processing. e.g. This could include the type of + processing in progress or it could list errors or failures. + This information will be shown in the console on the detail page + for the extension instance. + - !ruby/object:Api::Type::NestedObject + name: fatalError + description: The fatal error state for the extension instance + properties: + - !ruby/object:Api::Type::String + name: errorMessage + description: | + The error message. This is set by the extension developer to give + more detail on why the extension is unusable and must be re-installed + or reconfigured. + diff --git a/mmv1/products/firebaseextensions/product.yaml b/mmv1/products/firebaseextensions/product.yaml new file mode 100644 index 000000000000..c63efe3bbf20 --- /dev/null +++ b/mmv1/products/firebaseextensions/product.yaml @@ -0,0 +1,26 @@ +# Copyright 2023 Google Inc. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +--- !ruby/object:Api::Product +name: FirebaseExtensions +display_name: Firebase Extensions +versions: + - !ruby/object:Api::Product::Version + name: beta + base_url: https://firebaseextensions.googleapis.com/v1beta/ +scopes: + - https://www.googleapis.com/auth/cloud-platform +apis_required: + - !ruby/object:Api::Product::ApiReference + name: Firebase Extensions API + url: https://console.cloud.google.com/apis/library/firebaseextensions.googleapis.com/ diff --git a/mmv1/templates/terraform/examples/firebase_extentions_instance_resize_image.tf.erb b/mmv1/templates/terraform/examples/firebase_extentions_instance_resize_image.tf.erb new file mode 100644 index 000000000000..4b48877df1e8 --- /dev/null +++ b/mmv1/templates/terraform/examples/firebase_extentions_instance_resize_image.tf.erb @@ -0,0 +1,47 @@ +resource "google_storage_bucket" "images" { + provider = google-beta + project = "<%= ctx[:test_env_vars]['project_id'] %>" + name = "<%= ctx[:vars]['bucket_id'] %>" + location = "US" + uniform_bucket_level_access = true + + # Delete all objects when the bucket is deleted + force_destroy = true +} + +resource "google_firebase_extensions_instance" "resize_image" { + provider = google-beta + project = "<%= ctx[:test_env_vars]['project_id'] %>" + instance_id = "<%= ctx[:vars]['instance-id'] %>" + config { + extension_ref = "firebase/storage-resize-images" + extension_version = "0.1.37" + + # The following params apply to the firebase/storage-resize-images extension. + # Different extensions may have different params + params = { + DELETE_ORIGINAL_FILE = false + MAKE_PUBLIC = false + IMAGE_TYPE = false + IS_ANIMATED = true + FUNCTION_MEMORY = 1024 + DO_BACKFILL = false + IMG_SIZES = "200x200" + IMG_BUCKET = google_storage_bucket.images.name + LOCATION = "<%= ctx[:vars]['location'] %>" + } + + system_params = { + "firebaseextensions.v1beta.function/maxInstances" = 3000 + "firebaseextensions.v1beta.function/memory" = 256 + "firebaseextensions.v1beta.function/minInstances" = 0 + "firebaseextensions.v1beta.function/vpcConnectorEgressSettings" = "VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED" + } + + allowed_event_types = [ + "firebase.extensions.storage-resize-images.v1.complete" + ] + + eventarc_channel = "projects/<%= ctx[:test_env_vars]['project_id'] %>/locations/<%= ctx[:vars]['location'] %>/channels/firebase" + } +} \ No newline at end of file diff --git a/mmv1/third_party/terraform/tests/resource_firebase_extensions_instance_test.go.erb b/mmv1/third_party/terraform/tests/resource_firebase_extensions_instance_test.go.erb new file mode 100644 index 000000000000..17194aefaca8 --- /dev/null +++ b/mmv1/third_party/terraform/tests/resource_firebase_extensions_instance_test.go.erb @@ -0,0 +1,151 @@ +<% autogen_exception -%> +package google +<% unless version == 'ga' -%> + +import ( + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + + "github.com/hashicorp/terraform-provider-google-beta/google-beta/acctest" +) + +func TestAccFirebaseExtensionsInstance_firebaseExtentionsInstanceResizeImageUpdate(t *testing.T) { + t.Parallel() + + context := map[string]interface{}{ + "project_id": acctest.GetTestProjectFromEnv(), + "location": "us-central1", + "random_suffix": RandString(t, 10), + } + + VcrTest(t, resource.TestCase{ + PreCheck: func() { acctest.AccTestPreCheck(t) }, + ProtoV5ProviderFactories: ProtoV5ProviderBetaFactories(t), + CheckDestroy: testAccCheckFirebaseExtensionsInstanceDestroyProducer(t), + Steps: []resource.TestStep{ + { + Config: testAccFirebaseExtensionsInstance_firebaseExtentionsInstanceResizeImageBefore(context), + }, + { + ResourceName: "google_firebase_extensions_instance.resize_image", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"instance_id"}, + }, + { + Config: testAccFirebaseExtensionsInstance_firebaseExtentionsInstanceResizeImageAfter(context), + }, + { + ResourceName: "google_firebase_extensions_instance.resize_image", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"instance_id"}, + }, + }, + }) +} + +func testAccFirebaseExtensionsInstance_firebaseExtentionsInstanceResizeImageBefore(context map[string]interface{}) string { + return Nprintf(` +resource "google_storage_bucket" "images" { + provider = google-beta + project = "%{project_id}" + name = "tf-test-bucket-id%{random_suffix}" + location = "US" + uniform_bucket_level_access = true + + # Delete all objects when the bucket is deleted + force_destroy = true +} + +resource "google_firebase_extensions_instance" "resize_image" { + provider = google-beta + project = "%{project_id}" + instance_id = "tf-test-storage-resize-images%{random_suffix}" + config { + extension_ref = "firebase/storage-resize-images" + extension_version = "0.1.37" + + # The following params apply to the firebase/storage-resize-images extension. + # Different extensions may have different params + params = { + DELETE_ORIGINAL_FILE = false + MAKE_PUBLIC = false + IMAGE_TYPE = "jpeg" + IS_ANIMATED = true + FUNCTION_MEMORY = 1024 + DO_BACKFILL = false + IMG_SIZES = "200x200" + IMG_BUCKET = google_storage_bucket.images.name + LOCATION = "%{location}" + } + + system_params = { + "firebaseextensions.v1beta.function/maxInstances" = 3000 + "firebaseextensions.v1beta.function/memory" = 256 + "firebaseextensions.v1beta.function/minInstances" = 0 + "firebaseextensions.v1beta.function/vpcConnectorEgressSettings" = "VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED" + } + + allowed_event_types = [ + "firebase.extensions.storage-resize-images.v1.complete" + ] + + eventarc_channel = "projects/%{project_id}/locations/%{location}/channels/firebase" + } +} +`, context) +} + +func testAccFirebaseExtensionsInstance_firebaseExtentionsInstanceResizeImageAfter(context map[string]interface{}) string { + return Nprintf(` +resource "google_storage_bucket" "images" { + provider = google-beta + project = "%{project_id}" + name = "tf-test-bucket-id%{random_suffix}" + location = "US" + uniform_bucket_level_access = true + + # Delete all objects when the bucket is deleted + force_destroy = true +} + +resource "google_firebase_extensions_instance" "resize_image" { + provider = google-beta + project = "%{project_id}" + instance_id = "tf-test-storage-resize-images%{random_suffix}" + config { + extension_ref = "firebase/storage-resize-images" + extension_version = "0.1.37" + + # The following params apply to the firebase/storage-resize-images extension. + # Different extensions may have different params + params = { + # Changed params + DELETE_ORIGINAL_FILE = true + MAKE_PUBLIC = true + IMAGE_TYPE = "jpeg" + IS_ANIMATED = true + FUNCTION_MEMORY = 512 + DO_BACKFILL = true + IMG_SIZES = "400x400" + IMG_BUCKET = google_storage_bucket.images.name + LOCATION = "%{location}" + } + + system_params = { + # Changed params + "firebaseextensions.v1beta.function/maxInstances" = 100 + "firebaseextensions.v1beta.function/memory" = 128 + "firebaseextensions.v1beta.function/minInstances" = 0 + "firebaseextensions.v1beta.function/vpcConnectorEgressSettings" = "VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED" + } + + # Disable events + } +} +`, context) +} + +<% end -%> \ No newline at end of file From c272153591af279873aa893d5b6e5ff7df25ad2a Mon Sep 17 00:00:00 2001 From: Zhenhua Li Date: Thu, 29 Jun 2023 08:51:55 -0700 Subject: [PATCH 11/55] Replace the usage of Nprinf (#8231) --- docs/content/develop/add-mmv1-test.md | 2 +- mmv1/provider/terraform_validator.rb | 2 + .../base_configs/iam_test_file.go.erb | 24 ++--- .../examples/base_configs/test_body.go.erb | 2 +- .../examples/base_configs/test_body.go.erb | 2 +- .../terraform/acctest/test_utils.go | 12 +++ ...ss_approval_folder_service_account_test.go | 2 +- ...roval_organization_service_account_test.go | 2 +- ...s_approval_project_service_account_test.go | 2 +- .../data_source_alloydb_locations_test.go | 2 +- ...e_alloydb_supported_database_flags_test.go | 2 +- ...ource_artifact_registry_repository_test.go | 2 +- .../data_source_certificate_authority_test.go | 2 +- ...e_cloud_identity_group_memberships_test.go | 4 +- .../data_source_cloud_identity_groups_test.go | 2 +- .../data_source_cloud_run_service_test.go | 4 +- ...rce_compute_network_endpoint_group_test.go | 2 +- ...ata_source_compute_network_peering_test.go | 2 +- ...e_google_beyondcorp_app_connection_test.go | 4 +- ...ce_google_beyondcorp_app_connector_test.go | 8 +- ...urce_google_beyondcorp_app_gateway_test.go | 8 +- ...a_source_google_cloudbuild_trigger_test.go | 2 +- ...source_google_composer_environment_test.go | 2 +- .../data_source_google_compute_disk_test.go | 2 +- ...gle_compute_instance_group_manager_test.go | 4 +- ...e_google_compute_instance_template_test.go | 8 +- ...mpute_region_instance_template_test.go.erb | 6 +- ...pute_region_network_endpoint_group_test.go | 2 +- ...a_source_google_compute_router_nat_test.go | 2 +- ...ource_google_compute_router_status_test.go | 2 +- ...ata_source_google_compute_snapshot_test.go | 6 +- ...le_firebase_android_app_config_test.go.erb | 2 +- ...ce_google_firebase_android_app_test.go.erb | 2 +- ...ogle_firebase_apple_app_config_test.go.erb | 2 +- ...urce_google_firebase_apple_app_test.go.erb | 2 +- ...oogle_firebase_hosting_channel_test.go.erb | 2 +- ...source_google_firebase_web_app_test.go.erb | 2 +- ...ces_game_server_deployment_rollout_test.go | 2 +- ...ogle_logging_project_cmek_settings_test.go | 2 +- .../data_source_google_logging_sink_test.go | 2 +- ...ce_google_vmwareengine_network_test.go.erb | 2 +- ...orkload_identity_pool_provider_test.go.erb | 2 +- ...am_beta_workload_identity_pool_test.go.erb | 2 +- .../tests/data_source_iap_client_test.go | 2 +- .../data_source_pubsub_subscription_test.go | 4 +- .../tests/data_source_pubsub_topic_test.go | 4 +- .../data_source_secret_manager_secret_test.go | 2 +- .../data_source_spanner_instance_test.go | 2 +- .../tests/data_source_sql_backup_run_test.go | 2 +- .../data_source_sql_database_instance_test.go | 2 +- ...data_source_sql_database_instances_test.go | 8 +- .../tests/data_source_sql_database_test.go | 2 +- .../tests/data_source_sql_databases_test.go | 2 +- .../tests/data_source_vertex_ai_index_test.go | 2 +- .../terraform/tests/iam_scc_source_test.go | 10 +-- ...ce_access_approval_folder_settings_test.go | 6 +- ...ess_approval_organization_settings_test.go | 6 +- ...e_access_approval_project_settings_test.go | 6 +- ...ntext_manager_authorized_orgs_desc_test.go | 2 +- ...xt_manager_gcp_user_access_binding_test.go | 2 +- ...urce_active_directory_domain_trust_test.go | 4 +- ...rce_active_directory_domain_update_test.go | 6 +- .../tests/resource_alloydb_backup_test.go | 6 +- .../tests/resource_alloydb_cluster_test.go | 20 ++--- .../tests/resource_alloydb_instance_test.go | 12 +-- ...esource_api_gateway_api_config_test.go.erb | 4 +- .../resource_api_gateway_api_test.go.erb | 2 +- .../resource_api_gateway_gateway_test.go.erb | 2 +- ...e_apigee_env_keystore_alias_pkcs12_test.go | 2 +- ..._apigee_environment_nodeconfig_test.go.erb | 2 +- .../tests/resource_apigee_flowhook_test.go | 2 +- ...ee_keystores_aliases_key_cert_file_test.go | 4 +- ...ource_apigee_sharedflow_deployment_test.go | 2 +- .../tests/resource_apigee_sharedflow_test.go | 4 +- ...resource_apigee_sync_authorization_test.go | 6 +- ...ce_app_engine_flexible_app_version_test.go | 4 +- ...pp_engine_service_network_settings_test.go | 4 +- ...ce_app_engine_standard_app_version_test.go | 6 +- ...resource_beyondcorp_app_connection_test.go | 2 +- .../resource_beyondcorp_app_connector_test.go | 2 +- ...rce_bigquery_analytics_hub_listing_test.go | 2 +- .../resource_bigquery_connection_test.go | 8 +- ...ce_bigquery_datapolicy_data_policy_test.go | 2 +- .../resource_bigquery_dataset_access_test.go | 2 +- .../tests/resource_bigquery_job_test.go | 2 +- .../tests/resource_bigquery_table_test.go | 4 +- .../tests/resource_billing_budget_test.go | 20 ++--- ...tificate_manager_dns_authorization_test.go | 4 +- ...loud_identity_group_membership_test.go.erb | 16 ++-- .../resource_cloud_identity_group_test.go.erb | 4 +- .../resource_cloud_run_domain_mapping_test.go | 4 +- .../tests/resource_cloud_run_v2_job_test.go | 4 +- .../resource_cloud_run_v2_service_test.go | 22 ++--- .../resource_cloud_scheduler_job_test.go | 4 +- ...esource_cloudbuild_worker_pool_test.go.erb | 8 +- .../resource_cloudfunction2_function_test.go | 8 +- .../tests/resource_cloudids_endpoint_test.go | 4 +- ...pute_backend_bucket_signed_url_key_test.go | 2 +- ...ute_backend_service_signed_url_key_test.go | 2 +- .../tests/resource_compute_disk_test.go.erb | 4 +- ...ompute_firewall_policy_association_test.go | 2 +- ...e_compute_firewall_policy_rule_test.go.erb | 12 +-- ...source_compute_forwarding_rule_test.go.erb | 6 +- ...ompute_global_network_endpoint_test.go.erb | 6 +- ...compute_instance_group_manager_test.go.erb | 2 +- ...urce_compute_instance_template_test.go.erb | 6 +- .../resource_compute_instance_test.go.erb | 2 +- ...compute_network_endpoint_group_test.go.erb | 4 +- ...ource_compute_network_endpoint_test.go.erb | 8 +- ...urce_compute_network_endpoints_test.go.erb | 10 +-- ...anization_security_policy_rule_test.go.erb | 4 +- ...e_organization_security_policy_test.go.erb | 4 +- ...ce_compute_per_instance_config_test.go.erb | 14 +-- ...e_compute_public_advertised_prefix_test.go | 4 +- ...mpute_region_instance_template_test.go.erb | 4 +- ..._region_network_endpoint_group_test.go.erb | 2 +- ...ute_region_per_instance_config_test.go.erb | 14 +-- ...compute_region_security_policy_test.go.erb | 4 +- .../resource_compute_router_interface_test.go | 2 +- ...esource_compute_service_attachment_test.go | 4 +- ..._compute_shared_reservation_update_test.go | 4 +- ...urce_container_analysis_occurrence_test.go | 4 +- ..._container_attached_cluster_update_test.go | 6 +- ...resource_data_catalog_tag_template_test.go | 6 +- .../tests/resource_data_catalog_tag_test.go | 2 +- .../resource_data_fusion_instance_test.go | 2 +- ...oss_prevention_deidentify_template_test.go | 90 +++++++++---------- ...a_loss_prevention_inspect_template_test.go | 18 ++-- ...e_data_loss_prevention_job_trigger_test.go | 54 +++++------ ...a_loss_prevention_stored_info_type_test.go | 12 +-- ...gration_service_connection_profile_test.go | 4 +- .../resource_dataform_repository_test.go.erb | 4 +- ...rce_dataproc_metastore_service_test.go.erb | 2 +- ...rce_dataproc_workflow_template_test.go.erb | 4 +- ...urce_datastream_connection_profile_test.go | 4 +- .../tests/resource_datastream_stream_test.go | 2 +- ...urce_deployment_manager_deployment_test.go | 2 +- .../resource_dialogflow_agent_test.go.erb | 4 +- ...esource_dialogflow_entity_type_test.go.erb | 4 +- ...esource_dialogflow_fulfillment_test.go.erb | 4 +- .../resource_dialogflow_intent_test.go.erb | 6 +- .../resource_dialogflowcx_agent_test.go.erb | 4 +- .../resource_dialogflowcx_entity_type_test.go | 4 +- .../resource_dialogflowcx_environment_test.go | 8 +- .../tests/resource_dialogflowcx_flow_test.go | 4 +- .../resource_dialogflowcx_intent_test.go | 4 +- .../tests/resource_dialogflowcx_page_test.go | 4 +- .../resource_dialogflowcx_version_test.go.erb | 6 +- .../resource_dialogflowcx_webhook_test.go | 4 +- ...esource_essential_contacts_contact_test.go | 4 +- .../resource_eventarc_channel_test.go.erb | 6 +- ...eventarc_google_channel_config_test.go.erb | 8 +- .../resource_eventarc_trigger_test.go.erb | 2 +- ...ce_firebase_android_app_update_test.go.erb | 2 +- ...urce_firebase_apple_app_update_test.go.erb | 2 +- ...rce_firebase_database_instance_test.go.erb | 2 +- ...ource_firebase_hosting_channel_test.go.erb | 10 +-- ...resource_firebase_hosting_site_test.go.erb | 4 +- .../resource_firebase_project_test.go.erb | 2 +- .../resource_firebase_web_app_test.go.erb | 4 +- .../tests/resource_firestore_field_test.go | 7 +- ...esource_gke_backup_backup_plan_test.go.erb | 4 +- .../resource_gke_hub_feature_iam_test.go.erb | 10 +-- ...rce_gke_hub_feature_membership_test.go.erb | 30 +++---- .../resource_gke_hub_feature_test.go.erb | 18 ++-- ...e_gkeonprem_bare_metal_cluster_test.go.erb | 13 +-- ...gkeonprem_bare_metal_node_pool_test.go.erb | 5 +- ...ource_gkeonprem_vmware_cluster_test.go.erb | 12 +-- ...rce_gkeonprem_vmware_node_pool_test.go.erb | 5 +- ...e_security_scanner_scan_config_test.go.erb | 2 +- ..._usage_consumer_quota_override_test.go.erb | 2 +- ...esource_iam_access_boundary_policy_test.go | 4 +- ...orkload_identity_pool_provider_test.go.erb | 12 +-- .../resource_iam_deny_policy_test.go.erb | 8 +- ...e_pool_workforce_pool_provider_test.go.erb | 14 +-- ..._workforce_pool_workforce_pool_test.go.erb | 6 +- .../tests/resource_iap_brand_test.go | 2 +- ...tform_default_supported_idp_config_test.go | 4 +- ...ntity_platform_inbound_saml_config_test.go | 4 +- ...identity_platform_oauth_idp_config_test.go | 4 +- ...enant_default_supported_idp_config_test.go | 4 +- ...latform_tenant_indound_saml_config_test.go | 4 +- ...y_platform_tenant_oauth_idp_config_test.go | 4 +- .../resource_identity_platform_tenant_test.go | 4 +- .../resource_kms_key_ring_import_job_test.go | 2 +- .../resource_logging_bucket_config_test.go | 16 ++-- .../tests/resource_logging_log_view_test.go | 2 +- ...agement_connectivity_test_resource_test.go | 6 +- ...network_services_edge_cache_keyset_test.go | 2 +- .../resource_notebooks_instance_test.go.erb | 5 +- .../resource_notebooks_runtime_test.go.erb | 4 +- ...e_org_policy_custom_constraint_test.go.erb | 4 +- ...os_config_os_policy_assignment_test.go.erb | 4 +- .../resource_os_login_ssh_public_key_test.go | 2 +- .../tests/resource_privateca_ca_pool_test.go | 14 +-- ...ce_privateca_certificate_authority_test.go | 6 +- .../resource_privateca_certificate_test.go | 4 +- .../tests/resource_redis_instance_test.go | 4 +- .../resource_scc_notification_config_test.go | 2 +- ...resource_secret_manager_secret_test.go.erb | 4 +- ..._secret_manager_secret_version_test.go.erb | 4 +- .../resource_spanner_database_test.go.erb | 4 +- .../resource_sql_database_instance_test.go | 16 ++-- .../tests/resource_storage_bucket_test.go.erb | 2 +- .../terraform/tests/resource_tags_test.go | 40 ++++----- .../tests/resource_vertex_ai_endpoint_test.go | 4 +- .../resource_vertex_ai_index_endpoint_test.go | 4 +- .../tests/resource_vertex_ai_index_test.go | 4 +- .../resource_vmwareengine_cluster_test.go.erb | 2 +- .../resource_vmwareengine_network_test.go.erb | 2 +- ...rce_vmwareengine_private_cloud_test.go.erb | 2 +- .../resource_vpc_access_connector_test.go | 2 +- ...rkstations_workstation_cluster_test.go.erb | 2 +- ...orkstations_workstation_config_test.go.erb | 22 ++--- ...ource_workstations_workstation_test.go.erb | 4 +- .../terraform/tpgresource/utils.go | 11 --- mmv1/third_party/terraform/utils/utils.go | 5 +- .../tests/source/environment_test.go | 6 -- .../testdata/covered_resource_test.go | 4 +- .../testdata/multiple_resource_test.go | 4 +- .../testdata/uncovered_resource_test.go | 2 +- tpgtools/templates/test_file.go.tmpl | 2 +- 222 files changed, 644 insertions(+), 641 deletions(-) diff --git a/docs/content/develop/add-mmv1-test.md b/docs/content/develop/add-mmv1-test.md index fd8473fe3fab..e2017f157b7b 100644 --- a/docs/content/develop/add-mmv1-test.md +++ b/docs/content/develop/add-mmv1-test.md @@ -131,7 +131,7 @@ func TestAccPubsubSubscription_pubsubSubscriptionDeadLetterExample(t *testing.T) } func testAccPubsubSubscription_pubsubSubscriptionDeadLetterExample(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_pubsub_topic" "example" { name = "tf-test-example-topic%{random_suffix}" } diff --git a/mmv1/provider/terraform_validator.rb b/mmv1/provider/terraform_validator.rb index 0d7ed3b5afa7..14ee84aa5d88 100644 --- a/mmv1/provider/terraform_validator.rb +++ b/mmv1/provider/terraform_validator.rb @@ -365,6 +365,8 @@ def copy_common_files(output_folder, generate_code, _generate_docs) 'third_party/terraform/services/privateca/privateca_utils.go'], ['converters/google/resources/utils.go', 'third_party/terraform/utils/utils.go'], + ['converters/google/resources/acctest/test_utils.go', + 'third_party/terraform/acctest/test_utils.go'], ['converters/google/resources/tpgresource/utils.go', 'third_party/terraform/tpgresource/utils.go'], ['converters/google/resources/iam_bigquery_dataset.go', diff --git a/mmv1/templates/terraform/examples/base_configs/iam_test_file.go.erb b/mmv1/templates/terraform/examples/base_configs/iam_test_file.go.erb index 99bdff5b5dbc..6d4889f192b4 100644 --- a/mmv1/templates/terraform/examples/base_configs/iam_test_file.go.erb +++ b/mmv1/templates/terraform/examples/base_configs/iam_test_file.go.erb @@ -372,10 +372,10 @@ func TestAcc<%= resource_name -%>IamPolicyGenerated_withCondition(t *testing.T) <% if object.iam_policy.admin_iam_role.nil? -%> // Test should have 2 bindings: one with a description and one without. Any < chars are converted to a unicode character by the API. - expectedPolicyData := Nprintf(`{"bindings":[{"condition":{"description":"%{condition_desc}","expression":"%{condition_expr}","title":"%{condition_title}"},"members":["user:admin@hashicorptest.com"],"role":"%{role}"},{"condition":{"expression":"%{condition_expr}","title":"%{condition_title}-no-description"},"members":["user:admin@hashicorptest.com"],"role":"%{role}"}]}`, context) + expectedPolicyData := acctest.Nprintf(`{"bindings":[{"condition":{"description":"%{condition_desc}","expression":"%{condition_expr}","title":"%{condition_title}"},"members":["user:admin@hashicorptest.com"],"role":"%{role}"},{"condition":{"expression":"%{condition_expr}","title":"%{condition_title}-no-description"},"members":["user:admin@hashicorptest.com"],"role":"%{role}"}]}`, context) <% else -%> // Test should have 3 bindings: one with a description and one without, and a third for an admin role. Any < chars are converted to a unicode character by the API. - expectedPolicyData := Nprintf(`{"bindings":[{"members":["serviceAccount:%{service_account}"],"role":"%{admin_role}"},{"condition":{"description":"%{condition_desc}","expression":"%{condition_expr}","title":"%{condition_title}"},"members":["user:admin@hashicorptest.com"],"role":"%{role}"},{"condition":{"expression":"%{condition_expr}","title":"%{condition_title}-no-description"},"members":["user:admin@hashicorptest.com"],"role":"%{role}"}]}`, context) + expectedPolicyData := acctest.Nprintf(`{"bindings":[{"members":["serviceAccount:%{service_account}"],"role":"%{admin_role}"},{"condition":{"description":"%{condition_desc}","expression":"%{condition_expr}","title":"%{condition_title}"},"members":["user:admin@hashicorptest.com"],"role":"%{role}"},{"condition":{"expression":"%{condition_expr}","title":"%{condition_title}-no-description"},"members":["user:admin@hashicorptest.com"],"role":"%{role}"}]}`, context) <% end -%> expectedPolicyData = strings.Replace(expectedPolicyData, "<", "\\u003c", -1) @@ -416,7 +416,7 @@ func TestAcc<%= resource_name -%>IamPolicyGenerated_withCondition(t *testing.T) <% end -%> func testAcc<%= resource_name -%>IamMember_basicGenerated(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` <%= example.config_test_body(pwd) -%> resource "<%= resource_ns_iam -%>_member" "foo" { @@ -431,7 +431,7 @@ resource "<%= resource_ns_iam -%>_member" "foo" { } func testAcc<%= resource_name -%>IamPolicy_basicGenerated(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` <%= example.config_test_body(pwd) -%> data "google_iam_policy" "foo" { @@ -471,7 +471,7 @@ data "<%= resource_ns_iam -%>_policy" "foo" { } func testAcc<%= resource_name -%>IamPolicy_emptyBinding(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` <%= example.config_test_body(pwd) -%> data "google_iam_policy" "foo" { @@ -491,7 +491,7 @@ resource "<%= resource_ns_iam -%>_policy" "foo" { } func testAcc<%= resource_name -%>IamBinding_basicGenerated(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` <%= example.config_test_body(pwd) -%> resource "<%= resource_ns_iam -%>_binding" "foo" { @@ -506,7 +506,7 @@ resource "<%= resource_ns_iam -%>_binding" "foo" { } func testAcc<%= resource_name -%>IamBinding_updateGenerated(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` <%= example.config_test_body(pwd) -%> resource "<%= resource_ns_iam -%>_binding" "foo" { @@ -522,7 +522,7 @@ resource "<%= resource_ns_iam -%>_binding" "foo" { <% unless object.iam_policy.iam_conditions_request_type.nil? -%> func testAcc<%= resource_name -%>IamBinding_withConditionGenerated(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` <%= example.config_test_body(pwd) -%> resource "<%= resource_ns_iam -%>_binding" "foo" { @@ -542,7 +542,7 @@ resource "<%= resource_ns_iam -%>_binding" "foo" { } func testAcc<%= resource_name -%>IamBinding_withAndWithoutConditionGenerated(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` <%= example.config_test_body(pwd) -%> resource "<%= resource_ns_iam -%>_binding" "foo" { @@ -586,7 +586,7 @@ resource "<%= resource_ns_iam -%>_binding" "foo3" { } func testAcc<%= resource_name -%>IamMember_withConditionGenerated(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` <%= example.config_test_body(pwd) -%> resource "<%= resource_ns_iam -%>_member" "foo" { @@ -606,7 +606,7 @@ resource "<%= resource_ns_iam -%>_member" "foo" { } func testAcc<%= resource_name -%>IamMember_withAndWithoutConditionGenerated(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` <%= example.config_test_body(pwd) -%> resource "<%= resource_ns_iam -%>_member" "foo" { @@ -650,7 +650,7 @@ resource "<%= resource_ns_iam -%>_member" "foo3" { } func testAcc<%= resource_name -%>IamPolicy_withConditionGenerated(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` <%= example.config_test_body(pwd) -%> data "google_iam_policy" "foo" { diff --git a/mmv1/templates/terraform/examples/base_configs/test_body.go.erb b/mmv1/templates/terraform/examples/base_configs/test_body.go.erb index 9d2daab180cf..a42d2e45a32c 100644 --- a/mmv1/templates/terraform/examples/base_configs/test_body.go.erb +++ b/mmv1/templates/terraform/examples/base_configs/test_body.go.erb @@ -1,3 +1,3 @@ - return tpgresource.Nprintf(` + return acctest.Nprintf(` <%= ctx[:content] -%> `, context) diff --git a/mmv1/templates/validator/examples/base_configs/test_body.go.erb b/mmv1/templates/validator/examples/base_configs/test_body.go.erb index 8243b3a0792c..a42d2e45a32c 100644 --- a/mmv1/templates/validator/examples/base_configs/test_body.go.erb +++ b/mmv1/templates/validator/examples/base_configs/test_body.go.erb @@ -1,3 +1,3 @@ - return Nprintf(` + return acctest.Nprintf(` <%= ctx[:content] -%> `, context) diff --git a/mmv1/third_party/terraform/acctest/test_utils.go b/mmv1/third_party/terraform/acctest/test_utils.go index b2615cd08343..7c6cfdf4e7ed 100644 --- a/mmv1/third_party/terraform/acctest/test_utils.go +++ b/mmv1/third_party/terraform/acctest/test_utils.go @@ -3,6 +3,7 @@ package acctest import ( "errors" "fmt" + "strings" "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" ) @@ -54,3 +55,14 @@ func CheckDataSourceStateMatchesResourceStateWithIgnores(dataSourceName, resourc return nil } } + +// This is a Printf sibling (Nprintf; Named Printf), which handles strings like +// Nprintf("Hello %{target}!", map[string]interface{}{"target":"world"}) == "Hello world!". +// This is particularly useful for generated tests, where we don't want to use Printf, +// since that would require us to generate a very particular ordering of arguments. +func Nprintf(format string, params map[string]interface{}) string { + for key, val := range params { + format = strings.Replace(format, "%{"+key+"}", fmt.Sprintf("%v", val), -1) + } + return format +} diff --git a/mmv1/third_party/terraform/tests/data_source_access_approval_folder_service_account_test.go b/mmv1/third_party/terraform/tests/data_source_access_approval_folder_service_account_test.go index 774a49317ca4..a9fddc5ba9cd 100644 --- a/mmv1/third_party/terraform/tests/data_source_access_approval_folder_service_account_test.go +++ b/mmv1/third_party/terraform/tests/data_source_access_approval_folder_service_account_test.go @@ -36,7 +36,7 @@ func TestAccDataSourceAccessApprovalFolderServiceAccount_basic(t *testing.T) { } func testAccDataSourceAccessApprovalFolderServiceAccount_basic(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_folder" "my_folder" { display_name = "tf-test-my-folder%{random_suffix}" parent = "organizations/%{org_id}" diff --git a/mmv1/third_party/terraform/tests/data_source_access_approval_organization_service_account_test.go b/mmv1/third_party/terraform/tests/data_source_access_approval_organization_service_account_test.go index f42c34a3c4a0..a8e6cdcbfca0 100644 --- a/mmv1/third_party/terraform/tests/data_source_access_approval_organization_service_account_test.go +++ b/mmv1/third_party/terraform/tests/data_source_access_approval_organization_service_account_test.go @@ -32,7 +32,7 @@ func TestAccDataSourceAccessApprovalOrganizationServiceAccount_basic(t *testing. } func testAccDataSourceAccessApprovalOrganizationServiceAccount_basic(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` data "google_access_approval_organization_service_account" "aa_account" { organization_id = "%{org_id}" } diff --git a/mmv1/third_party/terraform/tests/data_source_access_approval_project_service_account_test.go b/mmv1/third_party/terraform/tests/data_source_access_approval_project_service_account_test.go index b3631e980de1..04b8efb51b8d 100644 --- a/mmv1/third_party/terraform/tests/data_source_access_approval_project_service_account_test.go +++ b/mmv1/third_party/terraform/tests/data_source_access_approval_project_service_account_test.go @@ -32,7 +32,7 @@ func TestAccDataSourceAccessApprovalProjectServiceAccount_basic(t *testing.T) { } func testAccDataSourceAccessApprovalProjectServiceAccount_basic(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` data "google_access_approval_project_service_account" "aa_account" { project_id = "%{project_id}" } diff --git a/mmv1/third_party/terraform/tests/data_source_alloydb_locations_test.go b/mmv1/third_party/terraform/tests/data_source_alloydb_locations_test.go index 98f6a7569b05..0dd756ee76e4 100644 --- a/mmv1/third_party/terraform/tests/data_source_alloydb_locations_test.go +++ b/mmv1/third_party/terraform/tests/data_source_alloydb_locations_test.go @@ -36,7 +36,7 @@ func TestAccDataSourceAlloydbLocations_basic(t *testing.T) { } func testAccDataSourceAlloydbLocations_basic(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` data "google_alloydb_locations" "qa" { } `, context) diff --git a/mmv1/third_party/terraform/tests/data_source_alloydb_supported_database_flags_test.go b/mmv1/third_party/terraform/tests/data_source_alloydb_supported_database_flags_test.go index 54a84c7d27a0..c7daab87477c 100644 --- a/mmv1/third_party/terraform/tests/data_source_alloydb_supported_database_flags_test.go +++ b/mmv1/third_party/terraform/tests/data_source_alloydb_supported_database_flags_test.go @@ -35,7 +35,7 @@ func TestAccDataSourceAlloydbSupportedDatabaseFlags_basic(t *testing.T) { } func testAccDataSourceAlloydbSupportedDatabaseFlags_basic(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` data "google_alloydb_supported_database_flags" "qa" { location = "us-central1" } diff --git a/mmv1/third_party/terraform/tests/data_source_artifact_registry_repository_test.go b/mmv1/third_party/terraform/tests/data_source_artifact_registry_repository_test.go index 084023b4f2c3..6598369b8542 100644 --- a/mmv1/third_party/terraform/tests/data_source_artifact_registry_repository_test.go +++ b/mmv1/third_party/terraform/tests/data_source_artifact_registry_repository_test.go @@ -32,7 +32,7 @@ func TestAccDataSourceGoogleArtifactRegistryRepositoryConfig(t *testing.T) { } func testAccDataSourceGoogleArtifactRegistryRepositoryConfig(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_artifact_registry_repository" "my-repo" { location = "us-central1" repository_id = "tf-test-my-repository%{random_suffix}" diff --git a/mmv1/third_party/terraform/tests/data_source_certificate_authority_test.go b/mmv1/third_party/terraform/tests/data_source_certificate_authority_test.go index 82325b41e91f..c4692c3a3c52 100644 --- a/mmv1/third_party/terraform/tests/data_source_certificate_authority_test.go +++ b/mmv1/third_party/terraform/tests/data_source_certificate_authority_test.go @@ -32,7 +32,7 @@ func TestAccDataSourcePrivatecaCertificateAuthority_privatecaCertificateAuthorit } func testAccDataSourcePrivatecaCertificateAuthority_privatecaCertificateAuthorityBasicExample(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_privateca_certificate_authority" "default" { // This example assumes this pool already exists. // Pools cannot be deleted in normal test circumstances, so we depend on static pools diff --git a/mmv1/third_party/terraform/tests/data_source_cloud_identity_group_memberships_test.go b/mmv1/third_party/terraform/tests/data_source_cloud_identity_group_memberships_test.go index 84c052ca03e0..4ad910b3902c 100644 --- a/mmv1/third_party/terraform/tests/data_source_cloud_identity_group_memberships_test.go +++ b/mmv1/third_party/terraform/tests/data_source_cloud_identity_group_memberships_test.go @@ -17,7 +17,7 @@ func testAccDataSourceCloudIdentityGroupMemberships_basicTest(t *testing.T) { "random_suffix": RandString(t, 10), } - memberId := Nprintf("%{identity_user}@%{org_domain}", context) + memberId := acctest.Nprintf("%{identity_user}@%{org_domain}", context) VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, @@ -39,7 +39,7 @@ func testAccDataSourceCloudIdentityGroupMemberships_basicTest(t *testing.T) { } func testAccCloudIdentityGroupMembershipConfig(context map[string]interface{}) string { - return testAccCloudIdentityGroupMembership_cloudIdentityGroupMembershipUserExample(context) + Nprintf(` + return testAccCloudIdentityGroupMembership_cloudIdentityGroupMembershipUserExample(context) + acctest.Nprintf(` data "google_cloud_identity_group_memberships" "members" { group = google_cloud_identity_group_membership.cloud_identity_group_membership_basic.group diff --git a/mmv1/third_party/terraform/tests/data_source_cloud_identity_groups_test.go b/mmv1/third_party/terraform/tests/data_source_cloud_identity_groups_test.go index 85405a7ff534..af4632061cea 100644 --- a/mmv1/third_party/terraform/tests/data_source_cloud_identity_groups_test.go +++ b/mmv1/third_party/terraform/tests/data_source_cloud_identity_groups_test.go @@ -35,7 +35,7 @@ func testAccDataSourceCloudIdentityGroups_basicTest(t *testing.T) { } func testAccCloudIdentityGroupConfig(context map[string]interface{}) string { - return testAccCloudIdentityGroup_cloudIdentityGroupsBasicExample(context) + Nprintf(` + return testAccCloudIdentityGroup_cloudIdentityGroupsBasicExample(context) + acctest.Nprintf(` data "google_cloud_identity_groups" "groups" { parent = google_cloud_identity_group.cloud_identity_group_basic.parent diff --git a/mmv1/third_party/terraform/tests/data_source_cloud_run_service_test.go b/mmv1/third_party/terraform/tests/data_source_cloud_run_service_test.go index da7478b6cfb7..29b5bf9df8ac 100644 --- a/mmv1/third_party/terraform/tests/data_source_cloud_run_service_test.go +++ b/mmv1/third_party/terraform/tests/data_source_cloud_run_service_test.go @@ -52,7 +52,7 @@ func TestAccDataSourceGoogleCloudRunService_optionalProject(t *testing.T) { } func testAccDataSourceGoogleCloudRunService_basic(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_cloud_run_service" "foo" { name = "tf-test-cloudrun-srv%{random_suffix}" location = "us-central1" @@ -80,7 +80,7 @@ data "google_cloud_run_service" "foo" { } func testAccDataSourceGoogleCloudRunService_optionalProject(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_cloud_run_service" "foo" { name = "tf-test-cloudrun-srv%{random_suffix}" location = "us-central1" diff --git a/mmv1/third_party/terraform/tests/data_source_compute_network_endpoint_group_test.go b/mmv1/third_party/terraform/tests/data_source_compute_network_endpoint_group_test.go index 3ed24f030f1e..178c2038c1ca 100644 --- a/mmv1/third_party/terraform/tests/data_source_compute_network_endpoint_group_test.go +++ b/mmv1/third_party/terraform/tests/data_source_compute_network_endpoint_group_test.go @@ -66,7 +66,7 @@ func testAccDataSourceComputeNetworkEndpointGroupCheck(data_source_name string, } func testAccDataSourceComputeNetworkEndpointGroupConfig(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_compute_network_endpoint_group" "neg" { name = "tf-test-my-lb-ds-neg%{random_suffix}" network = "${google_compute_network.default.self_link}" diff --git a/mmv1/third_party/terraform/tests/data_source_compute_network_peering_test.go b/mmv1/third_party/terraform/tests/data_source_compute_network_peering_test.go index 8fcda0ae55ed..459b3c870920 100644 --- a/mmv1/third_party/terraform/tests/data_source_compute_network_peering_test.go +++ b/mmv1/third_party/terraform/tests/data_source_compute_network_peering_test.go @@ -30,7 +30,7 @@ func TestAccDataSourceComputeNetworkPeering_basic(t *testing.T) { } func testAccDataSourceComputeNetworkPeering_basic(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_compute_network_peering" "peering1" { name = "peering1-%{random_suffix}" network = google_compute_network.default.self_link diff --git a/mmv1/third_party/terraform/tests/data_source_google_beyondcorp_app_connection_test.go b/mmv1/third_party/terraform/tests/data_source_google_beyondcorp_app_connection_test.go index 3b8586469e57..b4a9f2f553eb 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_beyondcorp_app_connection_test.go +++ b/mmv1/third_party/terraform/tests/data_source_google_beyondcorp_app_connection_test.go @@ -53,7 +53,7 @@ func TestAccDataSourceGoogleBeyondcorpAppConnection_full(t *testing.T) { } func testAccDataSourceGoogleBeyondcorpAppConnection_basic(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_service_account" "service_account" { account_id = "tf-test-my-account%{random_suffix}" display_name = "Test Service Account" @@ -85,7 +85,7 @@ data "google_beyondcorp_app_connection" "foo" { } func testAccDataSourceGoogleBeyondcorpAppConnection_full(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_service_account" "service_account" { account_id = "tf-test-my-account%{random_suffix}" display_name = "Test Service Account" diff --git a/mmv1/third_party/terraform/tests/data_source_google_beyondcorp_app_connector_test.go b/mmv1/third_party/terraform/tests/data_source_google_beyondcorp_app_connector_test.go index 1e775864ddad..ec5f164a6eee 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_beyondcorp_app_connector_test.go +++ b/mmv1/third_party/terraform/tests/data_source_google_beyondcorp_app_connector_test.go @@ -96,7 +96,7 @@ func TestAccDataSourceGoogleBeyondcorpAppConnector_optionalProjectRegion(t *test } func testAccDataSourceGoogleBeyondcorpAppConnector_basic(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_service_account" "service_account" { account_id = "tf-test-my-account%{random_suffix}" display_name = "Test Service Account" @@ -120,7 +120,7 @@ data "google_beyondcorp_app_connector" "foo" { } func testAccDataSourceGoogleBeyondcorpAppConnector_optionalProject(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_service_account" "service_account" { account_id = "tf-test-my-account%{random_suffix}" display_name = "Test Service Account" @@ -143,7 +143,7 @@ data "google_beyondcorp_app_connector" "foo" { } func testAccDataSourceGoogleBeyondcorpAppConnector_optionalRegion(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_service_account" "service_account" { account_id = "tf-test-my-account%{random_suffix}" display_name = "Test Service Account" @@ -166,7 +166,7 @@ data "google_beyondcorp_app_connector" "foo" { } func testAccDataSourceGoogleBeyondcorpAppConnector_optionalProjectRegion(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_service_account" "service_account" { account_id = "tf-test-my-account%{random_suffix}" display_name = "Test Service Account" diff --git a/mmv1/third_party/terraform/tests/data_source_google_beyondcorp_app_gateway_test.go b/mmv1/third_party/terraform/tests/data_source_google_beyondcorp_app_gateway_test.go index 37081926e451..2ada03644414 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_beyondcorp_app_gateway_test.go +++ b/mmv1/third_party/terraform/tests/data_source_google_beyondcorp_app_gateway_test.go @@ -96,7 +96,7 @@ func TestAccDataSourceGoogleBeyondcorpAppGateway_optionalProjectRegion(t *testin } func testAccDataSourceGoogleBeyondcorpAppGateway_basic(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_beyondcorp_app_gateway" "foo" { name = "tf-test-appgateway-%{random_suffix}" type = "TCP_PROXY" @@ -112,7 +112,7 @@ data "google_beyondcorp_app_gateway" "foo" { } func testAccDataSourceGoogleBeyondcorpAppGateway_optionalProject(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_beyondcorp_app_gateway" "foo" { name = "tf-test-appgateway-%{random_suffix}" type = "TCP_PROXY" @@ -127,7 +127,7 @@ data "google_beyondcorp_app_gateway" "foo" { } func testAccDataSourceGoogleBeyondcorpAppGateway_optionalRegion(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_beyondcorp_app_gateway" "foo" { name = "tf-test-appgateway-%{random_suffix}" type = "TCP_PROXY" @@ -142,7 +142,7 @@ data "google_beyondcorp_app_gateway" "foo" { } func testAccDataSourceGoogleBeyondcorpAppGateway_optionalProjectRegion(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_beyondcorp_app_gateway" "foo" { name = "tf-test-appgateway-%{random_suffix}" type = "TCP_PROXY" diff --git a/mmv1/third_party/terraform/tests/data_source_google_cloudbuild_trigger_test.go b/mmv1/third_party/terraform/tests/data_source_google_cloudbuild_trigger_test.go index 0e235ffa1d35..ad9541ec7982 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_cloudbuild_trigger_test.go +++ b/mmv1/third_party/terraform/tests/data_source_google_cloudbuild_trigger_test.go @@ -30,7 +30,7 @@ func TestAccDataSourceGoogleCloudBuildTrigger_basic(t *testing.T) { } func testAccDataSourceGoogleCloudBuildTrigger_basic(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_cloudbuild_trigger" "test-trigger" { location = "us-central1" name = "manual-build%{random_suffix}" diff --git a/mmv1/third_party/terraform/tests/data_source_google_composer_environment_test.go b/mmv1/third_party/terraform/tests/data_source_google_composer_environment_test.go index 3da4fd563315..0455ddb56b00 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_composer_environment_test.go +++ b/mmv1/third_party/terraform/tests/data_source_google_composer_environment_test.go @@ -76,7 +76,7 @@ func testAccCheckGoogleComposerEnvironmentMeta(n string) resource.TestCheckFunc } func testAccDataSourceComposerEnvironment_basic(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_composer_environment" "test" { name = "tf-test-composer-env-%{random_suffix}" region = "us-central1" diff --git a/mmv1/third_party/terraform/tests/data_source_google_compute_disk_test.go b/mmv1/third_party/terraform/tests/data_source_google_compute_disk_test.go index 695fc9def418..eaf2e3f8fd3d 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_compute_disk_test.go +++ b/mmv1/third_party/terraform/tests/data_source_google_compute_disk_test.go @@ -30,7 +30,7 @@ func TestAccDataSourceGoogleComputeDisk_basic(t *testing.T) { } func testAccDataSourceGoogleComputeDisk_basic(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_compute_disk" "foo" { name = "tf-test-compute-disk-%{random_suffix}" } diff --git a/mmv1/third_party/terraform/tests/data_source_google_compute_instance_group_manager_test.go b/mmv1/third_party/terraform/tests/data_source_google_compute_instance_group_manager_test.go index a5a319e0335d..2982edcf8fbc 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_compute_instance_group_manager_test.go +++ b/mmv1/third_party/terraform/tests/data_source_google_compute_instance_group_manager_test.go @@ -46,7 +46,7 @@ func TestAccDataSourceGoogleComputeInstanceGroupManager(t *testing.T) { } func testAccDataSourceGoogleComputeInstanceGroupManager_basic1(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_compute_health_check" "autohealing" { name = "%{autoHealName}" check_interval_sec = 5 @@ -122,7 +122,7 @@ func testAccDataSourceGoogleComputeInstanceGroupManager_basic1(context map[strin } func testAccDataSourceGoogleComputeInstanceGroupManager_basic2(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_compute_health_check" "autohealing" { name = "%{autoHealName}" check_interval_sec = 5 diff --git a/mmv1/third_party/terraform/tests/data_source_google_compute_instance_template_test.go b/mmv1/third_party/terraform/tests/data_source_google_compute_instance_template_test.go index dd3962e96b31..da60fa3f860c 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_compute_instance_template_test.go +++ b/mmv1/third_party/terraform/tests/data_source_google_compute_instance_template_test.go @@ -97,7 +97,7 @@ func TestAccInstanceTemplateDatasource_self_link_unique(t *testing.T) { } func testAccInstanceTemplate_name(project, suffix string) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_compute_instance_template" "default" { name = "tf-test-template-%{suffix}" description = "Example template." @@ -125,7 +125,7 @@ data "google_compute_instance_template" "default" { } func testAccInstanceTemplate_filter(project, suffix string) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_compute_instance_template" "a" { name = "tf-test-template-a-%{suffix}" description = "Example template." @@ -191,7 +191,7 @@ data "google_compute_instance_template" "default" { } func testAccInstanceTemplate_filter_mostRecent(project, suffix string) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_compute_instance_template" "a" { name = "tf-test-template-%{suffix}-a" description = "tf-test-instance-template" @@ -267,7 +267,7 @@ data "google_compute_instance_template" "default" { } func testAccInstanceTemplate_self_link_unique(project, suffix string) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_compute_instance_template" "default" { name = "tf-test-template-%{suffix}" description = "Example template." diff --git a/mmv1/third_party/terraform/tests/data_source_google_compute_region_instance_template_test.go.erb b/mmv1/third_party/terraform/tests/data_source_google_compute_region_instance_template_test.go.erb index aadd6b461b01..df7f08b11acd 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_compute_region_instance_template_test.go.erb +++ b/mmv1/third_party/terraform/tests/data_source_google_compute_region_instance_template_test.go.erb @@ -76,7 +76,7 @@ func TestAccRegionInstanceTemplateDatasource_filter_mostRecent(t *testing.T) { } func testAccRegionInstanceTemplate_name(project, suffix string) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_compute_region_instance_template" "default" { name = "tf-test-template-%{suffix}" description = "Example template." @@ -101,7 +101,7 @@ data "google_compute_region_instance_template" "default" { } func testAccRegionInstanceTemplate_filter(project, suffix string) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_compute_region_instance_template" "a" { name = "tf-test-template-a-%{suffix}" description = "Example template." @@ -161,7 +161,7 @@ data "google_compute_region_instance_template" "default" { } func testAccRegionInstanceTemplate_filter_mostRecent(project, suffix string) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_compute_region_instance_template" "a" { name = "tf-test-template-%{suffix}-a" description = "tf-test-instance-template" diff --git a/mmv1/third_party/terraform/tests/data_source_google_compute_region_network_endpoint_group_test.go b/mmv1/third_party/terraform/tests/data_source_google_compute_region_network_endpoint_group_test.go index 8dfe7efa43bd..b1b715cf96a0 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_compute_region_network_endpoint_group_test.go +++ b/mmv1/third_party/terraform/tests/data_source_google_compute_region_network_endpoint_group_test.go @@ -29,7 +29,7 @@ func TestAccDataSourceRegionNetworkEndpointGroup_basic(t *testing.T) { } func testAccDataSourceRegionNetworkEndpointGroup_basic(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_compute_region_network_endpoint_group" "cloudrun_neg" { name = "cloud-run-rneg-%{random_suffix}" network_endpoint_type = "SERVERLESS" diff --git a/mmv1/third_party/terraform/tests/data_source_google_compute_router_nat_test.go b/mmv1/third_party/terraform/tests/data_source_google_compute_router_nat_test.go index bb807b294061..fa8d25a6358a 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_compute_router_nat_test.go +++ b/mmv1/third_party/terraform/tests/data_source_google_compute_router_nat_test.go @@ -30,7 +30,7 @@ func TestAccDataSourceGoogleComputeRouterNat_basic(t *testing.T) { } func testAccDataSourceGoogleComputeRouterNat_basic(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_compute_network" "net" { name = "my-network%{random_suffix}" } diff --git a/mmv1/third_party/terraform/tests/data_source_google_compute_router_status_test.go b/mmv1/third_party/terraform/tests/data_source_google_compute_router_status_test.go index 7e79ecf2114f..dd62230fbfe5 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_compute_router_status_test.go +++ b/mmv1/third_party/terraform/tests/data_source_google_compute_router_status_test.go @@ -40,7 +40,7 @@ func TestAccDataSourceComputeRouterStatus(t *testing.T) { } func testAccDataSourceComputeRouterStatusConfig(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_compute_network" "network1" { name = "network1-%{suffix}" routing_mode = "GLOBAL" diff --git a/mmv1/third_party/terraform/tests/data_source_google_compute_snapshot_test.go b/mmv1/third_party/terraform/tests/data_source_google_compute_snapshot_test.go index 319e854febfa..85fd99e921bb 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_compute_snapshot_test.go +++ b/mmv1/third_party/terraform/tests/data_source_google_compute_snapshot_test.go @@ -72,7 +72,7 @@ func TestAccSnapshotDatasource_filterMostRecent(t *testing.T) { } func testAccSnapshot_name(project, suffix string) string { - return Nprintf(` + return acctest.Nprintf(` data "google_compute_image" "tf-test-image" { family = "debian-11" project = "debian-cloud" @@ -104,7 +104,7 @@ func testAccSnapshot_name(project, suffix string) string { } func testAccSnapshot_filter(project, suffix string) string { - return Nprintf(` + return acctest.Nprintf(` data "google_compute_image" "tf-test-image" { family = "debian-11" project = "debian-cloud" @@ -155,7 +155,7 @@ func testAccSnapshot_filter(project, suffix string) string { } func testAccSnapshot_filter_mostRecent(project, suffix string) string { - return Nprintf(` + return acctest.Nprintf(` data "google_compute_image" "tf-test-image" { family = "debian-11" project = "debian-cloud" diff --git a/mmv1/third_party/terraform/tests/data_source_google_firebase_android_app_config_test.go.erb b/mmv1/third_party/terraform/tests/data_source_google_firebase_android_app_config_test.go.erb index d824dd830d74..5028af72da67 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_firebase_android_app_config_test.go.erb +++ b/mmv1/third_party/terraform/tests/data_source_google_firebase_android_app_config_test.go.erb @@ -36,7 +36,7 @@ func TestAccDataSourceGoogleFirebaseAndroidAppConfig(t *testing.T) { } func testAccDataSourceGoogleFirebaseAndroidAppConfig(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_firebase_android_app" "my_app_config" { project = "%{project_id}" package_name = "%{package_name}" diff --git a/mmv1/third_party/terraform/tests/data_source_google_firebase_android_app_test.go.erb b/mmv1/third_party/terraform/tests/data_source_google_firebase_android_app_test.go.erb index b916b52c950c..315c16c0601f 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_firebase_android_app_test.go.erb +++ b/mmv1/third_party/terraform/tests/data_source_google_firebase_android_app_test.go.erb @@ -41,7 +41,7 @@ func TestAccDataSourceGoogleFirebaseAndroidApp(t *testing.T) { } func testAccDataSourceGoogleFirebaseAndroidApp(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_firebase_android_app" "my_app" { project = "%{project_id}" package_name = "%{package_name}" diff --git a/mmv1/third_party/terraform/tests/data_source_google_firebase_apple_app_config_test.go.erb b/mmv1/third_party/terraform/tests/data_source_google_firebase_apple_app_config_test.go.erb index 38a95608b0ac..d7143641cd76 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_firebase_apple_app_config_test.go.erb +++ b/mmv1/third_party/terraform/tests/data_source_google_firebase_apple_app_config_test.go.erb @@ -50,7 +50,7 @@ func TestAccDataSourceGoogleFirebaseAppleAppConfig(t *testing.T) { } func testAccDataSourceGoogleFirebaseAppleAppConfig(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_firebase_apple_app" "my_app_config" { project = "%{project_id}" bundle_id = "%{bundle_id}" diff --git a/mmv1/third_party/terraform/tests/data_source_google_firebase_apple_app_test.go.erb b/mmv1/third_party/terraform/tests/data_source_google_firebase_apple_app_test.go.erb index 66d114d40032..a7b5934426fc 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_firebase_apple_app_test.go.erb +++ b/mmv1/third_party/terraform/tests/data_source_google_firebase_apple_app_test.go.erb @@ -43,7 +43,7 @@ func TestAccDataSourceGoogleFirebaseAppleApp(t *testing.T) { } func testAccDataSourceGoogleFirebaseAppleApp(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_firebase_apple_app" "my_app" { project = "%{project_id}" bundle_id = "%{bundle_id}" diff --git a/mmv1/third_party/terraform/tests/data_source_google_firebase_hosting_channel_test.go.erb b/mmv1/third_party/terraform/tests/data_source_google_firebase_hosting_channel_test.go.erb index baffa58dd2fa..1408f1b15a75 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_firebase_hosting_channel_test.go.erb +++ b/mmv1/third_party/terraform/tests/data_source_google_firebase_hosting_channel_test.go.erb @@ -35,7 +35,7 @@ func TestAccDataSourceGoogleFirebaseHostingChannel(t *testing.T) { } func testAccDataSourceGoogleFirebaseHostingChannel(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_firebase_hosting_site" "default" { project = "%{project_id}" site_id = "tf-test-site-with-channel%{random_suffix}" diff --git a/mmv1/third_party/terraform/tests/data_source_google_firebase_web_app_test.go.erb b/mmv1/third_party/terraform/tests/data_source_google_firebase_web_app_test.go.erb index ce6347c59f20..96f4f3fe64d9 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_firebase_web_app_test.go.erb +++ b/mmv1/third_party/terraform/tests/data_source_google_firebase_web_app_test.go.erb @@ -40,7 +40,7 @@ func TestAccDataSourceGoogleFirebaseWebApp(t *testing.T) { } func testAccDataSourceGoogleFirebaseWebApp(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_firebase_web_app" "my_app" { project = "%{project_id}" display_name = "%{display_name}" diff --git a/mmv1/third_party/terraform/tests/data_source_google_game_services_game_server_deployment_rollout_test.go b/mmv1/third_party/terraform/tests/data_source_google_game_services_game_server_deployment_rollout_test.go index 4912fe985cff..18585968ebd8 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_game_services_game_server_deployment_rollout_test.go +++ b/mmv1/third_party/terraform/tests/data_source_google_game_services_game_server_deployment_rollout_test.go @@ -30,7 +30,7 @@ func TestAccDataSourceGameServicesGameServerDeploymentRollout_basic(t *testing.T } func testAccDataSourceGameServicesGameServerDeploymentRollout_basic(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_game_services_game_server_deployment" "default" { deployment_id = "tf-test-deployment-%{random_suffix}" description = "a deployment description" diff --git a/mmv1/third_party/terraform/tests/data_source_google_logging_project_cmek_settings_test.go b/mmv1/third_party/terraform/tests/data_source_google_logging_project_cmek_settings_test.go index 8a563251acb6..299cdf1947b4 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_logging_project_cmek_settings_test.go +++ b/mmv1/third_party/terraform/tests/data_source_google_logging_project_cmek_settings_test.go @@ -38,7 +38,7 @@ func TestAccLoggingProjectCmekSettings_basic(t *testing.T) { } func testAccLoggingProjectCmekSettings_basic(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_project" "default" { project_id = "%{project_name}" name = "%{project_name}" diff --git a/mmv1/third_party/terraform/tests/data_source_google_logging_sink_test.go b/mmv1/third_party/terraform/tests/data_source_google_logging_sink_test.go index 384f47ecf5a0..56ffcd6c58e2 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_logging_sink_test.go +++ b/mmv1/third_party/terraform/tests/data_source_google_logging_sink_test.go @@ -39,7 +39,7 @@ func TestAccDataSourceGoogleLoggingSink_basic(t *testing.T) { } func testAccDataSourceGoogleLoggingSink_basic(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_logging_project_sink" "basic" { name = "%{sink_name}" project = "%{project_name}" diff --git a/mmv1/third_party/terraform/tests/data_source_google_vmwareengine_network_test.go.erb b/mmv1/third_party/terraform/tests/data_source_google_vmwareengine_network_test.go.erb index fe15fa9915ea..2f102929b4fd 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_vmwareengine_network_test.go.erb +++ b/mmv1/third_party/terraform/tests/data_source_google_vmwareengine_network_test.go.erb @@ -39,7 +39,7 @@ func TestAccDataSourceVmwareEngineNetwork_basic(t *testing.T) { } func testAccDataSourceVmwareEngineNetworkConfig(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` # there can be only 1 Legacy network per region for a given project, so creating new project to isolate tests. resource "google_project" "acceptance" { name = "tf-test-%{random_suffix}" diff --git a/mmv1/third_party/terraform/tests/data_source_iam_beta_workload_identity_pool_provider_test.go.erb b/mmv1/third_party/terraform/tests/data_source_iam_beta_workload_identity_pool_provider_test.go.erb index 4be4c2257eaf..8a373b00564a 100644 --- a/mmv1/third_party/terraform/tests/data_source_iam_beta_workload_identity_pool_provider_test.go.erb +++ b/mmv1/third_party/terraform/tests/data_source_iam_beta_workload_identity_pool_provider_test.go.erb @@ -32,7 +32,7 @@ func TestAccDataSourceIAMBetaWorkloadIdentityPoolProvider_basic(t *testing.T) { } func testAccDataSourceIAMBetaWorkloadIdentityPoolProviderBasic(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_iam_workload_identity_pool" "pool" { workload_identity_pool_id = "pool-%{random_suffix}" } diff --git a/mmv1/third_party/terraform/tests/data_source_iam_beta_workload_identity_pool_test.go.erb b/mmv1/third_party/terraform/tests/data_source_iam_beta_workload_identity_pool_test.go.erb index e913aa81567f..5145f8cba795 100644 --- a/mmv1/third_party/terraform/tests/data_source_iam_beta_workload_identity_pool_test.go.erb +++ b/mmv1/third_party/terraform/tests/data_source_iam_beta_workload_identity_pool_test.go.erb @@ -32,7 +32,7 @@ func TestAccDataSourceIAMBetaWorkloadIdentityPool_basic(t *testing.T) { } func testAccDataSourceIAMBetaWorkloadIdentityPoolBasic(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_iam_workload_identity_pool" "bar" { workload_identity_pool_id = "bar-pool-%{random_suffix}" display_name = "Name of pool" diff --git a/mmv1/third_party/terraform/tests/data_source_iap_client_test.go b/mmv1/third_party/terraform/tests/data_source_iap_client_test.go index de7aa137cb51..b0c92f107605 100644 --- a/mmv1/third_party/terraform/tests/data_source_iap_client_test.go +++ b/mmv1/third_party/terraform/tests/data_source_iap_client_test.go @@ -38,7 +38,7 @@ func TestAccIapClient_Datasource_basic(t *testing.T) { } func testAccIapClientDatasourceConfig(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_project" "project" { project_id = "tf-test%{random_suffix}" name = "tf-test%{random_suffix}" diff --git a/mmv1/third_party/terraform/tests/data_source_pubsub_subscription_test.go b/mmv1/third_party/terraform/tests/data_source_pubsub_subscription_test.go index d112c24c2aee..acd0f49a22ca 100644 --- a/mmv1/third_party/terraform/tests/data_source_pubsub_subscription_test.go +++ b/mmv1/third_party/terraform/tests/data_source_pubsub_subscription_test.go @@ -52,7 +52,7 @@ func TestAccDataSourceGooglePubsubSubscription_optionalProject(t *testing.T) { } func testAccDataSourceGooglePubsubSubscription_basic(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_pubsub_topic" "foo" { name = "tf-test-pubsub-%{random_suffix}" } @@ -70,7 +70,7 @@ data "google_pubsub_subscription" "foo" { } func testAccDataSourceGooglePubsubSubscription_optionalProject(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_pubsub_topic" "foo" { name = "tf-test-pubsub-%{random_suffix}" } diff --git a/mmv1/third_party/terraform/tests/data_source_pubsub_topic_test.go b/mmv1/third_party/terraform/tests/data_source_pubsub_topic_test.go index fac40df27759..9be54c5af87e 100644 --- a/mmv1/third_party/terraform/tests/data_source_pubsub_topic_test.go +++ b/mmv1/third_party/terraform/tests/data_source_pubsub_topic_test.go @@ -52,7 +52,7 @@ func TestAccDataSourceGooglePubsubTopic_optionalProject(t *testing.T) { } func testAccDataSourceGooglePubsubTopic_basic(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_pubsub_topic" "foo" { name = "tf-test-pubsub-%{random_suffix}" } @@ -65,7 +65,7 @@ data "google_pubsub_topic" "foo" { } func testAccDataSourceGooglePubsubTopic_optionalProject(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_pubsub_topic" "foo" { name = "tf-test-pubsub-%{random_suffix}" } diff --git a/mmv1/third_party/terraform/tests/data_source_secret_manager_secret_test.go b/mmv1/third_party/terraform/tests/data_source_secret_manager_secret_test.go index d98755db6549..0732ca54f09b 100644 --- a/mmv1/third_party/terraform/tests/data_source_secret_manager_secret_test.go +++ b/mmv1/third_party/terraform/tests/data_source_secret_manager_secret_test.go @@ -30,7 +30,7 @@ func TestAccDataSourceSecretManagerSecret_basic(t *testing.T) { } func testAccDataSourceSecretManagerSecret_basic(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_secret_manager_secret" "bar" { secret_id = "tf-test-secret-%{random_suffix}" diff --git a/mmv1/third_party/terraform/tests/data_source_spanner_instance_test.go b/mmv1/third_party/terraform/tests/data_source_spanner_instance_test.go index 0bf0c062e341..1c23be5f8f35 100644 --- a/mmv1/third_party/terraform/tests/data_source_spanner_instance_test.go +++ b/mmv1/third_party/terraform/tests/data_source_spanner_instance_test.go @@ -32,7 +32,7 @@ func TestAccDataSourceSpannerInstance_basic(t *testing.T) { } func testAccDataSourceSpannerInstanceBasic(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_spanner_instance" "bar" { config = "regional-us-central1" display_name = "Test Spanner Instance" diff --git a/mmv1/third_party/terraform/tests/data_source_sql_backup_run_test.go b/mmv1/third_party/terraform/tests/data_source_sql_backup_run_test.go index 08a6367804f0..dcb75730168e 100644 --- a/mmv1/third_party/terraform/tests/data_source_sql_backup_run_test.go +++ b/mmv1/third_party/terraform/tests/data_source_sql_backup_run_test.go @@ -62,7 +62,7 @@ data "google_sql_backup_run" "backup" { } func testAccDataSourceSqlBackupRun_notFound(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_sql_database_instance" "instance" { name = "tf-test-instance-%{random_suffix}" database_version = "POSTGRES_11" diff --git a/mmv1/third_party/terraform/tests/data_source_sql_database_instance_test.go b/mmv1/third_party/terraform/tests/data_source_sql_database_instance_test.go index ba14bfd68113..d4fc1c0f8984 100644 --- a/mmv1/third_party/terraform/tests/data_source_sql_database_instance_test.go +++ b/mmv1/third_party/terraform/tests/data_source_sql_database_instance_test.go @@ -36,7 +36,7 @@ func TestAccDataSourceSqlDatabaseInstance_basic(t *testing.T) { } func testAccDataSourceSqlDatabaseInstance_basic(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_sql_database_instance" "main" { name = "tf-test-instance-%{random_suffix}" database_version = "POSTGRES_11" diff --git a/mmv1/third_party/terraform/tests/data_source_sql_database_instances_test.go b/mmv1/third_party/terraform/tests/data_source_sql_database_instances_test.go index 09f9d9a536e7..d5d97ae2dcd5 100644 --- a/mmv1/third_party/terraform/tests/data_source_sql_database_instances_test.go +++ b/mmv1/third_party/terraform/tests/data_source_sql_database_instances_test.go @@ -132,7 +132,7 @@ func TestAccDataSourceSqlDatabaseInstances_tierFilter(t *testing.T) { } func testAccDataSourceSqlDatabaseInstances_basic(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_sql_database_instance" "main" { name = "tf-test-instance-%{random_suffix}" database_version = "POSTGRES_14" @@ -172,7 +172,7 @@ data "google_sql_database_instances" "qa" { } func testAccDataSourceSqlDatabaseInstances_databaseVersionFilter(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_sql_database_instance" "main" { name = "tf-test-instance-%{random_suffix}" database_version = "POSTGRES_14" @@ -213,7 +213,7 @@ data "google_sql_database_instances" "qa" { } func testAccDataSourceSqlDatabaseInstances_regionFilter(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_sql_database_instance" "main" { name = "tf-test-instance-%{random_suffix}" database_version = "POSTGRES_14" @@ -254,7 +254,7 @@ data "google_sql_database_instances" "qa" { } func testAccDataSourceSqlDatabaseInstances_tierFilter(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_sql_database_instance" "main" { name = "tf-test-instance-%{random_suffix}" database_version = "POSTGRES_14" diff --git a/mmv1/third_party/terraform/tests/data_source_sql_database_test.go b/mmv1/third_party/terraform/tests/data_source_sql_database_test.go index 64c65648db34..b06b6874b395 100644 --- a/mmv1/third_party/terraform/tests/data_source_sql_database_test.go +++ b/mmv1/third_party/terraform/tests/data_source_sql_database_test.go @@ -36,7 +36,7 @@ func TestAccDataSourceSqlDatabase_basic(t *testing.T) { } func testAccDataSourceSqlDatabase_basic(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_sql_database_instance" "main" { name = "tf-test-instance-%{random_suffix}" database_version = "POSTGRES_14" diff --git a/mmv1/third_party/terraform/tests/data_source_sql_databases_test.go b/mmv1/third_party/terraform/tests/data_source_sql_databases_test.go index 7d64b1cdfa8e..4be7a1bc580f 100644 --- a/mmv1/third_party/terraform/tests/data_source_sql_databases_test.go +++ b/mmv1/third_party/terraform/tests/data_source_sql_databases_test.go @@ -42,7 +42,7 @@ func TestAccDataSourceSqlDatabases_basic(t *testing.T) { } func testAccDataSourceSqlDatabases_basic(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_sql_database_instance" "main" { name = "tf-test-instance-%{random_suffix}" database_version = "POSTGRES_14" diff --git a/mmv1/third_party/terraform/tests/data_source_vertex_ai_index_test.go b/mmv1/third_party/terraform/tests/data_source_vertex_ai_index_test.go index 93220ff04f51..fecdf2d1d006 100644 --- a/mmv1/third_party/terraform/tests/data_source_vertex_ai_index_test.go +++ b/mmv1/third_party/terraform/tests/data_source_vertex_ai_index_test.go @@ -40,7 +40,7 @@ func TestAccDataSourceVertexAIIndex_basic(t *testing.T) { } func testAccDataSourceVertexAIIndex_basic(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_storage_bucket" "bucket" { name = "tf-test-%{project}-vertex-ai-index-%{random_suffix}" # Every bucket name must be globally unique location = "us-central1" diff --git a/mmv1/third_party/terraform/tests/iam_scc_source_test.go b/mmv1/third_party/terraform/tests/iam_scc_source_test.go index a8c7b1da565e..54a983d55888 100644 --- a/mmv1/third_party/terraform/tests/iam_scc_source_test.go +++ b/mmv1/third_party/terraform/tests/iam_scc_source_test.go @@ -128,7 +128,7 @@ func TestAccSecurityCenterSourceIamPolicy(t *testing.T) { } func testAccSecurityCenterSourceIamMember_basic(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_scc_source" "custom_source" { display_name = "tf-test-source%{random_suffix}" organization = "%{org_id}" @@ -145,7 +145,7 @@ resource "google_scc_source_iam_member" "foo" { } func testAccSecurityCenterSourceIamPolicy_basic(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_scc_source" "custom_source" { display_name = "tf-test-source%{random_suffix}" organization = "%{org_id}" @@ -168,7 +168,7 @@ resource "google_scc_source_iam_policy" "foo" { } func testAccSecurityCenterSourceIamPolicy_emptyBinding(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_scc_source" "custom_source" { display_name = "tf-test-source%{random_suffix}" organization = "%{org_id}" @@ -187,7 +187,7 @@ resource "google_scc_source_iam_policy" "foo" { } func testAccSecurityCenterSourceIamBinding_basic(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_scc_source" "custom_source" { display_name = "tf-test-source%{random_suffix}" organization = "%{org_id}" @@ -204,7 +204,7 @@ resource "google_scc_source_iam_binding" "foo" { } func testAccSecurityCenterSourceIamBinding_update(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_scc_source" "custom_source" { display_name = "tf-test-source%{random_suffix}" organization = "%{org_id}" diff --git a/mmv1/third_party/terraform/tests/resource_access_approval_folder_settings_test.go b/mmv1/third_party/terraform/tests/resource_access_approval_folder_settings_test.go index b0d5fd6eecd4..f95e3f68f1ca 100644 --- a/mmv1/third_party/terraform/tests/resource_access_approval_folder_settings_test.go +++ b/mmv1/third_party/terraform/tests/resource_access_approval_folder_settings_test.go @@ -63,7 +63,7 @@ func testAccAccessApprovalFolderSettings(t *testing.T) { } func testAccAccessApprovalFolderSettings_full(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_folder" "my_folder" { display_name = "tf-test-my-folder%{random_suffix}" parent = "organizations/%{org_id}" @@ -90,7 +90,7 @@ resource "google_folder_access_approval_settings" "folder_access_approval" { } func testAccAccessApprovalFolderSettings_update(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_folder" "my_folder" { display_name = "tf-test-my-folder%{random_suffix}" parent = "organizations/%{org_id}" @@ -117,7 +117,7 @@ resource "google_folder_access_approval_settings" "folder_access_approval" { } func testAccAccessApprovalFolderSettings_activeKeyVersion(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_folder" "my_folder" { display_name = "tf-test-my-folder%{random_suffix}" parent = "organizations/%{org_id}" diff --git a/mmv1/third_party/terraform/tests/resource_access_approval_organization_settings_test.go b/mmv1/third_party/terraform/tests/resource_access_approval_organization_settings_test.go index b32c5de9f4be..bb2285403f4c 100644 --- a/mmv1/third_party/terraform/tests/resource_access_approval_organization_settings_test.go +++ b/mmv1/third_party/terraform/tests/resource_access_approval_organization_settings_test.go @@ -78,7 +78,7 @@ func testAccAccessApprovalOrganizationSettings(t *testing.T) { } func testAccAccessApprovalOrganizationSettings_full(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_organization_access_approval_settings" "organization_access_approval" { organization_id = "%{org_id}" notification_emails = ["testuser@example.com"] @@ -96,7 +96,7 @@ resource "google_organization_access_approval_settings" "organization_access_app } func testAccAccessApprovalOrganizationSettings_update(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_organization_access_approval_settings" "organization_access_approval" { organization_id = "%{org_id}" notification_emails = ["testuser@example.com", "example.user@example.com"] @@ -110,7 +110,7 @@ resource "google_organization_access_approval_settings" "organization_access_app } func testAccAccessApprovalOrganizationSettings_activeKeyVersion(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_kms_key_ring" "key_ring" { name = "tf-test-%{random_suffix}" project = "%{project}" diff --git a/mmv1/third_party/terraform/tests/resource_access_approval_project_settings_test.go b/mmv1/third_party/terraform/tests/resource_access_approval_project_settings_test.go index 85d7410d1d82..dd172c7f082c 100644 --- a/mmv1/third_party/terraform/tests/resource_access_approval_project_settings_test.go +++ b/mmv1/third_party/terraform/tests/resource_access_approval_project_settings_test.go @@ -60,7 +60,7 @@ func testAccAccessApprovalProjectSettings(t *testing.T) { } func testAccAccessApprovalProjectSettings_basic(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_project_access_approval_settings" "project_access_approval" { project_id = "%{project}" @@ -73,7 +73,7 @@ resource "google_project_access_approval_settings" "project_access_approval" { } func testAccAccessApprovalProjectSettings_update(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_project_access_approval_settings" "project_access_approval" { project_id = "%{project}" notification_emails = ["testuser@example.com", "example.user@example.com"] @@ -87,7 +87,7 @@ resource "google_project_access_approval_settings" "project_access_approval" { } func testAccAccessApprovalProjectSettings_activeKeyVersion(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_kms_key_ring" "key_ring" { name = "tf-test-%{random_suffix}" project = "%{project}" diff --git a/mmv1/third_party/terraform/tests/resource_access_context_manager_authorized_orgs_desc_test.go b/mmv1/third_party/terraform/tests/resource_access_context_manager_authorized_orgs_desc_test.go index 8ca9e899db68..4ff922eeece0 100644 --- a/mmv1/third_party/terraform/tests/resource_access_context_manager_authorized_orgs_desc_test.go +++ b/mmv1/third_party/terraform/tests/resource_access_context_manager_authorized_orgs_desc_test.go @@ -38,7 +38,7 @@ func testAccAccessContextManagerAuthorizedOrgsDesc_basicTest(t *testing.T) { } func testAccAccessContextManagerAuthorizedOrgsDesc_accessContextManagerAuthorizedOrgsDescBasicExample(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_access_context_manager_authorized_orgs_desc" "authorized-orgs-desc" { parent = "accessPolicies/${google_access_context_manager_access_policy.test-access.name}" name = "accessPolicies/${google_access_context_manager_access_policy.test-access.name}/authorizedOrgsDescs/fakeDescName" diff --git a/mmv1/third_party/terraform/tests/resource_access_context_manager_gcp_user_access_binding_test.go b/mmv1/third_party/terraform/tests/resource_access_context_manager_gcp_user_access_binding_test.go index 0c37820470f1..e1b4e8429867 100644 --- a/mmv1/third_party/terraform/tests/resource_access_context_manager_gcp_user_access_binding_test.go +++ b/mmv1/third_party/terraform/tests/resource_access_context_manager_gcp_user_access_binding_test.go @@ -46,7 +46,7 @@ func testAccAccessContextManagerGcpUserAccessBinding_basicTest(t *testing.T) { } func testAccAccessContextManagerGcpUserAccessBinding_accessContextManagerGcpUserAccessBindingBasicExample(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_cloud_identity_group" "group" { display_name = "tf-test-my-identity-group%{random_suffix}" diff --git a/mmv1/third_party/terraform/tests/resource_active_directory_domain_trust_test.go b/mmv1/third_party/terraform/tests/resource_active_directory_domain_trust_test.go index 80611ae73c5e..82bd0f7ec37c 100644 --- a/mmv1/third_party/terraform/tests/resource_active_directory_domain_trust_test.go +++ b/mmv1/third_party/terraform/tests/resource_active_directory_domain_trust_test.go @@ -54,7 +54,7 @@ func TestAccActiveDirectoryDomainTrust_activeDirectoryDomainTrustBasicExample(t } func testAccActiveDirectoryDomainTrust_activeDirectoryDomainTrustBasicExample(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_active_directory_domain_trust" "ad-domain-trust" { domain = "ci-managed-ad.com" target_domain_name = "example-gcp.com" @@ -67,7 +67,7 @@ resource "google_active_directory_domain_trust" "ad-domain-trust" { } func testAccActiveDirectoryDomainTrust_activeDirectoryDomainTrustUpdate(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_active_directory_domain_trust" "ad-domain-trust" { domain = "ci-managed-ad.com" target_domain_name = "example-gcp.com" diff --git a/mmv1/third_party/terraform/tests/resource_active_directory_domain_update_test.go b/mmv1/third_party/terraform/tests/resource_active_directory_domain_update_test.go index 31c63e086db3..09fdf9bad5c7 100644 --- a/mmv1/third_party/terraform/tests/resource_active_directory_domain_update_test.go +++ b/mmv1/third_party/terraform/tests/resource_active_directory_domain_update_test.go @@ -25,7 +25,7 @@ func TestAccActiveDirectoryDomain_update(t *testing.T) { "resource_name": "ad-domain", } - resourceName := Nprintf("google_active_directory_domain.%{resource_name}", context) + resourceName := acctest.Nprintf("google_active_directory_domain.%{resource_name}", context) VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, @@ -65,7 +65,7 @@ func TestAccActiveDirectoryDomain_update(t *testing.T) { func testAccADDomainBasic(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_active_directory_domain" "%{resource_name}" { domain_name = "%{domain}" locations = ["us-central1"] @@ -75,7 +75,7 @@ func testAccADDomainBasic(context map[string]interface{}) string { } func testAccADDomainUpdate(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_active_directory_domain" "%{resource_name}" { domain_name = "%{domain}" locations = ["us-central1", "us-west1"] diff --git a/mmv1/third_party/terraform/tests/resource_alloydb_backup_test.go b/mmv1/third_party/terraform/tests/resource_alloydb_backup_test.go index 2a7a4fb5f307..6c22ffa39d93 100644 --- a/mmv1/third_party/terraform/tests/resource_alloydb_backup_test.go +++ b/mmv1/third_party/terraform/tests/resource_alloydb_backup_test.go @@ -44,7 +44,7 @@ func TestAccAlloydbBackup_update(t *testing.T) { // Updates "label" field from testAccAlloydbBackup_alloydbBackupFullExample func testAccAlloydbBackup_update(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_alloydb_backup" "default" { location = "us-central1" backup_id = "tf-test-alloydb-backup%{random_suffix}" @@ -113,7 +113,7 @@ func TestAccAlloydbBackup_createBackupWithMandatoryFields(t *testing.T) { } func testAccAlloydbBackup_createBackupWithMandatoryFields(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_alloydb_backup" "default" { backup_id = "tf-test-alloydb-backup%{random_suffix}" location = "us-central1" @@ -195,7 +195,7 @@ func TestAccAlloydbBackup_usingCMEK(t *testing.T) { } func testAccAlloydbBackup_usingCMEK(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_alloydb_backup" "default" { location = "us-central1" backup_id = "tf-test-alloydb-backup%{random_suffix}" diff --git a/mmv1/third_party/terraform/tests/resource_alloydb_cluster_test.go b/mmv1/third_party/terraform/tests/resource_alloydb_cluster_test.go index 664f4ef2e2c2..a1d171240988 100644 --- a/mmv1/third_party/terraform/tests/resource_alloydb_cluster_test.go +++ b/mmv1/third_party/terraform/tests/resource_alloydb_cluster_test.go @@ -45,7 +45,7 @@ func TestAccAlloydbCluster_update(t *testing.T) { } func testAccAlloydbCluster_update(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_alloydb_cluster" "default" { cluster_id = "tf-test-alloydb-cluster%{random_suffix}" location = "us-central1" @@ -150,7 +150,7 @@ func TestAccAlloydbCluster_deleteAutomatedBackupPolicyAndInitialUser(t *testing. } func testAccAlloydbCluster_withInitialUserAndAutomatedBackupPolicy(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_alloydb_cluster" "default" { cluster_id = "tf-test-alloydb-cluster%{random_suffix}" location = "us-central1" @@ -200,7 +200,7 @@ resource "google_compute_network" "default" { } func testAccAlloydbCluster_withoutInitialUserAndAutomatedBackupPolicy(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_alloydb_cluster" "default" { cluster_id = "tf-test-alloydb-cluster%{random_suffix}" location = "us-central1" @@ -245,7 +245,7 @@ func TestAccAlloydbCluster_missingWeeklySchedule(t *testing.T) { } func testAccAlloydbCluster_missingWeeklySchedule(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_alloydb_cluster" "default" { cluster_id = "tf-test-alloydb-cluster%{random_suffix}" location = "us-central1" @@ -346,7 +346,7 @@ func TestAccAlloydbCluster_deleteTimeBasedRetentionPolicy(t *testing.T) { } func testAccAlloydbCluster_withTimeBasedRetentionPolicy(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_alloydb_cluster" "default" { cluster_id = "tf-test-alloydb-cluster%{random_suffix}" location = "us-central1" @@ -387,7 +387,7 @@ resource "google_compute_network" "default" { } func testAccAlloydbCluster_withoutTimeBasedRetentionPolicy(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_alloydb_cluster" "default" { cluster_id = "tf-test-alloydb-cluster%{random_suffix}" location = "us-central1" @@ -450,7 +450,7 @@ func TestAccAlloydbCluster_usingCMEK(t *testing.T) { } func testAccAlloydbCluster_usingCMEK(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_alloydb_cluster" "default" { cluster_id = "tf-test-alloydb-cluster%{random_suffix}" location = "us-central1" @@ -527,7 +527,7 @@ func TestAccAlloydbCluster_CMEKInAutomatedBackupIsUpdatable(t *testing.T) { } func testAccAlloydbCluster_usingCMEKInClusterAndAutomatedBackup(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_alloydb_cluster" "default" { cluster_id = "tf-test-alloydb-cluster%{random_suffix}" location = "us-central1" @@ -579,7 +579,7 @@ resource "google_kms_crypto_key_iam_binding" "crypto_key" { } func testAccAlloydbCluster_updateCMEKInAutomatedBackup(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_alloydb_cluster" "default" { cluster_id = "tf-test-alloydb-cluster%{random_suffix}" location = "us-central1" @@ -644,7 +644,7 @@ resource "google_kms_crypto_key_iam_binding" "crypto_key2" { } func testAccAlloydbCluster_usingCMEKallowDeletion(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_alloydb_cluster" "default" { cluster_id = "tf-test-alloydb-cluster%{random_suffix}" location = "us-central1" diff --git a/mmv1/third_party/terraform/tests/resource_alloydb_instance_test.go b/mmv1/third_party/terraform/tests/resource_alloydb_instance_test.go index d70a8bffa9c9..ad799c635a8c 100644 --- a/mmv1/third_party/terraform/tests/resource_alloydb_instance_test.go +++ b/mmv1/third_party/terraform/tests/resource_alloydb_instance_test.go @@ -42,7 +42,7 @@ func TestAccAlloydbInstance_update(t *testing.T) { } func testAccAlloydbInstance_update(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_alloydb_instance" "default" { cluster = google_alloydb_cluster.default.name instance_id = "tf-test-alloydb-instance%{random_suffix}" @@ -113,7 +113,7 @@ func TestAccAlloydbInstance_createInstanceWithMandatoryFields(t *testing.T) { } func testAccAlloydbInstance_createInstanceWithMandatoryFields(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_alloydb_instance" "default" { cluster = google_alloydb_cluster.default.name instance_id = "tf-test-alloydb-instance%{random_suffix}" @@ -171,7 +171,7 @@ func TestAccAlloydbInstance_createInstanceWithMaximumFields(t *testing.T) { } func testAccAlloydbInstance_createInstanceWithMaximumFields(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_alloydb_instance" "default" { cluster = google_alloydb_cluster.default.name instance_id = "tf-test-alloydb-instance%{random_suffix}" @@ -248,7 +248,7 @@ func TestAccAlloydbInstance_createPrimaryAndReadPoolInstance(t *testing.T) { } func testAccAlloydbInstance_createPrimaryAndReadPoolInstance(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_alloydb_instance" "primary" { cluster = google_alloydb_cluster.default.name instance_id = "tf-test-alloydb-instance%{random_suffix}" @@ -323,7 +323,7 @@ func TestAccAlloydbInstance_updateDatabaseFlagInPrimaryInstance(t *testing.T) { } func testAccAlloydbInstance_autoExplainEnabledInPrimaryInstance(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_alloydb_instance" "primary" { cluster = google_alloydb_cluster.default.name instance_id = "tf-test-alloydb-instance%{random_suffix}" @@ -363,7 +363,7 @@ resource "google_service_networking_connection" "vpc_connection" { } func testAccAlloydbInstance_autoExplainDisabledInPrimaryInstance(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_alloydb_instance" "primary" { cluster = google_alloydb_cluster.default.name instance_id = "tf-test-alloydb-instance%{random_suffix}" diff --git a/mmv1/third_party/terraform/tests/resource_api_gateway_api_config_test.go.erb b/mmv1/third_party/terraform/tests/resource_api_gateway_api_config_test.go.erb index 4f8b14b0d60a..328d95ebb375 100644 --- a/mmv1/third_party/terraform/tests/resource_api_gateway_api_config_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_api_gateway_api_config_test.go.erb @@ -53,7 +53,7 @@ func TestAccApiGatewayApiConfig_generatedPrefix(t *testing.T) { } func testAccApiGatewayApiConfig_apigatewayApiConfigBasicExampleUpdated(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_api_gateway_api" "api_cfg" { provider = google-beta api_id = "tf-test-api-cfg%{random_suffix}" @@ -79,7 +79,7 @@ resource "google_api_gateway_api_config" "api_cfg" { } func testAccApiGatewayApiConfig_generatedPrefix(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_api_gateway_api" "api_cfg" { provider = google-beta api_id = "tf-test-api-cfg%{random_suffix}" diff --git a/mmv1/third_party/terraform/tests/resource_api_gateway_api_test.go.erb b/mmv1/third_party/terraform/tests/resource_api_gateway_api_test.go.erb index a2ec447c182a..e3d8958ddafa 100644 --- a/mmv1/third_party/terraform/tests/resource_api_gateway_api_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_api_gateway_api_test.go.erb @@ -32,7 +32,7 @@ func TestAccApiGatewayApi_apigatewayApiBasicExampleUpdated(t *testing.T) { } func testAccApiGatewayApi_apigatewayApiBasicExampleUpdated(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_api_gateway_api" "api" { provider = google-beta api_id = "api%{random_suffix}" diff --git a/mmv1/third_party/terraform/tests/resource_api_gateway_gateway_test.go.erb b/mmv1/third_party/terraform/tests/resource_api_gateway_gateway_test.go.erb index a9b24fd26f05..e3bbbed5fb95 100644 --- a/mmv1/third_party/terraform/tests/resource_api_gateway_gateway_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_api_gateway_gateway_test.go.erb @@ -32,7 +32,7 @@ func TestAccApiGatewayGateway_apigatewayGatewayBasicExampleUpdated(t *testing.T) } func testAccApiGatewayGateway_apigatewayGatewayBasicExampleUpdated(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_api_gateway_api" "api_gw" { provider = google-beta api_id = "tf-test-api-gw%{random_suffix}" diff --git a/mmv1/third_party/terraform/tests/resource_apigee_env_keystore_alias_pkcs12_test.go b/mmv1/third_party/terraform/tests/resource_apigee_env_keystore_alias_pkcs12_test.go index 7f0f2ac408ec..4e10b5d1d95b 100644 --- a/mmv1/third_party/terraform/tests/resource_apigee_env_keystore_alias_pkcs12_test.go +++ b/mmv1/third_party/terraform/tests/resource_apigee_env_keystore_alias_pkcs12_test.go @@ -44,7 +44,7 @@ func TestAccApigeeKeystoresAliasesPkcs12_ApigeeKeystoresAliasesPkcs12Example(t * } func testAccApigeeKeystoresAliasesPkcs12_ApigeeKeystoresAliasesPkcs12Example(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_project" "project" { project_id = "tf-test%{random_suffix}" name = "tf-test%{random_suffix}" diff --git a/mmv1/third_party/terraform/tests/resource_apigee_environment_nodeconfig_test.go.erb b/mmv1/third_party/terraform/tests/resource_apigee_environment_nodeconfig_test.go.erb index c11d2d49fdb1..cfdbb155cd98 100644 --- a/mmv1/third_party/terraform/tests/resource_apigee_environment_nodeconfig_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_apigee_environment_nodeconfig_test.go.erb @@ -48,7 +48,7 @@ func TestAccApigeeEnvironment_apigeeEnvironmentNodeconfigTestExampleUpdate(t *te } func testAccApigeeEnvironment_apigeeEnvironmentNodeconfigTestExampleUpdate(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_project" "project" { provider = google-beta diff --git a/mmv1/third_party/terraform/tests/resource_apigee_flowhook_test.go b/mmv1/third_party/terraform/tests/resource_apigee_flowhook_test.go index b10cc3a08e1a..5d8357f5068d 100644 --- a/mmv1/third_party/terraform/tests/resource_apigee_flowhook_test.go +++ b/mmv1/third_party/terraform/tests/resource_apigee_flowhook_test.go @@ -43,7 +43,7 @@ func TestAccApigeeFlowhook_apigeeFlowhookTestExample(t *testing.T) { } func testAccApigeeFlowhook_apigeeFlowhookTestExample(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_project" "project" { project_id = "tf-test%{random_suffix}" name = "tf-test%{random_suffix}" diff --git a/mmv1/third_party/terraform/tests/resource_apigee_keystores_aliases_key_cert_file_test.go b/mmv1/third_party/terraform/tests/resource_apigee_keystores_aliases_key_cert_file_test.go index 2dc0d8c96e6a..cb789432adec 100644 --- a/mmv1/third_party/terraform/tests/resource_apigee_keystores_aliases_key_cert_file_test.go +++ b/mmv1/third_party/terraform/tests/resource_apigee_keystores_aliases_key_cert_file_test.go @@ -53,7 +53,7 @@ func TestAccApigeeKeystoresAliasesKeyCertFile_apigeeKeystoresAliasesKeyCertFileT } func testAccApigeeKeystoresAliasesKeyCertFile_apigeeKeystoresAliasesKeyCertFileTestExample(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_project" "project" { project_id = "tf-test%{random_suffix}" name = "tf-test%{random_suffix}" @@ -174,7 +174,7 @@ func testAccCheckApigeeKeystoresAliasesKeyCertFileDestroyProducer(t *testing.T) } func testAccApigeeKeystoresAliasesKeyCertFile_apigeeKeystoresAliasesKeyCertFileTestExampleUpdate(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_project" "project" { project_id = "tf-test%{random_suffix}" name = "tf-test%{random_suffix}" diff --git a/mmv1/third_party/terraform/tests/resource_apigee_sharedflow_deployment_test.go b/mmv1/third_party/terraform/tests/resource_apigee_sharedflow_deployment_test.go index 64e2bded205e..8ffc8252d319 100644 --- a/mmv1/third_party/terraform/tests/resource_apigee_sharedflow_deployment_test.go +++ b/mmv1/third_party/terraform/tests/resource_apigee_sharedflow_deployment_test.go @@ -54,7 +54,7 @@ func TestAccApigeeSharedflowDeployment_apigeeSharedflowDeploymentTestExample(t * func testAccApigeeSharedflowDeployment_apigeeSharedflowDeploymentTestExample(context map[string]interface{}, configBundle string) string { context["config_bundle"] = configBundle - return Nprintf(` + return acctest.Nprintf(` resource "google_project" "project" { project_id = "tf-test%{random_suffix}" name = "tf-test%{random_suffix}" diff --git a/mmv1/third_party/terraform/tests/resource_apigee_sharedflow_test.go b/mmv1/third_party/terraform/tests/resource_apigee_sharedflow_test.go index fa24f1adbffb..c76afce12073 100644 --- a/mmv1/third_party/terraform/tests/resource_apigee_sharedflow_test.go +++ b/mmv1/third_party/terraform/tests/resource_apigee_sharedflow_test.go @@ -54,7 +54,7 @@ func TestAccApigeeSharedFlow_apigeeSharedflowTestExample(t *testing.T) { } func testAccApigeeSharedFlow_apigeeSharedflowTestExample(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_project" "project" { project_id = "tf-test%{random_suffix}" name = "tf-test%{random_suffix}" @@ -160,7 +160,7 @@ func testAccCheckApigeeSharedFlowDestroyProducer(t *testing.T) func(s *terraform } func testAccApigeeSharedFlow_apigeeSharedflowTestExampleUpdate(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_project" "project" { project_id = "tf-test%{random_suffix}" name = "tf-test%{random_suffix}" diff --git a/mmv1/third_party/terraform/tests/resource_apigee_sync_authorization_test.go b/mmv1/third_party/terraform/tests/resource_apigee_sync_authorization_test.go index d018d13a2561..3a7673299004 100644 --- a/mmv1/third_party/terraform/tests/resource_apigee_sync_authorization_test.go +++ b/mmv1/third_party/terraform/tests/resource_apigee_sync_authorization_test.go @@ -53,7 +53,7 @@ func TestAccApigeeSyncAuthorization_update(t *testing.T) { } func testAccApigeeSyncAuthorization_basic(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_project" "project" { project_id = "tf-test-my-project%{random_suffix}" name = "tf-test-my-project%{random_suffix}" @@ -98,7 +98,7 @@ resource "google_apigee_sync_authorization" "apigee_sync_authorization" { } func testAccApigeeSyncAuthorization_multipleIdentities(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_project" "project" { project_id = "tf-test-my-project%{random_suffix}" name = "tf-test-my-project%{random_suffix}" @@ -157,7 +157,7 @@ resource "google_apigee_sync_authorization" "apigee_sync_authorization" { } func testAccApigeeSyncAuthorization_emptyIdentities(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_project" "project" { project_id = "tf-test-my-project%{random_suffix}" name = "tf-test-my-project%{random_suffix}" diff --git a/mmv1/third_party/terraform/tests/resource_app_engine_flexible_app_version_test.go b/mmv1/third_party/terraform/tests/resource_app_engine_flexible_app_version_test.go index 163d114e9ec3..c051cf742eb7 100644 --- a/mmv1/third_party/terraform/tests/resource_app_engine_flexible_app_version_test.go +++ b/mmv1/third_party/terraform/tests/resource_app_engine_flexible_app_version_test.go @@ -45,7 +45,7 @@ func TestAccAppEngineFlexibleAppVersion_update(t *testing.T) { } func testAccAppEngineFlexibleAppVersion_python(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_project" "my_project" { name = "tf-test-appeng-flex%{random_suffix}" project_id = "tf-test-appeng-flex%{random_suffix}" @@ -158,7 +158,7 @@ resource "google_storage_bucket_object" "main" { } func testAccAppEngineFlexibleAppVersion_pythonUpdate(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_project" "my_project" { name = "tf-test-appeng-flex%{random_suffix}" project_id = "tf-test-appeng-flex%{random_suffix}" diff --git a/mmv1/third_party/terraform/tests/resource_app_engine_service_network_settings_test.go b/mmv1/third_party/terraform/tests/resource_app_engine_service_network_settings_test.go index c4840b9c56bf..08e389b44de6 100644 --- a/mmv1/third_party/terraform/tests/resource_app_engine_service_network_settings_test.go +++ b/mmv1/third_party/terraform/tests/resource_app_engine_service_network_settings_test.go @@ -39,7 +39,7 @@ func TestAccAppEngineServiceNetworkSettings_update(t *testing.T) { } func testAccAppEngineServiceNetworkSettings_basic(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_storage_bucket" "bucket" { name = "tf-test-%{random_suffix}-ae-networksettings" location = "US" @@ -79,7 +79,7 @@ resource "google_app_engine_service_network_settings" "main" { } func testAccAppEngineServiceNetworkSettings_update(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_storage_bucket" "bucket" { name = "tf-test-%{random_suffix}-ae-networksettings" location = "US" diff --git a/mmv1/third_party/terraform/tests/resource_app_engine_standard_app_version_test.go b/mmv1/third_party/terraform/tests/resource_app_engine_standard_app_version_test.go index 3f34237eafdf..a032d3ac5b7f 100644 --- a/mmv1/third_party/terraform/tests/resource_app_engine_standard_app_version_test.go +++ b/mmv1/third_party/terraform/tests/resource_app_engine_standard_app_version_test.go @@ -54,7 +54,7 @@ func TestAccAppEngineStandardAppVersion_update(t *testing.T) { } func testAccAppEngineStandardAppVersion_python(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_project" "my_project" { name = "tf-test-appeng-std%{random_suffix}" project_id = "tf-test-appeng-std%{random_suffix}" @@ -141,7 +141,7 @@ resource "google_storage_bucket_object" "main" { } func testAccAppEngineStandardAppVersion_vpcAccessConnector(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_project" "my_project" { name = "tf-test-appeng-std%{random_suffix}" project_id = "tf-test-appeng-std%{random_suffix}" @@ -251,7 +251,7 @@ resource "google_storage_bucket_object" "main" { } func testAccAppEngineStandardAppVersion_pythonUpdate(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_project" "my_project" { name = "tf-test-appeng-std%{random_suffix}" project_id = "tf-test-appeng-std%{random_suffix}" diff --git a/mmv1/third_party/terraform/tests/resource_beyondcorp_app_connection_test.go b/mmv1/third_party/terraform/tests/resource_beyondcorp_app_connection_test.go index 7ed7d76cead4..dbb64100a50f 100644 --- a/mmv1/third_party/terraform/tests/resource_beyondcorp_app_connection_test.go +++ b/mmv1/third_party/terraform/tests/resource_beyondcorp_app_connection_test.go @@ -45,7 +45,7 @@ func TestAccBeyondcorpAppConnection_beyondcorpAppConnectionUpdateExample(t *test } func testAccBeyondcorpAppConnection_beyondcorpAppConnectionUpdateExample(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_service_account" "service_account" { account_id = "tf-test-my-account%{random_suffix}" display_name = "Test Service Account" diff --git a/mmv1/third_party/terraform/tests/resource_beyondcorp_app_connector_test.go b/mmv1/third_party/terraform/tests/resource_beyondcorp_app_connector_test.go index a49b531d1213..3016f6bdd374 100644 --- a/mmv1/third_party/terraform/tests/resource_beyondcorp_app_connector_test.go +++ b/mmv1/third_party/terraform/tests/resource_beyondcorp_app_connector_test.go @@ -45,7 +45,7 @@ func TestAccBeyondcorpAppConnector_beyondcorpAppConnectorUpdateExample(t *testin } func testAccBeyondcorpAppConnector_beyondcorpAppConnectorUpdateExample(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_service_account" "service_account" { account_id = "tf-test-my-account%{random_suffix}" display_name = "Test Service Account" diff --git a/mmv1/third_party/terraform/tests/resource_bigquery_analytics_hub_listing_test.go b/mmv1/third_party/terraform/tests/resource_bigquery_analytics_hub_listing_test.go index 3c283a7e78e3..f6c2fc40f17e 100644 --- a/mmv1/third_party/terraform/tests/resource_bigquery_analytics_hub_listing_test.go +++ b/mmv1/third_party/terraform/tests/resource_bigquery_analytics_hub_listing_test.go @@ -35,7 +35,7 @@ func TestAccBigqueryAnalyticsHubListing_bigqueryAnalyticshubListingUpdate(t *tes } func testAccBigqueryAnalyticsHubListing_bigqueryAnalyticshubListingUpdate(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_bigquery_analytics_hub_data_exchange" "listing" { location = "US" data_exchange_id = "tf_test_my_data_exchange%{random_suffix}" diff --git a/mmv1/third_party/terraform/tests/resource_bigquery_connection_test.go b/mmv1/third_party/terraform/tests/resource_bigquery_connection_test.go index 6cdb542372cd..87036ae2b3ca 100644 --- a/mmv1/third_party/terraform/tests/resource_bigquery_connection_test.go +++ b/mmv1/third_party/terraform/tests/resource_bigquery_connection_test.go @@ -47,7 +47,7 @@ func TestAccBigqueryConnectionConnection_bigqueryConnectionBasic(t *testing.T) { } func testAccBigqueryConnectionConnection_bigqueryConnectionBasic(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_sql_database_instance" "instance" { name = "tf-test-pg-database-instance%{random_suffix}" database_version = "POSTGRES_11" @@ -94,7 +94,7 @@ resource "google_bigquery_connection" "connection" { } func testAccBigqueryConnectionConnection_bigqueryConnectionBasicUpdate(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_sql_database_instance" "instance" { name = "tf-test-mysql-database-instance%{random_suffix}" database_version = "MYSQL_5_6" @@ -179,7 +179,7 @@ func TestAccBigqueryConnectionConnection_bigqueryConnectionAwsUpdate(t *testing. } func testAccBigqueryConnectionConnection_bigqueryConnectionAws(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_bigquery_connection" "connection" { connection_id = "tf-test-my-connection%{random_suffix}" location = "aws-us-east-1" @@ -195,7 +195,7 @@ resource "google_bigquery_connection" "connection" { } func testAccBigqueryConnectionConnection_bigqueryConnectionAwsUpdate(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_bigquery_connection" "connection" { connection_id = "tf-test-my-connection%{random_suffix}" location = "aws-us-east-1" diff --git a/mmv1/third_party/terraform/tests/resource_bigquery_datapolicy_data_policy_test.go b/mmv1/third_party/terraform/tests/resource_bigquery_datapolicy_data_policy_test.go index 84e0a928a7f3..41d59001aa64 100644 --- a/mmv1/third_party/terraform/tests/resource_bigquery_datapolicy_data_policy_test.go +++ b/mmv1/third_party/terraform/tests/resource_bigquery_datapolicy_data_policy_test.go @@ -36,7 +36,7 @@ func TestAccBigqueryDatapolicyDataPolicy_bigqueryDatapolicyDataPolicyUpdate(t *t } func testAccBigqueryDatapolicyDataPolicy_bigqueryDatapolicyDataPolicyUpdate(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_bigquery_datapolicy_data_policy" "data_policy" { location = "us-central1" data_policy_id = "tf_test_data_policy%{random_suffix}" diff --git a/mmv1/third_party/terraform/tests/resource_bigquery_dataset_access_test.go b/mmv1/third_party/terraform/tests/resource_bigquery_dataset_access_test.go index be08f3dd9c00..72cdb6cd9956 100644 --- a/mmv1/third_party/terraform/tests/resource_bigquery_dataset_access_test.go +++ b/mmv1/third_party/terraform/tests/resource_bigquery_dataset_access_test.go @@ -405,7 +405,7 @@ resource "google_bigquery_dataset" "public" { } func testAccBigQueryDatasetAccess_authorizedRoutine(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_bigquery_dataset" "public" { dataset_id = "%{public_dataset}" description = "This dataset is public" diff --git a/mmv1/third_party/terraform/tests/resource_bigquery_job_test.go b/mmv1/third_party/terraform/tests/resource_bigquery_job_test.go index aa10497f60e3..a111c0d66496 100644 --- a/mmv1/third_party/terraform/tests/resource_bigquery_job_test.go +++ b/mmv1/third_party/terraform/tests/resource_bigquery_job_test.go @@ -39,7 +39,7 @@ func TestAccBigQueryJob_withLocation(t *testing.T) { } func testAccBigQueryJob_withLocation(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_bigquery_table" "foo" { deletion_protection = false dataset_id = google_bigquery_dataset.bar.dataset_id diff --git a/mmv1/third_party/terraform/tests/resource_bigquery_table_test.go b/mmv1/third_party/terraform/tests/resource_bigquery_table_test.go index 421e7cbac02c..58d445bbe6b7 100644 --- a/mmv1/third_party/terraform/tests/resource_bigquery_table_test.go +++ b/mmv1/third_party/terraform/tests/resource_bigquery_table_test.go @@ -1741,7 +1741,7 @@ resource "google_bigquery_table" "test" { } func testAccBigQueryTableFromBigtable(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_bigtable_instance" "instance" { name = "tf-test-bigtable-inst-%{random_suffix}" cluster { @@ -1788,7 +1788,7 @@ func testAccBigQueryTableFromBigtable(context map[string]interface{}) string { } func testAccBigQueryTableFromSheet(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_bigquery_table" "table" { deletion_protection = false dataset_id = google_bigquery_dataset.dataset.dataset_id diff --git a/mmv1/third_party/terraform/tests/resource_billing_budget_test.go b/mmv1/third_party/terraform/tests/resource_billing_budget_test.go index 2ccb59b50e20..60b1c0e2dd92 100644 --- a/mmv1/third_party/terraform/tests/resource_billing_budget_test.go +++ b/mmv1/third_party/terraform/tests/resource_billing_budget_test.go @@ -33,7 +33,7 @@ func TestAccBillingBudget_billingBudgetCurrencycode(t *testing.T) { } func testAccBillingBudget_billingBudgetCurrencycode(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` data "google_billing_account" "account" { billing_account = "%{billing_acct}" } @@ -160,7 +160,7 @@ func TestAccBillingBudget_billingFilterSubaccounts(t *testing.T) { } func testAccBillingBudget_billingFilterSubaccounts(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` data "google_billing_account" "account" { billing_account = "%{master_billing_acct}" } @@ -204,7 +204,7 @@ resource "google_billing_budget" "budget" { } func testAccBillingBudget_billingFilterRemoveSubaccounts(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` data "google_billing_account" "account" { billing_account = "%{master_billing_acct}" } @@ -242,7 +242,7 @@ resource "google_billing_budget" "budget" { } func testAccBillingBudget_billingBudgetUpdateStart(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_pubsub_topic" "topic1" { name = "tf-test-billing-budget1-%{random_suffix}" } @@ -292,7 +292,7 @@ resource "google_billing_budget" "budget" { } func testAccBillingBudget_billingBudgetUpdateRemoveFilter(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_pubsub_topic" "topic1" { name = "tf-test-billing-budget1-%{random_suffix}" } @@ -338,7 +338,7 @@ resource "google_billing_budget" "budget" { } func testAccBillingBudget_billingBudgetUpdate(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_pubsub_topic" "topic1" { name = "tf-test-billing-budget1-%{random_suffix}" } @@ -389,7 +389,7 @@ resource "google_billing_budget" "budget" { } func testAccBillingBudget_billingBudgetCalendarUpdate(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_pubsub_topic" "topic1" { name = "tf-test-billing-budget1-%{random_suffix}" } @@ -437,7 +437,7 @@ resource "google_billing_budget" "budget" { } func testAccBillingBudget_billingBudgetCustomPeriodUpdate(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_pubsub_topic" "topic1" { name = "tf-test-billing-budget1-%{random_suffix}" } @@ -581,7 +581,7 @@ func TestAccBillingBudget_budgetFilterProjectsOrdering(t *testing.T) { } func testAccBillingBudget_budgetFilterProjectsOrdering1(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` data "google_billing_account" "account" { billing_account = "%{billing_acct}" @@ -625,7 +625,7 @@ resource "google_billing_budget" "budget" { } func testAccBillingBudget_budgetFilterProjectsOrdering2(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` data "google_billing_account" "account" { billing_account = "%{billing_acct}" diff --git a/mmv1/third_party/terraform/tests/resource_certificate_manager_dns_authorization_test.go b/mmv1/third_party/terraform/tests/resource_certificate_manager_dns_authorization_test.go index c45325e04888..1274066d1043 100644 --- a/mmv1/third_party/terraform/tests/resource_certificate_manager_dns_authorization_test.go +++ b/mmv1/third_party/terraform/tests/resource_certificate_manager_dns_authorization_test.go @@ -42,7 +42,7 @@ func TestAccCertificateManagerDnsAuthorization_update(t *testing.T) { } func testAccCertificateManagerDnsAuthorization_update0(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_certificate_manager_dns_authorization" "default" { name = "tf-test-dns-auth%{random_suffix}" description = "The default dnss" @@ -55,7 +55,7 @@ resource "google_certificate_manager_dns_authorization" "default" { } func testAccCertificateManagerDnsAuthorization_update1(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_certificate_manager_dns_authorization" "default" { name = "tf-test-dns-auth%{random_suffix}" description = "The default dnss2" diff --git a/mmv1/third_party/terraform/tests/resource_cloud_identity_group_membership_test.go.erb b/mmv1/third_party/terraform/tests/resource_cloud_identity_group_membership_test.go.erb index cc49981dce7f..81732e9d3811 100644 --- a/mmv1/third_party/terraform/tests/resource_cloud_identity_group_membership_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_cloud_identity_group_membership_test.go.erb @@ -57,7 +57,7 @@ func testAccCloudIdentityGroupMembership_updateTest(t *testing.T) { } func testAccCloudIdentityGroupMembership_update1(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_cloud_identity_group" "group" { display_name = "tf-test-my-identity-group%{random_suffix}" @@ -88,7 +88,7 @@ resource "google_cloud_identity_group_membership" "basic" { } func testAccCloudIdentityGroupMembership_update2(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_cloud_identity_group" "group" { display_name = "tf-test-my-identity-group%{random_suffix}" @@ -147,7 +147,7 @@ func testAccCloudIdentityGroupMembership_importTest(t *testing.T) { } func testAccCloudIdentityGroupMembership_import(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_cloud_identity_group" "group" { display_name = "tf-test-my-identity-group%{random_suffix}" @@ -234,7 +234,7 @@ func testAccCloudIdentityGroupMembership_membershipDoesNotExistTest(t *testing.T } func testAccCloudIdentityGroupMembership_dne(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_cloud_identity_group" "group" { display_name = "tf-test-my-identity-group-%{random_suffix}" @@ -289,7 +289,7 @@ func testAccCloudIdentityGroupMembership_cloudIdentityGroupMembershipWithMemberK } func testAccCloudIdentityGroupMembership_cloudIdentityGroupMembershipWithMemberKey(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_cloud_identity_group" "group" { display_name = "tf-test-my-identity-group%{random_suffix}" @@ -358,7 +358,7 @@ func testAccCloudIdentityGroupMembership_cloudIdentityGroupMembershipUserWithMem } func testAccCloudIdentityGroupMembership_cloudIdentityGroupMembershipUserWithMemberKey(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_cloud_identity_group" "group" { display_name = "tf-test-my-identity-group%{random_suffix}" @@ -418,7 +418,7 @@ func testAccCloudIdentityGroupMembership_cloudIdentityGroupMembershipExampleTest } func testAccCloudIdentityGroupMembership_cloudIdentityGroupMembershipExample(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_cloud_identity_group" "group" { display_name = "tf-test-my-identity-group%{random_suffix}" @@ -488,7 +488,7 @@ func testAccCloudIdentityGroupMembership_cloudIdentityGroupMembershipUserExample } func testAccCloudIdentityGroupMembership_cloudIdentityGroupMembershipUserExample(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_cloud_identity_group" "group" { display_name = "tf-test-my-identity-group%{random_suffix}" diff --git a/mmv1/third_party/terraform/tests/resource_cloud_identity_group_test.go.erb b/mmv1/third_party/terraform/tests/resource_cloud_identity_group_test.go.erb index 7f72eadbbd84..c77cebbf8912 100644 --- a/mmv1/third_party/terraform/tests/resource_cloud_identity_group_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_cloud_identity_group_test.go.erb @@ -71,7 +71,7 @@ func testAccCloudIdentityGroup_updateTest(t *testing.T) { } func testAccCloudIdentityGroup_update(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_cloud_identity_group" "cloud_identity_group_basic" { display_name = "tf-test-my-identity-group%{random_suffix}-update" description = "my-description" @@ -116,7 +116,7 @@ func testAccCloudIdentityGroup_cloudIdentityGroupsBasicExampleTest(t *testing.T) } func testAccCloudIdentityGroup_cloudIdentityGroupsBasicExample(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_cloud_identity_group" "cloud_identity_group_basic" { display_name = "tf-test-my-identity-group%{random_suffix}" initial_group_config = "WITH_INITIAL_OWNER" diff --git a/mmv1/third_party/terraform/tests/resource_cloud_run_domain_mapping_test.go b/mmv1/third_party/terraform/tests/resource_cloud_run_domain_mapping_test.go index e7c9203a545e..0f833dffea2d 100644 --- a/mmv1/third_party/terraform/tests/resource_cloud_run_domain_mapping_test.go +++ b/mmv1/third_party/terraform/tests/resource_cloud_run_domain_mapping_test.go @@ -45,7 +45,7 @@ func TestAccCloudRunDomainMapping_foregroundDeletion(t *testing.T) { } func testAccCloudRunDomainMapping_cloudRunDomainMappingUpdated1(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_cloud_run_service" "default" { name = "tf-test-cloudrun-srv%{random_suffix}" location = "us-central1" @@ -79,7 +79,7 @@ resource "google_cloud_run_domain_mapping" "default" { } func testAccCloudRunDomainMapping_cloudRunDomainMappingUpdated2(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_cloud_run_service" "default" { name = "tf-test-cloudrun-srv%{random_suffix}" location = "us-central1" diff --git a/mmv1/third_party/terraform/tests/resource_cloud_run_v2_job_test.go b/mmv1/third_party/terraform/tests/resource_cloud_run_v2_job_test.go index 526ea3048ebb..758bda1e687e 100644 --- a/mmv1/third_party/terraform/tests/resource_cloud_run_v2_job_test.go +++ b/mmv1/third_party/terraform/tests/resource_cloud_run_v2_job_test.go @@ -42,7 +42,7 @@ func TestAccCloudRunV2Job_cloudrunv2JobFullUpdate(t *testing.T) { } func testAccCloudRunV2Job_cloudrunv2JobFull(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_cloud_run_v2_job" "default" { name = "tf-test-cloudrun-job%{random_suffix}" location = "us-central1" @@ -110,7 +110,7 @@ func testAccCloudRunV2Job_cloudrunv2JobFull(context map[string]interface{}) stri } func testAccCloudRunV2Job_cloudrunv2JobFullUpdate(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_cloud_run_v2_job" "default" { name = "tf-test-cloudrun-job%{random_suffix}" location = "us-central1" diff --git a/mmv1/third_party/terraform/tests/resource_cloud_run_v2_service_test.go b/mmv1/third_party/terraform/tests/resource_cloud_run_v2_service_test.go index e4544cdd0380..29d9abbad730 100644 --- a/mmv1/third_party/terraform/tests/resource_cloud_run_v2_service_test.go +++ b/mmv1/third_party/terraform/tests/resource_cloud_run_v2_service_test.go @@ -46,7 +46,7 @@ func TestAccCloudRunV2Service_cloudrunv2ServiceFullUpdate(t *testing.T) { } func testAccCloudRunV2Service_cloudrunv2ServiceFull(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_cloud_run_v2_service" "default" { name = "tf-test-cloudrun-service%{random_suffix}" description = "description creating" @@ -110,7 +110,7 @@ resource "google_service_account" "service_account" { } func testAccCloudRunV2Service_cloudrunv2ServiceFullUpdate(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_cloud_run_v2_service" "default" { name = "tf-test-cloudrun-service%{random_suffix}" description = "description updating" @@ -354,7 +354,7 @@ func testAccCheckCloudRunV2ServiceDestroyByNameProducer(t *testing.T, serviceNam } func testAccCloudRunV2Service_cloudrunv2ServiceWithEmptyTCPStartupProbeAndHTTPLivenessProbe(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_cloud_run_v2_service" "default" { name = "tf-test-cloudrun-service%{random_suffix}" location = "us-central1" @@ -378,7 +378,7 @@ resource "google_cloud_run_v2_service" "default" { } func testAccCloudRunV2Service_cloudrunv2ServiceUpdateWithTCPStartupProbeAndHTTPLivenessProbe(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_cloud_run_v2_service" "default" { name = "tf-test-cloudrun-service%{random_suffix}" location = "us-central1" @@ -422,7 +422,7 @@ resource "google_cloud_run_v2_service" "default" { } func testAccCloudRunV2Service_cloudrunv2ServiceUpdateWithEmptyHTTPStartupProbe(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_cloud_run_v2_service" "default" { name = "tf-test-cloudrun-service%{random_suffix}" location = "us-central1" @@ -440,7 +440,7 @@ resource "google_cloud_run_v2_service" "default" { } func testAccCloudRunV2Service_cloudrunv2ServiceUpdateWithHTTPStartupProbe(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_cloud_run_v2_service" "default" { name = "tf-test-cloudrun-service%{random_suffix}" location = "us-central1" @@ -472,7 +472,7 @@ resource "google_cloud_run_v2_service" "default" { } func testAccCloudRunV2Service_cloudRunServiceUpdateWithEmptyGRPCLivenessProbe(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_cloud_run_v2_service" "default" { name ="%{service_name}" location = "us-central1" @@ -493,7 +493,7 @@ resource "google_cloud_run_v2_service" "default" { } func testAccCloudRunV2Service_cloudRunServiceUpdateWithGRPCLivenessProbe(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_cloud_run_v2_service" "default" { name = "%{service_name}" location = "us-central1" @@ -517,7 +517,7 @@ resource "google_cloud_run_v2_service" "default" { } func testAccCloudRunV2Service_cloudRunServiceUpdateWithEmptyGRPCStartupProbe(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_cloud_run_v2_service" "default" { name = "%{service_name}" location = "us-central1" @@ -538,7 +538,7 @@ resource "google_cloud_run_v2_service" "default" { } func testAccCloudRunV2Service_cloudRunServiceUpdateWithGRPCStartupProbe(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_cloud_run_v2_service" "default" { name = "%{service_name}" location = "us-central1" @@ -562,7 +562,7 @@ resource "google_cloud_run_v2_service" "default" { } func testAccCloudRunV2Service_cloudRunServiceUpdateWithGRPCLivenessAndStartupProbes(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_cloud_run_v2_service" "default" { name = "%{service_name}" location = "us-central1" diff --git a/mmv1/third_party/terraform/tests/resource_cloud_scheduler_job_test.go b/mmv1/third_party/terraform/tests/resource_cloud_scheduler_job_test.go index 32e252495a57..b2af7ae9b4db 100644 --- a/mmv1/third_party/terraform/tests/resource_cloud_scheduler_job_test.go +++ b/mmv1/third_party/terraform/tests/resource_cloud_scheduler_job_test.go @@ -38,7 +38,7 @@ func TestAccCloudSchedulerJob_schedulerPausedExample(t *testing.T) { } func testAccCloudSchedulerJob_schedulerPaused(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_cloud_scheduler_job" "job" { paused = true name = "tf-test-test-job%{random_suffix}" @@ -61,7 +61,7 @@ resource "google_cloud_scheduler_job" "job" { } func testAccCloudSchedulerJob_schedulerUnPaused(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_cloud_scheduler_job" "job" { paused = false # Has been flipped name = "tf-test-test-job%{random_suffix}" diff --git a/mmv1/third_party/terraform/tests/resource_cloudbuild_worker_pool_test.go.erb b/mmv1/third_party/terraform/tests/resource_cloudbuild_worker_pool_test.go.erb index 5b30e2383530..ee97dc32303c 100644 --- a/mmv1/third_party/terraform/tests/resource_cloudbuild_worker_pool_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_cloudbuild_worker_pool_test.go.erb @@ -56,7 +56,7 @@ func TestAccCloudbuildWorkerPool_basic(t *testing.T) { } func testAccCloudbuildWorkerPool_basic(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_cloudbuild_worker_pool" "pool" { name = "pool%{random_suffix}" location = "europe-west1" @@ -70,7 +70,7 @@ resource "google_cloudbuild_worker_pool" "pool" { } func testAccCloudbuildWorkerPool_updated(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_cloudbuild_worker_pool" "pool" { name = "pool%{random_suffix}" location = "europe-west1" @@ -84,7 +84,7 @@ resource "google_cloudbuild_worker_pool" "pool" { } func testAccCloudbuildWorkerPool_noWorkerConfig(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_cloudbuild_worker_pool" "pool" { name = "pool%{random_suffix}" location = "europe-west1" @@ -118,7 +118,7 @@ func TestAccCloudbuildWorkerPool_withNetwork(t *testing.T) { } func testAccCloudbuildWorkerPool_withNetwork(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_project_service" "servicenetworking" { service = "servicenetworking.googleapis.com" disable_on_destroy = false diff --git a/mmv1/third_party/terraform/tests/resource_cloudfunction2_function_test.go b/mmv1/third_party/terraform/tests/resource_cloudfunction2_function_test.go index 09194623ffb0..ec5d7fa310b4 100644 --- a/mmv1/third_party/terraform/tests/resource_cloudfunction2_function_test.go +++ b/mmv1/third_party/terraform/tests/resource_cloudfunction2_function_test.go @@ -53,7 +53,7 @@ func TestAccCloudFunctions2Function_update(t *testing.T) { } func testAccCloudfunctions2function_basic(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_storage_bucket" "bucket" { name = "tf-test-cloudfunctions2-function-bucket%{random_suffix}" location = "US" @@ -92,7 +92,7 @@ resource "google_cloudfunctions2_function" "terraform-test2" { } func testAccCloudFunctions2Function_test_update(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_storage_bucket" "bucket" { name = "tf-test-cloudfunctions2-function-bucket%{random_suffix}" location = "US" @@ -129,7 +129,7 @@ resource "google_cloudfunctions2_function" "terraform-test2" { } func testAccCloudFunctions2Function_test_redeploy(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_storage_bucket" "bucket" { name = "tf-test-cloudfunctions2-function-bucket%{random_suffix}" location = "US" @@ -204,7 +204,7 @@ func TestAccCloudFunctions2Function_fullUpdate(t *testing.T) { } func testAccCloudfunctions2function_cloudfunctions2BasicAuditlogsExample_update(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` # [START functions_v2_basic_auditlogs] # This example follows the examples shown in this Google Cloud Community blog post # https://medium.com/google-cloud/applying-a-path-pattern-when-filtering-in-eventarc-f06b937b4c34 diff --git a/mmv1/third_party/terraform/tests/resource_cloudids_endpoint_test.go b/mmv1/third_party/terraform/tests/resource_cloudids_endpoint_test.go index 37c94fe889b8..85e2cb0e1181 100644 --- a/mmv1/third_party/terraform/tests/resource_cloudids_endpoint_test.go +++ b/mmv1/third_party/terraform/tests/resource_cloudids_endpoint_test.go @@ -46,7 +46,7 @@ func TestAccCloudIdsEndpoint_basic(t *testing.T) { } func testCloudIds_basic(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_compute_network" "default" { name = "tf-test-my-network%{random_suffix}" } @@ -75,7 +75,7 @@ resource "google_cloud_ids_endpoint" "endpoint" { } func testCloudIds_basicUpdate(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_compute_network" "default" { name = "tf-test-my-network%{random_suffix}" } diff --git a/mmv1/third_party/terraform/tests/resource_compute_backend_bucket_signed_url_key_test.go b/mmv1/third_party/terraform/tests/resource_compute_backend_bucket_signed_url_key_test.go index bb0908292be6..e0bc6da80ab3 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_backend_bucket_signed_url_key_test.go +++ b/mmv1/third_party/terraform/tests/resource_compute_backend_bucket_signed_url_key_test.go @@ -34,7 +34,7 @@ func TestAccComputeBackendBucketSignedUrlKey_basic(t *testing.T) { } func testAccComputeBackendBucketSignedUrlKey_basic(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_compute_backend_bucket_signed_url_key" "backend_key" { name = "test-key-%{random_suffix}" key_value = "iAmAFakeKeyRandomBytes==" diff --git a/mmv1/third_party/terraform/tests/resource_compute_backend_service_signed_url_key_test.go b/mmv1/third_party/terraform/tests/resource_compute_backend_service_signed_url_key_test.go index c4c24a723e60..004b4e461e14 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_backend_service_signed_url_key_test.go +++ b/mmv1/third_party/terraform/tests/resource_compute_backend_service_signed_url_key_test.go @@ -34,7 +34,7 @@ func TestAccComputeBackendServiceSignedUrlKey_basic(t *testing.T) { } func testAccComputeBackendServiceSignedUrlKey_basic(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_compute_backend_service_signed_url_key" "backend_key" { name = "testkey-%{random_suffix}" key_value = "iAmAFakeKeyRandomBytes==" diff --git a/mmv1/third_party/terraform/tests/resource_compute_disk_test.go.erb b/mmv1/third_party/terraform/tests/resource_compute_disk_test.go.erb index e3f477cec08e..34b27abed81f 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_disk_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_compute_disk_test.go.erb @@ -1025,7 +1025,7 @@ resource "google_compute_instance_group_manager" "manager" { } func testAccComputeDisk_pdHyperDiskProvisionedIopsLifeCycle(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_compute_disk" "foobar" { name = "tf-test-hyperdisk-%{random_suffix}" type = "hyperdisk-extreme" @@ -1039,7 +1039,7 @@ func testAccComputeDisk_pdHyperDiskProvisionedIopsLifeCycle(context map[string]i } func testAccComputeDisk_pdHyperDiskProvisionedThroughputLifeCycle(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_compute_disk" "foobar" { name = "tf-test-hyperdisk-%{random_suffix}" type = "hyperdisk-throughput" diff --git a/mmv1/third_party/terraform/tests/resource_compute_firewall_policy_association_test.go b/mmv1/third_party/terraform/tests/resource_compute_firewall_policy_association_test.go index cdd525639f8c..d79f5b2a96cb 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_firewall_policy_association_test.go +++ b/mmv1/third_party/terraform/tests/resource_compute_firewall_policy_association_test.go @@ -36,7 +36,7 @@ func TestAccComputeFirewallPolicyAssociation_basic(t *testing.T) { } func testAccComputeFirewallPolicyAssociation_basic(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_folder" "folder" { display_name = "tf-test-folder-%{random_suffix}" parent = "%{org_name}" diff --git a/mmv1/third_party/terraform/tests/resource_compute_firewall_policy_rule_test.go.erb b/mmv1/third_party/terraform/tests/resource_compute_firewall_policy_rule_test.go.erb index fc2fe66fc598..d2dd80164cd5 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_firewall_policy_rule_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_compute_firewall_policy_rule_test.go.erb @@ -67,7 +67,7 @@ func TestAccComputeFirewallPolicyRule_update(t *testing.T) { } func testAccComputeFirewallPolicyRule_start(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_service_account" "service_account" { account_id = "tf-test-sa-%{random_suffix}" } @@ -135,7 +135,7 @@ resource "google_compute_firewall_policy_rule" "default" { } func testAccComputeFirewallPolicyRule_update(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_service_account" "service_account" { account_id = "tf-test-sa-%{random_suffix}" } @@ -210,7 +210,7 @@ resource "google_compute_firewall_policy_rule" "default" { } func testAccComputeFirewallPolicyRule_removeConfigs(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_service_account" "service_account" { account_id = "tf-test-sa-%{random_suffix}" } @@ -323,7 +323,7 @@ func TestAccComputeFirewallPolicyRule_multipleRules(t *testing.T) { } func testAccComputeFirewallPolicyRule_multiple(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_folder" "folder" { display_name = "tf-test-folder-%{random_suffix}" parent = "%{org_name}" @@ -399,7 +399,7 @@ resource "google_compute_firewall_policy_rule" "rule2" { } func testAccComputeFirewallPolicyRule_multipleAdd(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_folder" "folder" { display_name = "tf-test-folder-%{random_suffix}" parent = "%{org_name}" @@ -497,7 +497,7 @@ resource "google_compute_firewall_policy_rule" "rule3" { } func testAccComputeFirewallPolicyRule_multipleRemove(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_folder" "folder" { display_name = "tf-test-folder-%{random_suffix}" parent = "%{org_name}" diff --git a/mmv1/third_party/terraform/tests/resource_compute_forwarding_rule_test.go.erb b/mmv1/third_party/terraform/tests/resource_compute_forwarding_rule_test.go.erb index c940610be671..3dcf3d8c3e69 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_forwarding_rule_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_compute_forwarding_rule_test.go.erb @@ -306,7 +306,7 @@ resource "google_compute_forwarding_rule" "foobar" { <% unless version == 'ga' -%> func testAccComputeForwardingRule_internalTcpUdpLbWithMigBackendExampleUpdate(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` # Internal TCP/UDP load balancer with a managed instance group backend # VPC @@ -550,7 +550,7 @@ resource "google_service_directory_service" "examplesvc" { <% end -%> func testAccComputeForwardingRule_forwardingRuleVpcPscExampleUpdate(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` // Forwarding rule for VPC private service connect resource "google_compute_forwarding_rule" "default" { name = "tf-test-psc-endpoint%{random_suffix}" @@ -649,7 +649,7 @@ resource "google_compute_health_check" "producer_service_health_check" { } func testAccComputeForwardingRule_forwardingRuleRegionalSteeringExampleUpdate(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_compute_forwarding_rule" "steering" { name = "tf-test-steering-rule%{random_suffix}" region = "us-central1" diff --git a/mmv1/third_party/terraform/tests/resource_compute_global_network_endpoint_test.go.erb b/mmv1/third_party/terraform/tests/resource_compute_global_network_endpoint_test.go.erb index 7913572fe32f..d4d98338b70d 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_global_network_endpoint_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_compute_global_network_endpoint_test.go.erb @@ -57,7 +57,7 @@ func TestAccComputeGlobalNetworkEndpoint_networkEndpointsBasic(t *testing.T) { } func testAccComputeGlobalNetworkEndpoint_networkEndpointsBasic(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_compute_global_network_endpoint" "default" { global_network_endpoint_group = google_compute_global_network_endpoint_group.neg.id @@ -68,7 +68,7 @@ resource "google_compute_global_network_endpoint" "default" { } func testAccComputeGlobalNetworkEndpoint_networkEndpointsModified(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_compute_global_network_endpoint" "default" { global_network_endpoint_group = google_compute_global_network_endpoint_group.neg.name @@ -79,7 +79,7 @@ resource "google_compute_global_network_endpoint" "default" { } func testAccComputeGlobalNetworkEndpoint_noNetworkEndpoints(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_compute_global_network_endpoint_group" "neg" { name = "neg-%{random_suffix}" default_port = "%{default_port}" diff --git a/mmv1/third_party/terraform/tests/resource_compute_instance_group_manager_test.go.erb b/mmv1/third_party/terraform/tests/resource_compute_instance_group_manager_test.go.erb index 25a4f4fcfa35..a624a7c1a003 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_instance_group_manager_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_compute_instance_group_manager_test.go.erb @@ -7,7 +7,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" - "github.com/hashicorp/terraform-provider-google/google/acctest" + "github.com/hashicorp/terraform-provider-google/google/acctest" ) func TestAccInstanceGroupManager_basic(t *testing.T) { diff --git a/mmv1/third_party/terraform/tests/resource_compute_instance_template_test.go.erb b/mmv1/third_party/terraform/tests/resource_compute_instance_template_test.go.erb index c1e61df6f324..d16738a0305f 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_instance_template_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_compute_instance_template_test.go.erb @@ -3198,7 +3198,7 @@ resource "google_compute_instance_template" "foobar" { } func testAccComputeInstanceTemplate_sourceSnapshotEncryptionKey(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` data "google_kms_key_ring" "ring" { name = "%{kms_ring_name}" location = "us-central1" @@ -3265,7 +3265,7 @@ resource "google_compute_instance_template" "template" { } func testAccComputeInstanceTemplate_sourceImageEncryptionKey(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` data "google_kms_key_ring" "ring" { name = "%{kms_ring_name}" location = "us-central1" @@ -3325,7 +3325,7 @@ resource "google_compute_instance_template" "template" { <% if version == "beta" -%> func testAccComputeInstanceTemplate_network_attachment(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` data "google_compute_image" "my_image" { family = "debian-11" project = "debian-cloud" diff --git a/mmv1/third_party/terraform/tests/resource_compute_instance_test.go.erb b/mmv1/third_party/terraform/tests/resource_compute_instance_test.go.erb index faf6882bdaaf..ad75a166452d 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_instance_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_compute_instance_test.go.erb @@ -3255,7 +3255,7 @@ resource "google_compute_instance" "foobar" { } func testAccComputeInstance_resourceManagerTags(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_tags_tag_key" "key" { parent = "projects/%{project}" short_name = "foobarbaz%{random_suffix}" diff --git a/mmv1/third_party/terraform/tests/resource_compute_network_endpoint_group_test.go.erb b/mmv1/third_party/terraform/tests/resource_compute_network_endpoint_group_test.go.erb index 8ee43623bd84..01c9d08444d8 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_network_endpoint_group_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_compute_network_endpoint_group_test.go.erb @@ -59,7 +59,7 @@ func TestAccComputeNetworkEndpointGroup_internalEndpoint(t *testing.T) { } func testAccComputeNetworkEndpointGroup_networkEndpointGroup(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_compute_network_endpoint_group" "neg" { name = "tf-test-my-lb-neg%{random_suffix}" network = google_compute_network.default.id @@ -75,7 +75,7 @@ resource "google_compute_network" "default" { } func testAccComputeNetworkEndpointGroup_internalEndpoint(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_compute_network_endpoint_group" "neg" { name = "tf-test-my-lb-neg%{random_suffix}" network = google_compute_network.internal.id diff --git a/mmv1/third_party/terraform/tests/resource_compute_network_endpoint_test.go.erb b/mmv1/third_party/terraform/tests/resource_compute_network_endpoint_test.go.erb index 367ede9b9ace..dca972a90a8b 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_network_endpoint_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_compute_network_endpoint_test.go.erb @@ -82,7 +82,7 @@ func TestAccComputeNetworkEndpoint_networkEndpointsBasic(t *testing.T) { } func testAccComputeNetworkEndpoint_networkEndpointsBasic(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_compute_network_endpoint" "default" { zone = "us-central1-a" network_endpoint_group = google_compute_network_endpoint_group.neg.id @@ -95,7 +95,7 @@ resource "google_compute_network_endpoint" "default" { } func testAccComputeNetworkEndpoint_networkEndpointsModified(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_compute_network_endpoint" "default" { zone = "us-central1-a" network_endpoint_group = google_compute_network_endpoint_group.neg.name @@ -108,7 +108,7 @@ resource "google_compute_network_endpoint" "default" { } func testAccComputeNetworkEndpoint_networkEndpointsAdditional(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_compute_network_endpoint" "default" { zone = "us-central1-a" network_endpoint_group = google_compute_network_endpoint_group.neg.id @@ -139,7 +139,7 @@ resource "google_compute_network_endpoint" "add2" { } func testAccComputeNetworkEndpoint_noNetworkEndpoints(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_compute_network_endpoint_group" "neg" { name = "tf-test-neg-%{random_suffix}" zone = "us-central1-a" diff --git a/mmv1/third_party/terraform/tests/resource_compute_network_endpoints_test.go.erb b/mmv1/third_party/terraform/tests/resource_compute_network_endpoints_test.go.erb index 258ced283c35..3b4f40b1a764 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_network_endpoints_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_compute_network_endpoints_test.go.erb @@ -96,7 +96,7 @@ func TestAccComputeNetworkEndpoints_networkEndpointsBasic(t *testing.T) { } func testAccComputeNetworkEndpoints_networkEndpointsBase(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_compute_network_endpoints" "default" { zone = "us-central1-a" network_endpoint_group = google_compute_network_endpoint_group.neg.id @@ -111,7 +111,7 @@ resource "google_compute_network_endpoints" "default" { } func testAccComputeNetworkEndpoints_networkEndpointsModified(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_compute_network_endpoints" "default" { zone = "us-central1-a" network_endpoint_group = google_compute_network_endpoint_group.neg.name @@ -126,7 +126,7 @@ resource "google_compute_network_endpoints" "default" { } func testAccComputeNetworkEndpoints_networkEndpointsAdditional(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_compute_network_endpoints" "default" { zone = "us-central1-a" network_endpoint_group = google_compute_network_endpoint_group.neg.id @@ -167,7 +167,7 @@ resource "google_compute_network_endpoints" "default" { func testAccComputeNetworkEndpoints_networkEndpointsPaginated(context map[string]interface{}, lower, upper int) string { context["for_each"] = networkEndpointsGenerateRanges(lower, upper) - return Nprintf(` + return acctest.Nprintf(` resource "google_compute_network_endpoints" "default" { zone = "us-central1-a" network_endpoint_group = google_compute_network_endpoint_group.neg.name @@ -201,7 +201,7 @@ func networkEndpointsGenerateRanges(lower, upper int) string { } func testAccComputeNetworkEndpoints_noNetworkEndpoints(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_compute_network_endpoint_group" "neg" { name = "tf-test-neg-%{random_suffix}" zone = "us-central1-a" diff --git a/mmv1/third_party/terraform/tests/resource_compute_organization_security_policy_rule_test.go.erb b/mmv1/third_party/terraform/tests/resource_compute_organization_security_policy_rule_test.go.erb index 055e835929e8..476417960467 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_organization_security_policy_rule_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_compute_organization_security_policy_rule_test.go.erb @@ -44,7 +44,7 @@ func TestAccComputeOrganizationSecurityPolicyRule_organizationSecurityPolicyRule } func testAccComputeOrganizationSecurityPolicyRule_organizationSecurityPolicyRulePreUpdateExample(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_folder" "security_policy_target" { display_name = "tf-test-secpol-%{random_suffix}" parent = "organizations/%{org_id}" @@ -78,7 +78,7 @@ resource "google_compute_organization_security_policy_rule" "policy" { } func testAccComputeOrganizationSecurityPolicyRule_organizationSecurityPolicyRulePostUpdateExample(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_folder" "security_policy_target" { display_name = "tf-test-secpol-%{random_suffix}" parent = "organizations/%{org_id}" diff --git a/mmv1/third_party/terraform/tests/resource_compute_organization_security_policy_test.go.erb b/mmv1/third_party/terraform/tests/resource_compute_organization_security_policy_test.go.erb index d514315acd28..42731ec20c1e 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_organization_security_policy_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_compute_organization_security_policy_test.go.erb @@ -44,7 +44,7 @@ func TestAccComputeOrganizationSecurityPolicy_organizationSecurityPolicyUpdateEx } func testAccComputeOrganizationSecurityPolicy_organizationSecurityPolicyPreUpdateExample(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_compute_organization_security_policy" "policy" { display_name = "tf-test%{random_suffix}" parent = "organizations/%{org_id}" @@ -53,7 +53,7 @@ resource "google_compute_organization_security_policy" "policy" { } func testAccComputeOrganizationSecurityPolicy_organizationSecurityPolicyPostUpdateExample(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_compute_organization_security_policy" "policy" { display_name = "tf-test%{random_suffix}" parent = "organizations/%{org_id}" diff --git a/mmv1/third_party/terraform/tests/resource_compute_per_instance_config_test.go.erb b/mmv1/third_party/terraform/tests/resource_compute_per_instance_config_test.go.erb index 52e7957a090d..adbaa4dc1234 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_per_instance_config_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_compute_per_instance_config_test.go.erb @@ -173,7 +173,7 @@ func TestAccComputePerInstanceConfig_statefulIps(t *testing.T) { <% end -%> func testAccComputePerInstanceConfig_statefulBasic(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_compute_per_instance_config" "default" { instance_group_manager = google_compute_instance_group_manager.igm.name name = "%{config_name}" @@ -188,7 +188,7 @@ resource "google_compute_per_instance_config" "default" { } func testAccComputePerInstanceConfig_update(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_compute_per_instance_config" "default" { instance_group_manager = google_compute_instance_group_manager.igm.name name = "%{config_name}" @@ -204,7 +204,7 @@ resource "google_compute_per_instance_config" "default" { } func testAccComputePerInstanceConfig_statefulModified(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_compute_per_instance_config" "default" { zone = google_compute_instance_group_manager.igm.zone instance_group_manager = google_compute_instance_group_manager.igm.name @@ -220,7 +220,7 @@ resource "google_compute_per_instance_config" "default" { } func testAccComputePerInstanceConfig_statefulAdditional(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_compute_per_instance_config" "default" { zone = google_compute_instance_group_manager.igm.zone instance_group_manager = google_compute_instance_group_manager.igm.name @@ -300,7 +300,7 @@ resource "google_compute_disk" "disk2" { } func testAccComputePerInstanceConfig_igm(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` data "google_compute_image" "my_image" { family = "debian-11" project = "debian-cloud" @@ -344,7 +344,7 @@ resource "google_compute_instance_group_manager" "igm" { <% unless version == 'ga' -%> func testAccComputePerInstanceConfig_statefulIpsBasic(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_compute_network" "default" { name = "%{network}" } @@ -419,7 +419,7 @@ resource "google_compute_disk" "disk1" { } func testAccComputePerInstanceConfig_statefulIpsUpdate(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_compute_network" "default" { name = "%{network}" } diff --git a/mmv1/third_party/terraform/tests/resource_compute_public_advertised_prefix_test.go b/mmv1/third_party/terraform/tests/resource_compute_public_advertised_prefix_test.go index e55d83d7307c..b117278adb1e 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_public_advertised_prefix_test.go +++ b/mmv1/third_party/terraform/tests/resource_compute_public_advertised_prefix_test.go @@ -58,7 +58,7 @@ func testAccComputePublicAdvertisedPrefix_publicAdvertisedPrefixesBasicTest(t *t } func testAccComputePublicAdvertisedPrefix_publicAdvertisedPrefixesBasicExample(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_compute_public_advertised_prefix" "prefix" { name = "tf-test-my-prefix%{random_suffix}" description = "%{description}" @@ -93,7 +93,7 @@ func testAccComputePublicDelegatedPrefix_publicDelegatedPrefixesBasicTest(t *tes } func testAccComputePublicDelegatedPrefix_publicDelegatedPrefixesBasicExample(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_compute_public_advertised_prefix" "advertised" { name = "tf-test-my-prefix%{random_suffix}" description = "%{description}" diff --git a/mmv1/third_party/terraform/tests/resource_compute_region_instance_template_test.go.erb b/mmv1/third_party/terraform/tests/resource_compute_region_instance_template_test.go.erb index 590fae1a8f81..3468c237c8b7 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_region_instance_template_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_compute_region_instance_template_test.go.erb @@ -3080,7 +3080,7 @@ resource "google_compute_region_instance_template" "foobar" { } func testAccComputeRegionInstanceTemplate_sourceSnapshotEncryptionKey(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` data "google_kms_key_ring" "ring" { name = "%{kms_ring_name}" location = "us-central1" @@ -3148,7 +3148,7 @@ resource "google_compute_region_instance_template" "template" { } func testAccComputeRegionInstanceTemplate_sourceImageEncryptionKey(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` data "google_kms_key_ring" "ring" { name = "%{kms_ring_name}" location = "us-central1" diff --git a/mmv1/third_party/terraform/tests/resource_compute_region_network_endpoint_group_test.go.erb b/mmv1/third_party/terraform/tests/resource_compute_region_network_endpoint_group_test.go.erb index 8f4223a5b339..01e5e8a69dd4 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_region_network_endpoint_group_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_compute_region_network_endpoint_group_test.go.erb @@ -39,7 +39,7 @@ func TestAccComputeRegionNetworkEndpointGroup_negWithServerlessDeployment(t *tes <% unless version == 'ga' -%> func testAccComputeRegionNetworkEndpointGroup_negWithServerlessDeployment(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_api_gateway_api" "api_gw" { api_id = "tf-test-%{random_suffix}" } diff --git a/mmv1/third_party/terraform/tests/resource_compute_region_per_instance_config_test.go.erb b/mmv1/third_party/terraform/tests/resource_compute_region_per_instance_config_test.go.erb index 47cc8b24a191..c68db36e1d94 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_region_per_instance_config_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_compute_region_per_instance_config_test.go.erb @@ -171,7 +171,7 @@ func TestAccComputeRegionPerInstanceConfig_statefulIps(t *testing.T) { <% end -%> func testAccComputeRegionPerInstanceConfig_statefulBasic(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_compute_region_per_instance_config" "default" { region_instance_group_manager = google_compute_region_instance_group_manager.rigm.name name = "%{config_name}" @@ -186,7 +186,7 @@ resource "google_compute_region_per_instance_config" "default" { } func testAccComputeRegionPerInstanceConfig_update(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_compute_region_per_instance_config" "default" { region_instance_group_manager = google_compute_region_instance_group_manager.rigm.name name = "%{config_name}" @@ -202,7 +202,7 @@ resource "google_compute_region_per_instance_config" "default" { } func testAccComputeRegionPerInstanceConfig_statefulModified(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_compute_region_per_instance_config" "default" { region = google_compute_region_instance_group_manager.rigm.region region_instance_group_manager = google_compute_region_instance_group_manager.rigm.name @@ -218,7 +218,7 @@ resource "google_compute_region_per_instance_config" "default" { } func testAccComputeRegionPerInstanceConfig_statefulAdditional(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_compute_region_per_instance_config" "default" { region = google_compute_region_instance_group_manager.rigm.region region_instance_group_manager = google_compute_region_instance_group_manager.rigm.name @@ -298,7 +298,7 @@ resource "google_compute_disk" "disk2" { } func testAccComputeRegionPerInstanceConfig_rigm(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` data "google_compute_image" "my_image" { family = "debian-11" project = "debian-cloud" @@ -349,7 +349,7 @@ resource "google_compute_region_instance_group_manager" "rigm" { } <% unless version == 'ga' -%> func testAccComputeRegionPerInstanceConfig_statefulIpsBasic(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_compute_network" "default" { name = "%{network}" } @@ -425,7 +425,7 @@ resource "google_compute_disk" "disk1" { } func testAccComputeRegionPerInstanceConfig_statefulIpsUpdate(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_compute_network" "default" { name = "%{network}" } diff --git a/mmv1/third_party/terraform/tests/resource_compute_region_security_policy_test.go.erb b/mmv1/third_party/terraform/tests/resource_compute_region_security_policy_test.go.erb index 7286ea91a23c..ee13bb6e0f87 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_region_security_policy_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_compute_region_security_policy_test.go.erb @@ -42,7 +42,7 @@ func TestAccComputeRegionSecurityPolicy_regionSecurityPolicyBasicUpdateExample(t } func testAccComputeRegionSecurityPolicy_basic(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_compute_region_security_policy" "regionSecPolicy" { name = "tf-test%{random_suffix}" description = "basic region security policy" @@ -56,7 +56,7 @@ resource "google_compute_region_security_policy" "regionSecPolicy" { } func testAccComputeRegionSecurityPolicy_update(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_compute_region_security_policy" "regionSecPolicy" { name = "tf-test%{random_suffix}" description = "basic update region security policy" diff --git a/mmv1/third_party/terraform/tests/resource_compute_router_interface_test.go b/mmv1/third_party/terraform/tests/resource_compute_router_interface_test.go index f4641c76fb54..2e711ca5376f 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_router_interface_test.go +++ b/mmv1/third_party/terraform/tests/resource_compute_router_interface_test.go @@ -242,7 +242,7 @@ func testAccCheckComputeRouterInterfaceExists(t *testing.T, n string) resource.T } func testAccComputeRouterInterfaceBasic(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_compute_network" "foobar" { name = "%{name}-net" } diff --git a/mmv1/third_party/terraform/tests/resource_compute_service_attachment_test.go b/mmv1/third_party/terraform/tests/resource_compute_service_attachment_test.go index 328a2bfefd73..36dc182e54ae 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_service_attachment_test.go +++ b/mmv1/third_party/terraform/tests/resource_compute_service_attachment_test.go @@ -42,7 +42,7 @@ func TestAccComputeServiceAttachment_serviceAttachmentBasicExampleUpdate(t *test } func testAccComputeServiceAttachment_serviceAttachmentBasicExampleFork(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_compute_service_attachment" "psc_ilb_service_attachment" { name = "tf-test-my-psc-ilb%{random_suffix}" region = "us-west2" @@ -125,7 +125,7 @@ resource "google_compute_subnetwork" "psc_ilb_nat" { } func testAccComputeServiceAttachment_serviceAttachmentBasicExampleUpdate(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_compute_service_attachment" "psc_ilb_service_attachment" { name = "tf-test-my-psc-ilb%{random_suffix}" region = "us-west2" diff --git a/mmv1/third_party/terraform/tests/resource_compute_shared_reservation_update_test.go b/mmv1/third_party/terraform/tests/resource_compute_shared_reservation_update_test.go index 50ab78a3ce83..2f21fec195b4 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_shared_reservation_update_test.go +++ b/mmv1/third_party/terraform/tests/resource_compute_shared_reservation_update_test.go @@ -56,7 +56,7 @@ func TestAccComputeSharedReservation_update(t *testing.T) { } func testAccComputeReservation_sharedReservation_basic(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_project" "owner_project" { project_id = "tf-test%{random_suffix}" name = "tf-test%{random_suffix}" @@ -145,7 +145,7 @@ resource "google_compute_reservation" "gce_reservation" { } func testAccComputeReservation_sharedReservation_update(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_project" "owner_project" { project_id = "tf-test%{random_suffix}" name = "tf-test%{random_suffix}" diff --git a/mmv1/third_party/terraform/tests/resource_container_analysis_occurrence_test.go b/mmv1/third_party/terraform/tests/resource_container_analysis_occurrence_test.go index 23b5d27027f2..81f0c955fda3 100644 --- a/mmv1/third_party/terraform/tests/resource_container_analysis_occurrence_test.go +++ b/mmv1/third_party/terraform/tests/resource_container_analysis_occurrence_test.go @@ -152,7 +152,7 @@ func TestAccContainerAnalysisOccurrence_multipleSignatures(t *testing.T) { } func testAccContainerAnalysisOccurence_basic(params map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_binary_authorization_attestor" "attestor" { name = "test-attestor%{random_suffix}" attestation_authority_note { @@ -206,7 +206,7 @@ resource "google_container_analysis_occurrence" "occurrence" { } func testAccContainerAnalysisOccurence_multipleSignatures(params map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_binary_authorization_attestor" "attestor" { name = "test-attestor%{random_suffix}" attestation_authority_note { diff --git a/mmv1/third_party/terraform/tests/resource_container_attached_cluster_update_test.go b/mmv1/third_party/terraform/tests/resource_container_attached_cluster_update_test.go index 91de81fb352a..bad75730026a 100644 --- a/mmv1/third_party/terraform/tests/resource_container_attached_cluster_update_test.go +++ b/mmv1/third_party/terraform/tests/resource_container_attached_cluster_update_test.go @@ -51,7 +51,7 @@ func TestAccContainerAttachedCluster_update(t *testing.T) { } func testAccContainerAttachedCluster_containerAttachedCluster_full(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` data "google_project" "project" { } @@ -95,7 +95,7 @@ resource "google_container_attached_cluster" "primary" { } func testAccContainerAttachedCluster_containerAttachedCluster_update(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` data "google_project" "project" { } @@ -138,7 +138,7 @@ resource "google_container_attached_cluster" "primary" { // Duplicate of testAccContainerAttachedCluster_containerAttachedCluster_update without lifecycle.prevent_destroy set // so the test can clean up the resource after the update. func testAccContainerAttachedCluster_containerAttachedCluster_destroy(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` data "google_project" "project" { } diff --git a/mmv1/third_party/terraform/tests/resource_data_catalog_tag_template_test.go b/mmv1/third_party/terraform/tests/resource_data_catalog_tag_template_test.go index 41beecf08cdb..87da88e97227 100644 --- a/mmv1/third_party/terraform/tests/resource_data_catalog_tag_template_test.go +++ b/mmv1/third_party/terraform/tests/resource_data_catalog_tag_template_test.go @@ -57,7 +57,7 @@ func TestAccDataCatalogTagTemplate_dataCatalogTagTemplate_updateFields(t *testin } func testAccDataCatalogTagTemplate_dataCatalogTagTemplateUpdateFields(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_data_catalog_tag_template" "basic_tag_template" { tag_template_id = "tf_test_my_template%{random_suffix}" region = "us-central1" @@ -96,7 +96,7 @@ resource "google_data_catalog_tag_template" "basic_tag_template" { } func testAccDataCatalogTagTemplate_dataCatalogTagTemplateUpdatePrimitiveTypeOfFieldsWithRequired(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_data_catalog_tag_template" "basic_tag_template" { tag_template_id = "tf_test_my_template%{random_suffix}" region = "us-central1" @@ -135,7 +135,7 @@ resource "google_data_catalog_tag_template" "basic_tag_template" { } func testAccDataCatalogTagTemplate_dataCatalogTagTemplateUpdatePrimitiveTypeOfFieldsWithOptional(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_data_catalog_tag_template" "basic_tag_template" { tag_template_id = "tf_test_my_template%{random_suffix}" region = "us-central1" diff --git a/mmv1/third_party/terraform/tests/resource_data_catalog_tag_test.go b/mmv1/third_party/terraform/tests/resource_data_catalog_tag_test.go index 56ad25c2fece..acc534253bd5 100644 --- a/mmv1/third_party/terraform/tests/resource_data_catalog_tag_test.go +++ b/mmv1/third_party/terraform/tests/resource_data_catalog_tag_test.go @@ -49,7 +49,7 @@ func TestAccDataCatalogTag_update(t *testing.T) { } func testAccDataCatalogTag_dataCatalogEntryTag_update(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_data_catalog_entry" "entry" { entry_group = google_data_catalog_entry_group.entry_group.id entry_id = "tf_test_my_entry%{random_suffix}" diff --git a/mmv1/third_party/terraform/tests/resource_data_fusion_instance_test.go b/mmv1/third_party/terraform/tests/resource_data_fusion_instance_test.go index f71bc62c91f9..a3a1cf43ab32 100644 --- a/mmv1/third_party/terraform/tests/resource_data_fusion_instance_test.go +++ b/mmv1/third_party/terraform/tests/resource_data_fusion_instance_test.go @@ -190,7 +190,7 @@ func TestAccDataFusionInstanceVersion_dataFusionInstanceUpdate(t *testing.T) { } func testAccDataFusionInstanceVersion_dataFusionInstanceUpdate(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_data_fusion_instance" "basic_instance" { name = "tf-test-my-instance%{random_suffix}" region = "us-central1" diff --git a/mmv1/third_party/terraform/tests/resource_data_loss_prevention_deidentify_template_test.go b/mmv1/third_party/terraform/tests/resource_data_loss_prevention_deidentify_template_test.go index bcbfa8e1062d..7e394767b5e9 100644 --- a/mmv1/third_party/terraform/tests/resource_data_loss_prevention_deidentify_template_test.go +++ b/mmv1/third_party/terraform/tests/resource_data_loss_prevention_deidentify_template_test.go @@ -43,7 +43,7 @@ func TestAccDataLossPreventionDeidentifyTemplate_dlpDeidentifyTemplate_infoTypeT } func testAccDataLossPreventionDeidentifyTemplate_dlpDeidentifyTemplate_infoTypeTransformationsStart(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_data_loss_prevention_deidentify_template" "basic" { parent = "organizations/%{organization}" description = "Description" @@ -271,7 +271,7 @@ resource "google_data_loss_prevention_deidentify_template" "basic" { } func testAccDataLossPreventionDeidentifyTemplate_dlpDeidentifyTemplate_infoTypeTransformationsUpdate(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_data_loss_prevention_deidentify_template" "basic" { parent = "organizations/%{organization}" description = "Description" @@ -485,7 +485,7 @@ func TestAccDataLossPreventionDeidentifyTemplate_dlpDeidentifyTemplate_recordTra } func testAccDataLossPreventionDeidentifyTemplate_dlpDeidentifyTemplate_recordTransformations_start(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_data_loss_prevention_deidentify_template" "basic" { parent = "organizations/%{organization}" description = "Description" @@ -754,7 +754,7 @@ resource "google_data_loss_prevention_deidentify_template" "basic" { } func testAccDataLossPreventionDeidentifyTemplate_dlpDeidentifyTemplate_recordTransformations_update(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_data_loss_prevention_deidentify_template" "basic" { parent = "organizations/%{organization}" description = "Description" @@ -1077,7 +1077,7 @@ func TestAccDataLossPreventionDeidentifyTemplate_dlpDeidentifyTemplate_imageTran } func testAccDataLossPreventionDeidentifyTemplate_dlpDeidentifyTemplate_imageTransformationsBasic(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_data_loss_prevention_deidentify_template" "basic" { parent = "organizations/%{organization}" description = "Description" @@ -1116,7 +1116,7 @@ resource "google_data_loss_prevention_deidentify_template" "basic" { } func testAccDataLossPreventionDeidentifyTemplate_dlpDeidentifyTemplate_imageTransformationsUpdate(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_data_loss_prevention_deidentify_template" "basic" { parent = "organizations/%{organization}" description = "Description" @@ -1182,7 +1182,7 @@ func TestAccDataLossPreventionDeidentifyTemplate_dlpDeidentifyTemplate_infoTypeT } func testAccDataLossPreventionDeidentifyTemplate_dlpDeidentifyTemplate_infoTypeTransformations_primitiveTransformationsStart(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_data_loss_prevention_deidentify_template" "config" { parent = "organizations/%{organization}" description = "Description" @@ -1328,7 +1328,7 @@ resource "google_data_loss_prevention_deidentify_template" "config" { } func testAccDataLossPreventionDeidentifyTemplate_dlpDeidentifyTemplate_infoTypeTransformations_primitiveTransformationsUpdate(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_data_loss_prevention_deidentify_template" "config" { parent = "organizations/%{organization}" description = "Description" @@ -1546,7 +1546,7 @@ func TestAccDataLossPreventionDeidentifyTemplate_dlpDeidentifyTemplate_infoTypeT } func testAccDataLossPreventionDeidentifyTemplate_dlpDeidentifyTemplate_infoTypeTransformations_primitiveTransformations_bucketingConfig_integerValue(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_data_loss_prevention_deidentify_template" "config" { parent = "organizations/%{organization}" description = "Description" @@ -1582,7 +1582,7 @@ resource "google_data_loss_prevention_deidentify_template" "config" { } func testAccDataLossPreventionDeidentifyTemplate_dlpDeidentifyTemplate_infoTypeTransformations_primitiveTransformations_bucketingConfig_floatValue(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_data_loss_prevention_deidentify_template" "config" { parent = "organizations/%{organization}" description = "Description" @@ -1618,7 +1618,7 @@ resource "google_data_loss_prevention_deidentify_template" "config" { } func testAccDataLossPreventionDeidentifyTemplate_dlpDeidentifyTemplate_infoTypeTransformations_primitiveTransformations_bucketingConfig_timestampValue(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_data_loss_prevention_deidentify_template" "config" { parent = "organizations/%{organization}" description = "Description" @@ -1654,7 +1654,7 @@ resource "google_data_loss_prevention_deidentify_template" "config" { } func testAccDataLossPreventionDeidentifyTemplate_dlpDeidentifyTemplate_infoTypeTransformations_primitiveTransformations_bucketingConfig_timeValue(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_data_loss_prevention_deidentify_template" "config" { parent = "organizations/%{organization}" description = "Description" @@ -1705,7 +1705,7 @@ resource "google_data_loss_prevention_deidentify_template" "config" { } func testAccDataLossPreventionDeidentifyTemplate_dlpDeidentifyTemplate_infoTypeTransformations_primitiveTransformations_bucketingConfig_dateValue(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_data_loss_prevention_deidentify_template" "config" { parent = "organizations/%{organization}" description = "Description" @@ -1753,7 +1753,7 @@ resource "google_data_loss_prevention_deidentify_template" "config" { } func testAccDataLossPreventionDeidentifyTemplate_dlpDeidentifyTemplate_infoTypeTransformations_primitiveTransformations_bucketingConfig_dayOfWeekValue(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_data_loss_prevention_deidentify_template" "config" { parent = "organizations/%{organization}" description = "Description" @@ -1823,7 +1823,7 @@ func TestAccDataLossPreventionDeidentifyTemplate_dlpDeidentifyTemplate_infoTypeT } func testAccDataLossPreventionDeidentifyTemplate_dlpDeidentifyTemplate_infoTypeTransformations_primitiveTransformations_fixedSizeBucketingConfig_integerValue(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_data_loss_prevention_deidentify_template" "config" { parent = "organizations/%{organization}" description = "Description" @@ -1855,7 +1855,7 @@ resource "google_data_loss_prevention_deidentify_template" "config" { } func testAccDataLossPreventionDeidentifyTemplate_dlpDeidentifyTemplate_infoTypeTransformations_primitiveTransformations_fixedSizeBucketingConfig_floatValue(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_data_loss_prevention_deidentify_template" "config" { parent = "organizations/%{organization}" description = "Description" @@ -1929,7 +1929,7 @@ func TestAccDataLossPreventionDeidentifyTemplate_dlpDeidentifyTemplate_infoTypeT } func testAccDataLossPreventionDeidentifyTemplate_dlpDeidentifyTemplate_infoTypeTransformations_primitiveTransformations_dateShiftConfig_transient(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_data_loss_prevention_deidentify_template" "config" { parent = "organizations/%{organization}" description = "Description" @@ -1964,7 +1964,7 @@ resource "google_data_loss_prevention_deidentify_template" "config" { } func testAccDataLossPreventionDeidentifyTemplate_dlpDeidentifyTemplate_infoTypeTransformations_primitiveTransformations_dateShiftConfig_unwrapped(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_data_loss_prevention_deidentify_template" "config" { parent = "organizations/%{organization}" description = "Description" @@ -1999,7 +1999,7 @@ resource "google_data_loss_prevention_deidentify_template" "config" { } func testAccDataLossPreventionDeidentifyTemplate_dlpDeidentifyTemplate_infoTypeTransformations_primitiveTransformations_dateShiftConfig_kmsWrapped(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_data_loss_prevention_deidentify_template" "config" { parent = "organizations/%{organization}" description = "Description" @@ -2068,7 +2068,7 @@ func TestAccDataLossPreventionDeidentifyTemplate_dlpDeidentifyTemplate_recordTra } func testAccDataLossPreventionDeidentifyTemplate_dlpDeidentifyTemplate_recordTransformations_with_infoTypeTransformations_start(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_data_loss_prevention_deidentify_template" "basic" { parent = "organizations/%{organization}" description = "Description" @@ -2439,7 +2439,7 @@ resource "google_data_loss_prevention_deidentify_template" "basic" { } func testAccDataLossPreventionDeidentifyTemplate_dlpDeidentifyTemplate_recordTransformations_with_infoTypeTransformations_update(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_data_loss_prevention_deidentify_template" "basic" { parent = "organizations/%{organization}" description = "Description" @@ -2927,7 +2927,7 @@ func TestAccDataLossPreventionDeidentifyTemplate_dlpDeidentifyTemplate_recordTra } func testAccDataLossPreventionDeidentifyTemplate_dlpDeidentifyTemplate_recordTransformations_with_infoTypeTransformations_replaceConfigString(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_data_loss_prevention_deidentify_template" "basic" { parent = "projects/%{project}" description = "Description" @@ -2992,7 +2992,7 @@ resource "google_data_loss_prevention_deidentify_template" "basic" { } func testAccDataLossPreventionDeidentifyTemplate_dlpDeidentifyTemplate_recordTransformations_with_infoTypeTransformations_replaceConfigBoolean(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_data_loss_prevention_deidentify_template" "basic" { parent = "projects/%{project}" description = "Description" @@ -3057,7 +3057,7 @@ resource "google_data_loss_prevention_deidentify_template" "basic" { } func testAccDataLossPreventionDeidentifyTemplate_dlpDeidentifyTemplate_recordTransformations_with_infoTypeTransformations_replaceConfigTimestamp(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_data_loss_prevention_deidentify_template" "basic" { parent = "projects/%{project}" description = "Description" @@ -3122,7 +3122,7 @@ resource "google_data_loss_prevention_deidentify_template" "basic" { } func testAccDataLossPreventionDeidentifyTemplate_dlpDeidentifyTemplate_recordTransformations_with_infoTypeTransformations_replaceConfigTimevalue(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_data_loss_prevention_deidentify_template" "basic" { parent = "projects/%{project}" description = "Description" @@ -3192,7 +3192,7 @@ resource "google_data_loss_prevention_deidentify_template" "basic" { } func testAccDataLossPreventionDeidentifyTemplate_dlpDeidentifyTemplate_recordTransformations_with_infoTypeTransformations_replaceConfigDatevalue(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_data_loss_prevention_deidentify_template" "basic" { parent = "projects/%{project}" description = "Description" @@ -3261,7 +3261,7 @@ resource "google_data_loss_prevention_deidentify_template" "basic" { } func testAccDataLossPreventionDeidentifyTemplate_dlpDeidentifyTemplate_recordTransformations_with_infoTypeTransformations_replaceConfigDayOfWeek(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_data_loss_prevention_deidentify_template" "basic" { parent = "projects/%{project}" description = "Description" @@ -3367,7 +3367,7 @@ func TestAccDataLossPreventionDeidentifyTemplate_dlpDeidentifyTemplate_recordTra } func testAccDataLossPreventionDeidentifyTemplate_dlpDeidentifyTemplate_recordTransformations_with_infoTypeTransformations_cryptoReplaceFfxFpeConfigTransient(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_data_loss_prevention_deidentify_template" "basic" { parent = "organizations/%{organization}" description = "Description" @@ -3435,7 +3435,7 @@ resource "google_data_loss_prevention_deidentify_template" "basic" { } func testAccDataLossPreventionDeidentifyTemplate_dlpDeidentifyTemplate_recordTransformations_with_infoTypeTransformations_cryptoReplaceFfxFpeConfigUnwrapped(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_data_loss_prevention_deidentify_template" "basic" { parent = "organizations/%{organization}" description = "Description" @@ -3504,7 +3504,7 @@ resource "google_data_loss_prevention_deidentify_template" "basic" { } func testAccDataLossPreventionDeidentifyTemplate_dlpDeidentifyTemplate_recordTransformations_with_infoTypeTransformations_cryptoReplaceFfxFpeConfigKmswrapped(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_data_loss_prevention_deidentify_template" "basic" { parent = "organizations/%{organization}" description = "Description" @@ -3638,7 +3638,7 @@ func TestAccDataLossPreventionDeidentifyTemplate_dlpDeidentifyTemplate_recordTra } func testAccDataLossPreventionDeidentifyTemplate_dlpDeidentifyTemplate_recordTransformations_with_infoTypeTransformations_bucketingConfigInteger(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_data_loss_prevention_deidentify_template" "basic" { parent = "projects/%{project}" description = "Description" @@ -3708,7 +3708,7 @@ resource "google_data_loss_prevention_deidentify_template" "basic" { } func testAccDataLossPreventionDeidentifyTemplate_dlpDeidentifyTemplate_recordTransformations_with_infoTypeTransformations_bucketingConfigFloat(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_data_loss_prevention_deidentify_template" "basic" { parent = "projects/%{project}" description = "Description" @@ -3778,7 +3778,7 @@ resource "google_data_loss_prevention_deidentify_template" "basic" { } func testAccDataLossPreventionDeidentifyTemplate_dlpDeidentifyTemplate_recordTransformations_with_infoTypeTransformations_bucketingConfigTimestamp(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_data_loss_prevention_deidentify_template" "basic" { parent = "projects/%{project}" description = "Description" @@ -3848,7 +3848,7 @@ resource "google_data_loss_prevention_deidentify_template" "basic" { } func testAccDataLossPreventionDeidentifyTemplate_dlpDeidentifyTemplate_recordTransformations_with_infoTypeTransformations_bucketingConfigTimeValue(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_data_loss_prevention_deidentify_template" "basic" { parent = "projects/%{project}" description = "Description" @@ -3933,7 +3933,7 @@ resource "google_data_loss_prevention_deidentify_template" "basic" { } func testAccDataLossPreventionDeidentifyTemplate_dlpDeidentifyTemplate_recordTransformations_with_infoTypeTransformations_bucketingConfigDateValue(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_data_loss_prevention_deidentify_template" "basic" { parent = "projects/%{project}" description = "Description" @@ -4015,7 +4015,7 @@ resource "google_data_loss_prevention_deidentify_template" "basic" { } func testAccDataLossPreventionDeidentifyTemplate_dlpDeidentifyTemplate_recordTransformations_with_infoTypeTransformations_bucketingConfigDayOfTheWeek(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_data_loss_prevention_deidentify_template" "basic" { parent = "projects/%{project}" description = "Description" @@ -4126,7 +4126,7 @@ func TestAccDataLossPreventionDeidentifyTemplate_dlpDeidentifyTemplate_recordTra } func testAccDataLossPreventionDeidentifyTemplate_dlpDeidentifyTemplate_recordTransformations_with_infoTypeTransformations_cryptoHashConfigTransient(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_data_loss_prevention_deidentify_template" "basic" { parent = "organizations/%{organization}" description = "Description" @@ -4187,7 +4187,7 @@ resource "google_data_loss_prevention_deidentify_template" "basic" { } func testAccDataLossPreventionDeidentifyTemplate_dlpDeidentifyTemplate_recordTransformations_with_infoTypeTransformations_cryptoHashConfigUnwrapped(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_data_loss_prevention_deidentify_template" "basic" { parent = "organizations/%{organization}" description = "Description" @@ -4248,7 +4248,7 @@ resource "google_data_loss_prevention_deidentify_template" "basic" { } func testAccDataLossPreventionDeidentifyTemplate_dlpDeidentifyTemplate_recordTransformations_with_infoTypeTransformations_cryptoHashConfigKmswrapped(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_data_loss_prevention_deidentify_template" "basic" { parent = "organizations/%{organization}" description = "Description" @@ -4351,7 +4351,7 @@ func TestAccDataLossPreventionDeidentifyTemplate_dlpDeidentifyTemplate_recordTra } func testAccDataLossPreventionDeidentifyTemplate_dlpDeidentifyTemplate_recordTransformations_with_infoTypeTransformations_dateShiftConfigTransient(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_data_loss_prevention_deidentify_template" "basic" { parent = "organizations/%{organization}" description = "Description" @@ -4417,7 +4417,7 @@ resource "google_data_loss_prevention_deidentify_template" "basic" { } func testAccDataLossPreventionDeidentifyTemplate_dlpDeidentifyTemplate_recordTransformations_with_infoTypeTransformations_dateShiftConfigUnwrapped(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_data_loss_prevention_deidentify_template" "basic" { parent = "organizations/%{organization}" description = "Description" @@ -4483,7 +4483,7 @@ resource "google_data_loss_prevention_deidentify_template" "basic" { } func testAccDataLossPreventionDeidentifyTemplate_dlpDeidentifyTemplate_recordTransformations_with_infoTypeTransformations_dateShiftConfigKmswrapped(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_data_loss_prevention_deidentify_template" "basic" { parent = "organizations/%{organization}" description = "Description" @@ -4591,7 +4591,7 @@ func TestAccDataLossPreventionDeidentifyTemplate_dlpDeidentifyTemplate_recordTra } func testAccDataLossPreventionDeidentifyTemplate_dlpDeidentifyTemplate_recordTransformations_with_infoTypeTransformations_cryptoDeterministicConfigTransient(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_data_loss_prevention_deidentify_template" "basic" { parent = "organizations/%{organization}" description = "Description" @@ -4655,7 +4655,7 @@ resource "google_data_loss_prevention_deidentify_template" "basic" { } func testAccDataLossPreventionDeidentifyTemplate_dlpDeidentifyTemplate_recordTransformations_with_infoTypeTransformations_cryptoDeterministicConfigUnwrapped(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_data_loss_prevention_deidentify_template" "basic" { parent = "organizations/%{organization}" description = "Description" @@ -4723,7 +4723,7 @@ resource "google_data_loss_prevention_deidentify_template" "basic" { } func testAccDataLossPreventionDeidentifyTemplate_dlpDeidentifyTemplate_recordTransformations_with_infoTypeTransformations_cryptoDeterministicConfigKmswrapped(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_data_loss_prevention_deidentify_template" "basic" { parent = "organizations/%{organization}" description = "Description" diff --git a/mmv1/third_party/terraform/tests/resource_data_loss_prevention_inspect_template_test.go b/mmv1/third_party/terraform/tests/resource_data_loss_prevention_inspect_template_test.go index 3cab11fdb411..1c53c6f24051 100644 --- a/mmv1/third_party/terraform/tests/resource_data_loss_prevention_inspect_template_test.go +++ b/mmv1/third_party/terraform/tests/resource_data_loss_prevention_inspect_template_test.go @@ -42,7 +42,7 @@ func TestAccDataLossPreventionInspectTemplate_dlpInspectTemplateUpdate(t *testin } func testAccDataLossPreventionInspectTemplate_dlpInspectTemplateBasic(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_data_loss_prevention_inspect_template" "basic" { parent = "projects/%{project}" description = "Description" @@ -152,7 +152,7 @@ resource "google_data_loss_prevention_inspect_template" "basic" { } func testAccDataLossPreventionInspectTemplate_dlpInspectTemplateUpdate(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_data_loss_prevention_inspect_template" "basic" { parent = "projects/%{project}" description = "Updated" @@ -276,7 +276,7 @@ func TestAccDataLossPreventionInspectTemplate_dlpInspectTemplate_withInfoTypesVe } func testAccDataLossPreventionInspectTemplate_dlpInspectTemplate_withInfoTypesVersionBasic(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_data_loss_prevention_inspect_template" "basic" { parent = "projects/%{project}" description = "Description" @@ -409,7 +409,7 @@ resource "google_data_loss_prevention_inspect_template" "basic" { } func testAccDataLossPreventionInspectTemplate_dlpInspectTemplate_withInfoTypesVersionUpdate(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_data_loss_prevention_inspect_template" "basic" { parent = "projects/%{project}" description = "Description" @@ -572,7 +572,7 @@ func TestAccDataLossPreventionInspectTemplate_dlpInspectTemplate_withExcludeByHo } func testAccDataLossPreventionInspectTemplate_dlpInspectTemplate_withExcludeByHotwordBasic(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_data_loss_prevention_inspect_template" "basic" { parent = "projects/%{project}" description = "Description" @@ -717,7 +717,7 @@ resource "google_data_loss_prevention_inspect_template" "basic" { } func testAccDataLossPreventionInspectTemplate_dlpInspectTemplate_withExcludeByHotwordUpdate(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_data_loss_prevention_inspect_template" "basic" { parent = "projects/%{project}" description = "Description" @@ -903,7 +903,7 @@ func TestAccDataLossPreventionInspectTemplate_dlpInspectTemplate_withSensitivity } func testAccDataLossPreventionInspectTemplate_dlpInspectTemplate_withSensitivityScoreBasic(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_data_loss_prevention_inspect_template" "basic" { parent = "projects/%{project}" description = "Description" @@ -1020,7 +1020,7 @@ resource "google_data_loss_prevention_inspect_template" "basic" { } func testAccDataLossPreventionInspectTemplate_dlpInspectTemplate_withSensitivityScoreUpdate(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_data_loss_prevention_inspect_template" "basic" { parent = "projects/%{project}" description = "Description" @@ -1128,7 +1128,7 @@ resource "google_data_loss_prevention_inspect_template" "basic" { } func testAccDataLossPreventionInspectTemplate_dlpInspectTemplate_withSensitivityScoreUpdate2(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_data_loss_prevention_inspect_template" "basic" { parent = "projects/%{project}" description = "Description" diff --git a/mmv1/third_party/terraform/tests/resource_data_loss_prevention_job_trigger_test.go b/mmv1/third_party/terraform/tests/resource_data_loss_prevention_job_trigger_test.go index 517bd71e0830..c193f5c8ec53 100644 --- a/mmv1/third_party/terraform/tests/resource_data_loss_prevention_job_trigger_test.go +++ b/mmv1/third_party/terraform/tests/resource_data_loss_prevention_job_trigger_test.go @@ -488,7 +488,7 @@ func TestAccDataLossPreventionJobTrigger_dlpJobTrigger_withSensitivityScore(t *t } func testAccDataLossPreventionJobTrigger_dlpJobTriggerBasic(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_data_loss_prevention_job_trigger" "basic" { parent = "projects/%{project}" description = "Starting description" @@ -526,7 +526,7 @@ resource "google_data_loss_prevention_job_trigger" "basic" { } func testAccDataLossPreventionJobTrigger_dlpJobTriggerIdentifyingFields(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_data_loss_prevention_job_trigger" "basic" { parent = "projects/%{project}" description = "Starting description" @@ -570,7 +570,7 @@ resource "google_data_loss_prevention_job_trigger" "basic" { } func testAccDataLossPreventionJobTrigger_dlpJobTriggerIncludedFields(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_data_loss_prevention_job_trigger" "basic" { parent = "projects/%{project}" description = "Starting description" @@ -614,7 +614,7 @@ resource "google_data_loss_prevention_job_trigger" "basic" { } func testAccDataLossPreventionJobTrigger_dlpJobTriggerExcludedFields(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_data_loss_prevention_job_trigger" "basic" { parent = "projects/%{project}" description = "Starting description" @@ -658,7 +658,7 @@ resource "google_data_loss_prevention_job_trigger" "basic" { } func testAccDataLossPreventionJobTrigger_dlpJobTriggerUpdate(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_data_loss_prevention_job_trigger" "basic" { parent = "projects/%{project}" description = "An updated description" @@ -695,7 +695,7 @@ resource "google_data_loss_prevention_job_trigger" "basic" { } func testAccDataLossPreventionJobTrigger_dlpJobTriggerIdentifyingFieldsUpdate(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_data_loss_prevention_job_trigger" "basic" { parent = "projects/%{project}" description = "An updated description" @@ -739,7 +739,7 @@ resource "google_data_loss_prevention_job_trigger" "basic" { } func testAccDataLossPreventionJobTrigger_dlpJobTriggerIncludedFieldsUpdate(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_data_loss_prevention_job_trigger" "basic" { parent = "projects/%{project}" description = "An updated description" @@ -783,7 +783,7 @@ resource "google_data_loss_prevention_job_trigger" "basic" { } func testAccDataLossPreventionJobTrigger_dlpJobTriggerExcludedFieldsUpdate(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_data_loss_prevention_job_trigger" "basic" { parent = "projects/%{project}" description = "An updated description" @@ -827,7 +827,7 @@ resource "google_data_loss_prevention_job_trigger" "basic" { } func testAccDataLossPreventionJobTrigger_publishToPubSub(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_data_loss_prevention_job_trigger" "pubsub" { parent = "projects/%{project}" description = "Starting description" @@ -859,7 +859,7 @@ resource "google_data_loss_prevention_job_trigger" "pubsub" { } func testAccDataLossPreventionJobTrigger_dlpJobTriggerDeidentifyBasic(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_data_loss_prevention_job_trigger" "actions" { parent = "projects/%{project}" description = "Description for the job_trigger created by terraform" @@ -947,7 +947,7 @@ resource "google_bigquery_table" "default" { } func testAccDataLossPreventionJobTrigger_dlpJobTriggerDeidentifyUpdate(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_data_loss_prevention_job_trigger" "actions" { parent = "projects/%{project}" description = "Description for the job_trigger created by terraform" @@ -1035,7 +1035,7 @@ resource "google_bigquery_table" "default" { } func testAccDataLossPreventionJobTrigger_dlpJobTriggerJobNotificationEmails(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_data_loss_prevention_job_trigger" "actions" { parent = "projects/%{project}" description = "Description for the job_trigger created by terraform" @@ -1065,7 +1065,7 @@ resource "google_data_loss_prevention_job_trigger" "actions" { } func testAccDataLossPreventionJobTrigger_dlpJobTriggerHybrid(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_data_loss_prevention_job_trigger" "hybrid" { parent = "projects/%{project}" @@ -1107,7 +1107,7 @@ resource "google_data_loss_prevention_job_trigger" "hybrid" { } func testAccDataLossPreventionJobTrigger_dlpJobTriggerHybridUpdated(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_data_loss_prevention_job_trigger" "hybrid" { parent = "projects/%{project}" @@ -1136,7 +1136,7 @@ resource "google_data_loss_prevention_job_trigger" "hybrid" { } func testAccDataLossPreventionJobTrigger_inspectBasic(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_data_loss_prevention_job_trigger" "inspect" { parent = "projects/%{project}" description = "Starting description" @@ -1273,7 +1273,7 @@ resource "google_data_loss_prevention_job_trigger" "inspect" { } func testAccDataLossPreventionJobTrigger_inspectUpdate(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_data_loss_prevention_job_trigger" "inspect" { parent = "projects/%{project}" description = "Starting description" @@ -1390,7 +1390,7 @@ resource "google_data_loss_prevention_job_trigger" "inspect" { } func testAccDataLossPreventionJobTrigger_inspectCustomInfoTypesRegex(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_data_loss_prevention_job_trigger" "inspect" { parent = "projects/%{project}" description = "Starting description" @@ -1541,7 +1541,7 @@ resource "google_data_loss_prevention_job_trigger" "inspect" { } func testAccDataLossPreventionJobTrigger_inspectCustomInfoTypesDictionaryWordList(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_data_loss_prevention_job_trigger" "inspect" { parent = "projects/%{project}" description = "Starting description" @@ -1691,7 +1691,7 @@ resource "google_data_loss_prevention_job_trigger" "inspect" { } func testAccDataLossPreventionJobTrigger_inspectCustomInfoTypesDictionaryCloudStoragePath(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_data_loss_prevention_job_trigger" "inspect" { parent = "projects/%{project}" description = "Starting description" @@ -1842,7 +1842,7 @@ resource "google_data_loss_prevention_job_trigger" "inspect" { } func testAccDataLossPreventionJobTrigger_inspectCustomInfoTypesStoredType(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_data_loss_prevention_job_trigger" "inspect" { parent = "projects/%{project}" description = "Starting description" @@ -2003,7 +2003,7 @@ resource "google_data_loss_prevention_stored_info_type" "basic" { } func testAccDataLossPreventionJobTrigger_inspectCustomInfoTypesSurrogateType(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_data_loss_prevention_job_trigger" "inspect" { parent = "projects/%{project}" description = "Starting description" @@ -2149,7 +2149,7 @@ resource "google_data_loss_prevention_job_trigger" "inspect" { } func testAccDataLossPreventionJobTrigger_inspectExclusionRule(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_data_loss_prevention_job_trigger" "inspect" { parent = "projects/%{project}" description = "Starting description" @@ -2301,7 +2301,7 @@ resource "google_data_loss_prevention_job_trigger" "inspect" { } func testAccDataLossPreventionJobTrigger_dlpJobTriggerActionsOptionalBasic(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_data_loss_prevention_job_trigger" "basic" { parent = "projects/%{project}" description = "Starting description" @@ -2328,7 +2328,7 @@ resource "google_data_loss_prevention_job_trigger" "basic" { } func testAccDataLossPreventionJobTrigger_dlpJobTriggerInspectOptionalBasic(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_data_loss_prevention_job_trigger" "basic" { parent = "projects/%{project}" description = "Starting description" @@ -2364,7 +2364,7 @@ resource "google_data_loss_prevention_job_trigger" "basic" { } func testAccDataLossPreventionJobTrigger_dlpJobTrigger_withSensitivityScoreBasic(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_data_loss_prevention_job_trigger" "basic" { parent = "projects/%{project}" description = "Starting description" @@ -2499,7 +2499,7 @@ resource "google_data_loss_prevention_job_trigger" "basic" { } func testAccDataLossPreventionJobTrigger_dlpJobTrigger_withSensitivityScoreUpdate(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_data_loss_prevention_job_trigger" "basic" { parent = "projects/%{project}" description = "Starting description" @@ -2625,7 +2625,7 @@ resource "google_data_loss_prevention_job_trigger" "basic" { } func testAccDataLossPreventionJobTrigger_dlpJobTrigger_withSensitivityScoreUpdate2(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_data_loss_prevention_job_trigger" "basic" { parent = "projects/%{project}" description = "Starting description" diff --git a/mmv1/third_party/terraform/tests/resource_data_loss_prevention_stored_info_type_test.go b/mmv1/third_party/terraform/tests/resource_data_loss_prevention_stored_info_type_test.go index 350d5afa1c15..a403d2255b39 100644 --- a/mmv1/third_party/terraform/tests/resource_data_loss_prevention_stored_info_type_test.go +++ b/mmv1/third_party/terraform/tests/resource_data_loss_prevention_stored_info_type_test.go @@ -42,7 +42,7 @@ func TestAccDataLossPreventionStoredInfoType_dlpStoredInfoTypeUpdate(t *testing. } func testAccDataLossPreventionStoredInfoType_dlpStoredInfoTypeStart(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_data_loss_prevention_stored_info_type" "basic" { parent = "projects/%{project}" description = "Description" @@ -57,7 +57,7 @@ resource "google_data_loss_prevention_stored_info_type" "basic" { } func testAccDataLossPreventionStoredInfoType_dlpStoredInfoTypeUpdate(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_data_loss_prevention_stored_info_type" "basic" { parent = "projects/%{project}" description = "Updated Description" @@ -121,7 +121,7 @@ func TestAccDataLossPreventionStoredInfoType_dlpStoredInfoTypeGroupIndexUpdate(t } func testAccDataLossPreventionStoredInfoType_dlpStoredInfoTypeWithoutGroupIndex(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_data_loss_prevention_stored_info_type" "basic" { parent = "projects/%{project}" description = "Description" @@ -135,7 +135,7 @@ resource "google_data_loss_prevention_stored_info_type" "basic" { } func testAccDataLossPreventionStoredInfoType_dlpStoredInfoTypeGroupIndexUpdate(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_data_loss_prevention_stored_info_type" "basic" { parent = "projects/%{project}" description = "Description" @@ -183,7 +183,7 @@ func TestAccDataLossPreventionStoredInfoType_dlpStoredInfoTypeStoredInfoTypeId(t } func testAccDataLossPreventionStoredInfoType_dlpStoredInfoTypeStoredInfoTypeId(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_data_loss_prevention_stored_info_type" "basic" { parent = "projects/%{project}" description = "Description" @@ -199,7 +199,7 @@ resource "google_data_loss_prevention_stored_info_type" "basic" { } func testAccDataLossPreventionStoredInfoType_dlpStoredInfoTypeStoredInfoTypeIdUpdate(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_data_loss_prevention_stored_info_type" "basic" { parent = "projects/%{project}" description = "Description" diff --git a/mmv1/third_party/terraform/tests/resource_database_migration_service_connection_profile_test.go b/mmv1/third_party/terraform/tests/resource_database_migration_service_connection_profile_test.go index f2cd6653d29f..4a9afb2f1f40 100644 --- a/mmv1/third_party/terraform/tests/resource_database_migration_service_connection_profile_test.go +++ b/mmv1/third_party/terraform/tests/resource_database_migration_service_connection_profile_test.go @@ -41,7 +41,7 @@ func TestAccDatabaseMigrationServiceConnectionProfile_update(t *testing.T) { } func testAccDatabaseMigrationServiceConnectionProfile_basic(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_database_migration_service_connection_profile" "default" { location = "us-central1" connection_profile_id = "tf-test-dbms-connection-profile%{random_suffix}" @@ -60,7 +60,7 @@ resource "google_database_migration_service_connection_profile" "default" { } func testAccDatabaseMigrationServiceConnectionProfile_update(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_database_migration_service_connection_profile" "default" { location = "us-central1" connection_profile_id = "tf-test-dbms-connection-profile%{random_suffix}" diff --git a/mmv1/third_party/terraform/tests/resource_dataform_repository_test.go.erb b/mmv1/third_party/terraform/tests/resource_dataform_repository_test.go.erb index 542219eb2021..8518a5307882 100644 --- a/mmv1/third_party/terraform/tests/resource_dataform_repository_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_dataform_repository_test.go.erb @@ -45,7 +45,7 @@ func TestAccDataformRepository_updated(t *testing.T) { } func testAccDataformRepository_basic(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_sourcerepo_repository" "git_repository" { provider = google-beta name = "my/repository%{random_suffix}" @@ -87,7 +87,7 @@ resource "google_dataform_repository" "dataform_respository" { } func testAccDataformRepository_updated(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_sourcerepo_repository" "git_repository" { provider = google-beta name = "my/repository%{random_suffix}" diff --git a/mmv1/third_party/terraform/tests/resource_dataproc_metastore_service_test.go.erb b/mmv1/third_party/terraform/tests/resource_dataproc_metastore_service_test.go.erb index 74c813b46d1a..6b5c92d679b6 100644 --- a/mmv1/third_party/terraform/tests/resource_dataproc_metastore_service_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_dataproc_metastore_service_test.go.erb @@ -81,7 +81,7 @@ func TestAccDataprocMetastoreService_PrivateServiceConnect(t *testing.T) { } func testAccDataprocMetastoreService_PrivateServiceConnect(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` // Use data source instead of creating a subnetwork due to a bug on API side. // With the bug, the new created subnetwork cannot be deleted when deleting the dataproc metastore service. data "google_compute_subnetwork" "subnet" { diff --git a/mmv1/third_party/terraform/tests/resource_dataproc_workflow_template_test.go.erb b/mmv1/third_party/terraform/tests/resource_dataproc_workflow_template_test.go.erb index 105ed1a7d30c..1ad98ab8890e 100644 --- a/mmv1/third_party/terraform/tests/resource_dataproc_workflow_template_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_dataproc_workflow_template_test.go.erb @@ -73,7 +73,7 @@ func TestAccDataprocWorkflowTemplate_withShieldedVMs(t *testing.T) { } func testAccDataprocWorkflowTemplate_basic(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_dataproc_workflow_template" "template" { name = "template%{random_suffix}" location = "us-central1" @@ -129,7 +129,7 @@ resource "google_dataproc_workflow_template" "template" { } func testAccDataprocWorkflowTemplate_withShieldedVMs(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_dataproc_workflow_template" "shielded_vms_template" { name = "template%{random_suffix}" location = "us-central1" diff --git a/mmv1/third_party/terraform/tests/resource_datastream_connection_profile_test.go b/mmv1/third_party/terraform/tests/resource_datastream_connection_profile_test.go index b5607f3f975f..73ef3a76921d 100644 --- a/mmv1/third_party/terraform/tests/resource_datastream_connection_profile_test.go +++ b/mmv1/third_party/terraform/tests/resource_datastream_connection_profile_test.go @@ -51,7 +51,7 @@ func TestAccDatastreamConnectionProfile_update(t *testing.T) { } func testAccDatastreamConnectionProfile_update(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_datastream_connection_profile" "default" { display_name = "Connection profile" location = "us-central1" @@ -76,7 +76,7 @@ func testAccDatastreamConnectionProfile_update2(context map[string]interface{}, prevent_destroy = true }` } - return Nprintf(` + return acctest.Nprintf(` resource "google_sql_database_instance" "instance" { name = "tf-test-my-database-instance%{random_suffix}" database_version = "POSTGRES_14" diff --git a/mmv1/third_party/terraform/tests/resource_datastream_stream_test.go b/mmv1/third_party/terraform/tests/resource_datastream_stream_test.go index 62402b9c4413..0b4f9435957d 100644 --- a/mmv1/third_party/terraform/tests/resource_datastream_stream_test.go +++ b/mmv1/third_party/terraform/tests/resource_datastream_stream_test.go @@ -82,7 +82,7 @@ func testAccDatastreamStream_datastreamStreamBasicUpdate(context map[string]inte }` } context["desired_state"] = desiredState - return Nprintf(` + return acctest.Nprintf(` data "google_project" "project" { } diff --git a/mmv1/third_party/terraform/tests/resource_deployment_manager_deployment_test.go b/mmv1/third_party/terraform/tests/resource_deployment_manager_deployment_test.go index 24ae4aec9f89..65cdcb6dd9c5 100644 --- a/mmv1/third_party/terraform/tests/resource_deployment_manager_deployment_test.go +++ b/mmv1/third_party/terraform/tests/resource_deployment_manager_deployment_test.go @@ -460,7 +460,7 @@ func createYamlConfigFileForTest(t *testing.T, sourcePath string, context map[st } // Create a buffer to write our archive to. buf := new(bytes.Buffer) - buf.WriteString(Nprintf(string(source), context)) + buf.WriteString(acctest.Nprintf(string(source), context)) // Create temp file to write zip to tmpfile, err := ioutil.TempFile("", "*.yml") if err != nil { diff --git a/mmv1/third_party/terraform/tests/resource_dialogflow_agent_test.go.erb b/mmv1/third_party/terraform/tests/resource_dialogflow_agent_test.go.erb index b54914068ca1..7ec827873edd 100644 --- a/mmv1/third_party/terraform/tests/resource_dialogflow_agent_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_dialogflow_agent_test.go.erb @@ -45,7 +45,7 @@ func TestAccDialogflowAgent_update(t *testing.T) { } func testAccDialogflowAgent_full1(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_project" "agent_project" { name = "tf-test-dialogflow-%{random_suffix}" project_id = "tf-test-dialogflow-%{random_suffix}" @@ -88,7 +88,7 @@ func testAccDialogflowAgent_full1(context map[string]interface{}) string { } func testAccDialogflowAgent_full2(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_project" "agent_project" { name = "tf-test-dialogflow-%{random_suffix}" project_id = "tf-test-dialogflow-%{random_suffix}" diff --git a/mmv1/third_party/terraform/tests/resource_dialogflow_entity_type_test.go.erb b/mmv1/third_party/terraform/tests/resource_dialogflow_entity_type_test.go.erb index 3dada93157eb..ef687be216bd 100644 --- a/mmv1/third_party/terraform/tests/resource_dialogflow_entity_type_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_dialogflow_entity_type_test.go.erb @@ -44,7 +44,7 @@ func TestAccDialogflowEntityType_update(t *testing.T) { } func testAccDialogflowEntityType_full1(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_project" "agent_project" { name = "tf-test-dialogflow-%{random_suffix}" project_id = "tf-test-dialogflow-%{random_suffix}" @@ -95,7 +95,7 @@ func testAccDialogflowEntityType_full1(context map[string]interface{}) string { } func testAccDialogflowEntityType_full2(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_project" "agent_project" { name = "tf-test-dialogflow-%{random_suffix}" project_id = "tf-test-dialogflow-%{random_suffix}" diff --git a/mmv1/third_party/terraform/tests/resource_dialogflow_fulfillment_test.go.erb b/mmv1/third_party/terraform/tests/resource_dialogflow_fulfillment_test.go.erb index bedcc51a55dc..ce651bc48ab8 100644 --- a/mmv1/third_party/terraform/tests/resource_dialogflow_fulfillment_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_dialogflow_fulfillment_test.go.erb @@ -44,7 +44,7 @@ func TestAccDialogflowFulfillment_update(t *testing.T) { } func testAccDialogflowFulfillment_basic(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_project" "agent_project" { name = "tf-test-dialogflow-%{random_suffix}" project_id = "tf-test-dialogflow-%{random_suffix}" @@ -86,7 +86,7 @@ func testAccDialogflowFulfillment_basic(context map[string]interface{}) string { } func testAccDialogflowEntityType_full(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_project" "agent_project" { name = "tf-test-dialogflow-%{random_suffix}" project_id = "tf-test-dialogflow-%{random_suffix}" diff --git a/mmv1/third_party/terraform/tests/resource_dialogflow_intent_test.go.erb b/mmv1/third_party/terraform/tests/resource_dialogflow_intent_test.go.erb index e26b019c369f..c65cb59705d1 100644 --- a/mmv1/third_party/terraform/tests/resource_dialogflow_intent_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_dialogflow_intent_test.go.erb @@ -69,7 +69,7 @@ func TestAccDialogflowIntent_update(t *testing.T) { } func testAccDialogflowIntent_basic(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_project" "agent_project" { name = "tf-test-dialogflow-%{random_suffix}" project_id = "tf-test-dialogflow-%{random_suffix}" @@ -110,7 +110,7 @@ func testAccDialogflowIntent_basic(context map[string]interface{}) string { } func testAccDialogflowIntent_full1(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_project" "agent_project" { name = "tf-test-dialogflow-%{random_suffix}" project_id = "tf-test-dialogflow-%{random_suffix}" @@ -160,7 +160,7 @@ func testAccDialogflowIntent_full1(context map[string]interface{}) string { } func testAccDialogflowIntent_full2(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_project" "agent_project" { name = "tf-test-dialogflow-%{random_suffix}" project_id = "tf-test-dialogflow-%{random_suffix}" diff --git a/mmv1/third_party/terraform/tests/resource_dialogflowcx_agent_test.go.erb b/mmv1/third_party/terraform/tests/resource_dialogflowcx_agent_test.go.erb index c69b09d78ac2..ccd9fbbfc340 100644 --- a/mmv1/third_party/terraform/tests/resource_dialogflowcx_agent_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_dialogflowcx_agent_test.go.erb @@ -44,7 +44,7 @@ func TestAccDialogflowCXAgent_update(t *testing.T) { } func testAccDialogflowCXAgent_basic(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` data "google_project" "project" {} resource "google_service_account" "dialogflowcx_service_account" { @@ -71,7 +71,7 @@ func testAccDialogflowCXAgent_basic(context map[string]interface{}) string { } func testAccDialogflowCXAgent_full(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` data "google_project" "project" {} resource "google_service_account" "dialogflowcx_service_account" { diff --git a/mmv1/third_party/terraform/tests/resource_dialogflowcx_entity_type_test.go b/mmv1/third_party/terraform/tests/resource_dialogflowcx_entity_type_test.go index b5d1d830d64a..1d527fd8945a 100644 --- a/mmv1/third_party/terraform/tests/resource_dialogflowcx_entity_type_test.go +++ b/mmv1/third_party/terraform/tests/resource_dialogflowcx_entity_type_test.go @@ -42,7 +42,7 @@ func TestAccDialogflowCXEntityType_update(t *testing.T) { } func testAccDialogflowCXEntityType_basic(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` data "google_project" "project" {} resource "google_service_account" "dialogflowcx_service_account" { @@ -84,7 +84,7 @@ func testAccDialogflowCXEntityType_basic(context map[string]interface{}) string } func testAccDialogflowCXEntityType_full(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` data "google_project" "project" {} resource "google_service_account" "dialogflowcx_service_account" { diff --git a/mmv1/third_party/terraform/tests/resource_dialogflowcx_environment_test.go b/mmv1/third_party/terraform/tests/resource_dialogflowcx_environment_test.go index fb6398f1cbb6..c15601c238c2 100644 --- a/mmv1/third_party/terraform/tests/resource_dialogflowcx_environment_test.go +++ b/mmv1/third_party/terraform/tests/resource_dialogflowcx_environment_test.go @@ -48,7 +48,7 @@ func TestAccDialogflowCXEnvironment_update(t *testing.T) { } func testAccDialogflowCXEnvironment_basic(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` data "google_project" "project" {} resource "google_service_account" "dialogflowcx_service_account" { @@ -89,7 +89,7 @@ func testAccDialogflowCXEnvironment_basic(context map[string]interface{}) string } func testAccDialogflowCXEnvironment_full(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` data "google_project" "project" {} resource "google_service_account" "dialogflowcx_service_account" { @@ -161,7 +161,7 @@ func TestAccDialogflowCXEnvironment_dialogflowcxEnvironmentFullExample(t *testin } func testAccDialogflowCXEnvironment_dialogflowcxEnvironmentFullExample(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_dialogflow_cx_agent" "agent" { display_name = "tf-test-dialogflowcx-agent%{random_suffix}" location = "global" @@ -220,7 +220,7 @@ func TestAccDialogflowCXEnvironment_dialogflowcxEnvironmentRegional(t *testing.T } func testAccDialogflowCXEnvironment_dialogflowcxEnvironmentFRegional(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_dialogflow_cx_agent" "agent" { display_name = "issue12880" location = "europe-west2" diff --git a/mmv1/third_party/terraform/tests/resource_dialogflowcx_flow_test.go b/mmv1/third_party/terraform/tests/resource_dialogflowcx_flow_test.go index 7cbd27794d72..d6560031659b 100644 --- a/mmv1/third_party/terraform/tests/resource_dialogflowcx_flow_test.go +++ b/mmv1/third_party/terraform/tests/resource_dialogflowcx_flow_test.go @@ -42,7 +42,7 @@ func TestAccDialogflowCXFlow_update(t *testing.T) { } func testAccDialogflowCXFlow_basic(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` data "google_project" "project" {} resource "google_service_account" "dialogflowcx_service_account" { @@ -79,7 +79,7 @@ func testAccDialogflowCXFlow_basic(context map[string]interface{}) string { } func testAccDialogflowCXFlow_full(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` data "google_project" "project" {} resource "google_service_account" "dialogflowcx_service_account" { diff --git a/mmv1/third_party/terraform/tests/resource_dialogflowcx_intent_test.go b/mmv1/third_party/terraform/tests/resource_dialogflowcx_intent_test.go index e2ffd7507178..be2cdda865d8 100644 --- a/mmv1/third_party/terraform/tests/resource_dialogflowcx_intent_test.go +++ b/mmv1/third_party/terraform/tests/resource_dialogflowcx_intent_test.go @@ -42,7 +42,7 @@ func TestAccDialogflowCXIntent_update(t *testing.T) { } func testAccDialogflowCXIntent_basic(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` data "google_project" "project" {} resource "google_service_account" "dialogflowcx_service_account" { @@ -101,7 +101,7 @@ func testAccDialogflowCXIntent_basic(context map[string]interface{}) string { } func testAccDialogflowCXIntent_full(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` data "google_project" "project" {} resource "google_service_account" "dialogflowcx_service_account" { diff --git a/mmv1/third_party/terraform/tests/resource_dialogflowcx_page_test.go b/mmv1/third_party/terraform/tests/resource_dialogflowcx_page_test.go index 96cf6987aa13..d4ddea2574d8 100644 --- a/mmv1/third_party/terraform/tests/resource_dialogflowcx_page_test.go +++ b/mmv1/third_party/terraform/tests/resource_dialogflowcx_page_test.go @@ -42,7 +42,7 @@ func TestAccDialogflowCXPage_update(t *testing.T) { } func testAccDialogflowCXPage_basic(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` data "google_project" "project" {} resource "google_service_account" "dialogflowcx_service_account" { @@ -74,7 +74,7 @@ func testAccDialogflowCXPage_basic(context map[string]interface{}) string { } func testAccDialogflowCXPage_full(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` data "google_project" "project" {} resource "google_service_account" "dialogflowcx_service_account" { diff --git a/mmv1/third_party/terraform/tests/resource_dialogflowcx_version_test.go.erb b/mmv1/third_party/terraform/tests/resource_dialogflowcx_version_test.go.erb index 179e63dcefb8..5b30684dd91a 100644 --- a/mmv1/third_party/terraform/tests/resource_dialogflowcx_version_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_dialogflowcx_version_test.go.erb @@ -48,7 +48,7 @@ func TestAccDialogflowCXVersion_update(t *testing.T) { } func testAccDialogflowCXVersion_basic(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` data "google_project" "project" {} resource "google_service_account" "dialogflowcx_service_account" { @@ -81,7 +81,7 @@ func testAccDialogflowCXVersion_basic(context map[string]interface{}) string { } func testAccDialogflowCXVersion_full(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` data "google_project" "project" {} resource "google_service_account" "dialogflowcx_service_account" { @@ -143,7 +143,7 @@ func TestAccDialogflowCXVersion_dialogflowcxVersionFullExample(t *testing.T) { } func testAccDialogflowCXVersion_dialogflowcxVersionFullExample(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_dialogflow_cx_agent" "agent" { display_name = "tf-test-dialogflowcx-agent%{random_suffix}" location = "global" diff --git a/mmv1/third_party/terraform/tests/resource_dialogflowcx_webhook_test.go b/mmv1/third_party/terraform/tests/resource_dialogflowcx_webhook_test.go index 5018fe376e1c..56d1538b6c6e 100644 --- a/mmv1/third_party/terraform/tests/resource_dialogflowcx_webhook_test.go +++ b/mmv1/third_party/terraform/tests/resource_dialogflowcx_webhook_test.go @@ -42,7 +42,7 @@ func TestAccDialogflowCXWebhook_update(t *testing.T) { } func testAccDialogflowCXWebhook_basic(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` data "google_project" "project" {} resource "google_dialogflow_cx_agent" "agent_entity" { @@ -66,7 +66,7 @@ func testAccDialogflowCXWebhook_basic(context map[string]interface{}) string { } func testAccDialogflowCXWebhook_full(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` data "google_project" "project" {} resource "google_dialogflow_cx_agent" "agent_entity" { diff --git a/mmv1/third_party/terraform/tests/resource_essential_contacts_contact_test.go b/mmv1/third_party/terraform/tests/resource_essential_contacts_contact_test.go index 9fd2dad3cde6..4dec08c3dc2d 100644 --- a/mmv1/third_party/terraform/tests/resource_essential_contacts_contact_test.go +++ b/mmv1/third_party/terraform/tests/resource_essential_contacts_contact_test.go @@ -50,7 +50,7 @@ func TestAccEssentialContactsContact_update(t *testing.T) { } func testAccEssentialContactsContact_v1(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` data "google_project" "project" { } @@ -64,7 +64,7 @@ resource "google_essential_contacts_contact" "contact" { } func testAccEssentialContactsContact_v2(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` data "google_project" "project" { } diff --git a/mmv1/third_party/terraform/tests/resource_eventarc_channel_test.go.erb b/mmv1/third_party/terraform/tests/resource_eventarc_channel_test.go.erb index f32e09866c47..d67511d25bd7 100644 --- a/mmv1/third_party/terraform/tests/resource_eventarc_channel_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_eventarc_channel_test.go.erb @@ -86,7 +86,7 @@ func TestAccEventarcChannel_cryptoKeyUpdate(t *testing.T) { } func testAccEventarcChannel_basic(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` data "google_project" "test_project" { project_id = "%{project_name}" } @@ -100,7 +100,7 @@ resource "google_eventarc_channel" "primary" { } func testAccEventarcChannel_setCryptoKey(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` data "google_project" "test_project" { project_id = "%{project_name}" } @@ -134,7 +134,7 @@ resource "google_eventarc_channel" "primary" { } func testAccEventarcChannel_cryptoKeyUpdate(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` data "google_project" "test_project" { project_id = "%{project_name}" } diff --git a/mmv1/third_party/terraform/tests/resource_eventarc_google_channel_config_test.go.erb b/mmv1/third_party/terraform/tests/resource_eventarc_google_channel_config_test.go.erb index a40519c47591..52a42eb6419e 100644 --- a/mmv1/third_party/terraform/tests/resource_eventarc_google_channel_config_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_eventarc_google_channel_config_test.go.erb @@ -89,7 +89,7 @@ func TestAccEventarcGoogleChannelConfig_cryptoKeyUpdate(t *testing.T) { } func testAccEventarcGoogleChannelConfig_basic(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_eventarc_google_channel_config" "primary" { location = "%{region}" name = "projects/%{project_name}/locations/%{region}/googleChannelConfig" @@ -98,7 +98,7 @@ resource "google_eventarc_google_channel_config" "primary" { } func testAccEventarcGoogleChannelConfig_setCryptoKey(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` data "google_project" "test_project" { project_id = "%{project_name}" } @@ -130,7 +130,7 @@ resource "google_eventarc_google_channel_config" "primary" { } func testAccEventarcGoogleChannelConfig_cryptoKeyUpdate(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` data "google_project" "test_project" { project_id = "%{project_name}" } @@ -162,7 +162,7 @@ resource "google_eventarc_google_channel_config" "primary" { } func testAccEventarcGoogleChannelConfig_deleteCryptoKey(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_eventarc_google_channel_config" "primary" { location = "%{region}" name = "projects/%{project_name}/locations/%{region}/googleChannelConfig" diff --git a/mmv1/third_party/terraform/tests/resource_eventarc_trigger_test.go.erb b/mmv1/third_party/terraform/tests/resource_eventarc_trigger_test.go.erb index 7738783cc8ef..533c3f61cd66 100644 --- a/mmv1/third_party/terraform/tests/resource_eventarc_trigger_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_eventarc_trigger_test.go.erb @@ -54,7 +54,7 @@ func TestAccEventarcTrigger_channel(t *testing.T) { } func testAccEventarcTrigger_createTriggerWithChannelName(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` data "google_project" "test_project" { project_id = "%{project_name}" } diff --git a/mmv1/third_party/terraform/tests/resource_firebase_android_app_update_test.go.erb b/mmv1/third_party/terraform/tests/resource_firebase_android_app_update_test.go.erb index 4d21f44e2dcf..71bcddcdf475 100644 --- a/mmv1/third_party/terraform/tests/resource_firebase_android_app_update_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_firebase_android_app_update_test.go.erb @@ -34,7 +34,7 @@ func TestAccFirebaseAndroidApp_update(t *testing.T) { func testAccFirebaseAndroidApp(context map[string]interface{}, update string) string { context["display_name"] = context["display_name"].(string) + update - return Nprintf(` + return acctest.Nprintf(` resource "google_firebase_android_app" "update" { provider = google-beta project = "%{project_id}" diff --git a/mmv1/third_party/terraform/tests/resource_firebase_apple_app_update_test.go.erb b/mmv1/third_party/terraform/tests/resource_firebase_apple_app_update_test.go.erb index 1e1997aaaf0d..7ca6453d193a 100644 --- a/mmv1/third_party/terraform/tests/resource_firebase_apple_app_update_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_firebase_apple_app_update_test.go.erb @@ -36,7 +36,7 @@ func testAccFirebaseAppleApp(context map[string]interface{}, appStoreId int, del context["display_name"] = context["display_name"].(string) + delta context["app_store_id"] = appStoreId context["team_id"] = "123456789" + delta - return Nprintf(` + return acctest.Nprintf(` resource "google_firebase_apple_app" "update" { provider = google-beta project = "%{project_id}" diff --git a/mmv1/third_party/terraform/tests/resource_firebase_database_instance_test.go.erb b/mmv1/third_party/terraform/tests/resource_firebase_database_instance_test.go.erb index 37a4105190c7..7277e26b1a0e 100644 --- a/mmv1/third_party/terraform/tests/resource_firebase_database_instance_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_firebase_database_instance_test.go.erb @@ -12,7 +12,7 @@ import ( func testAccFirebaseDatabaseInstance_firebaseDatabaseInstanceInState(context map[string]interface{}, state string) string { context["desired_state"] = state - return Nprintf(` + return acctest.Nprintf(` resource "google_firebase_database_instance" "updated" { provider = google-beta project = "%{project_id}" diff --git a/mmv1/third_party/terraform/tests/resource_firebase_hosting_channel_test.go.erb b/mmv1/third_party/terraform/tests/resource_firebase_hosting_channel_test.go.erb index 724840cf119b..291557296c9f 100644 --- a/mmv1/third_party/terraform/tests/resource_firebase_hosting_channel_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_firebase_hosting_channel_test.go.erb @@ -100,7 +100,7 @@ func TestAccFirebaseHostingChannel_firebasehostingChannelUpdate(t *testing.T) { } func testAccFirebaseHostingChannel_firebasehostingChannelBasic(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_firebase_hosting_site" "default" { provider = google-beta project = "%{project_id}" @@ -117,7 +117,7 @@ resource "google_firebase_hosting_channel" "update" { func testAccFirebaseHostingChannel_firebasehostingChannelTtl(context map[string]interface{}, ttl string) string { context["ttl"] = ttl - return Nprintf(` + return acctest.Nprintf(` resource "google_firebase_hosting_site" "default" { provider = google-beta project = "%{project_id}" @@ -135,7 +135,7 @@ resource "google_firebase_hosting_channel" "update" { func testAccFirebaseHostingChannel_firebasehostingChannelRetainedReleaseCount(context map[string]interface{}, retainedReleaseCount int) string { context["retained_release_count"] = retainedReleaseCount - return Nprintf(` + return acctest.Nprintf(` resource "google_firebase_hosting_site" "default" { provider = google-beta project = "%{project_id}" @@ -153,7 +153,7 @@ resource "google_firebase_hosting_channel" "update" { } func testAccFirebaseHostingChannel_firebasehostingChannelLabels(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_firebase_hosting_site" "default" { provider = google-beta project = "%{project_id}" @@ -174,7 +174,7 @@ resource "google_firebase_hosting_channel" "update" { } func testAccFirebaseHostingChannel_firebasehostingChannelMultipleFields(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_firebase_hosting_site" "default" { provider = google-beta project = "%{project_id}" diff --git a/mmv1/third_party/terraform/tests/resource_firebase_hosting_site_test.go.erb b/mmv1/third_party/terraform/tests/resource_firebase_hosting_site_test.go.erb index d9bfd9790b5c..df603604f294 100644 --- a/mmv1/third_party/terraform/tests/resource_firebase_hosting_site_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_firebase_hosting_site_test.go.erb @@ -47,7 +47,7 @@ func TestAccFirebaseHostingSite_firebasehostingSiteUpdate(t *testing.T) { } func testAccFirebaseHostingSite_firebasehostingSiteBeforeUpdate(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_firebase_web_app" "before" { provider = google-beta project = "%{project_id}" @@ -65,7 +65,7 @@ resource "google_firebase_hosting_site" "update" { } func testAccFirebaseHostingSite_firebasehostingSiteAfterUpdate(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_firebase_web_app" "after" { provider = google-beta project = "%{project_id}" diff --git a/mmv1/third_party/terraform/tests/resource_firebase_project_test.go.erb b/mmv1/third_party/terraform/tests/resource_firebase_project_test.go.erb index c6ac52753344..3dc2ccacca15 100644 --- a/mmv1/third_party/terraform/tests/resource_firebase_project_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_firebase_project_test.go.erb @@ -41,7 +41,7 @@ func TestAccFirebaseProject_destroyAndReapply(t *testing.T) { } func testAccFirebaseProject_firebaseProjectBasicExampleDestroyed(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_project" "default" { provider = google-beta diff --git a/mmv1/third_party/terraform/tests/resource_firebase_web_app_test.go.erb b/mmv1/third_party/terraform/tests/resource_firebase_web_app_test.go.erb index 4e851d87fd27..0ad5f19978dc 100644 --- a/mmv1/third_party/terraform/tests/resource_firebase_web_app_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_firebase_web_app_test.go.erb @@ -72,7 +72,7 @@ func TestAccFirebaseWebApp_firebaseWebAppFull(t *testing.T) { func testAccFirebaseWebApp_firebaseWebAppFull(context map[string]interface{}, update string) string { context["display_name"] = context["display_name"].(string) + update - return Nprintf(` + return acctest.Nprintf(` resource "google_project" "default" { provider = google-beta @@ -132,7 +132,7 @@ func TestAccFirebaseWebApp_firebaseWebAppSkipDelete(t *testing.T) { } func testAccFirebaseWebApp_firebaseWebAppSkipDelete(context map[string]interface{}, update string) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_firebase_web_app" "skip_delete" { provider = google-beta project = "%{project_id}" diff --git a/mmv1/third_party/terraform/tests/resource_firestore_field_test.go b/mmv1/third_party/terraform/tests/resource_firestore_field_test.go index 1a6fd0108eaa..0552b321a738 100644 --- a/mmv1/third_party/terraform/tests/resource_firestore_field_test.go +++ b/mmv1/third_party/terraform/tests/resource_firestore_field_test.go @@ -5,6 +5,7 @@ import ( "testing" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-provider-google/google/acctest" ) func TestAccFirestoreField_firestoreFieldUpdateAddIndexExample(t *testing.T) { @@ -69,7 +70,7 @@ func testAccFirestoreField_runUpdateTest(updateConfig string, t *testing.T, cont } func testAccFirestoreField_firestoreFieldUpdateInitialExample(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_firestore_field" "%{resource_name}" { project = "%{project_id}" collection = "chatrooms_%{random_suffix}" @@ -89,7 +90,7 @@ resource "google_firestore_field" "%{resource_name}" { } func testAccFirestoreField_firestoreFieldUpdateAddTTLExample(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_firestore_field" "%{resource_name}" { project = "%{project_id}" collection = "chatrooms_%{random_suffix}" @@ -111,7 +112,7 @@ resource "google_firestore_field" "%{resource_name}" { } func testAccFirestoreField_firestoreFieldUpdateAddIndexExample(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_firestore_field" "%{resource_name}" { project = "%{project_id}" collection = "chatrooms_%{random_suffix}" diff --git a/mmv1/third_party/terraform/tests/resource_gke_backup_backup_plan_test.go.erb b/mmv1/third_party/terraform/tests/resource_gke_backup_backup_plan_test.go.erb index aaf8c0fb7bc9..6bed9b39f6bf 100644 --- a/mmv1/third_party/terraform/tests/resource_gke_backup_backup_plan_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_gke_backup_backup_plan_test.go.erb @@ -44,7 +44,7 @@ func TestAccGKEBackupBackupPlan_update(t *testing.T) { } func testAccGKEBackupBackupPlan_basic(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_container_cluster" "primary" { name = "tf-test-testcluster%{random_suffix}" location = "us-central1" @@ -73,7 +73,7 @@ resource "google_gke_backup_backup_plan" "backupplan" { } func testAccGKEBackupBackupPlan_full(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_container_cluster" "primary" { name = "tf-test-testcluster%{random_suffix}" location = "us-central1" diff --git a/mmv1/third_party/terraform/tests/resource_gke_hub_feature_iam_test.go.erb b/mmv1/third_party/terraform/tests/resource_gke_hub_feature_iam_test.go.erb index 9380d05b0adb..8e3c4f1429fa 100644 --- a/mmv1/third_party/terraform/tests/resource_gke_hub_feature_iam_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_gke_hub_feature_iam_test.go.erb @@ -123,7 +123,7 @@ func TestAccGKEHub2FeatureIamPolicyGenerated(t *testing.T) { } func testAccGKEHub2FeatureIamMember_basicGenerated(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_project" "project" { name = "%{project_id}" project_id = "%{project_id}" @@ -159,7 +159,7 @@ resource "google_gke_hub_feature_iam_member" "foo" { } func testAccGKEHub2FeatureIamPolicy_basicGenerated(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_project" "project" { name = "%{project_id}" project_id = "%{project_id}" @@ -208,7 +208,7 @@ data "google_gke_hub_feature_iam_policy" "foo" { } func testAccGKEHub2FeatureIamPolicy_emptyBinding(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_project" "project" { name = "%{project_id}" project_id = "%{project_id}" @@ -245,7 +245,7 @@ resource "google_gke_hub_feature_iam_policy" "foo" { } func testAccGKEHub2FeatureIamBinding_basicGenerated(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_project" "project" { name = "%{project_id}" project_id = "%{project_id}" @@ -281,7 +281,7 @@ resource "google_gke_hub_feature_iam_binding" "foo" { } func testAccGKEHub2FeatureIamBinding_updateGenerated(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_project" "project" { name = "%{project_id}" project_id = "%{project_id}" diff --git a/mmv1/third_party/terraform/tests/resource_gke_hub_feature_membership_test.go.erb b/mmv1/third_party/terraform/tests/resource_gke_hub_feature_membership_test.go.erb index 4a4460b52939..16b1c7583fd4 100644 --- a/mmv1/third_party/terraform/tests/resource_gke_hub_feature_membership_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_gke_hub_feature_membership_test.go.erb @@ -88,7 +88,7 @@ func TestAccGKEHubFeatureMembership_gkehubFeatureAcmUpdate(t *testing.T) { } func testAccGKEHubFeatureMembership_gkehubFeatureAcmUpdateStart(context map[string]interface{}) string { - return gkeHubFeatureProjectSetup(context) + gkeHubClusterMembershipSetup(context) + Nprintf(` + return gkeHubFeatureProjectSetup(context) + gkeHubClusterMembershipSetup(context) + acctest.Nprintf(` resource "google_gke_hub_feature" "feature" { project = google_project.project.project_id name = "configmanagement" @@ -140,7 +140,7 @@ resource "google_gke_hub_feature_membership" "feature_member_2" { } func testAccGKEHubFeatureMembership_gkehubFeatureAcmMembershipUpdate(context map[string]interface{}) string { - return gkeHubFeatureProjectSetup(context) + gkeHubClusterMembershipSetup(context) + Nprintf(` + return gkeHubFeatureProjectSetup(context) + gkeHubClusterMembershipSetup(context) + acctest.Nprintf(` resource "google_gke_hub_feature" "feature" { project = google_project.project.project_id name = "configmanagement" @@ -198,7 +198,7 @@ resource "google_gke_hub_feature_membership" "feature_member_2" { } func testAccGKEHubFeatureMembership_gkehubFeatureAcmAddHierarchyController(context map[string]interface{}) string { - return gkeHubFeatureProjectSetup(context) + gkeHubClusterMembershipSetup(context) + Nprintf(` + return gkeHubFeatureProjectSetup(context) + gkeHubClusterMembershipSetup(context) + acctest.Nprintf(` resource "google_gke_hub_feature" "feature" { project = google_project.project.project_id name = "configmanagement" @@ -295,7 +295,7 @@ resource "google_gke_hub_feature_membership" "feature_member_4" { } func testAccGKEHubFeatureMembership_gkehubFeatureAcmRemoveFields(context map[string]interface{}) string { - return gkeHubFeatureProjectSetup(context) + gkeHubClusterMembershipSetup(context) + Nprintf(` + return gkeHubFeatureProjectSetup(context) + gkeHubClusterMembershipSetup(context) + acctest.Nprintf(` resource "google_gke_hub_feature" "feature" { project = google_project.project.project_id name = "configmanagement" @@ -392,7 +392,7 @@ func TestAccGKEHubFeatureMembership_gkehubFeatureAcmAllFields(t *testing.T) { } func testAccGKEHubFeatureMembership_gkehubFeatureAcmAllFields(context map[string]interface{}) string { - return gkeHubFeatureProjectSetup(context) + Nprintf(` + return gkeHubFeatureProjectSetup(context) + acctest.Nprintf(` resource "google_container_cluster" "primary" { project = google_project.project.project_id name = "tf-test-cl%{random_suffix}" @@ -459,7 +459,7 @@ resource "google_gke_hub_feature_membership" "feature_member" { } func testAccGKEHubFeatureMembership_gkehubFeatureWithPreventDriftField(context map[string]interface{}) string { - return gkeHubFeatureProjectSetup(context) + Nprintf(` + return gkeHubFeatureProjectSetup(context) + acctest.Nprintf(` resource "google_container_cluster" "primary" { project = google_project.project.project_id name = "tf-test-cl%{random_suffix}" @@ -527,7 +527,7 @@ resource "google_gke_hub_feature_membership" "feature_member" { } func testAccGKEHubFeatureMembership_gkehubFeatureAcmFewFields(context map[string]interface{}) string { - return gkeHubFeatureProjectSetup(context) + Nprintf(` + return gkeHubFeatureProjectSetup(context) + acctest.Nprintf(` resource "google_container_cluster" "primary" { project = google_project.project.project_id name = "tf-test-cl%{random_suffix}" @@ -640,7 +640,7 @@ func TestAccGKEHubFeatureMembership_gkehubFeatureAcmOci(t *testing.T) { } func testAccGKEHubFeatureMembership_gkehubFeatureAcmOciStart(context map[string]interface{}) string { - return gkeHubFeatureProjectSetup(context) + gkeHubClusterMembershipSetup_ACMOCI(context) + Nprintf(` + return gkeHubFeatureProjectSetup(context) + gkeHubClusterMembershipSetup_ACMOCI(context) + acctest.Nprintf(` resource "google_gke_hub_feature" "feature" { project = google_project.project.project_id name = "configmanagement" @@ -692,7 +692,7 @@ resource "google_gke_hub_feature_membership" "feature_member" { } func testAccGKEHubFeatureMembership_gkehubFeatureAcmOciUpdate(context map[string]interface{}) string { - return gkeHubFeatureProjectSetup(context) + gkeHubClusterMembershipSetup_ACMOCI(context) + Nprintf(` + return gkeHubFeatureProjectSetup(context) + gkeHubClusterMembershipSetup_ACMOCI(context) + acctest.Nprintf(` resource "google_gke_hub_feature" "feature" { project = google_project.project.project_id name = "configmanagement" @@ -744,7 +744,7 @@ resource "google_gke_hub_feature_membership" "feature_member" { } func testAccGKEHubFeatureMembership_gkehubFeatureAcmOciRemoveFields(context map[string]interface{}) string { - return gkeHubFeatureProjectSetup(context) + gkeHubClusterMembershipSetup_ACMOCI(context) + Nprintf(` + return gkeHubFeatureProjectSetup(context) + gkeHubClusterMembershipSetup_ACMOCI(context) + acctest.Nprintf(` resource "google_gke_hub_feature" "feature" { project = google_project.project.project_id name = "configmanagement" @@ -838,7 +838,7 @@ func TestAccGKEHubFeatureMembership_gkehubFeatureMesh(t *testing.T) { } func testAccGKEHubFeatureMembership_meshStart(context map[string]interface{}) string { - return gkeHubFeatureProjectSetup(context) + Nprintf(` + return gkeHubFeatureProjectSetup(context) + acctest.Nprintf(` resource "google_container_cluster" "primary" { project = google_project.project.project_id name = "tf-test-cl%{random_suffix}" @@ -893,7 +893,7 @@ resource "google_gke_hub_feature_membership" "feature_member" { } func testAccGKEHubFeatureMembership_meshUpdateManagement(context map[string]interface{}) string { - return gkeHubFeatureProjectSetup(context) + Nprintf(` + return gkeHubFeatureProjectSetup(context) + acctest.Nprintf(` resource "google_container_cluster" "primary" { project = google_project.project.project_id name = "tf-test-cl%{random_suffix}" @@ -947,7 +947,7 @@ resource "google_gke_hub_feature_membership" "feature_member" { } func testAccGKEHubFeatureMembership_meshUpdateControlPlane(context map[string]interface{}) string { - return gkeHubFeatureProjectSetup(context) + Nprintf(` + return gkeHubFeatureProjectSetup(context) + acctest.Nprintf(` resource "google_container_cluster" "primary" { project = google_project.project.project_id name = "tf-test-cl%{random_suffix}" @@ -1001,7 +1001,7 @@ resource "google_gke_hub_feature_membership" "feature_member" { } func gkeHubClusterMembershipSetup(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_container_cluster" "primary" { name = "tf-test-cl%{random_suffix}" location = "us-central1-a" @@ -1090,7 +1090,7 @@ resource "google_gke_hub_membership" "membership_fourth" { } func gkeHubClusterMembershipSetup_ACMOCI(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_compute_network" "testnetwork" { project = google_project.project.project_id diff --git a/mmv1/third_party/terraform/tests/resource_gke_hub_feature_test.go.erb b/mmv1/third_party/terraform/tests/resource_gke_hub_feature_test.go.erb index 9fe072b6e2db..0f46636124b2 100644 --- a/mmv1/third_party/terraform/tests/resource_gke_hub_feature_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_gke_hub_feature_test.go.erb @@ -64,7 +64,7 @@ func TestAccGKEHubFeature_gkehubFeatureFleetObservability(t *testing.T) { } func testAccGKEHubFeature_gkehubFeatureFleetObservability(context map[string]interface{}) string { - return gkeHubFeatureProjectSetup(context) + Nprintf(` + return gkeHubFeatureProjectSetup(context) + acctest.Nprintf(` resource "time_sleep" "wait_for_gkehub_enablement" { create_duration = "150s" depends_on = [google_project_service.gkehub] @@ -93,7 +93,7 @@ resource "google_gke_hub_feature" "feature" { } func testAccGKEHubFeature_gkehubFeatureFleetObservabilityUpdate1(context map[string]interface{}) string { - return gkeHubFeatureProjectSetup(context) + Nprintf(` + return gkeHubFeatureProjectSetup(context) + acctest.Nprintf(` resource "time_sleep" "wait_for_gkehub_enablement" { create_duration = "150s" depends_on = [google_project_service.gkehub] @@ -119,7 +119,7 @@ resource "google_gke_hub_feature" "feature" { } func testAccGKEHubFeature_gkehubFeatureFleetObservabilityUpdate2(context map[string]interface{}) string { - return gkeHubFeatureProjectSetup(context) + Nprintf(` + return gkeHubFeatureProjectSetup(context) + acctest.Nprintf(` resource "time_sleep" "wait_for_gkehub_enablement" { create_duration = "150s" depends_on = [google_project_service.gkehub] @@ -145,7 +145,7 @@ resource "google_gke_hub_feature" "feature" { } func gkeHubFeatureProjectSetup(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_project" "project" { name = "tf-test-gkehub%{random_suffix}" project_id = "tf-test-gkehub%{random_suffix}" @@ -241,7 +241,7 @@ func TestAccGKEHubFeature_gkehubFeatureMciUpdate(t *testing.T) { } func testAccGKEHubFeature_gkehubFeatureMciUpdateStart(context map[string]interface{}) string { - return gkeHubFeatureProjectSetupForGA(context) + Nprintf(` + return gkeHubFeatureProjectSetupForGA(context) + acctest.Nprintf(` resource "google_container_cluster" "primary" { name = "tf-test%{random_suffix}" @@ -293,7 +293,7 @@ resource "google_gke_hub_feature" "feature" { } func testAccGKEHubFeature_gkehubFeatureMciChangeMembership(context map[string]interface{}) string { - return gkeHubFeatureProjectSetupForGA(context) + Nprintf(` + return gkeHubFeatureProjectSetupForGA(context) + acctest.Nprintf(` resource "google_container_cluster" "primary" { name = "tf-test%{random_suffix}" location = "us-central1-a" @@ -384,7 +384,7 @@ func TestAccGKEHubFeature_gkehubFeatureMcsd(t *testing.T) { } func testAccGKEHubFeature_gkehubFeatureMcsd(context map[string]interface{}) string { - return gkeHubFeatureProjectSetupForGA(context) + Nprintf(` + return gkeHubFeatureProjectSetupForGA(context) + acctest.Nprintf(` resource "google_gke_hub_feature" "feature" { name = "multiclusterservicediscovery" location = "global" @@ -398,7 +398,7 @@ resource "google_gke_hub_feature" "feature" { } func testAccGKEHubFeature_gkehubFeatureMcsdUpdate(context map[string]interface{}) string { - return gkeHubFeatureProjectSetupForGA(context) + Nprintf(` + return gkeHubFeatureProjectSetupForGA(context) + acctest.Nprintf(` resource "google_gke_hub_feature" "feature" { name = "multiclusterservicediscovery" location = "global" @@ -413,7 +413,7 @@ resource "google_gke_hub_feature" "feature" { } func gkeHubFeatureProjectSetupForGA(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_project" "project" { name = "tf-test-gkehub%{random_suffix}" project_id = "tf-test-gkehub%{random_suffix}" diff --git a/mmv1/third_party/terraform/tests/resource_gkeonprem_bare_metal_cluster_test.go.erb b/mmv1/third_party/terraform/tests/resource_gkeonprem_bare_metal_cluster_test.go.erb index 048d61df5290..ed02f04db2ba 100644 --- a/mmv1/third_party/terraform/tests/resource_gkeonprem_bare_metal_cluster_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_gkeonprem_bare_metal_cluster_test.go.erb @@ -5,6 +5,7 @@ import ( "testing" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-provider-google/google/acctest" ) func TestAccGkeonpremBareMetalCluster_bareMetalClusterUpdateBasic(t *testing.T) { @@ -98,7 +99,7 @@ func TestAccGkeonpremBareMetalCluster_bareMetalClusterUpdateBgpLb(t *testing.T) } func testAccGkeonpremBareMetalCluster_bareMetalClusterUpdateMetalLbStart(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_gkeonprem_bare_metal_cluster" "cluster-metallb" { provider = google-beta @@ -174,7 +175,7 @@ func testAccGkeonpremBareMetalCluster_bareMetalClusterUpdateMetalLbStart(context } func testAccGkeonpremBareMetalCluster_bareMetalClusterUpdateMetalLb(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_gkeonprem_bare_metal_cluster" "cluster-metallb" { provider = google-beta @@ -248,7 +249,7 @@ func testAccGkeonpremBareMetalCluster_bareMetalClusterUpdateMetalLb(context map[ } func testAccGkeonpremBareMetalCluster_bareMetalClusterUpdateManualLbStart(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_gkeonprem_bare_metal_cluster" "cluster-manuallb" { provider = google-beta @@ -322,7 +323,7 @@ func testAccGkeonpremBareMetalCluster_bareMetalClusterUpdateManualLbStart(contex } func testAccGkeonpremBareMetalCluster_bareMetalClusterUpdateManualLb(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_gkeonprem_bare_metal_cluster" "cluster-manuallb" { provider = google-beta @@ -385,7 +386,7 @@ func testAccGkeonpremBareMetalCluster_bareMetalClusterUpdateManualLb(context map } func testAccGkeonpremBareMetalCluster_bareMetalClusterUpdateBgpLbStart(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_gkeonprem_bare_metal_cluster" "cluster-bgplb" { provider = google-beta @@ -470,7 +471,7 @@ func testAccGkeonpremBareMetalCluster_bareMetalClusterUpdateBgpLbStart(context m } func testAccGkeonpremBareMetalCluster_bareMetalClusterUpdateBgpLb(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_gkeonprem_bare_metal_cluster" "cluster-bgplb" { provider = google-beta diff --git a/mmv1/third_party/terraform/tests/resource_gkeonprem_bare_metal_node_pool_test.go.erb b/mmv1/third_party/terraform/tests/resource_gkeonprem_bare_metal_node_pool_test.go.erb index a26d8a82e524..9fd598d5dbe7 100644 --- a/mmv1/third_party/terraform/tests/resource_gkeonprem_bare_metal_node_pool_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_gkeonprem_bare_metal_node_pool_test.go.erb @@ -5,6 +5,7 @@ import ( "testing" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-provider-google/google/acctest" ) func TestAccGkeonpremBareMetalNodePool_bareMetalNodePoolUpdate(t *testing.T) { @@ -38,7 +39,7 @@ func TestAccGkeonpremBareMetalNodePool_bareMetalNodePoolUpdate(t *testing.T) { } func testAccGkeonpremBareMetalNodePool_bareMetalNodePoolUpdateStart(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_gkeonprem_bare_metal_cluster" "cluster" { provider = google-beta @@ -130,7 +131,7 @@ func testAccGkeonpremBareMetalNodePool_bareMetalNodePoolUpdateStart(context map[ } func testAccGkeonpremBareMetalNodePool_bareMetalNodePoolUpdate(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_gkeonprem_bare_metal_cluster" "cluster" { provider = google-beta diff --git a/mmv1/third_party/terraform/tests/resource_gkeonprem_vmware_cluster_test.go.erb b/mmv1/third_party/terraform/tests/resource_gkeonprem_vmware_cluster_test.go.erb index fdf8774a8622..2265f100daca 100644 --- a/mmv1/third_party/terraform/tests/resource_gkeonprem_vmware_cluster_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_gkeonprem_vmware_cluster_test.go.erb @@ -101,7 +101,7 @@ func TestAccGkeonpremVmwareCluster_vmwareClusterUpdateManualLb(t *testing.T) { } func testAccGkeonpremVmwareCluster_vmwareClusterUpdateMetalLbStart(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_gkeonprem_vmware_cluster" "cluster" { name = "cluster" @@ -150,7 +150,7 @@ func testAccGkeonpremVmwareCluster_vmwareClusterUpdateMetalLbStart(context map[s } func testAccGkeonpremVmwareCluster_vmwareClusterUpdateMetalLb(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_gkeonprem_vmware_cluster" "cluster" { name = "cluster" @@ -199,7 +199,7 @@ func testAccGkeonpremVmwareCluster_vmwareClusterUpdateMetalLb(context map[string } func testAccGkeonpremVmwareCluster_vmwareClusterUpdateF5LbStart(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_gkeonprem_vmware_cluster" "cluster" { name = "cluster" @@ -249,7 +249,7 @@ func testAccGkeonpremVmwareCluster_vmwareClusterUpdateF5LbStart(context map[stri } func testAccGkeonpremVmwareCluster_vmwareClusterUpdateF5lb(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_gkeonprem_vmware_cluster" "cluster" { name = "cluster" @@ -299,7 +299,7 @@ func testAccGkeonpremVmwareCluster_vmwareClusterUpdateF5lb(context map[string]in } func testAccGkeonpremVmwareCluster_vmwareClusterUpdateManualLbStart(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_gkeonprem_vmware_cluster" "cluster" { name = "cluster" @@ -382,7 +382,7 @@ func testAccGkeonpremVmwareCluster_vmwareClusterUpdateManualLbStart(context map[ } func testAccGkeonpremVmwareCluster_vmwareClusterUpdateManualLb(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_gkeonprem_vmware_cluster" "cluster" { name = "cluster" diff --git a/mmv1/third_party/terraform/tests/resource_gkeonprem_vmware_node_pool_test.go.erb b/mmv1/third_party/terraform/tests/resource_gkeonprem_vmware_node_pool_test.go.erb index 51a07b4fb5b7..abbee1c46e35 100644 --- a/mmv1/third_party/terraform/tests/resource_gkeonprem_vmware_node_pool_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_gkeonprem_vmware_node_pool_test.go.erb @@ -5,6 +5,7 @@ import ( "testing" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-provider-google/google/acctest" ) func TestAccGkeonpremVmwareNodePool_vmwareNodePoolUpdate(t *testing.T) { @@ -38,7 +39,7 @@ func TestAccGkeonpremVmwareNodePool_vmwareNodePoolUpdate(t *testing.T) { } func testAccGkeonpremVmwareNodePool_vmwareNodePoolUpdateStart(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_gkeonprem_vmware_cluster" "cluster" { provider = google-beta @@ -111,7 +112,7 @@ func testAccGkeonpremVmwareNodePool_vmwareNodePoolUpdateStart(context map[string } func testAccGkeonpremVmwareNodePool_vmwareNodePoolUpdate(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_gkeonprem_vmware_cluster" "cluster" { provider = google-beta diff --git a/mmv1/third_party/terraform/tests/resource_google_security_scanner_scan_config_test.go.erb b/mmv1/third_party/terraform/tests/resource_google_security_scanner_scan_config_test.go.erb index 026bfe29a499..0d9b60e429bb 100644 --- a/mmv1/third_party/terraform/tests/resource_google_security_scanner_scan_config_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_google_security_scanner_scan_config_test.go.erb @@ -52,7 +52,7 @@ func TestAccSecurityScannerScanConfig_scanConfigUpdate(t *testing.T) { } func testAccSecurityScannerScanConfig(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_compute_address" "scanner_static_ip" { name = "scan-static-ip-%{random_suffix}" } diff --git a/mmv1/third_party/terraform/tests/resource_google_service_usage_consumer_quota_override_test.go.erb b/mmv1/third_party/terraform/tests/resource_google_service_usage_consumer_quota_override_test.go.erb index e61b275979e8..8ef9e2812fdc 100644 --- a/mmv1/third_party/terraform/tests/resource_google_service_usage_consumer_quota_override_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_google_service_usage_consumer_quota_override_test.go.erb @@ -34,7 +34,7 @@ func TestAccServiceUsageConsumerQuotaOverride_consumerQuotaOverrideCustomIncorre } func testAccServiceUsageConsumerQuotaOverride_consumerQuotaOverrideCustomIncorrectLimitFormat(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_project" "my_project" { provider = google-beta name = "tf-test-project" diff --git a/mmv1/third_party/terraform/tests/resource_iam_access_boundary_policy_test.go b/mmv1/third_party/terraform/tests/resource_iam_access_boundary_policy_test.go index 4ba3c3c0ab5c..d1852830f7c1 100644 --- a/mmv1/third_party/terraform/tests/resource_iam_access_boundary_policy_test.go +++ b/mmv1/third_party/terraform/tests/resource_iam_access_boundary_policy_test.go @@ -69,7 +69,7 @@ func testAccIAM2AccessBoundaryPolicy_iamAccessBoundaryPolicyBasic(t *testing.T) } func testAccIAM2AccessBoundaryPolicy_iamAccessBoundaryPolicyBasicExample(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_project" "project" { project_id = "tf-test%{random_suffix}" name = "tf-test%{random_suffix}" @@ -123,7 +123,7 @@ resource "google_iam_access_boundary_policy" "example" { } func testAccIAM2AccessBoundaryPolicy_iamAccessBoundaryPolicyBasicExampleUpdate(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_project" "project" { project_id = "tf-test%{random_suffix}" name = "tf-test%{random_suffix}" diff --git a/mmv1/third_party/terraform/tests/resource_iam_beta_workload_identity_pool_provider_test.go.erb b/mmv1/third_party/terraform/tests/resource_iam_beta_workload_identity_pool_provider_test.go.erb index a4e773d85369..9f76f6e2722d 100644 --- a/mmv1/third_party/terraform/tests/resource_iam_beta_workload_identity_pool_provider_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_iam_beta_workload_identity_pool_provider_test.go.erb @@ -90,7 +90,7 @@ func TestAccIAMBetaWorkloadIdentityPoolProvider_oidc(t *testing.T) { } func testAccIAMBetaWorkloadIdentityPoolProvider_aws_full(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_iam_workload_identity_pool" "my_pool" { workload_identity_pool_id = "my-pool-%{random_suffix}" } @@ -115,7 +115,7 @@ resource "google_iam_workload_identity_pool_provider" "my_provider" { } func testAccIAMBetaWorkloadIdentityPoolProvider_aws_enabled(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_iam_workload_identity_pool" "my_pool" { workload_identity_pool_id = "my-pool-%{random_suffix}" } @@ -140,7 +140,7 @@ resource "google_iam_workload_identity_pool_provider" "my_provider" { } func testAccIAMBetaWorkloadIdentityPoolProvider_oidc_full(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_iam_workload_identity_pool" "my_pool" { workload_identity_pool_id = "my-pool-%{random_suffix}" } @@ -172,7 +172,7 @@ EOT } func testAccIAMBetaWorkloadIdentityPoolProvider_oidc_update(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_iam_workload_identity_pool" "my_pool" { workload_identity_pool_id = "my-pool-%{random_suffix}" } @@ -205,7 +205,7 @@ EOT } func testAccIAMBetaWorkloadIdentityPoolProvider_aws_basic(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_iam_workload_identity_pool" "my_pool" { workload_identity_pool_id = "my-pool-%{random_suffix}" } @@ -221,7 +221,7 @@ resource "google_iam_workload_identity_pool_provider" "my_provider" { } func testAccIAMBetaWorkloadIdentityPoolProvider_oidc_basic(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_iam_workload_identity_pool" "my_pool" { workload_identity_pool_id = "my-pool-%{random_suffix}" } diff --git a/mmv1/third_party/terraform/tests/resource_iam_deny_policy_test.go.erb b/mmv1/third_party/terraform/tests/resource_iam_deny_policy_test.go.erb index 2696ae726e78..904be93543c7 100644 --- a/mmv1/third_party/terraform/tests/resource_iam_deny_policy_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_iam_deny_policy_test.go.erb @@ -93,7 +93,7 @@ func TestAccIAM2DenyPolicy_iamDenyPolicyFolderParent(t *testing.T) { } func testAccIAM2DenyPolicy_iamDenyPolicyUpdate(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_project" "project" { provider = google-beta project_id = "tf-test%{random_suffix}" @@ -142,7 +142,7 @@ resource "google_service_account" "test-account" { } func testAccIAM2DenyPolicy_iamDenyPolicyUpdate2(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_project" "project" { provider = google-beta project_id = "tf-test%{random_suffix}" @@ -181,7 +181,7 @@ resource "google_service_account" "test-account" { } func testAccIAM2DenyPolicy_iamDenyPolicyFolder(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_iam_deny_policy" "example" { provider = google-beta parent = urlencode("cloudresourcemanager.googleapis.com/${google_folder.folder.id}") @@ -209,7 +209,7 @@ resource "google_folder" "folder" { } func testAccIAM2DenyPolicy_iamDenyPolicyFolderUpdate(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_iam_deny_policy" "example" { provider = google-beta parent = urlencode("cloudresourcemanager.googleapis.com/${google_folder.folder.id}") diff --git a/mmv1/third_party/terraform/tests/resource_iam_workforce_pool_workforce_pool_provider_test.go.erb b/mmv1/third_party/terraform/tests/resource_iam_workforce_pool_workforce_pool_provider_test.go.erb index 408e7ca6c6f5..b540ea979323 100644 --- a/mmv1/third_party/terraform/tests/resource_iam_workforce_pool_workforce_pool_provider_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_iam_workforce_pool_workforce_pool_provider_test.go.erb @@ -144,7 +144,7 @@ func testAccCheckIAMWorkforcePoolWorkforcePoolProviderAccess(t *testing.T, rando } func testAccIAMWorkforcePoolWorkforcePoolProvider_oidc_full(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_iam_workforce_pool" "my_pool" { workforce_pool_id = "my-pool-%{random_suffix}" parent = "organizations/%{org_id}" @@ -175,7 +175,7 @@ resource "google_iam_workforce_pool_provider" "my_provider" { } func testAccIAMWorkforcePoolWorkforcePoolProvider_oidc_update(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_iam_workforce_pool" "my_pool" { workforce_pool_id = "my-pool-%{random_suffix}" parent = "organizations/%{org_id}" @@ -206,7 +206,7 @@ resource "google_iam_workforce_pool_provider" "my_provider" { } func testAccIAMWorkforcePoolWorkforcePoolProvider_oidc_basic(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_iam_workforce_pool" "my_pool" { workforce_pool_id = "my-pool-%{random_suffix}" parent = "organizations/%{org_id}" @@ -233,7 +233,7 @@ resource "google_iam_workforce_pool_provider" "my_provider" { } func testAccIAMWorkforcePoolWorkforcePoolProvider_saml_full(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_iam_workforce_pool" "my_pool" { workforce_pool_id = "my-pool-%{random_suffix}" parent = "organizations/%{org_id}" @@ -259,7 +259,7 @@ resource "google_iam_workforce_pool_provider" "my_provider" { } func testAccIAMWorkforcePoolWorkforcePoolProvider_saml_update(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_iam_workforce_pool" "my_pool" { workforce_pool_id = "my-pool-%{random_suffix}" parent = "organizations/%{org_id}" @@ -285,7 +285,7 @@ resource "google_iam_workforce_pool_provider" "my_provider" { } func testAccIAMWorkforcePoolWorkforcePoolProvider_saml_basic(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_iam_workforce_pool" "my_pool" { workforce_pool_id = "my-pool-%{random_suffix}" parent = "organizations/%{org_id}" @@ -307,7 +307,7 @@ resource "google_iam_workforce_pool_provider" "my_provider" { } func testAccIAMWorkforcePoolWorkforcePoolProvider_destroy(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_iam_workforce_pool" "my_pool" { workforce_pool_id = "my-pool-%{random_suffix}" parent = "organizations/%{org_id}" diff --git a/mmv1/third_party/terraform/tests/resource_iam_workforce_pool_workforce_pool_test.go.erb b/mmv1/third_party/terraform/tests/resource_iam_workforce_pool_workforce_pool_test.go.erb index afa3aae82d27..f55aec007f02 100644 --- a/mmv1/third_party/terraform/tests/resource_iam_workforce_pool_workforce_pool_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_iam_workforce_pool_workforce_pool_test.go.erb @@ -75,7 +75,7 @@ func TestAccIAMWorkforcePoolWorkforcePool_minimal(t *testing.T) { } func testAccIAMWorkforcePoolWorkforcePool_full(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_iam_workforce_pool" "my_pool" { workforce_pool_id = "my-pool-%{random_suffix}" parent = "organizations/%{org_id}" @@ -89,7 +89,7 @@ resource "google_iam_workforce_pool" "my_pool" { } func testAccIAMWorkforcePoolWorkforcePool_minimal(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_iam_workforce_pool" "my_pool" { workforce_pool_id = "my-pool-%{random_suffix}" parent = "organizations/%{org_id}" @@ -99,7 +99,7 @@ resource "google_iam_workforce_pool" "my_pool" { } func testAccIAMWorkforcePoolWorkforcePool_update(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_iam_workforce_pool" "my_pool" { workforce_pool_id = "my-pool-%{random_suffix}" parent = "organizations/%{org_id}" diff --git a/mmv1/third_party/terraform/tests/resource_iap_brand_test.go b/mmv1/third_party/terraform/tests/resource_iap_brand_test.go index 3681883cacf6..00222785c3c2 100644 --- a/mmv1/third_party/terraform/tests/resource_iap_brand_test.go +++ b/mmv1/third_party/terraform/tests/resource_iap_brand_test.go @@ -35,7 +35,7 @@ func TestAccIapBrand_iapBrandExample(t *testing.T) { } func testAccIapBrand_iapBrandExample(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_project" "project" { project_id = "tf-test%{random_suffix}" name = "tf-test%{random_suffix}" diff --git a/mmv1/third_party/terraform/tests/resource_identity_platform_default_supported_idp_config_test.go b/mmv1/third_party/terraform/tests/resource_identity_platform_default_supported_idp_config_test.go index f04883e20e63..9109d605fc46 100644 --- a/mmv1/third_party/terraform/tests/resource_identity_platform_default_supported_idp_config_test.go +++ b/mmv1/third_party/terraform/tests/resource_identity_platform_default_supported_idp_config_test.go @@ -78,7 +78,7 @@ func testAccCheckIdentityPlatformDefaultSupportedIdpConfigDestroyProducer(t *tes } func testAccIdentityPlatformDefaultSupportedIdpConfig_defaultSupportedIdpConfigBasic(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_identity_platform_default_supported_idp_config" "idp_config" { enabled = true idp_id = "playgames.google.com" @@ -89,7 +89,7 @@ resource "google_identity_platform_default_supported_idp_config" "idp_config" { } func testAccIdentityPlatformDefaultSupportedIdpConfig_defaultSupportedIdpConfigUpdate(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_identity_platform_default_supported_idp_config" "idp_config" { enabled = false idp_id = "playgames.google.com" diff --git a/mmv1/third_party/terraform/tests/resource_identity_platform_inbound_saml_config_test.go b/mmv1/third_party/terraform/tests/resource_identity_platform_inbound_saml_config_test.go index 430f59d2de97..88a1e4cbaf48 100644 --- a/mmv1/third_party/terraform/tests/resource_identity_platform_inbound_saml_config_test.go +++ b/mmv1/third_party/terraform/tests/resource_identity_platform_inbound_saml_config_test.go @@ -40,7 +40,7 @@ func TestAccIdentityPlatformInboundSamlConfig_inboundSamlConfigUpdate(t *testing } func testAccIdentityPlatformInboundSamlConfig_inboundSamlConfigBasic(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_identity_platform_inbound_saml_config" "saml_config" { name = "saml.tf-config%{random_suffix}" display_name = "Display Name" @@ -61,7 +61,7 @@ resource "google_identity_platform_inbound_saml_config" "saml_config" { } func testAccIdentityPlatformInboundSamlConfig_inboundSamlConfigUpdate(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_identity_platform_inbound_saml_config" "saml_config" { name = "saml.tf-config%{random_suffix}" display_name = "Display Name2" diff --git a/mmv1/third_party/terraform/tests/resource_identity_platform_oauth_idp_config_test.go b/mmv1/third_party/terraform/tests/resource_identity_platform_oauth_idp_config_test.go index 40a8dc666e25..f3dd35b0ea21 100644 --- a/mmv1/third_party/terraform/tests/resource_identity_platform_oauth_idp_config_test.go +++ b/mmv1/third_party/terraform/tests/resource_identity_platform_oauth_idp_config_test.go @@ -40,7 +40,7 @@ func TestAccIdentityPlatformOauthIdpConfig_identityPlatformOauthIdpConfigUpdate( } func testAccIdentityPlatformOauthIdpConfig_identityPlatformOauthIdpConfigBasic(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_identity_platform_oauth_idp_config" "oauth_idp_config" { name = "oidc.oauth-idp-config%{random_suffix}" display_name = "Display Name" @@ -53,7 +53,7 @@ resource "google_identity_platform_oauth_idp_config" "oauth_idp_config" { } func testAccIdentityPlatformOauthIdpConfig_identityPlatformOauthIdpConfigUpdate(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_identity_platform_oauth_idp_config" "oauth_idp_config" { name = "oidc.oauth-idp-config%{random_suffix}" display_name = "Another display name" diff --git a/mmv1/third_party/terraform/tests/resource_identity_platform_tenant_default_supported_idp_config_test.go b/mmv1/third_party/terraform/tests/resource_identity_platform_tenant_default_supported_idp_config_test.go index a2472b1f2c5f..1270a014efaf 100644 --- a/mmv1/third_party/terraform/tests/resource_identity_platform_tenant_default_supported_idp_config_test.go +++ b/mmv1/third_party/terraform/tests/resource_identity_platform_tenant_default_supported_idp_config_test.go @@ -42,7 +42,7 @@ func TestAccIdentityPlatformTenantDefaultSupportedIdpConfig_identityPlatformTena } func testAccIdentityPlatformTenantDefaultSupportedIdpConfig_identityPlatformTenantDefaultSupportedIdpConfigBasic(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_identity_platform_tenant" "tenant" { display_name = "tenant" } @@ -58,7 +58,7 @@ resource "google_identity_platform_tenant_default_supported_idp_config" "idp_con } func testAccIdentityPlatformTenantDefaultSupportedIdpConfig_identityPlatformTenantDefaultSupportedIdpConfigUpdate(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_identity_platform_tenant" "tenant" { display_name = "tenant" } diff --git a/mmv1/third_party/terraform/tests/resource_identity_platform_tenant_indound_saml_config_test.go b/mmv1/third_party/terraform/tests/resource_identity_platform_tenant_indound_saml_config_test.go index d1824632ca4b..a542fe2f599e 100644 --- a/mmv1/third_party/terraform/tests/resource_identity_platform_tenant_indound_saml_config_test.go +++ b/mmv1/third_party/terraform/tests/resource_identity_platform_tenant_indound_saml_config_test.go @@ -42,7 +42,7 @@ func TestAccIdentityPlatformTenantInboundSamlConfig_identityPlatformTenantInboun } func testAccIdentityPlatformTenantInboundSamlConfig_identityPlatformTenantInboundSamlConfigBasic(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_identity_platform_tenant" "tenant" { display_name = "tenant" } @@ -69,7 +69,7 @@ resource "google_identity_platform_tenant_inbound_saml_config" "tenant_saml_conf } func testAccIdentityPlatformTenantInboundSamlConfig_identityPlatformTenantInboundSamlConfigUpdate(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_identity_platform_tenant" "tenant" { display_name = "tenant" } diff --git a/mmv1/third_party/terraform/tests/resource_identity_platform_tenant_oauth_idp_config_test.go b/mmv1/third_party/terraform/tests/resource_identity_platform_tenant_oauth_idp_config_test.go index 70da6364142e..0ce83cb99bfc 100644 --- a/mmv1/third_party/terraform/tests/resource_identity_platform_tenant_oauth_idp_config_test.go +++ b/mmv1/third_party/terraform/tests/resource_identity_platform_tenant_oauth_idp_config_test.go @@ -42,7 +42,7 @@ func TestAccIdentityPlatformTenantOauthIdpConfig_identityPlatformTenantOauthIdpC } func testAccIdentityPlatformTenantOauthIdpConfig_identityPlatformTenantOauthIdpConfigBasic(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_identity_platform_tenant" "tenant" { display_name = "tenant" } @@ -60,7 +60,7 @@ resource "google_identity_platform_tenant_oauth_idp_config" "tenant_oauth_idp_co } func testAccIdentityPlatformTenantOauthIdpConfig_identityPlatformTenantOauthIdpConfigUpdate(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_identity_platform_tenant" "tenant" { display_name = "tenant" } diff --git a/mmv1/third_party/terraform/tests/resource_identity_platform_tenant_test.go b/mmv1/third_party/terraform/tests/resource_identity_platform_tenant_test.go index 1b04e7fb1643..39cd8d8d54d7 100644 --- a/mmv1/third_party/terraform/tests/resource_identity_platform_tenant_test.go +++ b/mmv1/third_party/terraform/tests/resource_identity_platform_tenant_test.go @@ -40,7 +40,7 @@ func TestAccIdentityPlatformTenant_identityPlatformTenantUpdate(t *testing.T) { } func testAccIdentityPlatformTenant_identityPlatformTenantBasic(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_identity_platform_tenant" "tenant" { display_name = "tenant" allow_password_signup = true @@ -49,7 +49,7 @@ resource "google_identity_platform_tenant" "tenant" { } func testAccIdentityPlatformTenant_identityPlatformTenantUpdate(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_identity_platform_tenant" "tenant" { display_name = "my-tenant" allow_password_signup = false diff --git a/mmv1/third_party/terraform/tests/resource_kms_key_ring_import_job_test.go b/mmv1/third_party/terraform/tests/resource_kms_key_ring_import_job_test.go index 1ef51152879d..df6266784b3e 100644 --- a/mmv1/third_party/terraform/tests/resource_kms_key_ring_import_job_test.go +++ b/mmv1/third_party/terraform/tests/resource_kms_key_ring_import_job_test.go @@ -32,7 +32,7 @@ func TestAccKmsKeyRingImportJob_basic(t *testing.T) { } func testGoogleKmsKeyRingImportJob_basic(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_kms_key_ring" "keyring" { name = "tf-test-import-job-%{random_suffix}" location = "global" diff --git a/mmv1/third_party/terraform/tests/resource_logging_bucket_config_test.go b/mmv1/third_party/terraform/tests/resource_logging_bucket_config_test.go index 408fb442d4c8..7018a3e1681e 100644 --- a/mmv1/third_party/terraform/tests/resource_logging_bucket_config_test.go +++ b/mmv1/third_party/terraform/tests/resource_logging_bucket_config_test.go @@ -269,7 +269,7 @@ func TestAccLoggingBucketConfigOrganization_basic(t *testing.T) { } func testAccLoggingBucketConfigFolder_basic(context map[string]interface{}, retention int) string { - return fmt.Sprintf(Nprintf(` + return fmt.Sprintf(acctest.Nprintf(` resource "google_folder" "default" { display_name = "%{folder_name}" parent = "organizations/%{org_id}" @@ -286,7 +286,7 @@ resource "google_logging_folder_bucket_config" "basic" { } func testAccLoggingBucketConfigProject_basic(context map[string]interface{}, retention int) string { - return fmt.Sprintf(Nprintf(` + return fmt.Sprintf(acctest.Nprintf(` resource "google_project" "default" { project_id = "%{project_name}" name = "%{project_name}" @@ -304,7 +304,7 @@ resource "google_logging_project_bucket_config" "basic" { } func testAccLoggingBucketConfigProject_analyticsEnabled(context map[string]interface{}, analytics bool) string { - return fmt.Sprintf(Nprintf(` + return fmt.Sprintf(acctest.Nprintf(` resource "google_project" "default" { project_id = "%{project_name}" name = "%{project_name}" @@ -321,7 +321,7 @@ resource "google_logging_project_bucket_config" "basic" { } func testAccLoggingBucketConfigProject_locked(context map[string]interface{}, locked bool) string { - return fmt.Sprintf(Nprintf(` + return fmt.Sprintf(acctest.Nprintf(` resource "google_project" "default" { project_id = "%{project_name}" name = "%{project_name}" @@ -347,7 +347,7 @@ resource "google_logging_project_bucket_config" "variable_locked" { } func testAccLoggingBucketConfigProject_preCmekSettings(context map[string]interface{}, keyRingName, cryptoKeyName, cryptoKeyNameUpdate string) string { - return fmt.Sprintf(Nprintf(` + return fmt.Sprintf(acctest.Nprintf(` resource "google_project" "default" { project_id = "%{project_name}" name = "%{project_name}" @@ -472,7 +472,7 @@ func TestAccLoggingBucketConfig_CreateBuckets_withCustomId(t *testing.T) { } func testAccLoggingBucketConfigBillingAccount_basic(context map[string]interface{}, retention int) string { - return fmt.Sprintf(Nprintf(` + return fmt.Sprintf(acctest.Nprintf(` data "google_billing_account" "default" { billing_account = "%{billing_account_name}" @@ -489,7 +489,7 @@ resource "google_logging_billing_account_bucket_config" "basic" { } func testAccLoggingBucketConfigOrganization_basic(context map[string]interface{}, retention int) string { - return fmt.Sprintf(Nprintf(` + return fmt.Sprintf(acctest.Nprintf(` data "google_organization" "default" { organization = "%{org_id}" } @@ -506,7 +506,7 @@ resource "google_logging_organization_bucket_config" "basic" { func getLoggingBucketConfigs(context map[string]interface{}) map[string]string { return map[string]string{ - "project": Nprintf(`resource "google_project" "default" { + "project": acctest.Nprintf(`resource "google_project" "default" { project_id = "%{project_name}" name = "%{project_name}" org_id = "%{org_id}" diff --git a/mmv1/third_party/terraform/tests/resource_logging_log_view_test.go b/mmv1/third_party/terraform/tests/resource_logging_log_view_test.go index f2ab9fa5af4e..22078fe0d692 100644 --- a/mmv1/third_party/terraform/tests/resource_logging_log_view_test.go +++ b/mmv1/third_party/terraform/tests/resource_logging_log_view_test.go @@ -44,7 +44,7 @@ func TestAccLoggingLogView_loggingLogViewBasicExampleUpdate(t *testing.T) { } func testAccLoggingLogView_loggingLogViewBasicExampleUpdate(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_logging_project_bucket_config" "logging_log_view" { project = "%{project}" location = "global" diff --git a/mmv1/third_party/terraform/tests/resource_network_management_connectivity_test_resource_test.go b/mmv1/third_party/terraform/tests/resource_network_management_connectivity_test_resource_test.go index a200167484cc..58a0df101cd7 100644 --- a/mmv1/third_party/terraform/tests/resource_network_management_connectivity_test_resource_test.go +++ b/mmv1/third_party/terraform/tests/resource_network_management_connectivity_test_resource_test.go @@ -41,7 +41,7 @@ func TestAccNetworkManagementConnectivityTest_update(t *testing.T) { } func testAccNetworkManagementConnectivityTest_instanceToInstance(context map[string]interface{}) string { - connTestCfg := Nprintf(` + connTestCfg := acctest.Nprintf(` resource "google_network_management_connectivity_test" "conn-test" { name = "tf-test-conntest%{random_suffix}" source { @@ -59,7 +59,7 @@ resource "google_network_management_connectivity_test" "conn-test" { } func testAccNetworkManagementConnectivityTest_instanceToAddr(context map[string]interface{}) string { - connTestCfg := Nprintf(` + connTestCfg := acctest.Nprintf(` resource "google_network_management_connectivity_test" "conn-test" { name = "tf-test-conntest%{random_suffix}" source { @@ -82,7 +82,7 @@ resource "google_network_management_connectivity_test" "conn-test" { } func testAccNetworkManagementConnectivityTest_baseResources(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_compute_address" "addr" { name = "tf-test-addr%{random_suffix}" diff --git a/mmv1/third_party/terraform/tests/resource_network_services_edge_cache_keyset_test.go b/mmv1/third_party/terraform/tests/resource_network_services_edge_cache_keyset_test.go index 8b4cd06568a6..4bd1d2148fa0 100644 --- a/mmv1/third_party/terraform/tests/resource_network_services_edge_cache_keyset_test.go +++ b/mmv1/third_party/terraform/tests/resource_network_services_edge_cache_keyset_test.go @@ -42,7 +42,7 @@ func TestAccNetworkServicesEdgeCacheKeyset_update(t *testing.T) { } func testAccNetworkServicesEdgeCacheKeyset_update(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_network_services_edge_cache_keyset" "default" { name = "default%{random_suffix}" diff --git a/mmv1/third_party/terraform/tests/resource_notebooks_instance_test.go.erb b/mmv1/third_party/terraform/tests/resource_notebooks_instance_test.go.erb index af241c8b5e75..e28c8192c17e 100644 --- a/mmv1/third_party/terraform/tests/resource_notebooks_instance_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_notebooks_instance_test.go.erb @@ -7,6 +7,7 @@ import ( "testing" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-provider-google/google/acctest" ) func TestAccNotebooksInstance_create_vm_image(t *testing.T) { @@ -97,7 +98,7 @@ resource "google_notebooks_instance" "test" { } func testAccNotebooksInstance_basic(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_notebooks_instance" "instance" { name = "tf-test-notebooks-instance%{random_suffix}" location = "us-central1-a" @@ -123,7 +124,7 @@ resource "google_notebooks_instance" "instance" { func testAccNotebooksInstance_update(context map[string]interface{}, preventDestroy bool) string { context["prevent_destroy"] = strconv.FormatBool(preventDestroy) - return Nprintf(` + return acctest.Nprintf(` resource "google_notebooks_instance" "instance" { name = "tf-test-notebooks-instance%{random_suffix}" location = "us-central1-a" diff --git a/mmv1/third_party/terraform/tests/resource_notebooks_runtime_test.go.erb b/mmv1/third_party/terraform/tests/resource_notebooks_runtime_test.go.erb index ccf2ae332f60..5d6351bfa1e1 100644 --- a/mmv1/third_party/terraform/tests/resource_notebooks_runtime_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_notebooks_runtime_test.go.erb @@ -48,7 +48,7 @@ func TestAccNotebooksRuntime_update(t *testing.T) { func testAccNotebooksRuntime_basic(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_notebooks_runtime" "runtime" { name = "tf-test-notebooks-runtime%{random_suffix}" location = "us-central1" @@ -74,7 +74,7 @@ resource "google_notebooks_runtime" "runtime" { } func testAccNotebooksRuntime_update(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_notebooks_runtime" "runtime" { name = "tf-test-notebooks-runtime%{random_suffix}" location = "us-central1" diff --git a/mmv1/third_party/terraform/tests/resource_org_policy_custom_constraint_test.go.erb b/mmv1/third_party/terraform/tests/resource_org_policy_custom_constraint_test.go.erb index da1acbcb215a..af45a6f5ccce 100644 --- a/mmv1/third_party/terraform/tests/resource_org_policy_custom_constraint_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_org_policy_custom_constraint_test.go.erb @@ -46,7 +46,7 @@ func TestAccOrgPolicyCustomConstraint_update(t *testing.T) { } func testAccOrgPolicyCustomConstraint_v1(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_org_policy_custom_constraint" "constraint" { name = "custom.tfTest%{random_suffix}" parent = "organizations/%{org_id}" @@ -62,7 +62,7 @@ resource "google_org_policy_custom_constraint" "constraint" { } func testAccOrgPolicyCustomConstraint_v2(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_org_policy_custom_constraint" "constraint" { name = "custom.tfTest%{random_suffix}" parent = "organizations/%{org_id}" diff --git a/mmv1/third_party/terraform/tests/resource_os_config_os_policy_assignment_test.go.erb b/mmv1/third_party/terraform/tests/resource_os_config_os_policy_assignment_test.go.erb index d4e4eca0062e..53f0ab927853 100644 --- a/mmv1/third_party/terraform/tests/resource_os_config_os_policy_assignment_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_os_config_os_policy_assignment_test.go.erb @@ -48,7 +48,7 @@ func TestAccOSConfigOSPolicyAssignment_basic(t *testing.T) { } func testAccOSConfigOSPolicyAssignment_basic(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_os_config_os_policy_assignment" "primary" { instance_filter { all = false @@ -138,7 +138,7 @@ resource "google_os_config_os_policy_assignment" "primary" { } func testAccOSConfigOSPolicyAssignment_update(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_os_config_os_policy_assignment" "primary" { instance_filter { all = false diff --git a/mmv1/third_party/terraform/tests/resource_os_login_ssh_public_key_test.go b/mmv1/third_party/terraform/tests/resource_os_login_ssh_public_key_test.go index 3ad535275470..d9884d51b630 100644 --- a/mmv1/third_party/terraform/tests/resource_os_login_ssh_public_key_test.go +++ b/mmv1/third_party/terraform/tests/resource_os_login_ssh_public_key_test.go @@ -41,7 +41,7 @@ func TestAccOSLoginSSHPublicKey_osLoginSshKeyExpiry(t *testing.T) { } func testAccOSLoginSSHPublicKey_osLoginSshKeyExpiry(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_project" "project" { project_id = "tf-test%{random_suffix}" name = "tf-test%{random_suffix}" diff --git a/mmv1/third_party/terraform/tests/resource_privateca_ca_pool_test.go b/mmv1/third_party/terraform/tests/resource_privateca_ca_pool_test.go index f16cf636b38b..6bf37924cf70 100644 --- a/mmv1/third_party/terraform/tests/resource_privateca_ca_pool_test.go +++ b/mmv1/third_party/terraform/tests/resource_privateca_ca_pool_test.go @@ -51,7 +51,7 @@ func TestAccPrivatecaCaPool_privatecaCapoolUpdate(t *testing.T) { } func testAccPrivatecaCaPool_privatecaCapoolStart(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_privateca_ca_pool" "default" { name = "tf-test-my-capool%{random_suffix}" location = "us-central1" @@ -133,7 +133,7 @@ resource "google_privateca_ca_pool" "default" { } func testAccPrivatecaCaPool_privatecaCapoolEnd(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_privateca_ca_pool" "default" { name = "tf-test-my-capool%{random_suffix}" location = "us-central1" @@ -240,7 +240,7 @@ func TestAccPrivatecaCaPool_privatecaCapoolEmptyBaseline(t *testing.T) { } func testAccPrivatecaCaPool_privatecaCapoolEmptyBaseline(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_privateca_ca_pool" "default" { name = "tf-test-my-capool%{random_suffix}" location = "us-central1" @@ -304,7 +304,7 @@ func TestAccPrivatecaCaPool_privatecaCapoolEmptyPublishingOptions(t *testing.T) } func testAccPrivatecaCaPool_privatecaCapoolEmptyPublishingOptions(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_privateca_ca_pool" "default" { name = "tf-test-my-capool%{random_suffix}" location = "us-central1" @@ -364,7 +364,7 @@ func TestAccPrivatecaCaPool_updateCaOption(t *testing.T) { } func testAccPrivatecaCaPool_privatecaCapoolCaOptionIsCaIsTrueAndMaxPathIsPositive(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_privateca_ca_pool" "default" { name = "tf-test-my-capool%{random_suffix}" location = "us-central1" @@ -391,7 +391,7 @@ resource "google_privateca_ca_pool" "default" { } func testAccPrivatecaCaPool_privatecaCapoolCaOptionIsCaIsFalse(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_privateca_ca_pool" "default" { name = "tf-test-my-capool%{random_suffix}" location = "us-central1" @@ -418,7 +418,7 @@ resource "google_privateca_ca_pool" "default" { } func testAccPrivatecaCaPool_privatecaCapoolCaOptionMaxIssuerPathLenghIsZero(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_privateca_ca_pool" "default" { name = "tf-test-my-capool%{random_suffix}" location = "us-central1" diff --git a/mmv1/third_party/terraform/tests/resource_privateca_certificate_authority_test.go b/mmv1/third_party/terraform/tests/resource_privateca_certificate_authority_test.go index 0fe53a9ede9e..7c8d6d3849dc 100644 --- a/mmv1/third_party/terraform/tests/resource_privateca_certificate_authority_test.go +++ b/mmv1/third_party/terraform/tests/resource_privateca_certificate_authority_test.go @@ -121,7 +121,7 @@ func TestAccPrivatecaCertificateAuthority_rootCaManageDesiredState(t *testing.T) } func testAccPrivatecaCertificateAuthority_privatecaCertificateAuthorityBasicRoot(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_privateca_certificate_authority" "default" { // This example assumes this pool already exists. // Pools cannot be deleted in normal test circumstances, so we depend on static pools @@ -175,7 +175,7 @@ resource "google_privateca_certificate_authority" "default" { } func testAccPrivatecaCertificateAuthority_privatecaCertificateAuthorityEnd(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_privateca_certificate_authority" "default" { // This example assumes this pool already exists. // Pools cannot be deleted in normal test circumstances, so we depend on static pools @@ -232,7 +232,7 @@ resource "google_privateca_certificate_authority" "default" { } func testAccPrivatecaCertificateAuthority_privatecaCertificateAuthorityWithDesiredState(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_privateca_certificate_authority" "default" { // This example assumes this pool already exists. // Pools cannot be deleted in normal test circumstances, so we depend on static pools diff --git a/mmv1/third_party/terraform/tests/resource_privateca_certificate_test.go b/mmv1/third_party/terraform/tests/resource_privateca_certificate_test.go index 6cf0284f454e..e7742e9cba85 100644 --- a/mmv1/third_party/terraform/tests/resource_privateca_certificate_test.go +++ b/mmv1/third_party/terraform/tests/resource_privateca_certificate_test.go @@ -52,7 +52,7 @@ func TestAccPrivatecaCertificate_privatecaCertificateUpdate(t *testing.T) { } func testAccPrivatecaCertificate_privatecaCertificateStart(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_privateca_ca_pool" "default" { location = "us-central1" name = "my-pool-%{random_suffix}" @@ -137,7 +137,7 @@ resource "google_privateca_certificate" "default" { } func testAccPrivatecaCertificate_privatecaCertificateEnd(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_privateca_ca_pool" "default" { location = "us-central1" name = "my-pool-%{random_suffix}" diff --git a/mmv1/third_party/terraform/tests/resource_redis_instance_test.go b/mmv1/third_party/terraform/tests/resource_redis_instance_test.go index c82881395eb1..a631a7ea4902 100644 --- a/mmv1/third_party/terraform/tests/resource_redis_instance_test.go +++ b/mmv1/third_party/terraform/tests/resource_redis_instance_test.go @@ -353,7 +353,7 @@ resource "google_redis_instance" "test" { } func testAccRedisInstance_redisInstanceAuthEnabled(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_redis_instance" "cache" { name = "tf-test-memory-cache%{random_suffix}" memory_size_gb = 1 @@ -363,7 +363,7 @@ resource "google_redis_instance" "cache" { } func testAccRedisInstance_redisInstanceAuthDisabled(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_redis_instance" "cache" { name = "tf-test-memory-cache%{random_suffix}" memory_size_gb = 1 diff --git a/mmv1/third_party/terraform/tests/resource_scc_notification_config_test.go b/mmv1/third_party/terraform/tests/resource_scc_notification_config_test.go index 4014e1ea8ba7..93902a2e007f 100644 --- a/mmv1/third_party/terraform/tests/resource_scc_notification_config_test.go +++ b/mmv1/third_party/terraform/tests/resource_scc_notification_config_test.go @@ -44,7 +44,7 @@ func TestAccSecurityCenterNotificationConfig_updateStreamingConfigFilter(t *test } func testAccSecurityCenterNotificationConfig_updateStreamingConfigFilter(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_pubsub_topic" "scc_notification" { name = "tf-test-my-topic%{random_suffix}" } diff --git a/mmv1/third_party/terraform/tests/resource_secret_manager_secret_test.go.erb b/mmv1/third_party/terraform/tests/resource_secret_manager_secret_test.go.erb index 67e443736912..8401fb0a2e92 100644 --- a/mmv1/third_party/terraform/tests/resource_secret_manager_secret_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_secret_manager_secret_test.go.erb @@ -65,7 +65,7 @@ func TestAccSecretManagerSecret_cmek(t *testing.T) { } func testAccSecretManagerSecret_basic(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_secret_manager_secret" "secret-basic" { secret_id = "tf-test-secret-%{random_suffix}" @@ -91,7 +91,7 @@ resource "google_secret_manager_secret" "secret-basic" { } func testAccSecretMangerSecret_cmek(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` data "google_project" "project" { project_id = "%{pid}" } diff --git a/mmv1/third_party/terraform/tests/resource_secret_manager_secret_version_test.go.erb b/mmv1/third_party/terraform/tests/resource_secret_manager_secret_version_test.go.erb index 25003071e4ff..3f1d8ba6ebb0 100644 --- a/mmv1/third_party/terraform/tests/resource_secret_manager_secret_version_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_secret_manager_secret_version_test.go.erb @@ -52,7 +52,7 @@ func TestAccSecretManagerSecretVersion_update(t *testing.T) { } func testAccSecretManagerSecretVersion_basic(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_secret_manager_secret" "secret-basic" { secret_id = "tf-test-secret-version-%{random_suffix}" @@ -75,7 +75,7 @@ resource "google_secret_manager_secret_version" "secret-version-basic" { } func testAccSecretManagerSecretVersion_disable(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_secret_manager_secret" "secret-basic" { secret_id = "tf-test-secret-version-%{random_suffix}" diff --git a/mmv1/third_party/terraform/tests/resource_spanner_database_test.go.erb b/mmv1/third_party/terraform/tests/resource_spanner_database_test.go.erb index a76cdcb4030c..12760c1565a2 100644 --- a/mmv1/third_party/terraform/tests/resource_spanner_database_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_spanner_database_test.go.erb @@ -496,7 +496,7 @@ func TestAccSpannerDatabase_deletionProtection(t *testing.T) { } func testAccSpannerDatabase_deletionProtection(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_spanner_instance" "main" { config = "regional-europe-west1" display_name = "main-instance" @@ -543,7 +543,7 @@ func TestAccSpannerDatabase_cmek(t *testing.T) { } func testAccSpannerDatabase_cmek(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_spanner_instance" "main" { provider = google-beta config = "regional-europe-west1" diff --git a/mmv1/third_party/terraform/tests/resource_sql_database_instance_test.go b/mmv1/third_party/terraform/tests/resource_sql_database_instance_test.go index 32c32c21bc9c..9674bfd8bf7a 100644 --- a/mmv1/third_party/terraform/tests/resource_sql_database_instance_test.go +++ b/mmv1/third_party/terraform/tests/resource_sql_database_instance_test.go @@ -1201,7 +1201,7 @@ func TestAccSqlDatabaseInstance_encryptionKey(t *testing.T) { CheckDestroy: testAccSqlDatabaseInstanceDestroyProducer(t), Steps: []resource.TestStep{ { - Config: Nprintf( + Config: acctest.Nprintf( testGoogleSqlDatabaseInstance_encryptionKey, context), }, { @@ -1235,7 +1235,7 @@ func TestAccSqlDatabaseInstance_encryptionKey_replicaInDifferentRegion(t *testin CheckDestroy: testAccSqlDatabaseInstanceDestroyProducer(t), Steps: []resource.TestStep{ { - Config: Nprintf( + Config: acctest.Nprintf( testGoogleSqlDatabaseInstance_encryptionKey_replicaInDifferentRegion, context), }, { @@ -1822,7 +1822,7 @@ func TestAccSqlDatabaseInstance_ReplicaPromoteSkippedWithNoMasterInstanceNameAnd } func testAccSqlDatabaseInstance_sqlMysqlInstancePvpExample(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_sql_database_instance" "mysql_pvp_instance_name" { name = "tf-test-mysql-pvp-instance-name%{random_suffix}" region = "asia-northeast1" @@ -3163,7 +3163,7 @@ resource "google_sql_database_instance" "instance" { } func testAccSqlDatabaseInstance_beforeBackup(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_sql_database_instance" "instance" { name = "tf-test-%{random_suffix}" database_version = "POSTGRES_11" @@ -3182,7 +3182,7 @@ resource "google_sql_database_instance" "instance" { } func testAccSqlDatabaseInstance_restoreFromBackup(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_sql_database_instance" "instance" { name = "tf-test-%{random_suffix}" database_version = "POSTGRES_11" @@ -3216,7 +3216,7 @@ data "google_sql_backup_run" "backup" { } func testAccSqlDatabaseInstance_basicClone(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_sql_database_instance" "instance" { name = "tf-test-%{random_suffix}" database_version = "POSTGRES_11" @@ -3243,7 +3243,7 @@ data "google_sql_backup_run" "backup" { } func testAccSqlDatabaseInstance_cloneWithSettings(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_sql_database_instance" "instance" { name = "tf-test-%{random_suffix}" database_version = "POSTGRES_11" @@ -3277,7 +3277,7 @@ data "google_sql_backup_run" "backup" { } func testAccSqlDatabaseInstance_cloneWithDatabaseNames(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_sql_database_instance" "instance" { name = "tf-test-%{random_suffix}" database_version = "POSTGRES_11" diff --git a/mmv1/third_party/terraform/tests/resource_storage_bucket_test.go.erb b/mmv1/third_party/terraform/tests/resource_storage_bucket_test.go.erb index 34c9f73c87df..5ee1ddf1268f 100644 --- a/mmv1/third_party/terraform/tests/resource_storage_bucket_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_storage_bucket_test.go.erb @@ -1823,7 +1823,7 @@ resource "google_storage_bucket" "bucket" { } func testAccStorageBucket_encryption(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_project" "acceptance" { name = "tf-test-%{random_suffix}" project_id = "tf-test-%{random_suffix}" diff --git a/mmv1/third_party/terraform/tests/resource_tags_test.go b/mmv1/third_party/terraform/tests/resource_tags_test.go index 9311c560dcca..316c1f7f9bee 100644 --- a/mmv1/third_party/terraform/tests/resource_tags_test.go +++ b/mmv1/third_party/terraform/tests/resource_tags_test.go @@ -66,7 +66,7 @@ func testAccTagsTagKey_tagKeyBasic(t *testing.T) { } func testAccTagsTagKey_tagKeyBasicExample(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_tags_tag_key" "key" { parent = "organizations/%{org_id}" @@ -95,7 +95,7 @@ func testAccTagsTagKey_tagKeyBasicWithPurposeGceFirewall(t *testing.T) { } func testAccTagsTagKey_tagKeyBasicWithPurposeGceFirewallExample(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_compute_network" "tag_network" { name = "vpc-%{random_suffix}" auto_create_subnetworks = false @@ -146,7 +146,7 @@ func testAccTagsTagKey_tagKeyUpdate(t *testing.T) { } func testAccTagsTagKey_basic(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_tags_tag_key" "key" { parent = "organizations/%{org_id}" @@ -157,7 +157,7 @@ resource "google_tags_tag_key" "key" { } func testAccTagsTagKey_basicUpdated(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_tags_tag_key" "key" { parent = "organizations/%{org_id}" @@ -225,7 +225,7 @@ func testAccTagsTagValue_tagValueBasic(t *testing.T) { } func testAccTagsTagValue_tagValueBasicExample(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_tags_tag_key" "key" { parent = "organizations/%{org_id}" @@ -274,7 +274,7 @@ func testAccTagsTagValue_tagValueUpdate(t *testing.T) { } func testAccTagsTagValue_basic(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_tags_tag_key" "key" { parent = "organizations/%{org_id}" @@ -292,7 +292,7 @@ resource "google_tags_tag_value" "value" { } func testAccTagsTagValue_basicUpdated(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_tags_tag_key" "key" { parent = "organizations/%{org_id}" @@ -373,7 +373,7 @@ func testAccTagsTagBinding_tagBindingBasic(t *testing.T) { } func testAccTagsTagBinding_tagBindingBasicExample(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_project" "project" { project_id = "%{project_id}" name = "%{project_id}" @@ -513,7 +513,7 @@ func testAccTagsTagKeyIamPolicy(t *testing.T) { } func testAccTagsTagKeyIamMember_basicGenerated(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_tags_tag_key" "key" { parent = "organizations/%{org_id}" @@ -530,7 +530,7 @@ resource "google_tags_tag_key_iam_member" "foo" { } func testAccTagsTagKeyIamPolicy_basicGenerated(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_tags_tag_key" "key" { parent = "organizations/%{org_id}" @@ -553,7 +553,7 @@ resource "google_tags_tag_key_iam_policy" "foo" { } func testAccTagsTagKeyIamPolicy_emptyBinding(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_tags_tag_key" "key" { parent = "organizations/%{org_id}" @@ -572,7 +572,7 @@ resource "google_tags_tag_key_iam_policy" "foo" { } func testAccTagsTagKeyIamBinding_basicGenerated(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_tags_tag_key" "key" { parent = "organizations/%{org_id}" @@ -589,7 +589,7 @@ resource "google_tags_tag_key_iam_binding" "foo" { } func testAccTagsTagKeyIamBinding_updateGenerated(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_tags_tag_key" "key" { parent = "organizations/%{org_id}" @@ -683,7 +683,7 @@ func testAccTagsTagValueIamPolicy(t *testing.T) { } func testAccTagsTagValueIamMember_basicGenerated(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_tags_tag_key" "key" { parent = "organizations/%{org_id}" short_name = "%{key_short_name}" @@ -705,7 +705,7 @@ resource "google_tags_tag_value_iam_member" "foo" { } func testAccTagsTagValueIamPolicy_basicGenerated(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_tags_tag_key" "key" { parent = "organizations/%{org_id}" short_name = "%{key_short_name}" @@ -733,7 +733,7 @@ resource "google_tags_tag_value_iam_policy" "foo" { } func testAccTagsTagValueIamPolicy_emptyBinding(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_tags_tag_key" "key" { parent = "organizations/%{org_id}" short_name = "%{key_short_name}" @@ -757,7 +757,7 @@ resource "google_tags_tag_value_iam_policy" "foo" { } func testAccTagsTagValueIamBinding_basicGenerated(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_tags_tag_key" "key" { parent = "organizations/%{org_id}" short_name = "%{key_short_name}" @@ -779,7 +779,7 @@ resource "google_tags_tag_value_iam_binding" "foo" { } func testAccTagsTagValueIamBinding_updateGenerated(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_tags_tag_key" "key" { parent = "organizations/%{org_id}" short_name = "%{key_short_name}" @@ -830,7 +830,7 @@ func testAccTagsLocationTagBinding_locationTagBindingbasic(t *testing.T) { } func testAccTagsLocationTagBinding_locationTagBindingBasicExample(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` data "google_project" "project" { } @@ -939,7 +939,7 @@ func TestAccTagsLocationTagBinding_locationTagBindingzonal(t *testing.T) { } func testAccTagsLocationTagBinding_locationTagBindingZonalExample(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` data "google_project" "project" { } resource "google_tags_tag_key" "key" { diff --git a/mmv1/third_party/terraform/tests/resource_vertex_ai_endpoint_test.go b/mmv1/third_party/terraform/tests/resource_vertex_ai_endpoint_test.go index 816a35bece7e..801a5fddf0ed 100644 --- a/mmv1/third_party/terraform/tests/resource_vertex_ai_endpoint_test.go +++ b/mmv1/third_party/terraform/tests/resource_vertex_ai_endpoint_test.go @@ -50,7 +50,7 @@ func TestAccVertexAIEndpoint_vertexAiEndpointNetwork(t *testing.T) { } func testAccVertexAIEndpoint_vertexAiEndpointNetwork(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_vertex_ai_endpoint" "endpoint" { name = "%{endpoint_name}" display_name = "sample-endpoint" @@ -98,7 +98,7 @@ data "google_project" "project" {} } func testAccVertexAIEndpoint_vertexAiEndpointNetworkUpdate(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_vertex_ai_endpoint" "endpoint" { name = "%{endpoint_name}" display_name = "new-sample-endpoint" diff --git a/mmv1/third_party/terraform/tests/resource_vertex_ai_index_endpoint_test.go b/mmv1/third_party/terraform/tests/resource_vertex_ai_index_endpoint_test.go index 32bddcf1cab4..e2e409e9ba68 100644 --- a/mmv1/third_party/terraform/tests/resource_vertex_ai_index_endpoint_test.go +++ b/mmv1/third_party/terraform/tests/resource_vertex_ai_index_endpoint_test.go @@ -44,7 +44,7 @@ func TestAccVertexAIIndexEndpoint_updated(t *testing.T) { } func testAccVertexAIIndexEndpoint_basic(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_vertex_ai_index_endpoint" "index_endpoint" { display_name = "sample-endpoint" description = "A sample vertex endpoint" @@ -77,7 +77,7 @@ data "google_project" "project" {} } func testAccVertexAIIndexEndpoint_updated(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_vertex_ai_index_endpoint" "index_endpoint" { display_name = "sample-endpoint-updated" description = "A sample vertex endpoint (updated)" diff --git a/mmv1/third_party/terraform/tests/resource_vertex_ai_index_test.go b/mmv1/third_party/terraform/tests/resource_vertex_ai_index_test.go index fe90ae22581f..95e85a93637c 100644 --- a/mmv1/third_party/terraform/tests/resource_vertex_ai_index_test.go +++ b/mmv1/third_party/terraform/tests/resource_vertex_ai_index_test.go @@ -50,7 +50,7 @@ func TestAccVertexAIIndex_updated(t *testing.T) { } func testAccVertexAIIndex_basic(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_storage_bucket" "bucket" { name = "tf-test-%{random_suffix}" location = "us-central1" @@ -104,7 +104,7 @@ resource "google_vertex_ai_index" "index" { } func testAccVertexAIIndex_updated(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_storage_bucket" "bucket" { name = "tf-test-%{random_suffix}" location = "us-central1" diff --git a/mmv1/third_party/terraform/tests/resource_vmwareengine_cluster_test.go.erb b/mmv1/third_party/terraform/tests/resource_vmwareengine_cluster_test.go.erb index d7fdb1629675..cc04441f5944 100644 --- a/mmv1/third_party/terraform/tests/resource_vmwareengine_cluster_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_vmwareengine_cluster_test.go.erb @@ -68,7 +68,7 @@ func TestAccVmwareengineCluster_vmwareEngineClusterUpdate(t *testing.T) { func testVmwareEngineClusterConfig(context map[string]interface{}, nodeCount int) string { context["node_count"] = nodeCount; - return Nprintf(` + return acctest.Nprintf(` resource "google_vmwareengine_cluster" "vmw-engine-ext-cluster" { provider = google-beta diff --git a/mmv1/third_party/terraform/tests/resource_vmwareengine_network_test.go.erb b/mmv1/third_party/terraform/tests/resource_vmwareengine_network_test.go.erb index cd1395e7867e..43cbae395c85 100644 --- a/mmv1/third_party/terraform/tests/resource_vmwareengine_network_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_vmwareengine_network_test.go.erb @@ -54,7 +54,7 @@ func TestAccVmwareengineNetwork_vmwareEngineNetworkUpdate(t *testing.T) { } func vmwareEngineNetworkConfigTemplate(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_vmwareengine_network" "default-nw" { provider = google-beta project = google_project_service.acceptance.project diff --git a/mmv1/third_party/terraform/tests/resource_vmwareengine_private_cloud_test.go.erb b/mmv1/third_party/terraform/tests/resource_vmwareengine_private_cloud_test.go.erb index 114b799b3357..c45e4ab7f397 100644 --- a/mmv1/third_party/terraform/tests/resource_vmwareengine_private_cloud_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_vmwareengine_private_cloud_test.go.erb @@ -67,7 +67,7 @@ func testPrivateCloudUpdateConfig(context map[string]interface{}, description st context["node_count"] = nodeCount context["description"] = description - return Nprintf(` + return acctest.Nprintf(` resource "google_vmwareengine_network" "default-nw" { provider = google-beta project = google_project_service.acceptance.project diff --git a/mmv1/third_party/terraform/tests/resource_vpc_access_connector_test.go b/mmv1/third_party/terraform/tests/resource_vpc_access_connector_test.go index 12ebd117f6b7..de42251884ed 100644 --- a/mmv1/third_party/terraform/tests/resource_vpc_access_connector_test.go +++ b/mmv1/third_party/terraform/tests/resource_vpc_access_connector_test.go @@ -32,7 +32,7 @@ func TestAccVPCAccessConnector_vpcAccessConnectorThroughput(t *testing.T) { } func testAccVPCAccessConnector_vpcAccessConnectorThroughput(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_vpc_access_connector" "connector" { name = "tf-test-vpc-con%{random_suffix}" subnet { diff --git a/mmv1/third_party/terraform/tests/resource_workstations_workstation_cluster_test.go.erb b/mmv1/third_party/terraform/tests/resource_workstations_workstation_cluster_test.go.erb index dce48d9fe2d7..f10a84fbafd2 100644 --- a/mmv1/third_party/terraform/tests/resource_workstations_workstation_cluster_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_workstations_workstation_cluster_test.go.erb @@ -44,7 +44,7 @@ func TestAccWorkstationsWorkstationCluster_update(t *testing.T) { } func testAccWorkstationsWorkstationCluster_update(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_workstations_workstation_cluster" "default" { provider = google-beta workstation_cluster_id = "tf-test-workstation-cluster%{random_suffix}" diff --git a/mmv1/third_party/terraform/tests/resource_workstations_workstation_config_test.go.erb b/mmv1/third_party/terraform/tests/resource_workstations_workstation_config_test.go.erb index ca656731144b..34d938753877 100644 --- a/mmv1/third_party/terraform/tests/resource_workstations_workstation_config_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_workstations_workstation_config_test.go.erb @@ -35,7 +35,7 @@ func TestAccWorkstationsWorkstationConfig_basic(t *testing.T) { } func testAccWorkstationsWorkstationConfig_basic(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_compute_network" "default" { provider = google-beta name = "tf-test-workstation-cluster%{random_suffix}" @@ -112,7 +112,7 @@ func TestAccWorkstationsWorkstationConfig_displayName(t *testing.T) { func testAccWorkstationsWorkstationConfig_displayName(context map[string]interface{}, update string) string { context["display_name"] = context["display_name"].(string) + update - return Nprintf(` + return acctest.Nprintf(` resource "google_compute_network" "default" { provider = google-beta name = "tf-test-workstation-cluster%{random_suffix}" @@ -179,7 +179,7 @@ func TestAccWorkstationsWorkstationConfig_persistentDirectories(t *testing.T) { } func testAccWorkstationsWorkstationConfig_persistentDirectories(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_compute_network" "default" { provider = google-beta name = "tf-test-workstation-cluster%{random_suffix}" @@ -258,7 +258,7 @@ func TestAccWorkstationsWorkstationConfig_update(t *testing.T) { } func testAccWorkstationsWorkstationConfig_update(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_compute_network" "default" { provider = google-beta name = "tf-test-workstation-cluster%{random_suffix}" @@ -350,7 +350,7 @@ func TestAccWorkstationsWorkstationConfig_updateHostDetails(t *testing.T) { } func testAccWorkstationsWorkstationConfig_updateHostDetailsDefault(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_compute_network" "default" { provider = google-beta name = "tf-test-workstation-cluster%{random_suffix}" @@ -403,7 +403,7 @@ resource "google_workstations_workstation_config" "default" { } func testAccWorkstationsWorkstationConfig_updateHostDetailsUpdated(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_compute_network" "default" { provider = google-beta name = "tf-test-workstation-cluster%{random_suffix}" @@ -457,7 +457,7 @@ resource "google_workstations_workstation_config" "default" { } func testAccWorkstationsWorkstationConfig_updateHostDetailsUnsetInstanceConfigs(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_compute_network" "default" { provider = google-beta name = "tf-test-workstation-cluster%{random_suffix}" @@ -538,7 +538,7 @@ func TestAccWorkstationsWorkstationConfig_updateWorkingDir(t *testing.T) { } func testAccWorkstationsWorkstationConfig_withCustomWorkingDir(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_compute_network" "default" { provider = google-beta name = "tf-test-workstation-cluster%{random_suffix}" @@ -576,7 +576,7 @@ resource "google_workstations_workstation_config" "default" { } func testAccWorkstationsWorkstationConfig_unsetWorkingDir(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_compute_network" "default" { provider = google-beta name = "tf-test-workstation-cluster%{random_suffix}" @@ -647,7 +647,7 @@ func TestAccWorkstationsWorkstationConfig_updatePersistentDirectorySourceSnapsho } func testAccWorkstationsWorkstationConfig_withSourceDiskSnapshot(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_compute_network" "default" { provider = google-beta name = "tf-test-workstation-cluster%{random_suffix}" @@ -704,7 +704,7 @@ resource "google_workstations_workstation_config" "default" { } func testAccWorkstationsWorkstationConfig_withUpdatedSourceDiskSnapshot(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_compute_network" "default" { provider = google-beta name = "tf-test-workstation-cluster%{random_suffix}" diff --git a/mmv1/third_party/terraform/tests/resource_workstations_workstation_test.go.erb b/mmv1/third_party/terraform/tests/resource_workstations_workstation_test.go.erb index f83f2e8e920a..1938bcfd7ffc 100644 --- a/mmv1/third_party/terraform/tests/resource_workstations_workstation_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_workstations_workstation_test.go.erb @@ -45,7 +45,7 @@ func TestAccWorkstationsWorkstation_update(t *testing.T) { func testAccWorkstationsWorkstation_basic(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_compute_network" "default" { name = "tf-test-workstation-cluster%{random_suffix}" auto_create_subnetworks = false @@ -93,7 +93,7 @@ resource "google_workstations_workstation" "default" { } func testAccWorkstationsWorkstation_modified(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` resource "google_compute_network" "default" { name = "tf-test-workstation-cluster%{random_suffix}" auto_create_subnetworks = false diff --git a/mmv1/third_party/terraform/tpgresource/utils.go b/mmv1/third_party/terraform/tpgresource/utils.go index 0f56763af2eb..3722678026c7 100644 --- a/mmv1/third_party/terraform/tpgresource/utils.go +++ b/mmv1/third_party/terraform/tpgresource/utils.go @@ -289,17 +289,6 @@ func ExtractFirstMapConfig(m []interface{}) map[string]interface{} { return m[0].(map[string]interface{}) } -// This is a Printf sibling (Nprintf; Named Printf), which handles strings like -// Nprintf("Hello %{target}!", map[string]interface{}{"target":"world"}) == "Hello world!". -// This is particularly useful for generated tests, where we don't want to use Printf, -// since that would require us to generate a very particular ordering of arguments. -func Nprintf(format string, params map[string]interface{}) string { - for key, val := range params { - format = strings.Replace(format, "%{"+key+"}", fmt.Sprintf("%v", val), -1) - } - return format -} - // ServiceAccountFQN will attempt to generate the fully qualified name in the format of: // // "projects/(-|)/serviceAccounts/@.iam.gserviceaccount.com" diff --git a/mmv1/third_party/terraform/utils/utils.go b/mmv1/third_party/terraform/utils/utils.go index 3f27c9ab1f0b..553c18e934fa 100644 --- a/mmv1/third_party/terraform/utils/utils.go +++ b/mmv1/third_party/terraform/utils/utils.go @@ -7,6 +7,7 @@ import ( "regexp" "time" + "github.com/hashicorp/terraform-provider-google/google/acctest" "github.com/hashicorp/terraform-provider-google/google/tpgresource" transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" @@ -218,9 +219,9 @@ func lockedCall(lockKey string, f func() error) error { // since that would require us to generate a very particular ordering of arguments. // // Deprecated: For backward compatibility Nprintf is still working, -// but all new code should use Nprintf in the tpgresource package instead. +// but all new code should use Nprintf in the acctest package instead. func Nprintf(format string, params map[string]interface{}) string { - return tpgresource.Nprintf(format, params) + return acctest.Nprintf(format, params) } // serviceAccountFQN will attempt to generate the fully qualified name in the format of: diff --git a/mmv1/third_party/validator/tests/source/environment_test.go b/mmv1/third_party/validator/tests/source/environment_test.go index 1d589c4210a6..20e46817c327 100644 --- a/mmv1/third_party/validator/tests/source/environment_test.go +++ b/mmv1/third_party/validator/tests/source/environment_test.go @@ -5,8 +5,6 @@ import ( "os" "path/filepath" "testing" - - google "github.com/GoogleCloudPlatform/terraform-google-conversion/v2/tfplan2cai/converters/google/resources" ) const ( @@ -26,10 +24,6 @@ const ( defaultServiceAccount = "meep@foobar.iam.gserviceaccount.com" ) -func Nprintf(format string, params map[string]interface{}) string { - return google.Nprintf(format, params) -} - // AccTestPreCheck ensures at least one of the project env variables is set. func getTestProjectFromEnv() string { project := multiEnvSearch([]string{"TEST_PROJECT", "GOOGLE_PROJECT"}) diff --git a/tools/missing-test-detector/testdata/covered_resource_test.go b/tools/missing-test-detector/testdata/covered_resource_test.go index c49864329bd9..eff1b1ceee67 100644 --- a/tools/missing-test-detector/testdata/covered_resource_test.go +++ b/tools/missing-test-detector/testdata/covered_resource_test.go @@ -21,7 +21,7 @@ func TestAccCoveredResource(t *testing.T) { } func testAccCoveredResource() string { - return fmt.Sprintf(Nprintf(` + return fmt.Sprintf(acctest.Nprintf(` resource "covered_resource" "resource" { field_one = "value-one" field_four { @@ -35,7 +35,7 @@ resource "covered_resource" "resource" { } func testAccCoveredResource_update() string { - return Nprintf(` + return acctest.Nprintf(` resource "covered_resource" "resource" { field_two { field_three = "value-two" diff --git a/tools/missing-test-detector/testdata/multiple_resource_test.go b/tools/missing-test-detector/testdata/multiple_resource_test.go index 41bf3294f001..a9e6fff7dd15 100644 --- a/tools/missing-test-detector/testdata/multiple_resource_test.go +++ b/tools/missing-test-detector/testdata/multiple_resource_test.go @@ -23,7 +23,7 @@ func TestAccMultipleResources(t *testing.T) { } func testAccMultipleResources() string { - return Nprintf(` + return acctest.Nprintf(` resource "resource_one" "instance_one" { field_one = "value-one" } @@ -42,7 +42,7 @@ resource "resource_two" "instace_two" { } func testAccMultipleResources_update() string { - return Nprintf(` + return acctest.Nprintf(` resource "resource_one" "instance_one" { field_one = "value-two" } diff --git a/tools/missing-test-detector/testdata/uncovered_resource_test.go b/tools/missing-test-detector/testdata/uncovered_resource_test.go index 43efaba9ec4b..7bc0090d544d 100644 --- a/tools/missing-test-detector/testdata/uncovered_resource_test.go +++ b/tools/missing-test-detector/testdata/uncovered_resource_test.go @@ -17,7 +17,7 @@ func TestAccUncoveredResource(t *testing.T) { } func testAccUncoveredResource() string { - return Nprintf(` + return acctest.Nprintf(` resource "uncovered_resource" "resource" { field_two { field_three = "value-two" diff --git a/tpgtools/templates/test_file.go.tmpl b/tpgtools/templates/test_file.go.tmpl index 3ab0be3c5c25..8fdd0e2120d6 100644 --- a/tpgtools/templates/test_file.go.tmpl +++ b/tpgtools/templates/test_file.go.tmpl @@ -105,7 +105,7 @@ func TestAcc{{$.PathType}}_{{$s.TestSlug}}(t *testing.T) { {{- range $s := $.TestSamples -}} {{ range $se := $s.EnumerateWithUpdateSamples }} func testAcc{{$.PathType}}_{{$se.TestSlug}}(context map[string]interface{}) string { - return Nprintf(` + return acctest.Nprintf(` {{ $se.GenerateHCL false }} `, context) } From af4241232c567f82123928f6c968b8e86af64ad7 Mon Sep 17 00:00:00 2001 From: Shuya Ma <87669292+shuyama1@users.noreply.github.com> Date: Thu, 29 Jun 2023 09:28:42 -0700 Subject: [PATCH 12/55] Convert docsite config.toml to hugo.yaml (#8209) --- docs/config.toml | 19 ------------------- docs/hugo.yaml | 22 ++++++++++++++++++++++ 2 files changed, 22 insertions(+), 19 deletions(-) delete mode 100644 docs/config.toml create mode 100644 docs/hugo.yaml diff --git a/docs/config.toml b/docs/config.toml deleted file mode 100644 index 8d6712b0b96c..000000000000 --- a/docs/config.toml +++ /dev/null @@ -1,19 +0,0 @@ -baseURL = 'https://googlecloudplatform.github.io/magic-modules/' -languageCode = 'en-us' -title = 'Magic Modules' - -enableGitInfo = true -disableKinds = ['taxonomy', 'taxonomyTerm'] - -[module] -[[module.imports]] -path = 'github.com/alex-shpak/hugo-book' - -[params] - BookTheme = 'light' - BookLogo = 'magic-modules.svg' - BookRepo = 'https://github.com/GoogleCloudPlatform/magic-modules' - BookCommitPath = 'commit' - BookEditPath = 'edit/main/docs' - BookComments = false - BookSection = '*' diff --git a/docs/hugo.yaml b/docs/hugo.yaml new file mode 100644 index 000000000000..f03eba652fe9 --- /dev/null +++ b/docs/hugo.yaml @@ -0,0 +1,22 @@ +baseURL: https://googlecloudplatform.github.io/magic-modules/ +languageCode: en-us +title: Magic Modules +enableGitInfo: true +disableKinds: + - taxonomy + - term +module: + imports: + - path: github.com/alex-shpak/hugo-book +params: + BookTheme: light + BookLogo: magic-modules.svg + BookRepo: https://github.com/GoogleCloudPlatform/magic-modules + BookCommitPath: commit + BookEditPath: edit/main/docs + BookComments: false + BookSection: '*' +markup: + goldmark: + renderer: + unsafe: true \ No newline at end of file From 108c30bf7c5a621f386f96aee0df613f0b8e9c88 Mon Sep 17 00:00:00 2001 From: Joshua Wright <19779568+joshw123@users.noreply.github.com> Date: Thu, 29 Jun 2023 18:15:19 +0100 Subject: [PATCH 13/55] Update Replacement Method on Example (#8210) Co-authored-by: Shuya Ma <87669292+shuyama1@users.noreply.github.com> --- .../website/docs/r/compute_instance_group_manager.html.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mmv1/third_party/terraform/website/docs/r/compute_instance_group_manager.html.markdown b/mmv1/third_party/terraform/website/docs/r/compute_instance_group_manager.html.markdown index db82546f9c1e..8312acd499d5 100644 --- a/mmv1/third_party/terraform/website/docs/r/compute_instance_group_manager.html.markdown +++ b/mmv1/third_party/terraform/website/docs/r/compute_instance_group_manager.html.markdown @@ -174,7 +174,7 @@ update_policy { type = "PROACTIVE" minimal_action = "REPLACE" most_disruptive_allowed_action = "REPLACE" - max_surge_percent = 20 + max_surge_fixed = 0 max_unavailable_fixed = 2 min_ready_sec = 50 replacement_method = "RECREATE" From c4f83cd969c197dfaff738492dc68bf00ea533a5 Mon Sep 17 00:00:00 2001 From: Thomas Rodgers Date: Thu, 29 Jun 2023 10:25:32 -0700 Subject: [PATCH 14/55] Migrate monitoring monitored project to mmv1 (#8008) * Migrate monitoring monitored project to mmv1 * Use function from tpgresource package * Remove extra blank line --- .../products/monitoring/MonitoredProject.yaml | 59 +++++++++++++++++++ .../monitoring_monitored_project.go.erb | 44 ++++++++++++++ .../monitoring_monitored_project.go.erb | 25 ++++++++ .../monitoring_monitored_project.go.erb | 20 +++++++ .../monitoring_monitored_project_basic.tf.erb | 10 ++++ .../monitoring/beta/monitored_project.yaml | 17 ------ .../monitoring/beta/tpgtools_product.yaml | 8 --- .../monitoring/monitored_project.yaml | 17 ------ .../monitoring/samples/metricsscope/meta.yaml | 1 - .../samples/monitoredproject/meta.yaml | 1 - .../monitoring/tpgtools_product.yaml | 7 --- 11 files changed, 158 insertions(+), 51 deletions(-) create mode 100644 mmv1/products/monitoring/MonitoredProject.yaml create mode 100644 mmv1/templates/terraform/custom_check_destroy/monitoring_monitored_project.go.erb create mode 100644 mmv1/templates/terraform/decoders/monitoring_monitored_project.go.erb create mode 100644 mmv1/templates/terraform/encoders/monitoring_monitored_project.go.erb create mode 100644 mmv1/templates/terraform/examples/monitoring_monitored_project_basic.tf.erb delete mode 100644 tpgtools/overrides/monitoring/beta/monitored_project.yaml delete mode 100644 tpgtools/overrides/monitoring/beta/tpgtools_product.yaml delete mode 100644 tpgtools/overrides/monitoring/monitored_project.yaml delete mode 100644 tpgtools/overrides/monitoring/samples/metricsscope/meta.yaml delete mode 100644 tpgtools/overrides/monitoring/samples/monitoredproject/meta.yaml delete mode 100644 tpgtools/overrides/monitoring/tpgtools_product.yaml diff --git a/mmv1/products/monitoring/MonitoredProject.yaml b/mmv1/products/monitoring/MonitoredProject.yaml new file mode 100644 index 000000000000..96a18785697e --- /dev/null +++ b/mmv1/products/monitoring/MonitoredProject.yaml @@ -0,0 +1,59 @@ +# Copyright 2023 Google Inc. +# Licensed under the Apache License, Version 2.0 (the License); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +--- !ruby/object:Api::Resource +name: MonitoredProject +base_url: v1/locations/global/metricsScopes +create_url: v1/locations/global/metricsScopes/{{metrics_scope}}/projects +delete_url: v1/locations/global/metricsScopes/{{metrics_scope}}/projects/{{name}} +self_link: v1/locations/global/metricsScopes/{{metrics_scope}} +id_format: v1/locations/global/metricsScopes/{{metrics_scope}}/projects/{{name}} +import_format: + - v1/locations/global/metricsScopes/{{metrics_scope}}/projects/{{name}} +references: !ruby/object:Api::Resource::ReferenceLinks + guides: + 'Official Documentation': 'https://cloud.google.com/monitoring/settings/manage-api' + api: 'https://cloud.google.com/monitoring/api/ref_v3/rest/v1/locations.global.metricsScopes.projects' +nested_query: !ruby/object:Api::Resource::NestedQuery + keys: + - monitoredProjects +description: "A [project being monitored](https://cloud.google.com/monitoring/settings/multiple-projects#create-multi) by a Metrics Scope." +immutable: true +custom_code: !ruby/object:Provider::Terraform::CustomCode + encoder: templates/terraform/encoders/monitoring_monitored_project.go.erb + decoder: templates/terraform/decoders/monitoring_monitored_project.go.erb + test_check_destroy: templates/terraform/custom_check_destroy/monitoring_monitored_project.go.erb +examples: + - !ruby/object:Provider::Terraform::Examples + name: 'monitoring_monitored_project_basic' + primary_resource_id: 'primary' + vars: + monitored_project: 'm-id' + test_env_vars: + org_id: :ORG_ID + project_id: :PROJECT_NAME +parameters: + - !ruby/object:Api::Type::String + name: metricsScope + description: 'Required. The resource name of the existing Metrics Scope that will monitor this project. Example: locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}' + url_param_only: true + required: true +properties: + - !ruby/object:Api::Type::String + name: name + description: 'Immutable. The resource name of the `MonitoredProject`. On input, the resource name includes the scoping project ID and monitored project ID. On output, it contains the equivalent project numbers. Example: `locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}/projects/{MONITORED_PROJECT_ID_OR_NUMBER}`' + required: true + - !ruby/object:Api::Type::String + name: createTime + description: Output only. The time when this `MonitoredProject` was created. + output: true diff --git a/mmv1/templates/terraform/custom_check_destroy/monitoring_monitored_project.go.erb b/mmv1/templates/terraform/custom_check_destroy/monitoring_monitored_project.go.erb new file mode 100644 index 000000000000..58b3cd3ab656 --- /dev/null +++ b/mmv1/templates/terraform/custom_check_destroy/monitoring_monitored_project.go.erb @@ -0,0 +1,44 @@ +<%# The license inside this block applies to this file. + # Copyright 2023 Google Inc. + # Licensed under the Apache License, Version 2.0 (the "License"); + # you may not use this file except in compliance with the License. + # You may obtain a copy of the License at + # + # http://www.apache.org/licenses/LICENSE-2.0 + # + # Unless required by applicable law or agreed to in writing, software + # distributed under the License is distributed on an "AS IS" BASIS, + # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + # See the License for the specific language governing permissions and + # limitations under the License. +-%> +config := GoogleProviderConfig(t) + +url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{MonitoringBasePath}}v1/locations/global/metricsScopes/{{metrics_scope}}") +if err != nil { + return err +} + +billingProject := "" + +if config.BillingProject != "" { + billingProject = config.BillingProject +} + +res, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ + Config: config, + Method: "GET", + Project: billingProject, + RawURL: url, + UserAgent: config.UserAgent, +}) + +rName := tpgresource.GetResourceNameFromSelfLink(rs.Primary.Attributes["name"]) +project, err := config.NewResourceManagerClient(config.UserAgent).Projects.Get(rName).Do() +rName = strconv.FormatInt(project.ProjectNumber, 10) + +for _, monitoredProject := range res["monitoredProjects"].([]any) { + if strings.HasSuffix(monitoredProject.(map[string]any)["name"].(string), rName) { + return fmt.Errorf("MonitoringMonitoredProject still exists at %s", url) + } +} diff --git a/mmv1/templates/terraform/decoders/monitoring_monitored_project.go.erb b/mmv1/templates/terraform/decoders/monitoring_monitored_project.go.erb new file mode 100644 index 000000000000..96e735c31d18 --- /dev/null +++ b/mmv1/templates/terraform/decoders/monitoring_monitored_project.go.erb @@ -0,0 +1,25 @@ +<%# The license inside this block applies to this file. + # Copyright 2023 Google Inc. + # Licensed under the Apache License, Version 2.0 (the "License"); + # you may not use this file except in compliance with the License. + # You may obtain a copy of the License at + # + # http://www.apache.org/licenses/LICENSE-2.0 + # + # Unless required by applicable law or agreed to in writing, software + # distributed under the License is distributed on an "AS IS" BASIS, + # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + # See the License for the specific language governing permissions and + # limitations under the License. +-%> +config := meta.(*transport_tpg.Config) +name := res["name"].(string) +name = tpgresource.GetResourceNameFromSelfLink(name) +if name != "" { + project, err := config.NewResourceManagerClient(config.UserAgent).Projects.Get(name).Do() + if err != nil { + return nil, err + } + res["name"] = project.Name +} +return res, nil diff --git a/mmv1/templates/terraform/encoders/monitoring_monitored_project.go.erb b/mmv1/templates/terraform/encoders/monitoring_monitored_project.go.erb new file mode 100644 index 000000000000..3736b6609811 --- /dev/null +++ b/mmv1/templates/terraform/encoders/monitoring_monitored_project.go.erb @@ -0,0 +1,20 @@ +<%- # the license inside this block applies to this file + # Copyright 2023 Google Inc. + # Licensed under the Apache License, Version 2.0 (the "License"); + # you may not use this file except in compliance with the License. + # You may obtain a copy of the License at + # + # http://www.apache.org/licenses/LICENSE-2.0 + # + # Unless required by applicable law or agreed to in writing, software + # distributed under the License is distributed on an "AS IS" BASIS, + # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + # See the License for the specific language governing permissions and + # limitations under the License. +-%> +name := d.Get("name").(string) +name = tpgresource.GetResourceNameFromSelfLink(name) +metricsScope := d.Get("metrics_scope").(string) +metricsScope = tpgresource.GetResourceNameFromSelfLink(metricsScope) +obj["name"] = fmt.Sprintf("locations/global/metricsScopes/%s/projects/%s", metricsScope, name) +return obj, nil diff --git a/mmv1/templates/terraform/examples/monitoring_monitored_project_basic.tf.erb b/mmv1/templates/terraform/examples/monitoring_monitored_project_basic.tf.erb new file mode 100644 index 000000000000..994d9b66d14b --- /dev/null +++ b/mmv1/templates/terraform/examples/monitoring_monitored_project_basic.tf.erb @@ -0,0 +1,10 @@ +resource "google_monitoring_monitored_project" "<%= ctx[:primary_resource_id] %>" { + metrics_scope = "<%= ctx[:test_env_vars]['project_id'] %>" + name = google_project.basic.name +} + +resource "google_project" "basic" { + project_id = "<%= ctx[:vars]['monitored_project'] %>" + name = "<%= ctx[:vars]['monitored_project'] %>" + org_id = "<%= ctx[:test_env_vars]['org_id'] %>" +} diff --git a/tpgtools/overrides/monitoring/beta/monitored_project.yaml b/tpgtools/overrides/monitoring/beta/monitored_project.yaml deleted file mode 100644 index 7cf83cf69dcc..000000000000 --- a/tpgtools/overrides/monitoring/beta/monitored_project.yaml +++ /dev/null @@ -1,17 +0,0 @@ -# Copyright 2021 Google LLC. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -- type: APPEND_TO_BASE_PATH - details: - string: v1 diff --git a/tpgtools/overrides/monitoring/beta/tpgtools_product.yaml b/tpgtools/overrides/monitoring/beta/tpgtools_product.yaml deleted file mode 100644 index 1f6c89e7288d..000000000000 --- a/tpgtools/overrides/monitoring/beta/tpgtools_product.yaml +++ /dev/null @@ -1,8 +0,0 @@ -## product level overrides - -- type: PRODUCT_BASE_PATH - details: - skip: true -- type: PRODUCT_DOCS_SECTION - details: - docssection: Cloud (Stackdriver) Monitoring diff --git a/tpgtools/overrides/monitoring/monitored_project.yaml b/tpgtools/overrides/monitoring/monitored_project.yaml deleted file mode 100644 index 7cf83cf69dcc..000000000000 --- a/tpgtools/overrides/monitoring/monitored_project.yaml +++ /dev/null @@ -1,17 +0,0 @@ -# Copyright 2021 Google LLC. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -- type: APPEND_TO_BASE_PATH - details: - string: v1 diff --git a/tpgtools/overrides/monitoring/samples/metricsscope/meta.yaml b/tpgtools/overrides/monitoring/samples/metricsscope/meta.yaml deleted file mode 100644 index 8b137891791f..000000000000 --- a/tpgtools/overrides/monitoring/samples/metricsscope/meta.yaml +++ /dev/null @@ -1 +0,0 @@ - diff --git a/tpgtools/overrides/monitoring/samples/monitoredproject/meta.yaml b/tpgtools/overrides/monitoring/samples/monitoredproject/meta.yaml deleted file mode 100644 index 8b137891791f..000000000000 --- a/tpgtools/overrides/monitoring/samples/monitoredproject/meta.yaml +++ /dev/null @@ -1 +0,0 @@ - diff --git a/tpgtools/overrides/monitoring/tpgtools_product.yaml b/tpgtools/overrides/monitoring/tpgtools_product.yaml deleted file mode 100644 index a5be7cfe3e5c..000000000000 --- a/tpgtools/overrides/monitoring/tpgtools_product.yaml +++ /dev/null @@ -1,7 +0,0 @@ -## product level overrides -- type: PRODUCT_BASE_PATH - details: - skip: true -- type: PRODUCT_DOCS_SECTION - details: - docssection: Cloud (Stackdriver) Monitoring From b297ea59e4130e8b12f371a99c13c399d89c613c Mon Sep 17 00:00:00 2001 From: Zhenhua Li Date: Thu, 29 Jun 2023 11:43:09 -0700 Subject: [PATCH 15/55] Rerun replaying mode after recording mode (#7982) * Rerun replaying mode after recording mode * Fix bug * Fix bug * Build log * Add comments * Fix syntax error * List fixtures * Modify style * Remove comments * Modify style * Add more details to the error message * Modify the error message * Remove the line 'All tests passed' --- .../test_terraform_vcr.sh | 39 ++++++++++++++++++- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/.ci/containers/gcb-terraform-vcr-tester/test_terraform_vcr.sh b/.ci/containers/gcb-terraform-vcr-tester/test_terraform_vcr.sh index 11ee13c6859d..b62e4c6e9dab 100755 --- a/.ci/containers/gcb-terraform-vcr-tester/test_terraform_vcr.sh +++ b/.ci/containers/gcb-terraform-vcr-tester/test_terraform_vcr.sh @@ -68,6 +68,8 @@ mkdir testlog mkdir testlog/replaying mkdir testlog/recording mkdir testlog/recording_build +mkdir testlog/replaying_after_recording +mkdir testlog/replaying_build_after_recording export GOOGLE_REGION=us-central1 export GOOGLE_ZONE=us-central1-a @@ -217,6 +219,7 @@ if [[ -n $FAILED_TESTS_PATTERN ]]; then RECORDING_FAILED_TESTS=$(grep "^--- FAIL: TestAcc" recording_test.log | awk -v pr_number=$pr_number -v build_id=$build_id '{print "`"$3"`[[Error message](https://storage.cloud.google.com/ci-vcr-logs/beta/refs/heads/auto-pr-"pr_number"/artifacts/"build_id"/build-log/recording_build/"$3"_recording_test.log)] [[Debug log](https://storage.cloud.google.com/ci-vcr-logs/beta/refs/heads/auto-pr-"pr_number"/artifacts/"build_id"/recording/"$3".log)]"}') RECORDING_PASSED_TESTS=$(grep "^--- PASS: TestAcc" recording_test.log | awk -v pr_number=$pr_number -v build_id=$build_id '{print "`"$3"`[[Debug log](https://storage.cloud.google.com/ci-vcr-logs/beta/refs/heads/auto-pr-"pr_number"/artifacts/"build_id"/recording/"$3".log)]"}') + RECORDING_PASSED_TEST_LIST=$(grep "^--- PASS: TestAcc" recording_test.log | awk '{print $3}') comment="" RECORDING_PASSED_TESTS_COUNT=0 @@ -224,6 +227,40 @@ if [[ -n $FAILED_TESTS_PATTERN ]]; then if [[ -n $RECORDING_PASSED_TESTS ]]; then comment+="Tests passed during RECORDING mode:${NEWLINE} $RECORDING_PASSED_TESTS ${NEWLINE}${NEWLINE}" RECORDING_PASSED_TESTS_COUNT=$(echo "$RECORDING_PASSED_TESTS" | wc -l) + comment+="##### Rerun these tests in REPLAYING mode to catch issues ${NEWLINE}${NEWLINE}" + + # Rerun passed tests in REPLAYING mode 3 times to catch issues + export VCR_MODE=REPLAYING + count=3 + parallel --jobs 16 TF_LOG=DEBUG TF_LOG_PATH_MASK=$local_path/testlog/replaying_after_recording/%s.log TF_ACC=1 TF_SCHEMA_PANIC_ON_ERROR=1 go test $GOOGLE_TEST_DIRECTORY -parallel 1 -count=$count -v -run="{}$" -timeout 120m -ldflags="-X=github.com/hashicorp/terraform-provider-google-beta/version.ProviderVersion=acc" ">" testlog/replaying_build_after_recording/{}_replaying_test.log ::: $RECORDING_PASSED_TEST_LIST + + test_exit_code=$? + + # Concatenate recording build logs to one file + for test in $RECORDING_PASSED_TEST_LIST + do + cat testlog/replaying_build_after_recording/${test}_replaying_test.log >> replaying_build_after_recording.log + done + + # store replaying individual build logs + gsutil -h "Content-Type:text/plain" -m -q cp testlog/replaying_build_after_recording/* gs://ci-vcr-logs/beta/refs/heads/auto-pr-$pr_number/artifacts/$build_id/build-log/replaying_build_after_recording/ + + # store replaying test logs + gsutil -h "Content-Type:text/plain" -m -q cp testlog/replaying_after_recording/* gs://ci-vcr-logs/beta/refs/heads/auto-pr-$pr_number/artifacts/$build_id/replaying_after_recording/ + + REPLAYING_FAILED_TESTS=$(grep "^--- FAIL: TestAcc" replaying_build_after_recording.log | sort -u -t' ' -k3,3 | awk -v pr_number=$pr_number -v build_id=$build_id '{print "`"$3"`[[Error message](https://storage.cloud.google.com/ci-vcr-logs/beta/refs/heads/auto-pr-"pr_number"/artifacts/"build_id"/build-log/replaying_build_after_recording/"$3"_replaying_test.log)] [[Debug log](https://storage.cloud.google.com/ci-vcr-logs/beta/refs/heads/auto-pr-"pr_number"/artifacts/"build_id"/replaying_after_recording/"$3".log)]"}') + if [[ -n $REPLAYING_FAILED_TESTS ]]; then + comment+="Tests failed when rerunning REPLAYING mode:${NEWLINE} $REPLAYING_FAILED_TESTS ${NEWLINE}${NEWLINE}" + comment+="Tests failed due to non-determinism or randomness when the VCR replayed the response after the HTTP request was made.${NEWLINE}${NEWLINE}" + comment+="Please fix these to complete your PR. If you do not know how VCR tests work, please work with the code reviewer to figure out the reason why the tests failed and fix the tests.${NEWLINE}" + else + comment+="All tests passed after rerunning REPLAYING mode.${NEWLINE}" + fi + comment+="${NEWLINE}---${NEWLINE}" + + # Clear replaying-log folder + rm testlog/replaying_after_recording/* + rm testlog/replaying_build_after_recording/* fi if [[ -n $RECORDING_FAILED_TESTS ]]; then @@ -239,8 +276,6 @@ if [[ -n $FAILED_TESTS_PATTERN ]]; then elif [[ $test_exit_code -ne 0 ]]; then # check for any uncaught errors in RECORDING mode comment+="Errors occurred during RECORDING mode. Please fix them to complete your PR${NEWLINE}" - else - comment+="All tests passed${NEWLINE}" fi fi From 72920d745611bf5c27b199e0ae71dbefa533335c Mon Sep 17 00:00:00 2001 From: Zhenhua Li Date: Thu, 29 Jun 2023 14:21:59 -0700 Subject: [PATCH 16/55] Move plugin framework provider and test utility files to packages (#8226) * Move plugin framework provider and test utility files to the specific package * Don't replace Nprintf * Fix the rebasing error * Fix tgc --- mmv1/provider/terraform/common~compile.yaml | 7 + mmv1/provider/terraform/common~copy.yaml | 7 + mmv1/provider/terraform_validator.rb | 2 +- .../acctest/framework_test_utils.go.erb | 23 + .../terraform/acctest/provider_test_utils.go | 30 ++ .../terraform/acctest/test_utils.go | 68 --- .../{utils => acctest}/test_utils.go.erb | 73 ++- .../terraform/acctest/vcr_utils.go | 473 +++++++++++++++++- .../framework_provider_test.go.erb | 95 ---- .../framework_provider.go.erb | 10 +- .../framework_provider_internal_test.go | 84 ++++ .../framework_validators.go | 2 +- mmv1/third_party/terraform/main.go.erb | 5 +- .../provider/provider_internal_test.go | 9 - ...s_context_manager_access_policy_sweeper.go | 6 +- .../resource_composer_environment_sweeper.go | 3 +- ..._compute_instance_group_manager_sweeper.go | 5 +- .../resource_compute_instance_sweeper.go | 5 +- ...e_region_instance_group_manager_sweeper.go | 5 +- .../resource_container_cluster_sweeper.go | 5 +- .../resource_google_project_sweeper.go | 6 +- .../data_source_dns_managed_zone_test.go.erb | 2 +- .../data_source_dns_record_set_test.go.erb | 2 +- ...ificatemanager_certificate_upgrade_test.go | 3 +- ...esource_cloudbuild_trigger_upgrade_test.go | 2 +- .../resource_logging_bucket_config_test.go | 4 +- .../terraform/utils/provider_test.go.erb | 2 +- .../utils/provider_test_utils.go.erb | 23 +- .../third_party/terraform/utils/test_utils.go | 45 ++ mmv1/third_party/terraform/utils/vcr_utils.go | 461 +---------------- mmv1/third_party/validator/test_utils.go | 17 + 31 files changed, 782 insertions(+), 702 deletions(-) delete mode 100644 mmv1/third_party/terraform/acctest/test_utils.go rename mmv1/third_party/terraform/{utils => acctest}/test_utils.go.erb (64%) rename mmv1/third_party/terraform/{utils => fwprovider}/framework_provider.go.erb (98%) create mode 100644 mmv1/third_party/terraform/fwprovider/framework_provider_internal_test.go rename mmv1/third_party/terraform/{framework_utils => fwprovider}/framework_validators.go (99%) create mode 100644 mmv1/third_party/terraform/utils/test_utils.go create mode 100644 mmv1/third_party/validator/test_utils.go diff --git a/mmv1/provider/terraform/common~compile.yaml b/mmv1/provider/terraform/common~compile.yaml index 8818b42c723d..3649796c4b86 100644 --- a/mmv1/provider/terraform/common~compile.yaml +++ b/mmv1/provider/terraform/common~compile.yaml @@ -85,6 +85,13 @@ '<%= dir -%>/fwmodels/<%= fname.delete_suffix(".erb") -%>': 'third_party/terraform/fwmodels/<%= fname -%>' <% end -%> +<% + Dir["third_party/terraform/fwprovider/*.go.erb"].each do |file_path| + fname = file_path.split('/')[-1] +-%> +'<%= dir -%>/fwprovider/<%= fname.delete_suffix(".erb") -%>': 'third_party/terraform/fwprovider/<%= fname -%>' +<% end -%> + <% Dir["third_party/terraform/fwtransport/*.go.erb"].each do |file_path| fname = file_path.split('/')[-1] diff --git a/mmv1/provider/terraform/common~copy.yaml b/mmv1/provider/terraform/common~copy.yaml index 830e9bed78db..e157b19dbc35 100644 --- a/mmv1/provider/terraform/common~copy.yaml +++ b/mmv1/provider/terraform/common~copy.yaml @@ -98,6 +98,13 @@ '<%= dir -%>/fwmodels/<%= fname -%>': 'third_party/terraform/fwmodels/<%= fname -%>' <% end -%> +<% + Dir["third_party/terraform/fwprovider/*.go"].each do |file_path| + fname = file_path.split('/')[-1] +-%> +'<%= dir -%>/fwprovider/<%= fname -%>': 'third_party/terraform/fwprovider/<%= fname -%>' +<% end -%> + <% Dir["third_party/terraform/fwtransport/*.go"].each do |file_path| fname = file_path.split('/')[-1] diff --git a/mmv1/provider/terraform_validator.rb b/mmv1/provider/terraform_validator.rb index 14ee84aa5d88..c3ae1533a3f7 100644 --- a/mmv1/provider/terraform_validator.rb +++ b/mmv1/provider/terraform_validator.rb @@ -366,7 +366,7 @@ def copy_common_files(output_folder, generate_code, _generate_docs) ['converters/google/resources/utils.go', 'third_party/terraform/utils/utils.go'], ['converters/google/resources/acctest/test_utils.go', - 'third_party/terraform/acctest/test_utils.go'], + 'third_party/validator/test_utils.go'], ['converters/google/resources/tpgresource/utils.go', 'third_party/terraform/tpgresource/utils.go'], ['converters/google/resources/iam_bigquery_dataset.go', diff --git a/mmv1/third_party/terraform/acctest/framework_test_utils.go.erb b/mmv1/third_party/terraform/acctest/framework_test_utils.go.erb index 4b818f1bae9b..ac072c15c1c8 100644 --- a/mmv1/third_party/terraform/acctest/framework_test_utils.go.erb +++ b/mmv1/third_party/terraform/acctest/framework_test_utils.go.erb @@ -2,10 +2,15 @@ package acctest import ( + "context" "fmt" + "log" "reflect" "regexp" "strings" + "testing" + + "github.com/hashicorp/terraform-plugin-framework/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" @@ -14,6 +19,24 @@ import ( "github.com/hashicorp/terraform-provider-google/google/tpgresource" ) +func GetFwTestProvider(t *testing.T) *frameworkTestProvider { + configsLock.RLock() + fwProvider, ok := fwProviders[t.Name()] + configsLock.RUnlock() + if ok { + return fwProvider + } + + var diags diag.Diagnostics + p := NewFrameworkTestProvider(t.Name()) + configureApiClient(context.Background(), &p.FrameworkProvider, &diags) + if diags.HasError() { + log.Fatalf("%d errors when configuring test provider client: first is %s", diags.ErrorsCount(), diags.Errors()[0].Detail()) + } + + return p +} + // General test utils // TestExtractResourceAttr navigates a test's state to find the specified resource (or data source) attribute and makes the value diff --git a/mmv1/third_party/terraform/acctest/provider_test_utils.go b/mmv1/third_party/terraform/acctest/provider_test_utils.go index eb543872c17d..bffc9425678e 100644 --- a/mmv1/third_party/terraform/acctest/provider_test_utils.go +++ b/mmv1/third_party/terraform/acctest/provider_test_utils.go @@ -1,6 +1,7 @@ package acctest import ( + "context" "fmt" "io/ioutil" "os" @@ -9,9 +10,11 @@ import ( "time" "github.com/hashicorp/terraform-provider-google/google/envvar" + "github.com/hashicorp/terraform-provider-google/google/provider" transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" ) @@ -95,6 +98,33 @@ var MasterBillingAccountEnvVars = envvar.MasterBillingAccountEnvVars // but all new code should use PapDescriptionEnvVars in the envvar package instead. var PapDescriptionEnvVars = envvar.PapDescriptionEnvVars +var TestAccProviders map[string]*schema.Provider +var testAccProvider *schema.Provider + +func init() { + configs = make(map[string]*transport_tpg.Config) + fwProviders = make(map[string]*frameworkTestProvider) + sources = make(map[string]VcrSource) + testAccProvider = provider.Provider() + TestAccProviders = map[string]*schema.Provider{ + "google": testAccProvider, + } +} + +func GoogleProviderConfig(t *testing.T) *transport_tpg.Config { + configsLock.RLock() + config, ok := configs[t.Name()] + configsLock.RUnlock() + if ok { + return config + } + + sdkProvider := provider.Provider() + rc := terraform.ResourceConfig{} + sdkProvider.Configure(context.Background(), &rc) + return sdkProvider.Meta().(*transport_tpg.Config) +} + func AccTestPreCheck(t *testing.T) { if v := os.Getenv("GOOGLE_CREDENTIALS_FILE"); v != "" { creds, err := ioutil.ReadFile(v) diff --git a/mmv1/third_party/terraform/acctest/test_utils.go b/mmv1/third_party/terraform/acctest/test_utils.go deleted file mode 100644 index 7c6cfdf4e7ed..000000000000 --- a/mmv1/third_party/terraform/acctest/test_utils.go +++ /dev/null @@ -1,68 +0,0 @@ -package acctest - -import ( - "errors" - "fmt" - "strings" - - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" -) - -func CheckDataSourceStateMatchesResourceState(dataSourceName, resourceName string) func(*terraform.State) error { - return CheckDataSourceStateMatchesResourceStateWithIgnores(dataSourceName, resourceName, map[string]struct{}{}) -} - -func CheckDataSourceStateMatchesResourceStateWithIgnores(dataSourceName, resourceName string, ignoreFields map[string]struct{}) func(*terraform.State) error { - return func(s *terraform.State) error { - ds, ok := s.RootModule().Resources[dataSourceName] - if !ok { - return fmt.Errorf("can't find %s in state", dataSourceName) - } - - rs, ok := s.RootModule().Resources[resourceName] - if !ok { - return fmt.Errorf("can't find %s in state", resourceName) - } - - dsAttr := ds.Primary.Attributes - rsAttr := rs.Primary.Attributes - - errMsg := "" - // Data sources are often derived from resources, so iterate over the resource fields to - // make sure all fields are accounted for in the data source. - // If a field exists in the data source but not in the resource, its expected value should - // be checked separately. - for k := range rsAttr { - if _, ok := ignoreFields[k]; ok { - continue - } - if k == "%" { - continue - } - if dsAttr[k] != rsAttr[k] { - // ignore data sources where an empty list is being compared against a null list. - if k[len(k)-1:] == "#" && (dsAttr[k] == "" || dsAttr[k] == "0") && (rsAttr[k] == "" || rsAttr[k] == "0") { - continue - } - errMsg += fmt.Sprintf("%s is %s; want %s\n", k, dsAttr[k], rsAttr[k]) - } - } - - if errMsg != "" { - return errors.New(errMsg) - } - - return nil - } -} - -// This is a Printf sibling (Nprintf; Named Printf), which handles strings like -// Nprintf("Hello %{target}!", map[string]interface{}{"target":"world"}) == "Hello world!". -// This is particularly useful for generated tests, where we don't want to use Printf, -// since that would require us to generate a very particular ordering of arguments. -func Nprintf(format string, params map[string]interface{}) string { - for key, val := range params { - format = strings.Replace(format, "%{"+key+"}", fmt.Sprintf("%v", val), -1) - } - return format -} diff --git a/mmv1/third_party/terraform/utils/test_utils.go.erb b/mmv1/third_party/terraform/acctest/test_utils.go.erb similarity index 64% rename from mmv1/third_party/terraform/utils/test_utils.go.erb rename to mmv1/third_party/terraform/acctest/test_utils.go.erb index 1c1011ba97d6..6717d15e4b4b 100644 --- a/mmv1/third_party/terraform/utils/test_utils.go.erb +++ b/mmv1/third_party/terraform/acctest/test_utils.go.erb @@ -1,10 +1,14 @@ <% autogen_exception -%> -package google + +package acctest import ( "context" + "errors" + "fmt" "math/rand" "os" + "strings" "testing" "github.com/hashicorp/terraform-plugin-framework/providerserver" @@ -12,20 +16,54 @@ import ( "github.com/hashicorp/terraform-plugin-mux/tf5muxserver" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" - - acctest_tpg "github.com/hashicorp/terraform-provider-google/google/acctest" ) -// Deprecated: For backward compatibility CheckDataSourceStateMatchesResourceState is still working, -// but all new code should use CheckDataSourceStateMatchesResourceState in the acctest package instead. func CheckDataSourceStateMatchesResourceState(dataSourceName, resourceName string) func(*terraform.State) error { - return acctest_tpg.CheckDataSourceStateMatchesResourceState(dataSourceName, resourceName) + return CheckDataSourceStateMatchesResourceStateWithIgnores(dataSourceName, resourceName, map[string]struct{}{}) } -// Deprecated: For backward compatibility CheckDataSourceStateMatchesResourceStateWithIgnores is still working, -// but all new code should use CheckDataSourceStateMatchesResourceStateWithIgnores in the acctest package instead. func CheckDataSourceStateMatchesResourceStateWithIgnores(dataSourceName, resourceName string, ignoreFields map[string]struct{}) func(*terraform.State) error { - return acctest_tpg.CheckDataSourceStateMatchesResourceStateWithIgnores(dataSourceName, resourceName, ignoreFields) + return func(s *terraform.State) error { + ds, ok := s.RootModule().Resources[dataSourceName] + if !ok { + return fmt.Errorf("can't find %s in state", dataSourceName) + } + + rs, ok := s.RootModule().Resources[resourceName] + if !ok { + return fmt.Errorf("can't find %s in state", resourceName) + } + + dsAttr := ds.Primary.Attributes + rsAttr := rs.Primary.Attributes + + errMsg := "" + // Data sources are often derived from resources, so iterate over the resource fields to + // make sure all fields are accounted for in the data source. + // If a field exists in the data source but not in the resource, its expected value should + // be checked separately. + for k := range rsAttr { + if _, ok := ignoreFields[k]; ok { + continue + } + if k == "%" { + continue + } + if dsAttr[k] != rsAttr[k] { + // ignore data sources where an empty list is being compared against a null list. + if k[len(k)-1:] == "#" && (dsAttr[k] == "" || dsAttr[k] == "0") && (rsAttr[k] == "" || rsAttr[k] == "0") { + continue + } + errMsg += fmt.Sprintf("%s is %s; want %s\n", k, dsAttr[k], rsAttr[k]) + } + } + + if errMsg != "" { + return errors.New(errMsg) + } + + return nil + } } // General test utils @@ -49,7 +87,7 @@ func MuxedProviders(testName string) (func() tfprotov5.ProviderServer, error) { } func RandString(t *testing.T, length int) string { - if !acctest_tpg.IsVcrEnabled() { + if !IsVcrEnabled() { return acctest.RandString(length) } envPath := os.Getenv("VCR_PATH") @@ -70,7 +108,7 @@ func RandString(t *testing.T, length int) string { } func RandInt(t *testing.T) int { - if !acctest_tpg.IsVcrEnabled() { + if !IsVcrEnabled() { return acctest.RandInt() } envPath := os.Getenv("VCR_PATH") @@ -108,4 +146,15 @@ func ProtoV5ProviderBetaFactories(t *testing.T) map[string]func() (tfprotov5.Pro }, <% end -%> } -} \ No newline at end of file +} + +// This is a Printf sibling (Nprintf; Named Printf), which handles strings like +// Nprintf("Hello %{target}!", map[string]interface{}{"target":"world"}) == "Hello world!". +// This is particularly useful for generated tests, where we don't want to use Printf, +// since that would require us to generate a very particular ordering of arguments. +func Nprintf(format string, params map[string]interface{}) string { + for key, val := range params { + format = strings.Replace(format, "%{"+key+"}", fmt.Sprintf("%v", val), -1) + } + return format +} diff --git a/mmv1/third_party/terraform/acctest/vcr_utils.go b/mmv1/third_party/terraform/acctest/vcr_utils.go index 4f296bc2fe4c..b03c8d6db138 100644 --- a/mmv1/third_party/terraform/acctest/vcr_utils.go +++ b/mmv1/third_party/terraform/acctest/vcr_utils.go @@ -1,9 +1,480 @@ package acctest -import "os" +import ( + "bytes" + "context" + "encoding/json" + "errors" + "fmt" + "io/ioutil" + "log" + "math/rand" + "net/http" + "os" + "path/filepath" + "reflect" + "regexp" + "strconv" + "strings" + "sync" + "testing" + "time" + + "github.com/hashicorp/terraform-provider-google/google/fwmodels" + "github.com/hashicorp/terraform-provider-google/google/fwprovider" + tpgprovider "github.com/hashicorp/terraform-provider-google/google/provider" + "github.com/hashicorp/terraform-provider-google/google/tpgresource" + transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" + + "github.com/dnaeon/go-vcr/cassette" + "github.com/dnaeon/go-vcr/recorder" + + "github.com/hashicorp/terraform-plugin-framework/attr" + fwDiags "github.com/hashicorp/terraform-plugin-framework/diag" + "github.com/hashicorp/terraform-plugin-framework/provider" + "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/hashicorp/terraform-plugin-go/tfprotov5" + "github.com/hashicorp/terraform-plugin-log/tflog" + "github.com/hashicorp/terraform-plugin-sdk/v2/diag" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" +) func IsVcrEnabled() bool { envPath := os.Getenv("VCR_PATH") vcrMode := os.Getenv("VCR_MODE") return envPath != "" && vcrMode != "" } + +var configsLock = sync.RWMutex{} +var sourcesLock = sync.RWMutex{} + +var configs map[string]*transport_tpg.Config +var fwProviders map[string]*frameworkTestProvider + +var sources map[string]VcrSource + +// VcrSource is a source for a given VCR test with the value that seeded it +type VcrSource struct { + seed int64 + source rand.Source +} + +// Produces a rand.Source for VCR testing based on the given mode. +// In RECORDING mode, generates a new seed and saves it to a file, using the seed for the source +// In REPLAYING mode, reads a seed from a file and creates a source from it +func vcrSource(t *testing.T, path, mode string) (*VcrSource, error) { + sourcesLock.RLock() + s, ok := sources[t.Name()] + sourcesLock.RUnlock() + if ok { + return &s, nil + } + tflog.Debug(context.Background(), fmt.Sprintf("VCR_MODE: %s", mode)) + switch mode { + case "RECORDING": + seed := rand.Int63() + s := rand.NewSource(seed) + vcrSource := VcrSource{seed: seed, source: s} + sourcesLock.Lock() + sources[t.Name()] = vcrSource + sourcesLock.Unlock() + return &vcrSource, nil + case "REPLAYING": + seed, err := readSeedFromFile(vcrSeedFile(path, t.Name())) + if err != nil { + return nil, fmt.Errorf("no cassette found on disk for %s, please replay this testcase in recording mode - %w", t.Name(), err) + } + s := rand.NewSource(seed) + vcrSource := VcrSource{seed: seed, source: s} + sourcesLock.Lock() + sources[t.Name()] = vcrSource + sourcesLock.Unlock() + return &vcrSource, nil + default: + log.Printf("[DEBUG] No valid environment var set for VCR_MODE, expected RECORDING or REPLAYING, skipping VCR. VCR_MODE: %s", mode) + return nil, errors.New("No valid VCR_MODE set") + } +} + +func readSeedFromFile(fileName string) (int64, error) { + // Max number of digits for int64 is 19 + data := make([]byte, 19) + f, err := os.Open(fileName) + if err != nil { + return 0, err + } + defer f.Close() + _, err = f.Read(data) + if err != nil { + return 0, err + } + // Remove NULL characters from seed + data = bytes.Trim(data, "\x00") + seed := string(data) + return tpgresource.StringToFixed64(seed) +} + +func writeSeedToFile(seed int64, fileName string) error { + f, err := os.Create(fileName) + if err != nil { + return err + } + defer f.Close() + _, err = f.WriteString(strconv.FormatInt(seed, 10)) + if err != nil { + return err + } + return nil +} + +// Retrieves a unique test name used for writing files +// replaces all `/` characters that would cause filepath issues +// This matters during tests that dispatch multiple tests, for example TestAccLoggingFolderExclusion +func vcrSeedFile(path, name string) string { + return filepath.Join(path, fmt.Sprintf("%s.seed", vcrFileName(name))) +} + +func vcrFileName(name string) string { + return strings.ReplaceAll(name, "/", "_") +} + +// VcrTest is a wrapper for resource.Test to swap out providers for VCR providers and handle VCR specific things +// Can be called when VCR is not enabled, and it will behave as normal +func VcrTest(t *testing.T, c resource.TestCase) { + if IsVcrEnabled() { + defer closeRecorder(t) + } else if isReleaseDiffEnabled() { + c = initializeReleaseDiffTest(c, t.Name()) + } + resource.Test(t, c) +} + +// We need to explicitly close the VCR recorder to save the cassette +func closeRecorder(t *testing.T) { + configsLock.RLock() + config, ok := configs[t.Name()] + configsLock.RUnlock() + if ok { + // We did not cache the config if it does not use VCR + if !t.Failed() && IsVcrEnabled() { + // If a test succeeds, write new seed/yaml to files + err := config.Client.Transport.(*recorder.Recorder).Stop() + if err != nil { + t.Error(err) + } + envPath := os.Getenv("VCR_PATH") + + sourcesLock.RLock() + vcrSource, ok := sources[t.Name()] + sourcesLock.RUnlock() + if ok { + err = writeSeedToFile(vcrSource.seed, vcrSeedFile(envPath, t.Name())) + if err != nil { + t.Error(err) + } + } + } + // Clean up test config + configsLock.Lock() + delete(configs, t.Name()) + configsLock.Unlock() + + sourcesLock.Lock() + delete(sources, t.Name()) + sourcesLock.Unlock() + } + + configsLock.RLock() + fwProvider, fwOk := fwProviders[t.Name()] + configsLock.RUnlock() + if fwOk { + // We did not cache the config if it does not use VCR + if !t.Failed() && IsVcrEnabled() { + // If a test succeeds, write new seed/yaml to files + err := fwProvider.Client.Transport.(*recorder.Recorder).Stop() + if err != nil { + t.Error(err) + } + envPath := os.Getenv("VCR_PATH") + + sourcesLock.RLock() + vcrSource, ok := sources[t.Name()] + sourcesLock.RUnlock() + if ok { + err = writeSeedToFile(vcrSource.seed, vcrSeedFile(envPath, t.Name())) + if err != nil { + t.Error(err) + } + } + } + // Clean up test config + configsLock.Lock() + delete(fwProviders, t.Name()) + configsLock.Unlock() + + sourcesLock.Lock() + delete(sources, t.Name()) + sourcesLock.Unlock() + } +} + +func isReleaseDiffEnabled() bool { + releaseDiff := os.Getenv("RELEASE_DIFF") + return releaseDiff != "" +} + +func initializeReleaseDiffTest(c resource.TestCase, testName string) resource.TestCase { + var releaseProvider string + packagePath := fmt.Sprint(reflect.TypeOf(transport_tpg.Config{}).PkgPath()) + if strings.Contains(packagePath, "google-beta") { + releaseProvider = "google-beta" + } else { + releaseProvider = "google" + } + + if c.ExternalProviders != nil { + c.ExternalProviders[releaseProvider] = resource.ExternalProvider{} + } else { + c.ExternalProviders = map[string]resource.ExternalProvider{ + releaseProvider: {}, + } + } + + localProviderName := "google-local" + if c.Providers != nil { + c.Providers = map[string]*schema.Provider{ + localProviderName: GetSDKProvider(testName), + } + c.ProtoV5ProviderFactories = map[string]func() (tfprotov5.ProviderServer, error){ + localProviderName: func() (tfprotov5.ProviderServer, error) { + return nil, nil + }, + } + } else { + c.ProtoV5ProviderFactories = map[string]func() (tfprotov5.ProviderServer, error){ + localProviderName: func() (tfprotov5.ProviderServer, error) { + provider, err := MuxedProviders(testName) + return provider(), err + }, + } + } + + var replacementSteps []resource.TestStep + for _, testStep := range c.Steps { + if testStep.Config != "" { + ogConfig := testStep.Config + testStep.Config = reformConfigWithProvider(ogConfig, localProviderName) + if testStep.ExpectError == nil && testStep.PlanOnly == false { + newStep := resource.TestStep{ + Config: reformConfigWithProvider(ogConfig, releaseProvider), + } + testStep.PlanOnly = true + testStep.ExpectNonEmptyPlan = false + replacementSteps = append(replacementSteps, newStep) + } + replacementSteps = append(replacementSteps, testStep) + } else { + replacementSteps = append(replacementSteps, testStep) + } + } + + c.Steps = replacementSteps + + return c +} + +func reformConfigWithProvider(config, provider string) string { + configBytes := []byte(config) + providerReplacement := fmt.Sprintf("provider = %s", provider) + providerReplacementBytes := []byte(providerReplacement) + providerBlock := regexp.MustCompile(`provider *=.*google-beta.*`) + + if providerBlock.Match(configBytes) { + return string(providerBlock.ReplaceAll(configBytes, providerReplacementBytes)) + } + + providerReplacement = fmt.Sprintf("${1}\n\t%s", providerReplacement) + providerReplacementBytes = []byte(providerReplacement) + resourceHeader := regexp.MustCompile(`(resource .*google_.* .*\w+.*\{.*)`) + return string(resourceHeader.ReplaceAll(configBytes, providerReplacementBytes)) +} + +func HandleVCRConfiguration(ctx context.Context, testName string, rndTripper http.RoundTripper, pollInterval time.Duration) (time.Duration, http.RoundTripper, fwDiags.Diagnostics) { + var diags fwDiags.Diagnostics + var vcrMode recorder.Mode + switch vcrEnv := os.Getenv("VCR_MODE"); vcrEnv { + case "RECORDING": + vcrMode = recorder.ModeRecording + case "REPLAYING": + vcrMode = recorder.ModeReplaying + // When replaying, set the poll interval low to speed up tests + pollInterval = 10 * time.Millisecond + default: + tflog.Debug(ctx, fmt.Sprintf("No valid environment var set for VCR_MODE, expected RECORDING or REPLAYING, skipping VCR. VCR_MODE: %s", vcrEnv)) + return pollInterval, rndTripper, diags + } + + envPath := os.Getenv("VCR_PATH") + if envPath == "" { + tflog.Debug(ctx, "No environment var set for VCR_PATH, skipping VCR") + return pollInterval, rndTripper, diags + } + path := filepath.Join(envPath, vcrFileName(testName)) + + rec, err := recorder.NewAsMode(path, vcrMode, rndTripper) + if err != nil { + diags.AddError("error creating record as new mode", err.Error()) + return pollInterval, rndTripper, diags + } + // Defines how VCR will match requests to responses. + rec.SetMatcher(func(r *http.Request, i cassette.Request) bool { + // Default matcher compares method and URL only + if !cassette.DefaultMatcher(r, i) { + return false + } + if r.Body == nil { + return true + } + contentType := r.Header.Get("Content-Type") + // If body contains media, don't try to compare + if strings.Contains(contentType, "multipart/related") { + return true + } + + var b bytes.Buffer + if _, err := b.ReadFrom(r.Body); err != nil { + tflog.Debug(ctx, fmt.Sprintf("Failed to read request body from cassette: %v", err)) + return false + } + r.Body = ioutil.NopCloser(&b) + reqBody := b.String() + // If body matches identically, we are done + if reqBody == i.Body { + return true + } + + // JSON might be the same, but reordered. Try parsing json and comparing + if strings.Contains(contentType, "application/json") { + var reqJson, cassetteJson interface{} + if err := json.Unmarshal([]byte(reqBody), &reqJson); err != nil { + tflog.Debug(ctx, fmt.Sprintf("Failed to unmarshall request json: %v", err)) + return false + } + if err := json.Unmarshal([]byte(i.Body), &cassetteJson); err != nil { + tflog.Debug(ctx, fmt.Sprintf("Failed to unmarshall cassette json: %v", err)) + return false + } + return reflect.DeepEqual(reqJson, cassetteJson) + } + return false + }) + + return pollInterval, rec, diags +} + +// MuxedProviders configures the providers, thus, if we want the providers to be configured +// to use VCR, the configure functions need to be altered. The only way to do this is to create +// test versions of the provider that will call the same configure function, only append the VCR +// configuration to it. + +func NewFrameworkTestProvider(testName string) *frameworkTestProvider { + return &frameworkTestProvider{ + FrameworkProvider: fwprovider.FrameworkProvider{ + Version: "test", + }, + TestName: testName, + } +} + +// frameworkTestProvider is a test version of the plugin-framework version of the provider +// that embeds FrameworkProvider whose configure function we can use +// the Configure function is overwritten in the framework_provider_test file +type frameworkTestProvider struct { + fwprovider.FrameworkProvider + TestName string +} + +// Configure is here to overwrite the FrameworkProvider configure function for VCR testing +func (p *frameworkTestProvider) Configure(ctx context.Context, req provider.ConfigureRequest, resp *provider.ConfigureResponse) { + p.FrameworkProvider.Configure(ctx, req, resp) + if IsVcrEnabled() { + if resp.Diagnostics.HasError() { + return + } + + var diags fwDiags.Diagnostics + p.PollInterval, p.Client.Transport, diags = HandleVCRConfiguration(ctx, p.TestName, p.Client.Transport, p.PollInterval) + if diags.HasError() { + resp.Diagnostics.Append(diags...) + return + } + + configsLock.Lock() + fwProviders[p.TestName] = p + configsLock.Unlock() + return + } else { + tflog.Debug(ctx, "VCR_PATH or VCR_MODE not set, skipping VCR") + } +} + +func configureApiClient(ctx context.Context, p *fwprovider.FrameworkProvider, diags *fwDiags.Diagnostics) { + var data fwmodels.ProviderModel + var d fwDiags.Diagnostics + + // Set defaults if needed - the only attribute without a default is ImpersonateServiceAccountDelegates + // this is a bit of a hack, but we'll just initialize it here so that it's been initialized at least + data.ImpersonateServiceAccountDelegates, d = types.ListValue(types.StringType, []attr.Value{}) + diags.Append(d...) + if diags.HasError() { + return + } + p.LoadAndValidateFramework(ctx, data, "test", diags, p.Version) +} + +// GetSDKProvider gets the SDK provider with an overwritten configure function to be called by MuxedProviders +func GetSDKProvider(testName string) *schema.Provider { + prov := tpgprovider.Provider() + if IsVcrEnabled() { + old := prov.ConfigureContextFunc + prov.ConfigureContextFunc = func(ctx context.Context, d *schema.ResourceData) (interface{}, diag.Diagnostics) { + return getCachedConfig(ctx, d, old, testName) + } + } else { + log.Print("[DEBUG] VCR_PATH or VCR_MODE not set, skipping VCR") + } + return prov +} + +// Returns a cached config if VCR testing is enabled. This enables us to use a single HTTP transport +// for a given test, allowing for recording of HTTP interactions. +// Why this exists: schema.Provider.ConfigureFunc is called multiple times for a given test +// ConfigureFunc on our provider creates a new HTTP client and sets base paths (config.go LoadAndValidate) +// VCR requires a single HTTP client to handle all interactions so it can record and replay responses so +// this caches HTTP clients per test by replacing ConfigureFunc +func getCachedConfig(ctx context.Context, d *schema.ResourceData, configureFunc schema.ConfigureContextFunc, testName string) (*transport_tpg.Config, diag.Diagnostics) { + configsLock.RLock() + v, ok := configs[testName] + configsLock.RUnlock() + if ok { + return v, nil + } + c, diags := configureFunc(ctx, d) + if diags.HasError() { + return nil, diags + } + + var fwD fwDiags.Diagnostics + config := c.(*transport_tpg.Config) + config.PollInterval, config.Client.Transport, fwD = HandleVCRConfiguration(ctx, testName, config.Client.Transport, config.PollInterval) + if fwD.HasError() { + diags = append(diags, *tpgresource.FrameworkDiagsToSdkDiags(fwD)...) + return nil, diags + } + + configsLock.Lock() + configs[testName] = config + configsLock.Unlock() + return config, nil +} diff --git a/mmv1/third_party/terraform/framework_utils/framework_provider_test.go.erb b/mmv1/third_party/terraform/framework_utils/framework_provider_test.go.erb index af06e9b5c5c9..3463c636d08d 100644 --- a/mmv1/third_party/terraform/framework_utils/framework_provider_test.go.erb +++ b/mmv1/third_party/terraform/framework_utils/framework_provider_test.go.erb @@ -2,39 +2,14 @@ package google import ( - "context" "fmt" - "io/ioutil" - "log" "regexp" "testing" - "github.com/hashicorp/terraform-plugin-framework/diag" - "github.com/hashicorp/terraform-plugin-framework/provider" - "github.com/hashicorp/terraform-plugin-framework/schema/validator" - "github.com/hashicorp/terraform-plugin-framework/types" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-provider-google/google/acctest" ) -func GetFwTestProvider(t *testing.T) *frameworkTestProvider { - configsLock.RLock() - fwProvider, ok := fwProviders[t.Name()] - configsLock.RUnlock() - if ok { - return fwProvider - } - - var diags diag.Diagnostics - p := NewFrameworkTestProvider(t.Name()) - configureApiClient(context.Background(), &p.FrameworkProvider, &diags) - if diags.HasError() { - log.Fatalf("%d errors when configuring test provider client: first is %s", diags.ErrorsCount(), diags.Errors()[0].Detail()) - } - - return p -} - func TestAccFrameworkProviderMeta_setModuleName(t *testing.T) { // TODO: https://github.com/hashicorp/terraform-provider-google/issues/14158 acctest.SkipIfVcr(t) @@ -55,76 +30,6 @@ func TestAccFrameworkProviderMeta_setModuleName(t *testing.T) { }) } -func TestFrameworkProvider_impl(t *testing.T) { - var _ provider.ProviderWithMetaSchema = New("test") -} - -func TestFrameworkProvider_CredentialsValidator(t *testing.T) { - cases := map[string]struct { - ConfigValue func(t *testing.T) types.String - ExpectedWarningCount int - ExpectedErrorCount int - }{ - "configuring credentials as a path to a credentials JSON file is valid": { - ConfigValue: func(t *testing.T) types.String { - return types.StringValue(testFakeCredentialsPath) // Path to a test fixture - }, - }, - "configuring credentials as a path to a non-existant file is NOT valid": { - ConfigValue: func(t *testing.T) types.String { - return types.StringValue("./this/path/doesnt/exist.json") // Doesn't exist - }, - ExpectedErrorCount: 1, - }, - "configuring credentials as a credentials JSON string is valid": { - ConfigValue: func(t *testing.T) types.String { - contents, err := ioutil.ReadFile(testFakeCredentialsPath) - if err != nil { - t.Fatalf("Unexpected error: %s", err) - } - stringContents := string(contents) - return types.StringValue(stringContents) - }, - }, - "configuring credentials as an empty string is valid": { - ConfigValue: func(t *testing.T) types.String { - return types.StringValue("") - }, - }, - "leaving credentials unconfigured is valid": { - ConfigValue: func(t *testing.T) types.String { - return types.StringNull() - }, - }, - } - - for tn, tc := range cases { - t.Run(tn, func(t *testing.T) { - // Arrange - req := validator.StringRequest{ - ConfigValue: tc.ConfigValue(t), - } - - resp := validator.StringResponse{ - Diagnostics: diag.Diagnostics{}, - } - - cv := CredentialsValidator() - - // Act - cv.ValidateString(context.Background(), req, &resp) - - // Assert - if resp.Diagnostics.WarningsCount() > tc.ExpectedWarningCount { - t.Errorf("Expected %d warnings, got %d", tc.ExpectedWarningCount, resp.Diagnostics.WarningsCount()) - } - if resp.Diagnostics.ErrorsCount() > tc.ExpectedErrorCount { - t.Errorf("Expected %d errors, got %d", tc.ExpectedErrorCount, resp.Diagnostics.ErrorsCount()) - } - }) - } -} - func TestAccFrameworkProviderBasePath_setInvalidBasePath(t *testing.T) { t.Parallel() diff --git a/mmv1/third_party/terraform/utils/framework_provider.go.erb b/mmv1/third_party/terraform/fwprovider/framework_provider.go.erb similarity index 98% rename from mmv1/third_party/terraform/utils/framework_provider.go.erb rename to mmv1/third_party/terraform/fwprovider/framework_provider.go.erb index c13d0573e351..803fb435c023 100644 --- a/mmv1/third_party/terraform/utils/framework_provider.go.erb +++ b/mmv1/third_party/terraform/fwprovider/framework_provider.go.erb @@ -1,5 +1,5 @@ <% autogen_exception -%> -package google +package fwprovider import ( "context" @@ -33,20 +33,20 @@ var ( // New is a helper function to simplify provider server and testing implementation. func New(version string) provider.ProviderWithMetaSchema { return &FrameworkProvider{ - version: version, + Version: version, } } // FrameworkProvider is the provider implementation. type FrameworkProvider struct { fwtransport.FrameworkProviderConfig - version string + Version string } // Metadata returns the provider type name. func (p *FrameworkProvider) Metadata(_ context.Context, _ provider.MetadataRequest, resp *provider.MetadataResponse) { resp.TypeName = "google" - resp.Version = p.version + resp.Version = p.Version } // MetaSchema returns the provider meta schema. @@ -235,7 +235,7 @@ func (p *FrameworkProvider) Configure(ctx context.Context, req provider.Configur } // Configuration values are now available. - p.LoadAndValidateFramework(ctx, data, req.TerraformVersion, &resp.Diagnostics, p.version) + p.LoadAndValidateFramework(ctx, data, req.TerraformVersion, &resp.Diagnostics, p.Version) if resp.Diagnostics.HasError() { return } diff --git a/mmv1/third_party/terraform/fwprovider/framework_provider_internal_test.go b/mmv1/third_party/terraform/fwprovider/framework_provider_internal_test.go new file mode 100644 index 000000000000..e81196794205 --- /dev/null +++ b/mmv1/third_party/terraform/fwprovider/framework_provider_internal_test.go @@ -0,0 +1,84 @@ +package fwprovider + +import ( + "context" + "io/ioutil" + "testing" + + "github.com/hashicorp/terraform-plugin-framework/diag" + "github.com/hashicorp/terraform-plugin-framework/provider" + "github.com/hashicorp/terraform-plugin-framework/schema/validator" + "github.com/hashicorp/terraform-plugin-framework/types" + + transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" +) + +func TestFrameworkProvider_impl(t *testing.T) { + var _ provider.ProviderWithMetaSchema = New("test") +} + +func TestFrameworkProvider_CredentialsValidator(t *testing.T) { + cases := map[string]struct { + ConfigValue func(t *testing.T) types.String + ExpectedWarningCount int + ExpectedErrorCount int + }{ + "configuring credentials as a path to a credentials JSON file is valid": { + ConfigValue: func(t *testing.T) types.String { + return types.StringValue(transport_tpg.TestFakeCredentialsPath) // Path to a test fixture + }, + }, + "configuring credentials as a path to a non-existant file is NOT valid": { + ConfigValue: func(t *testing.T) types.String { + return types.StringValue("./this/path/doesnt/exist.json") // Doesn't exist + }, + ExpectedErrorCount: 1, + }, + "configuring credentials as a credentials JSON string is valid": { + ConfigValue: func(t *testing.T) types.String { + contents, err := ioutil.ReadFile(transport_tpg.TestFakeCredentialsPath) + if err != nil { + t.Fatalf("Unexpected error: %s", err) + } + stringContents := string(contents) + return types.StringValue(stringContents) + }, + }, + "configuring credentials as an empty string is valid": { + ConfigValue: func(t *testing.T) types.String { + return types.StringValue("") + }, + }, + "leaving credentials unconfigured is valid": { + ConfigValue: func(t *testing.T) types.String { + return types.StringNull() + }, + }, + } + + for tn, tc := range cases { + t.Run(tn, func(t *testing.T) { + // Arrange + req := validator.StringRequest{ + ConfigValue: tc.ConfigValue(t), + } + + resp := validator.StringResponse{ + Diagnostics: diag.Diagnostics{}, + } + + cv := CredentialsValidator() + + // Act + cv.ValidateString(context.Background(), req, &resp) + + // Assert + if resp.Diagnostics.WarningsCount() > tc.ExpectedWarningCount { + t.Errorf("Expected %d warnings, got %d", tc.ExpectedWarningCount, resp.Diagnostics.WarningsCount()) + } + if resp.Diagnostics.ErrorsCount() > tc.ExpectedErrorCount { + t.Errorf("Expected %d errors, got %d", tc.ExpectedErrorCount, resp.Diagnostics.ErrorsCount()) + } + }) + } +} diff --git a/mmv1/third_party/terraform/framework_utils/framework_validators.go b/mmv1/third_party/terraform/fwprovider/framework_validators.go similarity index 99% rename from mmv1/third_party/terraform/framework_utils/framework_validators.go rename to mmv1/third_party/terraform/fwprovider/framework_validators.go index 560fb943ad5a..31bf849d0368 100644 --- a/mmv1/third_party/terraform/framework_utils/framework_validators.go +++ b/mmv1/third_party/terraform/fwprovider/framework_validators.go @@ -1,4 +1,4 @@ -package google +package fwprovider import ( "context" diff --git a/mmv1/third_party/terraform/main.go.erb b/mmv1/third_party/terraform/main.go.erb index de60da65fe8a..73ce963766e7 100644 --- a/mmv1/third_party/terraform/main.go.erb +++ b/mmv1/third_party/terraform/main.go.erb @@ -10,8 +10,9 @@ import ( "github.com/hashicorp/terraform-plugin-go/tfprotov5" "github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server" "github.com/hashicorp/terraform-plugin-mux/tf5muxserver" + + "github.com/hashicorp/terraform-provider-google/google/fwprovider" "github.com/hashicorp/terraform-provider-google/google/provider" - "github.com/hashicorp/terraform-provider-google/google" ver "github.com/hashicorp/terraform-provider-google/version" ) @@ -32,7 +33,7 @@ func main() { // concat with sdkv2 provider providers := []func() tfprotov5.ProviderServer{ - providerserver.NewProtocol5(google.New(version)), // framework provider + providerserver.NewProtocol5(fwprovider.New(version)), // framework provider provider.Provider().GRPCProvider, // sdk provider } diff --git a/mmv1/third_party/terraform/provider/provider_internal_test.go b/mmv1/third_party/terraform/provider/provider_internal_test.go index 75fa6a75dd2f..b3ac7b4f62cd 100644 --- a/mmv1/third_party/terraform/provider/provider_internal_test.go +++ b/mmv1/third_party/terraform/provider/provider_internal_test.go @@ -10,8 +10,6 @@ import ( "github.com/hashicorp/terraform-provider-google/google/envvar" "github.com/hashicorp/terraform-provider-google/google/tpgresource" transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" - - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) func TestProvider_validateCredentials(t *testing.T) { @@ -84,13 +82,6 @@ func TestProvider_validateCredentials(t *testing.T) { } } -// Used to create populated schema.ResourceData structs in tests. -// Pass in a schema and a config map containing the fields and values you wish to set -// The returned schema.ResourceData can represent a configured resource, data source or provider. -func setupTestResourceDataFromConfigMap(t *testing.T, s map[string]*schema.Schema, configValues map[string]interface{}) *schema.ResourceData { - return tpgresource.SetupTestResourceDataFromConfigMap(t, s, configValues) -} - // ProviderConfigEnvNames returns a list of all the environment variables that could be set by a user to configure the provider func ProviderConfigEnvNames() []string { diff --git a/mmv1/third_party/terraform/services/accesscontextmanager/resource_access_context_manager_access_policy_sweeper.go b/mmv1/third_party/terraform/services/accesscontextmanager/resource_access_context_manager_access_policy_sweeper.go index a03b178ae46e..acb9da8e2701 100644 --- a/mmv1/third_party/terraform/services/accesscontextmanager/resource_access_context_manager_access_policy_sweeper.go +++ b/mmv1/third_party/terraform/services/accesscontextmanager/resource_access_context_manager_access_policy_sweeper.go @@ -6,7 +6,7 @@ import ( "log" neturl "net/url" - "github.com/hashicorp/terraform-provider-google/google/acctest" + "github.com/hashicorp/terraform-provider-google/google/envvar" "github.com/hashicorp/terraform-provider-google/google/sweeper" transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" ) @@ -16,7 +16,7 @@ func init() { } func testSweepAccessContextManagerPolicies(region string) error { - config, err := acctest.SharedConfigForRegion(region) + config, err := sweeper.SharedConfigForRegion(region) if err != nil { log.Fatalf("error getting shared config for region %q: %s", region, err) } @@ -26,7 +26,7 @@ func testSweepAccessContextManagerPolicies(region string) error { log.Fatalf("error loading and validating shared config for region %q: %s", region, err) } - testOrg := acctest.GetTestOrgFromEnv(nil) + testOrg := envvar.GetTestOrgFromEnv(nil) if testOrg == "" { log.Printf("test org not set for test environment, skip sweep") return nil diff --git a/mmv1/third_party/terraform/services/composer/resource_composer_environment_sweeper.go b/mmv1/third_party/terraform/services/composer/resource_composer_environment_sweeper.go index 651a79ca02b9..934894e2541d 100644 --- a/mmv1/third_party/terraform/services/composer/resource_composer_environment_sweeper.go +++ b/mmv1/third_party/terraform/services/composer/resource_composer_environment_sweeper.go @@ -4,7 +4,6 @@ import ( "context" "fmt" - "github.com/hashicorp/terraform-provider-google/google/acctest" "github.com/hashicorp/terraform-provider-google/google/sweeper" transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" @@ -25,7 +24,7 @@ func init() { * rate-limited, for now just warn instead of returning actual errors. */ func testSweepComposerResources(region string) error { - config, err := acctest.SharedConfigForRegion(region) + config, err := sweeper.SharedConfigForRegion(region) if err != nil { return fmt.Errorf("error getting shared config for region: %s", err) } diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_instance_group_manager_sweeper.go b/mmv1/third_party/terraform/services/compute/resource_compute_instance_group_manager_sweeper.go index 8d256e11cb81..c66d82c13477 100644 --- a/mmv1/third_party/terraform/services/compute/resource_compute_instance_group_manager_sweeper.go +++ b/mmv1/third_party/terraform/services/compute/resource_compute_instance_group_manager_sweeper.go @@ -4,7 +4,6 @@ import ( "context" "log" - "github.com/hashicorp/terraform-provider-google/google/acctest" "github.com/hashicorp/terraform-provider-google/google/sweeper" "github.com/hashicorp/terraform-provider-google/google/tpgresource" ) @@ -19,7 +18,7 @@ func testSweepComputeInstanceGroupManager(region string) error { resourceName := "ComputeInstanceGroupManager" log.Printf("[INFO][SWEEPER_LOG] Starting sweeper for %s", resourceName) - config, err := acctest.SharedConfigForRegion(region) + config, err := sweeper.SharedConfigForRegion(region) if err != nil { log.Printf("[INFO][SWEEPER_LOG] error getting shared config for region: %s", err) return err @@ -41,7 +40,7 @@ func testSweepComputeInstanceGroupManager(region string) error { nonPrefixCount := 0 for zone, itemList := range found.Items { for _, igm := range itemList.InstanceGroupManagers { - if !acctest.IsSweepableTestResource(igm.Name) { + if !sweeper.IsSweepableTestResource(igm.Name) { nonPrefixCount++ continue } diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_instance_sweeper.go b/mmv1/third_party/terraform/services/compute/resource_compute_instance_sweeper.go index da77a1031689..05459763243d 100644 --- a/mmv1/third_party/terraform/services/compute/resource_compute_instance_sweeper.go +++ b/mmv1/third_party/terraform/services/compute/resource_compute_instance_sweeper.go @@ -4,7 +4,6 @@ import ( "context" "log" - "github.com/hashicorp/terraform-provider-google/google/acctest" "github.com/hashicorp/terraform-provider-google/google/sweeper" "github.com/hashicorp/terraform-provider-google/google/tpgresource" ) @@ -19,7 +18,7 @@ func testSweepComputeInstance(region string) error { resourceName := "ComputeInstance" log.Printf("[INFO][SWEEPER_LOG] Starting sweeper for %s", resourceName) - config, err := acctest.SharedConfigForRegion(region) + config, err := sweeper.SharedConfigForRegion(region) if err != nil { log.Printf("[INFO][SWEEPER_LOG] error getting shared config for region: %s", err) return err @@ -41,7 +40,7 @@ func testSweepComputeInstance(region string) error { nonPrefixCount := 0 for zone, itemList := range found.Items { for _, instance := range itemList.Instances { - if !acctest.IsSweepableTestResource(instance.Name) { + if !sweeper.IsSweepableTestResource(instance.Name) { nonPrefixCount++ continue } diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_region_instance_group_manager_sweeper.go b/mmv1/third_party/terraform/services/compute/resource_compute_region_instance_group_manager_sweeper.go index af96d5afc2d0..e143cb60575b 100644 --- a/mmv1/third_party/terraform/services/compute/resource_compute_region_instance_group_manager_sweeper.go +++ b/mmv1/third_party/terraform/services/compute/resource_compute_region_instance_group_manager_sweeper.go @@ -4,7 +4,6 @@ import ( "context" "log" - "github.com/hashicorp/terraform-provider-google/google/acctest" "github.com/hashicorp/terraform-provider-google/google/sweeper" ) @@ -18,7 +17,7 @@ func testSweepComputeRegionInstanceGroupManager(region string) error { resourceName := "ComputeRegionInstanceGroupManager" log.Printf("[INFO][SWEEPER_LOG] Starting sweeper for %s", resourceName) - config, err := acctest.SharedConfigForRegion(region) + config, err := sweeper.SharedConfigForRegion(region) if err != nil { log.Printf("[INFO][SWEEPER_LOG] error getting shared config for region: %s", err) return err @@ -39,7 +38,7 @@ func testSweepComputeRegionInstanceGroupManager(region string) error { // Keep count of items that aren't sweepable for logging. nonPrefixCount := 0 for _, rigm := range found.Items { - if !acctest.IsSweepableTestResource(rigm.Name) { + if !sweeper.IsSweepableTestResource(rigm.Name) { nonPrefixCount++ continue } diff --git a/mmv1/third_party/terraform/services/container/resource_container_cluster_sweeper.go b/mmv1/third_party/terraform/services/container/resource_container_cluster_sweeper.go index 6f5761b172cf..5269274282c6 100644 --- a/mmv1/third_party/terraform/services/container/resource_container_cluster_sweeper.go +++ b/mmv1/third_party/terraform/services/container/resource_container_cluster_sweeper.go @@ -5,7 +5,6 @@ import ( "fmt" "log" - "github.com/hashicorp/terraform-provider-google/google/acctest" "github.com/hashicorp/terraform-provider-google/google/sweeper" ) @@ -14,7 +13,7 @@ func init() { } func testSweepContainerClusters(region string) error { - config, err := acctest.SharedConfigForRegion(region) + config, err := sweeper.SharedConfigForRegion(region) if err != nil { log.Fatalf("error getting shared config for region: %s", err) } @@ -37,7 +36,7 @@ func testSweepContainerClusters(region string) error { } for _, cluster := range found.Clusters { - if acctest.IsSweepableTestResource(cluster.Name) { + if sweeper.IsSweepableTestResource(cluster.Name) { log.Printf("Sweeping Container Cluster: %s", cluster.Name) clusterURL := fmt.Sprintf("projects/%s/locations/%s/clusters/%s", config.Project, cluster.Location, cluster.Name) _, err := config.NewContainerClient(config.UserAgent).Projects.Locations.Clusters.Delete(clusterURL).Do() diff --git a/mmv1/third_party/terraform/services/resourcemanager/resource_google_project_sweeper.go b/mmv1/third_party/terraform/services/resourcemanager/resource_google_project_sweeper.go index 76d00a42bc4a..33ec9a89712d 100644 --- a/mmv1/third_party/terraform/services/resourcemanager/resource_google_project_sweeper.go +++ b/mmv1/third_party/terraform/services/resourcemanager/resource_google_project_sweeper.go @@ -6,7 +6,7 @@ import ( "log" "os" - "github.com/hashicorp/terraform-provider-google/google/acctest" + "github.com/hashicorp/terraform-provider-google/google/envvar" "github.com/hashicorp/terraform-provider-google/google/sweeper" ) @@ -28,7 +28,7 @@ func init() { } func testSweepProject(region string) error { - config, err := acctest.SharedConfigForRegion(region) + config, err := sweeper.SharedConfigForRegion(region) if err != nil { log.Printf("[INFO][SWEEPER_LOG] error getting shared config for region: %s", err) return err @@ -40,7 +40,7 @@ func testSweepProject(region string) error { return err } - org := acctest.UnsafeGetTestOrgFromEnv() + org := envvar.UnsafeGetTestOrgFromEnv() if org == "" { log.Printf("[INFO][SWEEPER_LOG] no organization set, failing project sweeper") return fmt.Errorf("no organization set") diff --git a/mmv1/third_party/terraform/tests/data_source_dns_managed_zone_test.go.erb b/mmv1/third_party/terraform/tests/data_source_dns_managed_zone_test.go.erb index a9400044f1e2..9358d2e87840 100644 --- a/mmv1/third_party/terraform/tests/data_source_dns_managed_zone_test.go.erb +++ b/mmv1/third_party/terraform/tests/data_source_dns_managed_zone_test.go.erb @@ -102,7 +102,7 @@ func testAccCheckDNSManagedZoneDestroyProducerFramework(t *testing.T) func(s *te continue } - p := GetFwTestProvider(t) + p := acctest.GetFwTestProvider(t) url, err := acctest.ReplaceVarsForFrameworkTest(&p.FrameworkProvider.FrameworkProviderConfig, rs, "{{DNSBasePath}}projects/{{project}}/managedZones/{{name}}") if err != nil { diff --git a/mmv1/third_party/terraform/tests/data_source_dns_record_set_test.go.erb b/mmv1/third_party/terraform/tests/data_source_dns_record_set_test.go.erb index 1c356d12eadc..3799ff757311 100644 --- a/mmv1/third_party/terraform/tests/data_source_dns_record_set_test.go.erb +++ b/mmv1/third_party/terraform/tests/data_source_dns_record_set_test.go.erb @@ -88,7 +88,7 @@ func testAccCheckDnsRecordSetDestroyProducerFramework(t *testing.T) func(s *terr continue } - p := GetFwTestProvider(t) + p := acctest.GetFwTestProvider(t) url, err := acctest.ReplaceVarsForFrameworkTest(&p.FrameworkProvider.FrameworkProviderConfig, rs, "{{DNSBasePath}}projects/{{project}}/managedZones/{{managed_zone}}/rrsets/{{name}}/{{type}}") if err != nil { diff --git a/mmv1/third_party/terraform/tests/resource_certificatemanager_certificate_upgrade_test.go b/mmv1/third_party/terraform/tests/resource_certificatemanager_certificate_upgrade_test.go index c305faca5532..4010f3e0eb0a 100644 --- a/mmv1/third_party/terraform/tests/resource_certificatemanager_certificate_upgrade_test.go +++ b/mmv1/third_party/terraform/tests/resource_certificatemanager_certificate_upgrade_test.go @@ -6,6 +6,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/hashicorp/terraform-provider-google/google/acctest" ) // Tests schema version migration by creating a certificate with an old version of the provider (4.59.0) @@ -22,7 +23,7 @@ func TestAccCertificateManagerCertificate_migration(t *testing.T) { }, } newVersion := map[string]func() (*schema.Provider, error){ - "mynewprovider": func() (*schema.Provider, error) { return TestAccProviders["google"], nil }, + "mynewprovider": func() (*schema.Provider, error) { return acctest.TestAccProviders["google"], nil }, } VcrTest(t, resource.TestCase{ diff --git a/mmv1/third_party/terraform/tests/resource_cloudbuild_trigger_upgrade_test.go b/mmv1/third_party/terraform/tests/resource_cloudbuild_trigger_upgrade_test.go index c38aef7a25ca..6a471254e696 100644 --- a/mmv1/third_party/terraform/tests/resource_cloudbuild_trigger_upgrade_test.go +++ b/mmv1/third_party/terraform/tests/resource_cloudbuild_trigger_upgrade_test.go @@ -23,7 +23,7 @@ func TestAccCloudBuildTrigger_migration(t *testing.T) { }, } newVersion := map[string]func() (*schema.Provider, error){ - "mynewprovider": func() (*schema.Provider, error) { return TestAccProviders["google"], nil }, + "mynewprovider": func() (*schema.Provider, error) { return acctest.TestAccProviders["google"], nil }, } VcrTest(t, resource.TestCase{ diff --git a/mmv1/third_party/terraform/tests/resource_logging_bucket_config_test.go b/mmv1/third_party/terraform/tests/resource_logging_bucket_config_test.go index 7018a3e1681e..849ac3c6a864 100644 --- a/mmv1/third_party/terraform/tests/resource_logging_bucket_config_test.go +++ b/mmv1/third_party/terraform/tests/resource_logging_bucket_config_test.go @@ -129,8 +129,8 @@ func TestAccLoggingBucketConfigProject_locked(t *testing.T) { context := map[string]interface{}{ "random_suffix": RandString(t, 10), "project_name": "tf-test-" + RandString(t, 10), - "org_id": acctest.GetTestOrgFromEnv(t), - "billing_account": acctest.GetTestBillingAccountFromEnv(t), + "org_id": envvar.GetTestOrgFromEnv(t), + "billing_account": envvar.GetTestBillingAccountFromEnv(t), } VcrTest(t, resource.TestCase{ diff --git a/mmv1/third_party/terraform/utils/provider_test.go.erb b/mmv1/third_party/terraform/utils/provider_test.go.erb index e214239654cc..6dea116a9895 100644 --- a/mmv1/third_party/terraform/utils/provider_test.go.erb +++ b/mmv1/third_party/terraform/utils/provider_test.go.erb @@ -7,8 +7,8 @@ import ( "testing" "github.com/hashicorp/terraform-provider-google/google/acctest" - "github.com/hashicorp/terraform-provider-google/google/provider" "github.com/hashicorp/terraform-provider-google/google/envvar" + "github.com/hashicorp/terraform-provider-google/google/provider" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" diff --git a/mmv1/third_party/terraform/utils/provider_test_utils.go.erb b/mmv1/third_party/terraform/utils/provider_test_utils.go.erb index fa0d646e81dc..60bc124ea925 100644 --- a/mmv1/third_party/terraform/utils/provider_test_utils.go.erb +++ b/mmv1/third_party/terraform/utils/provider_test_utils.go.erb @@ -2,11 +2,9 @@ package google import ( - "context" "testing" "github.com/hashicorp/terraform-provider-google/google/acctest" - "github.com/hashicorp/terraform-provider-google/google/provider" transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" @@ -17,7 +15,6 @@ import ( const TestEnvVar = acctest.TestEnvVar var TestAccProviders map[string]*schema.Provider -var testAccProvider *schema.Provider var CredsEnvVars = acctest.CredsEnvVars @@ -62,27 +59,11 @@ var papDescriptionEnvVars = acctest.PapDescriptionEnvVars func init() { - configs = make(map[string]*transport_tpg.Config) - fwProviders = make(map[string]*frameworkTestProvider) - sources = make(map[string]VcrSource) - testAccProvider = provider.Provider() - TestAccProviders = map[string]*schema.Provider{ - "google": testAccProvider, - } + TestAccProviders = acctest.TestAccProviders } func GoogleProviderConfig(t *testing.T) *transport_tpg.Config { - configsLock.RLock() - config, ok := configs[t.Name()] - configsLock.RUnlock() - if ok { - return config - } - - sdkProvider := provider.Provider() - rc := terraform.ResourceConfig{} - sdkProvider.Configure(context.Background(), &rc) - return sdkProvider.Meta().(*transport_tpg.Config) + return acctest.GoogleProviderConfig(t) } func AccTestPreCheck(t *testing.T) { diff --git a/mmv1/third_party/terraform/utils/test_utils.go b/mmv1/third_party/terraform/utils/test_utils.go new file mode 100644 index 000000000000..148e64668cbb --- /dev/null +++ b/mmv1/third_party/terraform/utils/test_utils.go @@ -0,0 +1,45 @@ +package google + +import ( + "testing" + + "github.com/hashicorp/terraform-plugin-go/tfprotov5" + "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + + "github.com/hashicorp/terraform-provider-google/google/acctest" +) + +// Deprecated: For backward compatibility CheckDataSourceStateMatchesResourceState is still working, +// but all new code should use CheckDataSourceStateMatchesResourceState in the acctest package instead. +func CheckDataSourceStateMatchesResourceState(dataSourceName, resourceName string) func(*terraform.State) error { + return acctest.CheckDataSourceStateMatchesResourceState(dataSourceName, resourceName) +} + +// Deprecated: For backward compatibility CheckDataSourceStateMatchesResourceStateWithIgnores is still working, +// but all new code should use CheckDataSourceStateMatchesResourceStateWithIgnores in the acctest package instead. +func CheckDataSourceStateMatchesResourceStateWithIgnores(dataSourceName, resourceName string, ignoreFields map[string]struct{}) func(*terraform.State) error { + return acctest.CheckDataSourceStateMatchesResourceStateWithIgnores(dataSourceName, resourceName, ignoreFields) +} + +// General test utils + +func RandString(t *testing.T, length int) string { + return acctest.RandString(t, length) +} + +func RandInt(t *testing.T) int { + return acctest.RandInt(t) +} + +// ProtoV5ProviderFactories returns a muxed ProviderServer that uses the provider code from this repo (SDK and plugin-framework). +// Used to set ProtoV5ProviderFactories in a resource.TestStep within an acceptance test. +func ProtoV5ProviderFactories(t *testing.T) map[string]func() (tfprotov5.ProviderServer, error) { + return acctest.ProtoV5ProviderFactories(t) +} + +// ProtoV5ProviderBetaFactories returns the same as ProtoV5ProviderFactories only the provider is mapped with +// "google-beta" to ensure that registry examples use `google-beta` if the example is versioned as beta; +// normal beta tests should continue to use ProtoV5ProviderFactories +func ProtoV5ProviderBetaFactories(t *testing.T) map[string]func() (tfprotov5.ProviderServer, error) { + return acctest.ProtoV5ProviderBetaFactories(t) +} diff --git a/mmv1/third_party/terraform/utils/vcr_utils.go b/mmv1/third_party/terraform/utils/vcr_utils.go index 15c8e87c3a5c..741ff5ca9294 100644 --- a/mmv1/third_party/terraform/utils/vcr_utils.go +++ b/mmv1/third_party/terraform/utils/vcr_utils.go @@ -1,478 +1,19 @@ package google import ( - "bytes" - "context" - "encoding/json" - "errors" - "fmt" - "io/ioutil" - "log" - "math/rand" - "net/http" - "os" - "path/filepath" - "reflect" - "regexp" - "strconv" - "strings" - "sync" "testing" - "time" "github.com/hashicorp/terraform-provider-google/google/acctest" - "github.com/hashicorp/terraform-provider-google/google/fwmodels" - tpgprovider "github.com/hashicorp/terraform-provider-google/google/provider" - "github.com/hashicorp/terraform-provider-google/google/tpgresource" - transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" - "github.com/dnaeon/go-vcr/cassette" - "github.com/dnaeon/go-vcr/recorder" - - "github.com/hashicorp/terraform-plugin-framework/attr" - fwDiags "github.com/hashicorp/terraform-plugin-framework/diag" - "github.com/hashicorp/terraform-plugin-framework/provider" - "github.com/hashicorp/terraform-plugin-framework/types" - "github.com/hashicorp/terraform-plugin-go/tfprotov5" - "github.com/hashicorp/terraform-plugin-log/tflog" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) -var configsLock = sync.RWMutex{} -var sourcesLock = sync.RWMutex{} - -var configs map[string]*transport_tpg.Config -var fwProviders map[string]*frameworkTestProvider - -var sources map[string]VcrSource - -// VcrSource is a source for a given VCR test with the value that seeded it -type VcrSource struct { - seed int64 - source rand.Source -} - func isVcrEnabled() bool { return acctest.IsVcrEnabled() } -// Produces a rand.Source for VCR testing based on the given mode. -// In RECORDING mode, generates a new seed and saves it to a file, using the seed for the source -// In REPLAYING mode, reads a seed from a file and creates a source from it -func vcrSource(t *testing.T, path, mode string) (*VcrSource, error) { - sourcesLock.RLock() - s, ok := sources[t.Name()] - sourcesLock.RUnlock() - if ok { - return &s, nil - } - tflog.Debug(context.Background(), fmt.Sprintf("VCR_MODE: %s", mode)) - switch mode { - case "RECORDING": - seed := rand.Int63() - s := rand.NewSource(seed) - vcrSource := VcrSource{seed: seed, source: s} - sourcesLock.Lock() - sources[t.Name()] = vcrSource - sourcesLock.Unlock() - return &vcrSource, nil - case "REPLAYING": - seed, err := readSeedFromFile(vcrSeedFile(path, t.Name())) - if err != nil { - return nil, fmt.Errorf("no cassette found on disk for %s, please replay this testcase in recording mode - %w", t.Name(), err) - } - s := rand.NewSource(seed) - vcrSource := VcrSource{seed: seed, source: s} - sourcesLock.Lock() - sources[t.Name()] = vcrSource - sourcesLock.Unlock() - return &vcrSource, nil - default: - log.Printf("[DEBUG] No valid environment var set for VCR_MODE, expected RECORDING or REPLAYING, skipping VCR. VCR_MODE: %s", mode) - return nil, errors.New("No valid VCR_MODE set") - } -} - -func readSeedFromFile(fileName string) (int64, error) { - // Max number of digits for int64 is 19 - data := make([]byte, 19) - f, err := os.Open(fileName) - if err != nil { - return 0, err - } - defer f.Close() - _, err = f.Read(data) - if err != nil { - return 0, err - } - // Remove NULL characters from seed - data = bytes.Trim(data, "\x00") - seed := string(data) - return tpgresource.StringToFixed64(seed) -} - -func writeSeedToFile(seed int64, fileName string) error { - f, err := os.Create(fileName) - if err != nil { - return err - } - defer f.Close() - _, err = f.WriteString(strconv.FormatInt(seed, 10)) - if err != nil { - return err - } - return nil -} - -// Retrieves a unique test name used for writing files -// replaces all `/` characters that would cause filepath issues -// This matters during tests that dispatch multiple tests, for example TestAccLoggingFolderExclusion -func vcrSeedFile(path, name string) string { - return filepath.Join(path, fmt.Sprintf("%s.seed", vcrFileName(name))) -} - -func vcrFileName(name string) string { - return strings.ReplaceAll(name, "/", "_") -} - // VcrTest is a wrapper for resource.Test to swap out providers for VCR providers and handle VCR specific things // Can be called when VCR is not enabled, and it will behave as normal func VcrTest(t *testing.T, c resource.TestCase) { - if acctest.IsVcrEnabled() { - defer closeRecorder(t) - } else if isReleaseDiffEnabled() { - c = initializeReleaseDiffTest(c, t.Name()) - } - resource.Test(t, c) -} - -// We need to explicitly close the VCR recorder to save the cassette -func closeRecorder(t *testing.T) { - configsLock.RLock() - config, ok := configs[t.Name()] - configsLock.RUnlock() - if ok { - // We did not cache the config if it does not use VCR - if !t.Failed() && acctest.IsVcrEnabled() { - // If a test succeeds, write new seed/yaml to files - err := config.Client.Transport.(*recorder.Recorder).Stop() - if err != nil { - t.Error(err) - } - envPath := os.Getenv("VCR_PATH") - - sourcesLock.RLock() - vcrSource, ok := sources[t.Name()] - sourcesLock.RUnlock() - if ok { - err = writeSeedToFile(vcrSource.seed, vcrSeedFile(envPath, t.Name())) - if err != nil { - t.Error(err) - } - } - } - // Clean up test config - configsLock.Lock() - delete(configs, t.Name()) - configsLock.Unlock() - - sourcesLock.Lock() - delete(sources, t.Name()) - sourcesLock.Unlock() - } - - configsLock.RLock() - fwProvider, fwOk := fwProviders[t.Name()] - configsLock.RUnlock() - if fwOk { - // We did not cache the config if it does not use VCR - if !t.Failed() && acctest.IsVcrEnabled() { - // If a test succeeds, write new seed/yaml to files - err := fwProvider.Client.Transport.(*recorder.Recorder).Stop() - if err != nil { - t.Error(err) - } - envPath := os.Getenv("VCR_PATH") - - sourcesLock.RLock() - vcrSource, ok := sources[t.Name()] - sourcesLock.RUnlock() - if ok { - err = writeSeedToFile(vcrSource.seed, vcrSeedFile(envPath, t.Name())) - if err != nil { - t.Error(err) - } - } - } - // Clean up test config - configsLock.Lock() - delete(fwProviders, t.Name()) - configsLock.Unlock() - - sourcesLock.Lock() - delete(sources, t.Name()) - sourcesLock.Unlock() - } -} - -func isReleaseDiffEnabled() bool { - releaseDiff := os.Getenv("RELEASE_DIFF") - return releaseDiff != "" -} - -func initializeReleaseDiffTest(c resource.TestCase, testName string) resource.TestCase { - var releaseProvider string - packagePath := fmt.Sprint(reflect.TypeOf(transport_tpg.Config{}).PkgPath()) - if strings.Contains(packagePath, "google-beta") { - releaseProvider = "google-beta" - } else { - releaseProvider = "google" - } - - if c.ExternalProviders != nil { - c.ExternalProviders[releaseProvider] = resource.ExternalProvider{} - } else { - c.ExternalProviders = map[string]resource.ExternalProvider{ - releaseProvider: {}, - } - } - - localProviderName := "google-local" - if c.Providers != nil { - c.Providers = map[string]*schema.Provider{ - localProviderName: GetSDKProvider(testName), - } - c.ProtoV5ProviderFactories = map[string]func() (tfprotov5.ProviderServer, error){ - localProviderName: func() (tfprotov5.ProviderServer, error) { - return nil, nil - }, - } - } else { - c.ProtoV5ProviderFactories = map[string]func() (tfprotov5.ProviderServer, error){ - localProviderName: func() (tfprotov5.ProviderServer, error) { - provider, err := MuxedProviders(testName) - return provider(), err - }, - } - } - - var replacementSteps []resource.TestStep - for _, testStep := range c.Steps { - if testStep.Config != "" { - ogConfig := testStep.Config - testStep.Config = reformConfigWithProvider(ogConfig, localProviderName) - if testStep.ExpectError == nil && testStep.PlanOnly == false { - newStep := resource.TestStep{ - Config: reformConfigWithProvider(ogConfig, releaseProvider), - } - testStep.PlanOnly = true - testStep.ExpectNonEmptyPlan = false - replacementSteps = append(replacementSteps, newStep) - } - replacementSteps = append(replacementSteps, testStep) - } else { - replacementSteps = append(replacementSteps, testStep) - } - } - - c.Steps = replacementSteps - - return c -} - -func reformConfigWithProvider(config, provider string) string { - configBytes := []byte(config) - providerReplacement := fmt.Sprintf("provider = %s", provider) - providerReplacementBytes := []byte(providerReplacement) - providerBlock := regexp.MustCompile(`provider *=.*google-beta.*`) - - if providerBlock.Match(configBytes) { - return string(providerBlock.ReplaceAll(configBytes, providerReplacementBytes)) - } - - providerReplacement = fmt.Sprintf("${1}\n\t%s", providerReplacement) - providerReplacementBytes = []byte(providerReplacement) - resourceHeader := regexp.MustCompile(`(resource .*google_.* .*\w+.*\{.*)`) - return string(resourceHeader.ReplaceAll(configBytes, providerReplacementBytes)) -} - -func HandleVCRConfiguration(ctx context.Context, testName string, rndTripper http.RoundTripper, pollInterval time.Duration) (time.Duration, http.RoundTripper, fwDiags.Diagnostics) { - var diags fwDiags.Diagnostics - var vcrMode recorder.Mode - switch vcrEnv := os.Getenv("VCR_MODE"); vcrEnv { - case "RECORDING": - vcrMode = recorder.ModeRecording - case "REPLAYING": - vcrMode = recorder.ModeReplaying - // When replaying, set the poll interval low to speed up tests - pollInterval = 10 * time.Millisecond - default: - tflog.Debug(ctx, fmt.Sprintf("No valid environment var set for VCR_MODE, expected RECORDING or REPLAYING, skipping VCR. VCR_MODE: %s", vcrEnv)) - return pollInterval, rndTripper, diags - } - - envPath := os.Getenv("VCR_PATH") - if envPath == "" { - tflog.Debug(ctx, "No environment var set for VCR_PATH, skipping VCR") - return pollInterval, rndTripper, diags - } - path := filepath.Join(envPath, vcrFileName(testName)) - - rec, err := recorder.NewAsMode(path, vcrMode, rndTripper) - if err != nil { - diags.AddError("error creating record as new mode", err.Error()) - return pollInterval, rndTripper, diags - } - // Defines how VCR will match requests to responses. - rec.SetMatcher(func(r *http.Request, i cassette.Request) bool { - // Default matcher compares method and URL only - if !cassette.DefaultMatcher(r, i) { - return false - } - if r.Body == nil { - return true - } - contentType := r.Header.Get("Content-Type") - // If body contains media, don't try to compare - if strings.Contains(contentType, "multipart/related") { - return true - } - - var b bytes.Buffer - if _, err := b.ReadFrom(r.Body); err != nil { - tflog.Debug(ctx, fmt.Sprintf("Failed to read request body from cassette: %v", err)) - return false - } - r.Body = ioutil.NopCloser(&b) - reqBody := b.String() - // If body matches identically, we are done - if reqBody == i.Body { - return true - } - - // JSON might be the same, but reordered. Try parsing json and comparing - if strings.Contains(contentType, "application/json") { - var reqJson, cassetteJson interface{} - if err := json.Unmarshal([]byte(reqBody), &reqJson); err != nil { - tflog.Debug(ctx, fmt.Sprintf("Failed to unmarshall request json: %v", err)) - return false - } - if err := json.Unmarshal([]byte(i.Body), &cassetteJson); err != nil { - tflog.Debug(ctx, fmt.Sprintf("Failed to unmarshall cassette json: %v", err)) - return false - } - return reflect.DeepEqual(reqJson, cassetteJson) - } - return false - }) - - return pollInterval, rec, diags -} - -// MuxedProviders configures the providers, thus, if we want the providers to be configured -// to use VCR, the configure functions need to be altered. The only way to do this is to create -// test versions of the provider that will call the same configure function, only append the VCR -// configuration to it. - -func NewFrameworkTestProvider(testName string) *frameworkTestProvider { - return &frameworkTestProvider{ - FrameworkProvider: FrameworkProvider{ - version: "test", - }, - TestName: testName, - } -} - -// frameworkTestProvider is a test version of the plugin-framework version of the provider -// that embeds FrameworkProvider whose configure function we can use -// the Configure function is overwritten in the framework_provider_test file -type frameworkTestProvider struct { - FrameworkProvider - TestName string -} - -// Configure is here to overwrite the FrameworkProvider configure function for VCR testing -func (p *frameworkTestProvider) Configure(ctx context.Context, req provider.ConfigureRequest, resp *provider.ConfigureResponse) { - p.FrameworkProvider.Configure(ctx, req, resp) - if acctest.IsVcrEnabled() { - if resp.Diagnostics.HasError() { - return - } - - var diags fwDiags.Diagnostics - p.PollInterval, p.Client.Transport, diags = HandleVCRConfiguration(ctx, p.TestName, p.Client.Transport, p.PollInterval) - if diags.HasError() { - resp.Diagnostics.Append(diags...) - return - } - - configsLock.Lock() - fwProviders[p.TestName] = p - configsLock.Unlock() - return - } else { - tflog.Debug(ctx, "VCR_PATH or VCR_MODE not set, skipping VCR") - } -} - -func configureApiClient(ctx context.Context, p *FrameworkProvider, diags *fwDiags.Diagnostics) { - var data fwmodels.ProviderModel - var d fwDiags.Diagnostics - - // Set defaults if needed - the only attribute without a default is ImpersonateServiceAccountDelegates - // this is a bit of a hack, but we'll just initialize it here so that it's been initialized at least - data.ImpersonateServiceAccountDelegates, d = types.ListValue(types.StringType, []attr.Value{}) - diags.Append(d...) - if diags.HasError() { - return - } - p.LoadAndValidateFramework(ctx, data, "test", diags, p.version) -} - -// GetSDKProvider gets the SDK provider with an overwritten configure function to be called by MuxedProviders -func GetSDKProvider(testName string) *schema.Provider { - prov := tpgprovider.Provider() - if acctest.IsVcrEnabled() { - old := prov.ConfigureContextFunc - prov.ConfigureContextFunc = func(ctx context.Context, d *schema.ResourceData) (interface{}, diag.Diagnostics) { - return getCachedConfig(ctx, d, old, testName) - } - } else { - log.Print("[DEBUG] VCR_PATH or VCR_MODE not set, skipping VCR") - } - return prov -} - -// Returns a cached config if VCR testing is enabled. This enables us to use a single HTTP transport -// for a given test, allowing for recording of HTTP interactions. -// Why this exists: schema.Provider.ConfigureFunc is called multiple times for a given test -// ConfigureFunc on our provider creates a new HTTP client and sets base paths (config.go LoadAndValidate) -// VCR requires a single HTTP client to handle all interactions so it can record and replay responses so -// this caches HTTP clients per test by replacing ConfigureFunc -func getCachedConfig(ctx context.Context, d *schema.ResourceData, configureFunc schema.ConfigureContextFunc, testName string) (*transport_tpg.Config, diag.Diagnostics) { - configsLock.RLock() - v, ok := configs[testName] - configsLock.RUnlock() - if ok { - return v, nil - } - c, diags := configureFunc(ctx, d) - if diags.HasError() { - return nil, diags - } - - var fwD fwDiags.Diagnostics - config := c.(*transport_tpg.Config) - config.PollInterval, config.Client.Transport, fwD = HandleVCRConfiguration(ctx, testName, config.Client.Transport, config.PollInterval) - if fwD.HasError() { - diags = append(diags, *frameworkDiagsToSdkDiags(fwD)...) - return nil, diags - } - - configsLock.Lock() - configs[testName] = config - configsLock.Unlock() - return config, nil + acctest.VcrTest(t, c) } diff --git a/mmv1/third_party/validator/test_utils.go b/mmv1/third_party/validator/test_utils.go new file mode 100644 index 000000000000..652e00ef4368 --- /dev/null +++ b/mmv1/third_party/validator/test_utils.go @@ -0,0 +1,17 @@ +package acctest + +import ( + "fmt" + "strings" +) + +// This is a Printf sibling (Nprintf; Named Printf), which handles strings like +// Nprintf("Hello %{target}!", map[string]interface{}{"target":"world"}) == "Hello world!". +// This is particularly useful for generated tests, where we don't want to use Printf, +// since that would require us to generate a very particular ordering of arguments. +func Nprintf(format string, params map[string]interface{}) string { + for key, val := range params { + format = strings.Replace(format, "%{"+key+"}", fmt.Sprintf("%v", val), -1) + } + return format +} From a54317ad3f642b51f476b6661cd6f35bf7727645 Mon Sep 17 00:00:00 2001 From: Shuya Ma <87669292+shuyama1@users.noreply.github.com> Date: Fri, 30 Jun 2023 08:24:44 -0700 Subject: [PATCH 17/55] Document requirement for CAMP+ subscription (#8214) --- .ci/infra/terraform/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/.ci/infra/terraform/README.md b/.ci/infra/terraform/README.md index 21b0ecaa8d8d..1c5a99adb525 100644 --- a/.ci/infra/terraform/README.md +++ b/.ci/infra/terraform/README.md @@ -46,6 +46,7 @@ After applying this configuration: - Add Group Admin role to new service account in the Google Workspace Admin Console: https://admin.google.com/ac/roles - Add a new test user in the Google Workspace Admin Console: https://admin.google.com/ac/users - Create a `support@` group in the Google Workspace Admin Console, add new service account as a member, and make it an owner +- Enroll in Cloud Armor Managed Protection Plus tier Quotas that will need to be adjusted to support all tests: - Project quota for the new service account From 5aa501d0316c98f542b8fec7226f54a3581a3b63 Mon Sep 17 00:00:00 2001 From: Piotr Date: Fri, 30 Jun 2023 17:41:21 +0200 Subject: [PATCH 18/55] Add example of Function v2 and Scheduler HTTP trigger with auth (#8169) Co-authored-by: Shuya Ma <87669292+shuyama1@users.noreply.github.com> --- mmv1/products/cloudfunctions2/Function.yaml | 20 +++++ .../cloudfunctions2_scheduler_auth.tf.erb | 80 +++++++++++++++++++ 2 files changed, 100 insertions(+) create mode 100644 mmv1/templates/terraform/examples/cloudfunctions2_scheduler_auth.tf.erb diff --git a/mmv1/products/cloudfunctions2/Function.yaml b/mmv1/products/cloudfunctions2/Function.yaml index d9e16162cda1..ee3bc696f1cc 100644 --- a/mmv1/products/cloudfunctions2/Function.yaml +++ b/mmv1/products/cloudfunctions2/Function.yaml @@ -91,6 +91,26 @@ examples: ignore_read_extra: - 'build_config.0.source.0.storage_source.0.object' - 'build_config.0.source.0.storage_source.0.bucket' + - !ruby/object:Provider::Terraform::Examples + name: 'cloudfunctions2_scheduler_auth' + primary_resource_id: 'function' + vars: + bucket_name: 'gcf-source' + service_account: 'gcf-sa' + function: 'gcf-function' + zip_path: 'function-source.zip' + test_env_vars: + project: :PROJECT_NAME + test_vars_overrides: + zip_path: '"./test-fixtures/cloudfunctions2/function-source.zip"' + primary_resource_id: '"terraform-test"' + location: + '"us-central1"' + # ignore these fields during import step + ignore_read_extra: + - 'build_config.0.source.0.storage_source.0.object' + - 'build_config.0.source.0.storage_source.0.bucket' + skip_test: true - !ruby/object:Provider::Terraform::Examples name: 'cloudfunctions2_basic_gcs' primary_resource_id: 'function' diff --git a/mmv1/templates/terraform/examples/cloudfunctions2_scheduler_auth.tf.erb b/mmv1/templates/terraform/examples/cloudfunctions2_scheduler_auth.tf.erb new file mode 100644 index 000000000000..2d1d281625a7 --- /dev/null +++ b/mmv1/templates/terraform/examples/cloudfunctions2_scheduler_auth.tf.erb @@ -0,0 +1,80 @@ +# [START function_v2_scheduler_auth] +locals { + project = "<%= ctx[:test_env_vars]['project'] %>" # Google Cloud Platform Project ID +} + +resource "google_service_account" "account" { + account_id = "<%= ctx[:vars]['service_account'] %>" + display_name = "Test Service Account" +} + +resource "google_storage_bucket" "bucket" { + name = "${local.project}-<%= ctx[:vars]['bucket_name'] %>" # Every bucket name must be globally unique + location = "US" + uniform_bucket_level_access = true +} + +resource "google_storage_bucket_object" "object" { + name = "function-source.zip" + bucket = google_storage_bucket.bucket.name + source = "<%= ctx[:vars]['zip_path'] %>" # Add path to the zipped function source code +} + +resource "google_cloudfunctions2_function" "<%= ctx[:primary_resource_id] %>" { + name = "<%= ctx[:vars]['function'] %>" # name should use kebab-case so generated Cloud Run service name will be the same + location = "us-central1" + description = "a new function" + + build_config { + runtime = "nodejs16" + entry_point = "helloHttp" # Set the entry point + source { + storage_source { + bucket = google_storage_bucket.bucket.name + object = google_storage_bucket_object.object.name + } + } + } + + service_config { + min_instance_count = 1 + available_memory = "256M" + timeout_seconds = 60 + service_account_email = google_service_account.account.email + } +} + +resource "google_cloudfunctions2_function_iam_member" "invoker" { + project = google_cloudfunctions2_function.<%= ctx[:primary_resource_id] %>.project + location = google_cloudfunctions2_function.<%= ctx[:primary_resource_id] %>.location + cloud_function = google_cloudfunctions2_function.<%= ctx[:primary_resource_id] %>.name + role = "roles/cloudfunctions.invoker" + member = "serviceAccount:${google_service_account.account.email}" +} + +resource "google_cloud_run_service_iam_member" "cloud_run_invoker" { + project = google_cloudfunctions2_function.<%= ctx[:primary_resource_id] %>.project + location = google_cloudfunctions2_function.<%= ctx[:primary_resource_id] %>.location + service = google_cloudfunctions2_function.<%= ctx[:primary_resource_id] %>.name + role = "roles/run.invoker" + member = "serviceAccount:${google_service_account.account.email}" +} + +resource "google_cloud_scheduler_job" "invoke_cloud_function" { + name = "invoke-<%= ctx[:vars]['function'] %>" + description = "Schedule the HTTPS trigger for cloud function" + schedule = "0 0 * * *" # every day at midnight + project = google_cloudfunctions2_function.<%= ctx[:primary_resource_id] %>.project + region = google_cloudfunctions2_function.<%= ctx[:primary_resource_id] %>.location + + http_target { + uri = google_cloudfunctions2_function.<%= ctx[:primary_resource_id] %>.service_config[0].uri + http_method = "POST" + oidc_token { + audience = "${google_cloudfunctions2_function.<%= ctx[:primary_resource_id] %>.service_config[0].uri}/" + service_account_email = google_service_account.account.email + } + } +} + +# [END function_v2_scheduler_auth] From 8fbb9b51445d42d179863b911f18854afacff523 Mon Sep 17 00:00:00 2001 From: "Stephen Lewis (Burrows)" Date: Fri, 30 Jun 2023 09:07:15 -0700 Subject: [PATCH 19/55] Merged "add / update resource" docs into a single guide (#8193) * Created add a resource page with template yaml and migrated some content to it * Temporary checkpoint for docs improvements * Added / renamed reference links * Finalized add-a-resource doc * Reverted test docs changes and cleaned up navigation * Removed change to how magic modules works * Renamed guide to include modifying * Reverted unrelated file deletion * Switched to multiline for docs warning & note * Clarified when field value replacement will happen * Standardized resource URL descriptions on language used in AIPs * Cleaned up boolean field descriptions * Clarified that field-level update_verb only has impact if update_url is set * Clarified the drawbacks of default_from_api. * Softened language around when new handwritten resources would be accepted * Added back required (but unused) async configuration * Switched to name rather than resource id * Clarified what triggers a handwritten resource being allowed * Added steps to clean up comments copied from templates in configuration files * Cleaned up descriptions related to default_from_api and usage of 'will' https://developers.google.com/style/tense --- ...dd-handwritten-datasource-documentation.md | 6 +- .../develop/add-handwritten-datasource.md | 6 +- docs/content/develop/add-handwritten-iam.md | 54 -- docs/content/develop/add-handwritten-test.md | 2 +- docs/content/develop/add-mmv1-iam.md | 112 ----- docs/content/develop/add-mmv1-resource.md | 456 ----------------- docs/content/develop/add-mmv1-test.md | 2 +- .../develop/mmv1-resource-documentation.md | 80 --- docs/content/develop/promote-to-ga.md | 74 +++ docs/content/develop/resource.md | 463 ++++++++++++++++++ .../update-handwritten-documentation.md | 50 -- .../develop/update-handwritten-resource.md | 371 -------------- docs/content/reference/field-reference.md | 6 + .../content/reference/iam-policy-reference.md | 6 + ...yaml-resource.md => resource-reference.md} | 4 +- mmv1/products/alloydb/Backup.yaml | 25 +- 16 files changed, 570 insertions(+), 1147 deletions(-) delete mode 100644 docs/content/develop/add-handwritten-iam.md delete mode 100644 docs/content/develop/add-mmv1-iam.md delete mode 100644 docs/content/develop/add-mmv1-resource.md delete mode 100644 docs/content/develop/mmv1-resource-documentation.md create mode 100644 docs/content/develop/promote-to-ga.md create mode 100644 docs/content/develop/resource.md delete mode 100644 docs/content/develop/update-handwritten-documentation.md delete mode 100644 docs/content/develop/update-handwritten-resource.md create mode 100644 docs/content/reference/field-reference.md create mode 100644 docs/content/reference/iam-policy-reference.md rename docs/content/reference/{resource-name-yaml-resource.md => resource-reference.md} (70%) diff --git a/docs/content/develop/add-handwritten-datasource-documentation.md b/docs/content/develop/add-handwritten-datasource-documentation.md index 59533fc57f4b..f30b412c6f65 100644 --- a/docs/content/develop/add-handwritten-datasource-documentation.md +++ b/docs/content/develop/add-handwritten-datasource-documentation.md @@ -1,13 +1,13 @@ --- -title: "Add documentation for a handwritten data source" +title: "Add datasource documentation" summary: "New handwritten datasources require new handwritten documentation to be created." -weight: 25 +weight: 61 aliases: - /docs/how-to/add-handwritten-datasource-documentation - /how-to/add-handwritten-datasource-documentation --- -# Add documentation for a handwritten data source +# Add data source documentation {{< hint info >}} **Note:** If you want to find information about documentation for a generated resource, look at the [MMv1 resource documentation](/magic-modules/docs/how-to/mmv1-resource-documentation) page instead. The information on this page will not be relevant for resources that have generated documentation. diff --git a/docs/content/develop/add-handwritten-datasource.md b/docs/content/develop/add-handwritten-datasource.md index 4bdbae787921..beeef07f1661 100644 --- a/docs/content/develop/add-handwritten-datasource.md +++ b/docs/content/develop/add-handwritten-datasource.md @@ -1,13 +1,13 @@ --- -title: "Add a handwritten datasource" +title: "Add a datasource" summary: "Datasources are like terraform resources except they don't *create* anything." -weight: 22 +weight: 60 aliases: - /docs/how-to/add-handwritten-datasource - /how-to/add-handwritten-datasource --- -# Add a handwritten datasource +# Add a datasource **Note:** only handwritten datasources are currently supported diff --git a/docs/content/develop/add-handwritten-iam.md b/docs/content/develop/add-handwritten-iam.md deleted file mode 100644 index 4c06b795163f..000000000000 --- a/docs/content/develop/add-handwritten-iam.md +++ /dev/null @@ -1,54 +0,0 @@ ---- -title: "Add handwritten IAM resources" -summary: "Handwritten IAM support is only recommended for resources that cannot be managed -using [MMv1](/magic-modules/docs/how-to/add-mmv1-iam)." -weight: 23 -aliases: - - /docs/how-to/add-handwritten-iam - - /how-to/add-handwritten-iam ---- - -# Add handwritten IAM resources - -Handwritten IAM support is only recommended for resources that cannot be managed -using [MMv1](/magic-modules/docs/how-to/add-mmv1-iam), -including for handwritten resources, due to the need to manage tests and -documentation by hand. This guidance goes through the motions of adding support -for new handwritten IAM resources, but does not go into the details of the -implementation as any new handwritten IAM resources are expected to be -exceptional. - -IAM resources are implemented using an IAM framework, where you implement an -interface for each parent resource supporting `getIamPolicy`/`setIamPolicy` and -the associated IAM resources that target that parent resource- `_member`, -`_binding`, and `_policy`- are created by the framework. - -To add support for a new target, create a new file in -`mmv1/third_party/terraform/utils` called `iam_{{resource}}.go`, and implement -the `ResourceIamUpdater`, `NewResourceIamUpdaterFunc`, `iamPolicyModifyFunc`, -`ResourceIdParserFunc` interfaces from -https://github.com/GoogleCloudPlatform/magic-modules/blob/main/mmv1/third_party/terraform/utils/iam.go.erb -in public types, alongside a public `map[string]*schema.Schema` containing all -fields referenced in the resource. - -Once your implementation is complete, add the IAM resources to `provider.go` -inside the `START non-generated IAM resources` block, creating the concrete -resource types using the `ResourceIamMember`, `ResourceIamBinding`, and -`ResourceIamPolicy` functions. For example: - -```go - "google_bigtable_instance_iam_binding": ResourceIamBinding(IamBigtableInstanceSchema, NewBigtableInstanceUpdater, BigtableInstanceIdParseFunc), - "google_bigtable_instance_iam_member": ResourceIamMember(IamBigtableInstanceSchema, NewBigtableInstanceUpdater, BigtableInstanceIdParseFunc), - "google_bigtable_instance_iam_policy": ResourceIamPolicy(IamBigtableInstanceSchema, NewBigtableInstanceUpdater, BigtableInstanceIdParseFunc), -``` - -Following that, write a test for each resource exercising create and update for -both `_policy` and `_binding`, and create for `_member`. No special -accommodations are needed for the IAM test compared to a normal Terraform -resource test. - -Documentation for IAM resources is done using single page per target resource, -rather than a distinct page for each IAM resource level. As most of the page is -standard, you can generally copy and edit an existing handwritten page such as -https://github.com/GoogleCloudPlatform/magic-modules/blob/main/mmv1/third_party/terraform/website/docs/r/bigtable_instance_iam.html.markdown -to write the documentation. diff --git a/docs/content/develop/add-handwritten-test.md b/docs/content/develop/add-handwritten-test.md index 3c5e766fddf1..339665d8b533 100644 --- a/docs/content/develop/add-handwritten-test.md +++ b/docs/content/develop/add-handwritten-test.md @@ -2,7 +2,7 @@ title: "Add a handwritten test" summary: "For handwritten resources and generated resources that need to test update, handwritten tests must be added." -weight: 21 +weight: 41 aliases: - /docs/how-to/add-handwritten-test - /how-to/add-handwritten-test diff --git a/docs/content/develop/add-mmv1-iam.md b/docs/content/develop/add-mmv1-iam.md deleted file mode 100644 index 350056b448c8..000000000000 --- a/docs/content/develop/add-mmv1-iam.md +++ /dev/null @@ -1,112 +0,0 @@ ---- -title: "Add MMv1 IAM resources" -summary: "For resources implemented through the MMv1 engine, the majority of configuration -for IAM support can be inferred based on the preexisting YAML specification file." -weight: 11 -aliases: - - /docs/how-to/add-mmv1-iam - - /how-to/add-mmv1-iam ---- - -# Add MMv1 IAM resources - -For resources implemented through the MMv1 engine, the majority of configuration -for IAM support can be inferred based on the preexisting YAML specification file. - -To add support for IAM resources based on an existing resource, add an -`iam_policy` block to the resource's definition in its `.yaml` file, such as the -following: - -```yaml - iam_policy: !ruby/object:Api::Resource::IamPolicy - method_name_separator: ':' - fetch_iam_policy_verb: :POST - parent_resource_attribute: 'registry' - import_format: ["projects/{{project}}/locations/{{location}}/registries/{{name}}", "{{name}}"] -``` - -The specification values can be determined based on a mixture of the resource -specification and the cloud.google.com `setIamPolicy`/`getIamPolicy` REST -documentation, such as -[this page](https://cloud.google.com/iot/docs/reference/cloudiot/rest/v1/projects.locations.registries/setIamPolicy) -for Cloud IOT Registries. - -`parent_resource_attribute` - (Required) determines the field name of the parent -resource reference in the IAM resources. Generally, this should be the singular -form of the parent resource kind in snake case, i.e. `registries` -> `registry` -or `backendServices` -> `backend_service`. - -`method_name_separator` - (Required) should be set to the character preceding -`setIamPolicy` in the "HTTP Request" section on the resource's `setIamPolicy` -page. This is almost always `:` for APIs other than Google Compute Engine (GCE), -MMv1's `compute` product. - -`fetch_iam_policy_verb` - (Required) should be set to the HTTP verb listed in -the "HTTP Request" section on the resource's `getIamPolicy` page. This is -generally `POST` but is occasionally `GET`. Note: This is specified as a Ruby -symbol, prefixed with a `:`. For example, for `GET`, you would specify `:GET`. - -`import_format` - (Optional) A list of templated strings used to determine the -Terraform import format. If the resource has a custom `import_format` or -`id_format` defined in `ResourceName.yaml`, this must be supplied. - - * If an `import_format` is set on the parent resource use that set of values exactly, substituting `parent_resource_attribute` for the field name of the **final** templated value. - * If an `id_format` is set on the parent resource use that as the first entry (substituting the final templated value, as with `import_format`) and define a second format with **only** the templated values, `/`-separated. For example, `projects/{{project}}/locations/{{region}}/myResources/{{name}}` -> `["projects/{{project}}/locations/{{region}}/myResources/{{myResource}}", "{{project}}/{{region}}/{{myResource}}"]`. - * Optionally, you may provide a version of the shortened format that excludes entries called `{{project}}`, `{{region}}`, and `{{zone}}`. For example, given `{{project}}/{{region}}/{{myResource}}/{{entry}}`, `{{myResource}}/{{entry}}` is a valid format. When a user specifies this format, the provider's default values for `project`/`region`/`zone` will be used. - -`allowed_iam_role` - (Optional) If the resource does not allow the -`roles/viewer` IAM role to be set, an alternate, valid role must be provided. - -`iam_conditions_request_type` - (Optional) The method the IAM policy version is -set in `getIamPolicy`. If unset, IAM conditions are assumed to not be supported for the resource. One of `QUERY_PARAM`, `QUERY_PARAM_NESTED` or `REQUEST_BODY`. For resources where a query parameter is expected, `QUERY_PARAM` should be used if the key is `optionsRequestedPolicyVersion`, while `QUERY_PARAM_NESTED` should be used if it is `options.requestedPolicyVersion`. - -`min_version` - (Optional) If the resource or IAM method is not generally -available, this should be set to `beta` or `alpha` as appropriate. - -`set_iam_policy_verb` - (Optional, rare) Similar to `fetch_iam_policy_verb`, the -HTTP verb expected by `setIamPolicy`. Defaults to `:POST`, and should only be -specified if it differs (typically if `:PUT` is expected). - -Several single-user settings are not documented on this page as they are not -expected to recur often. If you are unable to configure your API successfully, -you may want to consult https://github.com/GoogleCloudPlatform/magic-modules/blob/main/mmv1/api/resource/iam_policy.rb -for additional configuration options. - -Additionally, in order to generate IAM tests based on a preexisting resource -configuration, the first `examples` entry in `ResourceName.yaml` must be modified -to include a `primary_resource_name` entry: - -```diff - - !ruby/object:Provider::Terraform::Examples - name: "disk_basic" - primary_resource_id: "default" -+ primary_resource_name: "fmt.Sprintf(\"tf-test-test-disk%s\", context[\"random_suffix\"])" - vars: - disk_name: "test-disk" -``` - -`primary_resource_name` - Typically -`"fmt.Sprintf(\"tf-test-{{shortname}}%s\", context[\"random_suffix\"])"`, -substituting the parent resource's shortname from the example configuration for -`{{shortname}}`, such as `test-disk` above. This value is variable, as both the -key and value are user-defined parts of the example configuration. In some cases -the value must be customized further, albeit rarely. - -Once an `iam_policy` block is added and filled out, and `primary_resource_name` -is set on the first example, you're finished, and you can run MMv1 to generate -the IAM resources you've added, alongside documentation, and tests. - -## Adding IAM support to nonexistent resources - -Some IAM targets don't exist as distinct resources, such as IAP, or their target -is supported through an engine other than MMv1 (i.e. through tpgtools/DCL or a -handwritten resource). For these resources, the `exclude_resource: true` -annotation can be used. To use it, partially define the resource in its own -resource `ResourceName.yaml` file and apply the annotation. MMv1 won't attempt to -generate the resource itself and will only generate IAM resources targeting it. - -For tpgtools/DCL resources, you may need to set the `PRODUCT_BASE_PATH` override -to ensure that MMv1 is the sole library trying to set the base product URL. - -The IAP product is a good reference for adding IAM support to nonexistent resources: -https://github.com/GoogleCloudPlatform/magic-modules/tree/main/mmv1/products/iap diff --git a/docs/content/develop/add-mmv1-resource.md b/docs/content/develop/add-mmv1-resource.md deleted file mode 100644 index 834cced76c06..000000000000 --- a/docs/content/develop/add-mmv1-resource.md +++ /dev/null @@ -1,456 +0,0 @@ ---- -title: "Add an MMv1 resource" -summary: "Generated resources are created using the `mmv1` code generator, and are -configured by editing definition files under the -[`mmv1/products`](https://github.com/GoogleCloudPlatform/magic-modules/tree/master/mmv1/products) -path." -weight: 10 -aliases: - - /docs/how-to/add-mmv1-resource - - /how-to/add-mmv1-resource - - /docs/how-to - - /how-to ---- - -# Add an MMv1 resource - -Generated resources are created using the `mmv1` code generator, and are -configured by editing definition files under the -[`mmv1/products`](https://github.com/GoogleCloudPlatform/magic-modules/tree/master/mmv1/products) -path. Go to the service for your resource like -[`compute`](https://github.com/GoogleCloudPlatform/magic-modules/tree/master/mmv1/products/compute) -and open the `ResourceName.yaml` and `product.yaml` files. - -For example, for `google_spanner_database`: - -* [`Database.yaml`](https://github.com/GoogleCloudPlatform/magic-modules/blob/67cef91ee76fc4871566f03e7caee1ef664f8aa0/mmv1/products/spanner/Database.yaml) - -* [`product.yaml`](https://github.com/GoogleCloudPlatform/magic-modules/blob/67cef91ee76fc4871566f03e7caee1ef664f8aa0/mmv1/products/spanner/product.yaml) - -In short, `properties` is an array of the resource's fields. `Database.yaml` is named after the resource -in PascalCase and contains the fields of the resource based on how it behaves in the API. -`product.yaml` is lower cased and contains the product-level information that applies to all resources -within that product. - -## Field Configuration - -### `ResourceName.yaml` - -To add a field, you'll append an entry to `properties` within `ResourceName.yaml`, such -as the following adding support for a `fooBar` field in the API: - -```yaml - - !ruby/object:Api::Type::String - name: 'fooBar' - min_version: beta - immutable: true - description: | - The cloud.google.com description of this field. - default_from_api: true - custom_expand: 'templates/terraform/custom_expand/shortname_to_url.go.erb' -``` - -The first line of that snippet is the type of the field in the API, including -primitives like `String`, `Integer`, `Boolean`, `Double`. Additional special -types are detailed below in "Complex Types". - -You can configure settings on the field that describe it in the API. Avoid -setting values to `false`, and omit them instead. - -* `description` is the cloud.google.com description of the field, and must be - filled out manually. -* `min_version` can be set to `beta` if the field is only available at public - preview or beta. If it is GA, do not set a `min_version` value. -* `required: true` indicates that a field is required. New top-level fields - should not be considered required, as that is a breaking change. Subfields - of newly-added optional fields can be added as required. -* `immutable: true` indicates that a field can only be set when the API resource is - created. Changing the field will force the resource to be recreated. -* `output: true` indicates that a field is output-only in the API and cannot - be configured by the user. -* `default_value: {{value}}` adds a default value for the field. This should - only be used if the default value is fixed in the API. -* `send_empty_value: true` indicates that an explicit zero value should be - sent to the API. This is useful when a value has a nonzero default in the - API but the zero value for the type can be set. This is extremely common for - booleans that default to `true`. -* `update_verb` and `update_url` configure a custom update function for a - field.`update_verb`should be set to a literal symbol for the type (such - as :POST for `POST`) and the URL to a templated URL such - as`projects/{{project}}/global/backendServices/{{name}}/setSecurityPolicy`. -* `default_from_api: true` indicates that Terraform needs to handle a field - specially. This is common for fields with complex defaults from the API that - can't be represented with `default_value`. If a `default_from_api: true` - field is set in a user's config, Terraform will treat it as an optional - field, detecting drift and correcting drift. If it is not set, it will be - treated as an output-only field. -* `url_param_only: true` indicates that a field is not a part of the resource - body (i.e. they will never be sent in request bodies or read from response - bodies), and generally indicates that they are part of the URL. These fields - can be referenced in template strings or custom code. Typically projects, - regions, zones, locations, and parent fields will be annotated as parameters. -* `ignore_read: true` indicates that a value is not returned from an API, and - Terraform should not look for it in API responses. -* `custom_expand` and `custom_flatten` are custom functions to read/write a - value from state. They refer to files holding function contents under - [`mmv1/template/terraform/custom_expand`](https://github.com/GoogleCloudPlatform/magic-modules/tree/8728bc89c37d5033b530c7d7157bb43865d9df58/mmv1/templates/terraform/custom_expand) - and - [`mmv1/template/terraform/custom_flatten`](https://github.com/GoogleCloudPlatform/magic-modules/tree/8728bc89c37d5033b530c7d7157bb43865d9df58/mmv1/templates/terraform/custom_flatten) - respectively. - -## Field Configuration - Complex Types - -### Enum - -```yaml - - !ruby/object:Api::Type::Enum - name: 'metadata' - description: | - Can only be specified if VPC flow logging for this subnetwork is enabled. - Configures whether metadata fields should be added to the reported VPC - flow logs. - values: - - :EXCLUDE_ALL_METADATA - - :INCLUDE_ALL_METADATA - - :CUSTOM_METADATA - default_value: :INCLUDE_ALL_METADATA -``` - -Enum values represent enums in the underlying API where it is valuable to -restrict the range of inputs to a fixed set of values. They are strings that -support a `values` key to define the array of possible values specified as -literal constants, and `default_value` should be specified as a literal constant -as well. - -Most API enums should be typed as `String` instead- if the value will not be -fixed for >1 year, use a `String`. - -### ResourceRef - -```yaml - - !ruby/object:Api::Type::ResourceRef - name: 'urlMap' - resource: 'UrlMap' - imports: 'selfLink' - description: | - A reference to the UrlMap resource that defines the mapping from URL - to the BackendService. -``` - -ResourceRefs are fields that reference other resource. They're most typical in -GCE, and making a field a `ResourceRef` instead of a `String` will cause -Terraform to allow switching between reference formats and versions safely. If a -field can refer to multiple resource types, use a `String` instead. - -In a `ResourceRef`, `resource` and `imports` must be defined but Terraform -ignores those values. `resource` should be set to the resource kind, and -`imports` to `selfLink` within GCE and `name` elsewhere. - -### Array - -```yaml - - !ruby/object:Api::Type::Array - name: scopes - item_type: Api::Type::String - description: | - The list of scopes to be made available for this service - account. -``` - -```yaml - - !ruby/object:Api::Type::Array - name: 'instances' - description: | - A list of virtual machine instances serving this pool. - They must live in zones contained in the same region as this pool. - item_type: !ruby/object:Api::Type::ResourceRef - name: 'instance' - description: 'The instance being served by this pool.' - resource: 'Instance' - imports: 'selfLink' -``` - -Arrays refer to arrays in the underlying API, with their item being specified -through an `item_type` field. `item_type` accepts any type, although primitives -(String / Integer / Boolean) must be specified differently than other types as -shown above. - -### NestedObject - -```yaml - - !ruby/object:Api::Type::NestedObject - name: 'imageEncryptionKey' - description: | - Encrypts the image using a customer-supplied encryption key. - After you encrypt an image with a customer-supplied key, you must - provide the same key if you use the image later (e.g. to create a - disk from the image) - properties: - - !ruby/object:Api::Type::String - name: 'rawKey' - description: | - Specifies a 256-bit customer-supplied encryption key, encoded in - RFC 4648 base64 to either encrypt or decrypt this resource. - - !ruby/object:Api::Type::String - name: 'sha256' - output: true - description: | - The RFC 4648 base64 encoded SHA-256 hash of the - customer-supplied encryption key that protects this resource. -``` - -NestedObject is an object in the JSON API, and contains a `properties` subfield -where a sub-properties array can be defined (including additional NestedObjects) - -### KeyValuePairs (Labels / Annotations) - -```yaml - - !ruby/object:Api::Type::KeyValuePairs - name: 'labels' - description: Labels to apply to this address. A list of key->value pairs. -``` - -KeyValuePairs is a special type to handle string -> string maps, such as GCE -`labels` fields. No extra configuration is required. - -### Exactly One Of - -To restrain a parent object to contain exactly one of its nested objects, -use `exactly_one_of` in the affected child objects. - -Yaml: - -```yaml -objects: - - !ruby/object:Api::Resource - name: 'Connection' - ... - properties: - - !ruby/object:Api::Type::NestedObject - name: 'cloudSql' - exactly_one_of: - - cloud_sql - - aws - properties: - ... - - !ruby/object:Api::Type::NestedObject - name: aws - exactly_one_of: - - cloud_sql - - aws - properties: - ... -``` - -## Advanced customization - -### DiffSuppressFunc - -Terraform allows fields to specify a -[DiffSuppressFunc](https://www.terraform.io/plugin/sdkv2/schemas/schema-behaviors#diffsuppressfunc), -which allows you to ignore diffs in cases where the two values are -**functionally identical**. This is generally useful when the API returns a -normalized value - for example by standardizing the case. - -Note: The *preferred* behavior for APIs is to always return the value that the -user sent. DiffSuppressFunc is a workaround for APIs that don't. - -The Terraform provider comes with a set of -["common diff suppress functions"](https://github.com/hashicorp/terraform-provider-google/blob/main/google/common_diff_suppress.go). -These fit frequent needs like ignoring whitespace at the beginning and end of a -string, or ignoring case differences. - -If you need to define a custom diff specifically for your resource, you can do -so in a "constants" file, which is a `.go.erb` file in -[mmv1/templates/terraform/constants](https://github.com/GoogleCloudPlatform/magic-modules/tree/main/mmv1/templates/terraform/constants) -named `_.erb`. You can then declare this custom code in -`ResourceName.yaml`: - -```yaml ---- !ruby/object:Api::Resource - name: ResourceName - - custom_code: !ruby/object:Provider::Terraform::CustomCode - constants: templates/terraform/constants/product_resource_name.go.erb -``` - -Once you have chosen a DiffSuppressFunc, you can declare it as an override on -your resource: - -```yaml ---- !ruby/object:Api::Resource - name: ResourceName - - properties: - - !ruby/object:Api::Type::String - name: "myField" - diff_suppress_func: 'tpgresource.CaseDiffSuppress' -``` - -The value of diff_suppress_func can be any valid DiffSuppressFunc, including the -result of a function call. For example: - -```yaml -diff_suppress_func: 'tpgresource.OptionalPrefixSuppress("folders/")' -``` - -Please make sure to add thorough unit tests (in addition to basic integration -tests) for your diff suppress func. - -Example: DomainMapping (DomainMappingLabelDiffSuppress) - -- [DomainMapping.yaml resource file](https://github.com/GoogleCloudPlatform/magic-modules/blob/67cef91ee76fc4871566f03e7caee1ef664f8aa0/mmv1/products/cloudrun/DomainMapping.yaml) - - [`custom_code`](https://github.com/GoogleCloudPlatform/magic-modules/blob/67cef91ee76fc4871566f03e7caee1ef664f8aa0/mmv1/products/cloudrun/DomainMapping.yaml#L40) - - [`diff_suppress_func: 'resourceBigQueryDatasetAccessRoleDiffSuppress'`](https://github.com/GoogleCloudPlatform/magic-modules/blob/67cef91ee76fc4871566f03e7caee1ef664f8aa0/mmv1/products/bigquery/DatasetAccess.yaml#L112) -- [constants file](https://github.com/GoogleCloudPlatform/magic-modules/blob/67cef91ee76fc4871566f03e7caee1ef664f8aa0/mmv1/templates/terraform/constants/cloud_run_domain_mapping.go.erb) -- [unit tests](https://github.com/GoogleCloudPlatform/magic-modules/blob/67cef91ee76fc4871566f03e7caee1ef664f8aa0/mmv1/third_party/terraform/tests/resource_cloud_run_domain_mapping_test.go#L9) - -## Documentation - -When adding a new MMv1 product or resource there are fields that you need to set within `product.yaml` and resource-level `ResourceName.yaml` that are specific to documentation for that resource. To learn more about MMv1 generated documentation and what YAML fields you need to pay attention to, see [Add and update MMv1 resource documentation](/magic-modules/docs/how-to/mmv1-resource-documentation). - -# Beta features - -When the underlying API of a feature is not final (i.e. a `vN` version like -`v1` or `v2`), is in preview, or the API has no SLO we add it to the -`google-beta` provider rather than the `google` provider, allowing users to -self-select for the stability level they are comfortable with. - -In MMv1, a "version tag" can be annotated on resources, fields, resource iam -metadata and examples to control the stability level that a feature is available -at. Version tags are a specification of the minimum version a feature is -available at, written as `min_version: {{version}}`. This is only -specified when a feature is available at `beta`, and omitting a tag indicates -the target is generally available, or available at `ga`. - -## Adding a beta resource - -To add support for a beta resource in a preexisting product, ensure that a -`beta` level exists in the `versions` map in the `product.yaml` file for the product. -If one doesn't already exist, add it, setting the `base_url` to the appropriate -value. This is generally an API version including `beta`, such as `v1beta`, but -may be the same `base_url` as the `ga` entry for services that mix fields with -different stability levels within a single endpoint. - -For example: - -```diff -versions: - - !ruby/object:Api::Product::Version - name: ga - base_url: https://compute.googleapis.com/compute/v1/ -+ - !ruby/object:Api::Product::Version -+ name: beta -+ base_url: https://compute.googleapis.com/compute/beta/ -``` - -If the product doesn't already exist, it's only necessary to add the `beta` -entry, i.e.: - -``` -versions: - - !ruby/object:Api::Product::Version - name: beta - base_url: https://runtimeconfig.googleapis.com/v1beta1/ -``` - -Next, annotate the resource (`Config.yaml`) i.e.: - -```diff ----!ruby/object:Api::Resource -name: 'Config' -base_url: projects/{{project}}/configs -self_link: projects/{{project}}/configs/{{name}} -+min_version: beta -description: | - A RuntimeConfig resource is the primary resource in the Cloud RuntimeConfig service. - A RuntimeConfig resource consists of metadata and a hierarchy of variables. -iam_policy: !ruby/object:Api::Resource::IamPolicy - parent_resource_attribute: 'config' - method_name_separator: ':' - exclude: false -properties: -... -``` - -You'll notice above that the `iam_policy` is not annotated with a version tag. -Due to the resource having a `min_version` tagged already, that's passed through -to the `iam_policy` (although the same is *not* true for `examples` entries used -to [create tests](#tests-that-use-a-beta-feature)). IAM-level tagging is only -necessary in the (rare) case that a resource is available at a higher stability -level than its `getIamPolicy`/`setIamPolicy` methods. - -## Adding beta field(s) - -NOTE: If a resource is already tagged as `min_version: beta`, follow the general -instructions for adding a field instead. - -To add support for a beta field to a GA resource, ensure that the `beta` entry -already exists in the `versions` map for the product. See -[above](#adding-a-beta-resource) for details on doing so. - -Next, add the field(s) as normal with a `min_version: beta` tag specified. In -the case of nested fields, only the highest-level field must be tagged, as -demonstrated below: - -```diff - - !ruby/object:Api::Type::NestedObject - name: 'scaleDownControl' -+ min_version: beta - description: | - Defines scale down controls to reduce the risk of response latency - and outages due to abrupt scale-in events - properties: - - !ruby/object:Api::Type::Integer - name: 'timeWindowSec' - description: | - How long back autoscaling should look when computing recommendations - to include directives regarding slower scale down, as described above. -... -``` - -## Promote a beta feature - -In order to promote a beta feature to GA, remove the version tags previously set -on the feature or its tests. This will automatically make it available in the -`google` provider and remove the note that the feature is in beta in the provider -documentation. - -For a resource, this typically means ensuring their removal: - -* At the resource level, `ResourceName.yaml` -* On all resource examples, `examples` in `ResourceName.yaml` (unless some examples -use other beta resources or fields) - * Additionally, for any modified examples, all `provider = google-beta` -annotations must be cleared - -For a field, this typically means ensuring their removal: - -* At the field level, `properties` in `ResourceName.yaml` -* On any resource examples where this was the last beta feature, `examples` in -`ResourceName.yaml` - * Additionally, for any modified examples, all `provider = google-beta` -annotations must be cleared - -If the feature was tested using handwritten tests, the version guards must be -removed, as described in the -[guidance for handwritten resources](third_party/terraform/README.md#promote-a-beta-feature). - -When writing a changelog entry for a promotion, write it as if it was a new -field or resource, and suffix it with `(ga only)`. For example, if the -`google_container_cluster` resource was promoted to GA in your change: - -~~~ -```release-note:new-resource -`google_container_cluster` (ga only) -``` -~~~ - -Alternatively, for field promotions, you may use `{{service}}: promoted -{{field}} in {{resource}} to GA`, i.e. - -~~~ -```release-note:enhancement -container: promoted `node_locations` field in google_container_cluster` to GA -``` -~~~ diff --git a/docs/content/develop/add-mmv1-test.md b/docs/content/develop/add-mmv1-test.md index e2017f157b7b..d0bf2a096f4d 100644 --- a/docs/content/develop/add-mmv1-test.md +++ b/docs/content/develop/add-mmv1-test.md @@ -1,7 +1,7 @@ --- title: "Add an MMv1 test" summary: "An example terraform configuration can be used to generate docs and tests for a resource." -weight: 12 +weight: 40 aliases: - /docs/how-to/add-mmv1-test - /how-to/add-mmv1-test diff --git a/docs/content/develop/mmv1-resource-documentation.md b/docs/content/develop/mmv1-resource-documentation.md deleted file mode 100644 index 45e969a8ae4b..000000000000 --- a/docs/content/develop/mmv1-resource-documentation.md +++ /dev/null @@ -1,80 +0,0 @@ ---- -title: "Add and update MMv1 resource documentation" -summary: "Generated resources have generated documentation. This page describes the generation process and what YAML inputs are used." -weight: 13 -aliases: - - /docs/how-to/mmv1-resource-documentation - - /how-to/mmv1-resource-documentation ---- - -# MMv1 resource documentation - -A majority of the provider's documentation is generated using the same information that's used for generating the provider's Go code. For example, when adding a new field to a resource in the relevant `ResourceName.yaml` file we include a `description` field. This is used to set a field description in the resource's schema and is also used to document the field in generated markdown files. - -## Updating an existing MMv1 resource's documentation - -As a result of code generation, you often do not need to explicitly think about making updates to documentation. However it is a good idea to check the markdown changes when you generate the provider, especially if you are making lots of changes. - -## Adding new documentation for a new MMv1 resource - -More thought is required when adding a new resource from scratch. See the relevant section below for guidance about what YAML fields are needed to create complete documentation. - -## How generated documentation is made - -The Magic Modules compiler parses YAML files, creates Ruby objects that are populated with the data from those files, and then uses that data within template files to create produce the final markdown files. - -The main template used for documentation is `mmv1/templates/terraform/resource.html.markdown.erb`. As an example of how it works, you can see that the main title of documentation pages are created by some [processing of name data](https://github.com/GoogleCloudPlatform/magic-modules/blob/a69f1150de76f2b2cd9d37faa6bd44c1fb8a460a/mmv1/templates/terraform/resource.html.markdown.erb#L41) for a given resource and then using Ruby string methods to [print an escaped version of the name](https://github.com/GoogleCloudPlatform/magic-modules/blob/a69f1150de76f2b2cd9d37faa6bd44c1fb8a460a/mmv1/templates/terraform/resource.html.markdown.erb#L58) into an H1 header. - - -## What YAML fields are used in the documentation - -The YAML files in Magic Modules are used to generate both the provider's Go code and the markdown documentation. As a result of this, changes to documentation happen automatically while you make a change to a resource's implementation in the provider. Often it's possible to address an issue without ever needing to think about documentation changes. - -However, if you are implementing a new product or resource from scratch, or making non-routine changes to documentation, then you will need to be aware of how the YAML fields are used. Especially as some are specific to documentation. - -Below are descriptions of fields that are directly referenced in the documentation templates. - -### Top level fields for a product - -These fields are found in the `product.yaml` files, and describe an overall product (ruby/object:Api::Product). - -| Field | Type | Relation to documentation | Example value | -| ----- | ---- |------------------------- | ------------- | -| `display_name` | string | Controls the value of `subcategory` in YAML frontmatter; determines where the link to the page appears in the left-side navigation menu. | [See example](https://github.com/GoogleCloudPlatform/magic-modules/blob/39bded78e3032328e972f8e5b5f37796a451440b/mmv1/products/accesscontextmanager/product.yaml#L16) | - -### Top level fields within resources - -These are top-level properties of a resource (ruby/object:Api::Resource) in `ResourceName.yaml`. - -| Field | Type | Relation to documentation | Example value | -| ----- | ---- |------------------------- | ------------- | -| `has_self_link` | boolean | Boolean to indicate if a resource has a `self_link` attribute. If true, the attribute is included in the templated markdown | [See example](https://github.com/GoogleCloudPlatform/magic-modules/blob/67cef91ee76fc4871566f03e7caee1ef664f8aa0/mmv1/products/bigquery/Dataset.yaml#L19) and the resulting [self_link attribute in docs](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/bigquery_dataset#self_link) | -| `import_format`| array of strings | Sets the identifiers that can be used to import a resource into Terraform state. Used to add multiple entries in the 'Import' section of documentation. | [See example](https://github.com/GoogleCloudPlatform/magic-modules/blob/67cef91ee76fc4871566f03e7caee1ef664f8aa0/mmv1/products/apigateway/Gateway.yaml#L37) that results in [an import section listing multiple options](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/api_gateway_api#import) | -| `description`| string | Sets the description of the resource at the top of the page | [See example](https://github.com/GoogleCloudPlatform/magic-modules/blob/67cef91ee76fc4871566f03e7caee1ef664f8aa0/mmv1/products/bigquery/Dataset.yaml#L20) | -| `docs.note` | string | Text is templated into a callout block at the top of the page which is titled "Note" | [See example](https://github.com/GoogleCloudPlatform/magic-modules/blob/67cef91ee76fc4871566f03e7caee1ef664f8aa0/mmv1/products/iamworkforcepool/WorkforcePool.yaml#L29) and the resulting [callout in the docs](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/iam_workforce_pool)| -| `docs.warning` | string | Text is templated into a callout block at the top of the page which is titled "Warning" | [See example](https://github.com/GoogleCloudPlatform/magic-modules/blob/67cef91ee76fc4871566f03e7caee1ef664f8aa0/mmv1/products/bigquery/Dataset.yaml#L78-L81) and the resulting [callout in the docs](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/bigquery_dataset)| -| * `docs.optional_properties` | string | Used to append extra content to the bulleted list describing optional properties for a resource. | [See example](https://github.com/GoogleCloudPlatform/magic-modules/blob/67cef91ee76fc4871566f03e7caee1ef664f8aa0/mmv1/products/cloudiot/DeviceRegistry.yaml#L43-L76) | -| * `docs.required_properties` | string | Used to append extra content to the bulleted list describing required properties for a resource. | There are no examples of this currently in use. | -| * `docs.attributes` | string | Used to append extra content to the bulleted list describing attributes for a resource. | There is currently only one example of this field in use, [here](https://github.com/GoogleCloudPlatform/magic-modules/blob/67cef91ee76fc4871566f03e7caee1ef664f8aa0/mmv1/products/iap/Client.yaml#L43-L44). | -| `min_version`| string | If set to `beta`, the template includes a beta warning at the start of the documentation | [See example in the official docs](https://registry.terraform.io/providers/hashicorp/google-beta/latest/docs/resources/alloydb_backup) | -| `references.api`| string | Sets the URL used in generated links to documentation | [See example](https://github.com/GoogleCloudPlatform/magic-modules/blob/67cef91ee76fc4871566f03e7caee1ef664f8aa0/mmv1/products/datacatalog/Entry.yaml#L31) | -| `references.guides`| hash | A set of key-value pairs where the key is text to be rendered and the value is the URL the text links to | [See example](https://github.com/GoogleCloudPlatform/magic-modules/blob/67cef91ee76fc4871566f03e7caee1ef664f8aa0/mmv1/products/datacatalog/Entry.yaml#L29-L30) | -| `supports_indirect_user_project_override`| boolean | This is the explicit way to make sure the 'User Project Overrides' section is shown in the resource's documentation | [See example](https://github.com/GoogleCloudPlatform/magic-modules/blob/67cef91ee76fc4871566f03e7caee1ef664f8aa0/mmv1/products/datacatalog/Entry.yaml#L33) and the [resulting section in the docs](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/data_catalog_entry#user-project-overrides) | - -\* = Avoid unless absolutely necessary. - -### Fields set within resource properties - -The main thing to focus on for properties is to provide an adequate description. Typically we copy and paste the descriptions from the official API reference, making sure to pick the richest description and include any links. - -Updates to other fields, like `output` and `required`, are easier to troubleshoot via acceptance testing but are also relevant to the produced documentation. - -| Field | Type | Relation to documentation | -| ----- | ---- | ------------------------- | -| `deprecated` | boolean | Controls if `(Deprecated)` will be shown next to the argument name | -| `description` | string | The description shown in for a given argument or attribute | -| `name` | string | The name displayed in a list of arguments or attributes | -| `output` | boolean | Used to prevent a field being presented as an argument in the docs | -| `required` | boolean | Controls if `(Required)` will be shown next to the argument name | -| `sensitive` | boolean | Is used to help create a list of sensitive values. This list is used in a warning callout about sensitive values in state at the top of the page | -| `skip_docs_values` | boolean | Controls if a default value will be shown, or not, in the docs | diff --git a/docs/content/develop/promote-to-ga.md b/docs/content/develop/promote-to-ga.md new file mode 100644 index 000000000000..2394949d99e7 --- /dev/null +++ b/docs/content/develop/promote-to-ga.md @@ -0,0 +1,74 @@ +--- +title: "Promote to GA" +weight: 70 +--- + +# Promote from beta to GA + +This document describes how to promote an existing resource or field that uses MMv1 and/or handwritten code from the `google-beta` provider to the `google` (also known as "GA") provider. + +Handwritten code (including `custom_code`) commonly uses "version guards" in the form of `<% unless version == 'ga' -%>...<% end -%>` to wrap code that is beta-specific, which need to be removed during promotion. + +For more information about types of resources and the generation process overall, see [How Magic Modules works]({{< ref "/get-started/how-magic-modules-works.md" >}}). + +## Before you begin + +1. Complete the [Generate the providers]({{< ref "/get-started/generate-providers" >}}) quickstart to set up your environment and your Google Cloud project. +2. Ensure that your `magic-modules`, `terraform-provider-google`, and `terraform-provider-google-beta` repositories are up to date. + ``` + cd ~/magic-modules + git checkout main && git clean -f . && git checkout -- . && git pull + cd $GOPATH/src/github.com/hashicorp/terraform-provider-google + git checkout main && git clean -f . && git checkout -- . && git pull + cd $GOPATH/src/github.com/hashicorp/terraform-provider-google-beta + git checkout main && git clean -f . && git checkout -- . && git pull + ``` + +## Promote fields and resources + +{{< tabs "resources" >}} +{{< tab "MMv1" >}} +1. Remove `min_version: beta` from the resource's or field's configuration in `ResourceName.yaml`. +2. If necessary, remove version guards from resource-level `custom_code`. +3. Add `min_version: beta` on any fields or subfields that should not be promoted. +4. If necessary, add `<% unless version == 'ga' -%>...<% end -%>` version guards to resource-level `custom_code` that should not be promoted. +{{< /tab >}} +{{< tab "Handwritten" >}} +1. Remove version guards from the resource's implementation for any functionality being promoted. Be sure to check: + - The overall resource (if the entire resource was beta-only) + - The resource schema + - For top-level fields, the resource's `Create`, `Update`, and `Read` methods + - For other fields, expanders and flatteners + - Any other resource-specific code +2. Add `<% unless version == 'ga' -%>...<% end -%>` version guards to any parts of the resource or field implementation that should not be promoted. Be sure to check: + - The resource schema + - For top-level fields, the resource's `Create`, `Update`, and `Read` methods + - For other fields, expanders and flatteners + - Any other resource-specific code +{{< /tab >}} +{{< /tabs >}} + +## Promote tests + +1. Remove `min_version: beta` from any examples in a `ResourceName.yaml` which only test fields and resources that are present in the `google` provider. +2. Remove version guards from any handwritten code related to fields and resources that are present in the `google` provider. +3. Remove `provider = google-beta` from any test configurations (from MMv1 `examples` or handwritten) which have been promoted. +4. Ensure that there is at least one test that will run for the `google` provider that covers any promoted fields and resources. + +## Promote documentation + +For handwritten resources, modify the documentation as appropriate for your change: + +1. If the entire resource has been promoted to `google`, remove the beta warning at the top of the documentation. +2. Remove the `Beta` annotation for any fields that have been promoted. +3. Add `Beta` as an annotation on any fields or subfields that remained beta-only. For example: + + ```markdown + * `FIELD_NAME` - (Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html)) FIELD_DESCRIPTION + ``` + + Replace `FIELD_NAME` and `FIELD_DESCRIPTION` with the field's name and description. + +## What's next? + +- [Test your changes]({{< ref "/get-started/run-provider-tests.md" >}}) diff --git a/docs/content/develop/resource.md b/docs/content/develop/resource.md new file mode 100644 index 000000000000..139984613015 --- /dev/null +++ b/docs/content/develop/resource.md @@ -0,0 +1,463 @@ +--- +title: "Add or modify a resource" +weight: 30 +aliases: + - /docs/how-to/add-mmv1-resource + - /how-to/add-mmv1-resource + - /develop/add-mmv1-resource + - /docs/how-to/mmv1-resource-documentation + - /how-to/mmv1-resource-documentation + - /develop/mmv1-resource-documentation + - /docs/how-to/add-mmv1-iam + - /how-to/add-mmv1-iam + - /develop/add-mmv1-iam + - /docs/how-to/update-handwritten-resource + - /how-to/update-handwritten-resource + - /develop/update-handwritten-resource + - /docs/how-to/update-handwritten-documentation + - /how-to/update-handwritten-documentation + - /develop/update-handwritten-documentation + - /docs/how-to + - /how-to +--- + +# Add or modify a resource + +This page describes how to add a new resource to the `google` or `google-beta` Terraform provider using MMv1 and/or handwritten code. + +For more information about types of resources and the generation process overall, see [How Magic Modules works]({{< ref "/get-started/how-magic-modules-works.md" >}}). + +## Before you begin + +1. Complete the [Generate the providers]({{< ref "/get-started/generate-providers" >}}) quickstart to set up your environment and your Google Cloud project. +2. Ensure that your `magic-modules`, `terraform-provider-google`, and `terraform-provider-google-beta` repositories are up to date. + ``` + cd ~/magic-modules + git checkout main && git clean -f . && git checkout -- . && git pull + cd $GOPATH/src/github.com/hashicorp/terraform-provider-google + git checkout main && git clean -f . && git checkout -- . && git pull + cd $GOPATH/src/github.com/hashicorp/terraform-provider-google-beta + git checkout main && git clean -f . && git checkout -- . && git pull + ``` + +## Add a resource + +{{< tabs "resource" >}} +{{< tab "MMv1" >}} +1. Using an editor of your choice, in the appropriate [product folder]({{}}), create a file called `RESOURCE_NAME.yaml`. Replace `RESOURCE_NAME` with the name of the API resource you are adding support for. For example, a configuration file for [NatAddress](https://cloud.google.com/apigee/docs/reference/apis/apigee/rest/v1/organizations.instances.natAddresses) would be called `NatAddress.yaml`. +2. Copy the following template into the new file: + ```yaml + # Copyright 2023 Google Inc. + # Licensed under the Apache License, Version 2.0 (the "License"); + # you may not use this file except in compliance with the License. + # You may obtain a copy of the License at + # + # http://www.apache.org/licenses/LICENSE-2.0 + # + # Unless required by applicable law or agreed to in writing, software + # distributed under the License is distributed on an "AS IS" BASIS, + # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + # See the License for the specific language governing permissions and + # limitations under the License. + + --- !ruby/object:Api::Resource + # API resource name + name: 'ResourceName' + # Resource description for the provider documentation. + description: | + RESOURCE_DESCRIPTION + references: !ruby/object:Api::Resource::ReferenceLinks + guides: + # Link to quickstart in the API's Guides section. For example: + # 'Create and connect to a database': 'https://cloud.google.com/alloydb/docs/quickstart/create-and-connect' + 'QUICKSTART_TITLE': 'QUICKSTART_URL' + # Link to the REST API reference for the resource. For example, + # https://cloud.google.com/alloydb/docs/reference/rest/v1/projects.locations.backups + api: 'API_REFERENCE_URL' + # Marks the resource as beta-only. Ensure a beta version block is present in + # provider.yaml. + # min_version: beta + + # Inserts styled markdown into the header of the resource's page in the + # provider documentation. + # docs: + # warning: | + # MULTILINE_WARNING_MARKDOWN + # note: | + # MULTILINE_NOTE_MARKDOWN + + # URL for the resource's standard List method. https://google.aip.dev/132 + # Terraform field names enclosed in double curly braces are replaced with + # the field values from the resource at runtime. + base_url: 'projects/{{project}}/locations/{{location}}/resourcenames' + # URL for the resource's standard Get method. https://google.aip.dev/131 + # Terraform field names enclosed in double curly braces are replaced with + # the field values from the resource at runtime. + self_link: 'projects/{{project}}/locations/{{location}}/resourcenames/{{name}}' + + # If true, the resource and all its fields are considered immutable - that is, + # only creatable, not updatable. Individual fields can override this if they + # have a custom update method in the API. + # immutable: true + + # Overrides one or more timeouts, in minutes. All timeouts default to 20. + # timeouts: !ruby/object:Api::Timeouts + # insert_minutes: 20 + # update_minutes: 20 + # delete_minutes: 20 + + # URL for the resource's standard Create method, including query parameters. + # https://google.aip.dev/133 + # Terraform field names enclosed in double curly braces are replaced with + # the field values from the resource at runtime. + create_url: 'projects/{{project}}/locations/{{location}}/resourcenames?resourceId={{name}}' + # Overrides the HTTP verb used to create a new resource. + # Allowed values: :POST, :PUT, :PATCH. Default: :POST + # create_verb: :POST + + # Overrides the URL for the resource's standard Update method. (If unset, the + # self_link URL is used by default.) https://google.aip.dev/134 + # Terraform field names enclosed in double curly braces are replaced with + # the field values from the resource at runtime. + # update_url: 'projects/{{project}}/locations/{{location}}/resourcenames/{{name}}' + # The HTTP verb used to update a resource. Allowed values: :POST, :PUT, :PATCH. Default: :PUT. + update_verb: :PATCH + # If true, the resource sets an `updateMask` query parameter listing modified + # fields when updating the resource. If false, it does not. + update_mask: true + + # Overrides the URL for the resource's standard Delete method. (If unset, the + # self_link URL is used by default.) https://google.aip.dev/135 + # Terraform field names enclosed in double curly braces are replaced with + # the field values from the resource at runtime. + # delete_url: 'projects/{{project}}/locations/{{location}}/resourcenames/{{name}}' + # Overrides the HTTP verb used to delete a resource. + # Allowed values: :POST, :PUT, :PATCH, :DELETE. Default: :DELETE + # delete_verb: :DELETE + + # If true, code for handling long-running operations is generated along with + # the resource. If false, that code is not generated. + autogen_async: true + # Sets parameters for handling operations returned by the API. + async: !ruby/object:Api::OpAsync + # Overrides which API calls return operations. Default: ['create', + # 'update', 'delete'] + # actions: ['create', 'update', 'delete'] + operation: !ruby/object:Api::OpAsync::Operation + base_url: '{{op_id}}' + # If true, the completed operation's returned JSON is expected to + # contain a full resource in the "response" field + # result: !ruby/object:Api::OpAsync::Result + # resource_inside_response: true + # The following are all required but unused. + path: 'unused' + wait_ms: 0 # unused + result: !ruby/object:Api::OpAsync::Result + path: 'unused' + status: !ruby/object:Api::OpAsync::Status + path: 'unused' + allowed: [] + error: !ruby/object:Api::OpAsync::Error + path: 'unused' + message: 'unused' + + # All resources (of all kinds) that share a mutex value block rather than + # executing concurrent API requests. + # Terraform field names enclosed in double curly braces are replaced with + # the field values from the resource at runtime. + # mutex: RESOURCE_NAME/{{name}} + + parameters: + - !ruby/object:Api::Type::String + name: 'location' + required: true + immutable: true + url_param_only: true + description: | + LOCATION_DESCRIPTION + - !ruby/object:Api::Type::String + name: 'name' + required: true + immutable: true + url_param_only: true + description: | + NAME_DESCRIPTION + + properties: + # Fields go here + ``` + +3. Modify the template as needed to match the API resource's documented behavior. +4. Delete all remaining comments in the resource configuration (including attribute descriptions) that were copied from the above template. + +> **Note:** The template includes the most commonly-used fields. For a comprehensive reference, see [ResourceName.yaml reference ↗]({{}}). +{{< /tab >}} +{{< tab "Handwritten" >}} +> **Warning:** Handwritten resources are more difficult to develop and maintain. New handwritten resources will only be accepted if implementing the resource in MMv1 would require entirely overriding two or more CRUD methods. + +1. Add the resource in MMv1. +2. [Generate the beta provider]({{< ref "/get-started/generate-providers.md" >}}) +3. From the beta provider, copy the files generated for the resource to the following locations: + - Resource: Copy to the appropriate service folder inside [`magic-modules/mmv1/third_party/terraform/services`](https://github.com/GoogleCloudPlatform/magic-modules/tree/main/mmv1/third_party/terraform/services) + - Documentation: [`magic-modules/mmv1/third_party/terraform/website/docs/r`](https://github.com/GoogleCloudPlatform/magic-modules/tree/main/mmv1/third_party/terraform/website/docs/r) + - Tests: [`magic-modules/mmv1/third_party/terraform/tests`](https://github.com/GoogleCloudPlatform/magic-modules/tree/main/mmv1/third_party/terraform/tests) + - Sweepers: [`magic-modules/mmv1/third_party/terraform/utils`](https://github.com/GoogleCloudPlatform/magic-modules/tree/main/mmv1/third_party/terraform/utils) +4. Modify the Go code as needed. + - Replace the comments at the top of the file with the following: + ``` + <% autogen_exception -%> + ``` + - If any of the added Go code (including any imports) is beta-only, change the file suffix to `.go.erb` and wrap the beta-only code in a version guard: `<% unless version = 'ga' -%>...<% else -%>...<% end -%>`. +5. Register the resource in [`magic-modules/mmv1/third_party/terraform/utils/provider.go.erb`](https://github.com/GoogleCloudPlatform/magic-modules/blob/main/mmv1/third_party/terraform/utils/provider.go.erb) under "START handwritten resources" + - Add a version guard for any beta-only resources. +{{< /tab >}} +{{< /tabs >}} + +## Add fields + +{{< tabs "fields" >}} +{{< tab "MMv1" >}} +1. For each API field, copy the following template into the resource's `properties` attribute. Be sure to indent appropriately. + +```yaml +# Supported types: String, Integer, Boolean, Double, Enum, +# ResourceRef (link to a GCP resource), KeyValuePairs (string -> string map), +# Array, and NestedObject +- !ruby/object:Api::Type::String + name: 'API_FIELD_NAME' + description: | + MULTILINE_FIELD_DESCRIPTION + # Marks the field (and any subfields) as beta-only. Ensure a beta version block + # is present in provider.yaml. Do not use if an ancestor field (or the overall + # resource) is already marked as beta-only. + # min_version: beta + + # If true, the field (and any subfields) are considered immutable - that is, + # only settable on create. If unset or false, the field is still considered + # immutable if any ancestor field (or the overall resource) is immutable, + # unless `update_url` is set. + # immutable: true + + # If set, changes to the field's value trigger a separate call to a specific + # API method for updating the field's value. The field is not considered + # immutable even if an ancestor field (or the overall resource) is immutable. + # Terraform field names enclosed in double curly braces are replaced with the + # field values from the resource at runtime. + # update_url: 'projects/{{project}}/locations/{{location}}/resourcenames/{{name}}/setFieldName' + + # If update_url is also set, overrides the verb used to update this specific + # field. Allowed values: :POST, :PUT, :PATCH. Default: Resource's update_verb + # (which defaults to :PUT if unset). + # update_verb: :POST + + # If true, the field is required. If unset or false, the field is optional. + # required: true + + # If true, the field is output-only - that is, it cannot be configured by the + # user. If unset or false, the field is configurable. + # output: true + + # If true, the provider sets the field's value in the resource state based only + # on the user's configuration. If false or unset, the provider sets the field's + # value in the resource state based on the API response. Only use this attribute + # if the field cannot be read from GCP due to either API or provider constraints. + # ignore_read: true + + # Sets a client-side default value for the field. This should be used if the + # API has a default value that applies in all cases and is stable. Removing + # or changing a default value is a breaking change. If unset, the field defaults + # to an "empty" value (such as zero, false, or an empty string). + # default_value: DEFAULT_VALUE + + # If true, and the field is either not set or set to an "empty" value (such as + # zero, false, or empty strings), the provider accepts any value returned from + # the API as the value for the field. If false, and the field is either not set + # or set to an "empty" value, the provider treats the field's `default_value` + # as the value for the field and shows a diff if the API returns any other + # value for the field. This attribute is useful for complex or + # frequently-changed API-side defaults, but provides less useful information at + # plan time than `default_value` and causes the provider to ignore user + # configurations that explicitly set the field to an "empty" value. + # `default_from_api` and `send_empty_value` cannot both be true on the same field. + # default_from_api: true + + # If true, the provider sends "empty" values (such as zero, false, or empty + # strings) to the API if set explicitly in the user's configuration. If false, + # "empty" values cause the field to be omitted entirely from the API request. + # This attribute is useful for fields where the API would behave differently + # for an "empty" value vs no value for a particular field - for example, + # boolean fields that have an API-side default of true. + # `send_empty_value` and `default_from_api` cannot both be true on the same field. + # send_empty_value: true + + # Specifies a list of fields (excluding the current field) that cannot be + # specified at the same time as the current field. Must be set separately on + # all listed fields. + # conflicts: + # - field_one + # - nested_object.0.nested_field + + # Specifies a list of fields (including the current field) that cannot be + # specified at the same time (but at least one of which must be set). Must be + # set separately on all listed fields. + # exactly_one_of: + # - field_one + # - nested_object.0.nested_field + + # Enum only. Sets allowed values as ruby "literal constants" (prefixed with a + # colon). If the allowed values change frequently, use a String field instead + # to allow better forwards-compatibility, and link to API documentation + # stating the current allowed values in the String field's description. Do not + # include UNSPECIFIED values in this list. + # values: + # - :VALUE_ONE + # - :VALUE_TWO + + # Array only. Sets the expected type of the items in the array. Primitives + # should use the name of the primitive class as a string; other types should + # define the attributes of the nested type. + # item_type: Api::Type::String + # item_type: !ruby/object:Api::Type::Enum + # name: 'required but unused' + # description: 'required but unused' + # values: + # - :VALUE_ONE + # - :VALUE_TWO + + # NestedObject only. Defines fields nested inside the current field. + # properties: + # - !ruby/object:Api::Type::String + # name: 'FIELD_NAME' + # description: | + # MULTI_LINE_FIELD_DESCRIPTION +``` +2. Modify the field configuration according to the API documentation and behavior. +3. Delete all remaining comments in the field configuration (including attribute descriptions) that were copied from the above template. + +> **Note:** The template includes the most commonly-used fields. For a comprehensive reference, see [Field reference ↗]({{}}). +{{< /tab >}} +{{< tab "Handwritten" >}} +1. Add the field to the handwritten resource's schema. + - The new field(s) should mirror the API's structure to ease predictability and maintenance. However, if there is an existing related / similar field in the resource that uses a different convention, follow that convention instead. + - Enum fields in the API should be represented as `TypeString` in Terraform for forwards-compatibility. Link to the API documentation of allowed values in the field description. + - Terraform field names should always use [snake case ↗](https://en.wikipedia.org/wiki/Snake_case). + - See [Schema Types ↗](https://developer.hashicorp.com/terraform/plugin/sdkv2/schemas/schema-types) and [Schema Behaviors ↗](https://developer.hashicorp.com/terraform/plugin/sdkv2/schemas/schema-behaviors) for more information about field schemas. +2. Add handling for the new field in the resource's Create method and Update methods. + - "Expanders" convert Terraform resource data to API request data. + - For top level fields, add an expander. If the field is set or has changed, call the expander and add the resulting value to the API request. + - For other fields, add logic to the parent field's expander to add the field to the API request. Use a nested expander for complex logic. +3. Add handling for the new field in the resource's Read method. + - "Flatteners" convert API response data to Terraform resource data. + - For top level fields, add a flattener. Call `d.Set()` on the flattened API response value to store it in Terraform state. + - For other fields, add logic to the parent field's flattener to convert the value from the API response to the Terraform state value. Use a nested flattener for complex logic. +4. If any of the added Go code (including any imports) is beta-only, change the file suffix to `.go.erb` and wrap the beta-only code in a version guard: `<% unless version = 'ga' -%>...<% else -%>...<% end -%>`. + - Add a new guard rather than adding the field to an existing guard; it is easier to read. +{{< /tab >}} +{{< /tabs >}} + + +## Add IAM support + +This section covers how to add IAM resources in Terraform if they are supported by a particular API resource (indicated by `setIamPolicy` and `getIamPolicy` methods in the API documentation for the resource). + +{{< tabs "IAM" >}} +{{< tab "MMv1" >}} +1. Add the following top-level block to `ResourceName.yaml` directly above `parameters`. + +```yaml +iam_policy: !ruby/object:Api::Resource::IamPolicy + # Name of the field on the terraform IAM resources which references + # the parent resource. Update to match the parent resource's name. + parent_resource_attribute: 'resource_name' + # Character preceding setIamPolicy in the full URL for the API method. + # Usually `:` + method_name_separator: ':' + # HTTP method for getIamPolicy. Usually :POST. + # Allowed values: :GET, :POST. Default: :GET + fetch_iam_policy_verb: :POST + # Overrides the HTTP method for setIamPolicy. + # Allowed values: :POST, :PUT. Default: :POST + # set_iam_policy_verb: :POST + + # Must match the parent resource's import_format, but with the + # parent_resource_attribute value substituted for the final field. + import_format: [ + 'projects/{{project}}/locations/{{location}}/resourcenames/{{resource_name}}' + ] + # Valid IAM role that can be set by generated tests. Default: 'roles/viewer' + # allowed_iam_role: 'roles/viewer' + + # If IAM conditions are supported, set this attribute to indicate how the + # conditions should be passed to the API. Allowed values: :QUERY_PARAM, + # :REQUEST_BODY, :QUERY_PARAM_NESTED. Note: :QUERY_PARAM_NESTED should + # only be used if the query param field contains a `.` + # iam_conditions_request_type: :REQUEST_BODY + + # Marks IAM support as beta-only + # min_version: beta +``` + +2. Modify the template as needed to match the API resource's documented behavior. These are the most commonly-used fields. For a comprehensive reference, see [IAM policy YAML reference ↗]({{}}). +3. Delete all remaining comments in the IAM configuration (including attribute descriptions) that were copied from the above template. +{{< /tab >}} +{{< tab "Handwritten" >}} +> **Warning:** IAM support for handwritten resources should be implemented using MMv1. New handwritten IAM resources will only be accepted if they cannot be implemented using MMv1. + +### Add support in MMv1 + +1. Follow the MMv1 directions in [Add the resource]({{}}) to create a skeleton ResourceName.yaml file for the handwritten resource, but set only the following top-level fields: `name`, `base_url` (set to URL of IAM parent resource), `self_link` (set to same value as `base_url`) `description` (required but unused), `id_format`, `import_format`, and `properties`. +2. Follow the MMv1 directions in [Add fields]({{}}) to add only the fields used by base_url. +3. Follow the MMv1 directions in this section to add IAM support. + +### Convert to handwritten (not usually necessary) + +1. [Generate the beta provider]({{< ref "/get-started/generate-providers.md" >}}) +2. From the beta provider, copy the files generated for the IAM resources to the following locations: + - Resource: Copy to the appropriate service folder inside [`magic-modules/mmv1/third_party/terraform/services`](https://github.com/GoogleCloudPlatform/magic-modules/tree/main/mmv1/third_party/terraform/services) + - Documentation: [`magic-modules/mmv1/third_party/terraform/website/docs/r`](https://github.com/GoogleCloudPlatform/magic-modules/tree/main/mmv1/third_party/terraform/website/docs/r) + - Tests: [`magic-modules/mmv1/third_party/terraform/tests`](https://github.com/GoogleCloudPlatform/magic-modules/tree/main/mmv1/third_party/terraform/tests) +3. Modify the Go code as needed. + - Replace the comments at the top of the file with the following: + ``` + <% autogen_exception -%> + ``` + - If any of the added Go code (including any imports) is beta-only, change the file suffix to `.go.erb` and wrap the beta-only code in a version guard: `<% unless version = 'ga' -%>...<% else -%>...<% end -%>`. +4. Register the binding, member, and policy resources in [`magic-modules/mmv1/third_party/terraform/utils/provider.go.erb`](https://github.com/GoogleCloudPlatform/magic-modules/blob/main/mmv1/third_party/terraform/utils/provider.go.erb) under "START non-generated IAM resources" + - Add a version guard for any beta-only resources. +{{< /tab >}} +{{< /tabs >}} + +## Add documentation + +{{< tabs "docs" >}} +{{< tab "MMv1" >}} +Documentation is autogenerated based on the resource and field configurations. To preview the documentation: + +1. [Generate the providers]({{< ref "/get-started/generate-providers.md" >}}) +2. Copy and paste the generated documentation into the Hashicorp Registry's [Doc Preview Tool](https://registry.terraform.io/tools/doc-preview) to see how it is rendered. +{{< /tab >}} +{{< tab "Handwritten" >}} +1. Open the resource documentation in [`magic-modules/third_party/terraform/website/docs/r/`](https://github.com/GoogleCloudPlatform/magic-modules/tree/main/mmv1/third_party/terraform/website/docs/r) using an editor of your choice. + - The name of the file is the name of the resource without a `google_` prefix. For example, for `google_compute_instance`, the file is called `compute_instance.html.markdown` +2. For beta-only resources, add the following snippet directly above the first example: + + ```markdown + ~> **Warning:** This resource is in beta, and should be used with the terraform-provider-google-beta provider. + See [Provider Versions](https://terraform.io/docs/providers/google/guides/provider_versions.html) for more details on beta resources. + ``` +3. For resources that are in the `google` provider but have beta-only fields, make sure that all beta-only fields are clearly marked. For example: + ```markdown + * `FIELD_NAME` - (Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html)) FIELD_DESCRIPTION + ``` + + Replace `FIELD_NAME` and `FIELD_DESCRIPTION` with the field's name and description. +4. [Generate the providers]({{< ref "/get-started/generate-providers.md" >}}) +5. Copy and paste the generated documentation into the Hashicorp Registry's [Doc Preview Tool](https://registry.terraform.io/tools/doc-preview) to see how it is rendered. +{{< /tab >}} +{{< /tabs >}} + +## What's next? + +- [Add MMv1 tests]({{< ref "/develop/add-mmv1-test.md" >}}) +- [Add handwritten tests]({{< ref "/develop/add-handwritten-test.md" >}}) +- [Test your changes]({{< ref "/get-started/run-provider-tests.md" >}}) diff --git a/docs/content/develop/update-handwritten-documentation.md b/docs/content/develop/update-handwritten-documentation.md deleted file mode 100644 index 9ad8b59160f2..000000000000 --- a/docs/content/develop/update-handwritten-documentation.md +++ /dev/null @@ -1,50 +0,0 @@ ---- -title: "Update handwritten provider documentation" -summary: "Handwritten resources and datasources have handwritten documentation that needs to be updated in PRs." -weight: 24 -aliases: - - /docs/how-to/update-handwritten-documentation - - /how-to/update-handwritten-documentation ---- - -# Update handwritten provider documentation (for handwritten resource or datasource) - -{{< hint info >}} -**Note:** If you want to find information about documentation for a generated resource, look at the [MMv1 resource documentation](/magic-modules/docs/how-to/mmv1-resource-documentation) page instead. The information on this page will not be relevant for resources that have generated documentation. - -{{< /hint >}} - -## How provider documentation works - -For general information about how provider documentation works, see [Provider Documentation](/magic-modules/docs/getting-started/provider-documentation). -That page contains information about how documentation should be structured and how you can test changes to documentation. - -This page includes only instructions on how to update the documentation for a handwritten resource or data source, with minimal background info. - -## Finding the relevant file - -Handwritten documentation is located in the `website/docs` folder, shown below. - -``` -mmv1/third_party/terraform/website/docs/ -├─ guides/ -│ ├─ ... -├─ d/ -│ ├─ ... -├─ r/ -│ ├─ ... -├─ index.html.markdown -``` - - -The subfolder `d` corresponds to data sources, and `r` corresponds to resources, and each file inside creates a page in the official provider documentation. For example, if you needed to update existing documentation for the `google_compute_instance` resource you should search in the `r` folder for a file with a name starting `compute_instance` (i.e. the resource name with the provider name removed from the start). The file [/docs/r/compute_instance.html.markdown](https://github.com/GoogleCloudPlatform/magic-modules/blob/main/mmv1/third_party/terraform/website/docs/r/compute_instance.html.markdown) is used to produce the [page for the `google_compute_instance` resource](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/compute_instance) in the official provider documentation. - -## Making changes - -After finding the file you need, make the changes required for the issue you are working on. - -## Testing your changes - -Next, you should test your changes to the file. To do this, you can copy and paste the markdown into the [Doc Preview Tool](https://registry.terraform.io/tools/doc-preview) on the Registry website. This will help you identify any malformed markdown and check that it is rendered in the way you expect. - -Once you are satified, include the markdown changes in your PR in the Magic Modules repo. When the downstream is generated from Magic Modules your handwritten files will be copied into the correct location within the `website/docs` folder in `terraform-provider-google` or `terraform-provider-google-beta`. \ No newline at end of file diff --git a/docs/content/develop/update-handwritten-resource.md b/docs/content/develop/update-handwritten-resource.md deleted file mode 100644 index ef2570dc470b..000000000000 --- a/docs/content/develop/update-handwritten-resource.md +++ /dev/null @@ -1,371 +0,0 @@ ---- -title: "Update a handwritten resource" -summary: "The Google providers for Terraform have a large number of handwritten go files, primarily for resources written before Magic Modules was used with them. Most handwritten files are expected to stay handwritten indefinitely, although conversion to a generator may be possible for a limited subset of them." -weight: 20 -aliases: - - /docs/how-to/update-handwritten-resource - - /how-to/update-handwritten-resource ---- - -# Update a handwritten resource - -The Google providers for Terraform have a large number of handwritten go files, primarily for resources written before Magic Modules was used with them. Most handwritten files are expected to stay handwritten indefinitely, although conversion to a generator may be possible for a limited subset of them. - -We no longer accept new handwritten resources except in rare cases. However, understanding -how to edit and add to existing resources may be important for implementing new fields -or changing existing behavior. - -To edit an existing resource to add a field there are four steps you'll go through. - -1. Add the new field to the schema -1. Implement the respective flattener and/or expander for the new field -1. Add a testcase for the field or extend an existing one -1. Add documentation for the field to the respective markdown file - - -## Shared concepts - -This section will serve as a point of reference for some shared concepts that -all handwritten files share. It's meant to be an introduction to our serialization -strategy and overview. - -### Serialization strategy -The go files within the directory files are copied literally to their respective providers. -Our serialization methodology may seem complicated but for the case of handwritten resources its quite -simple. Editing the file will change its counterpart downstream. - -### go and go.erb -Within the third party library you'll notice `go` and `go.erb` files. -Go files are native golang code while go.erb pass through ruby before -being serialized. The reason `go.erb` files exist are to protect certain -properties or fields from entering the `ga` provider. Thus you'll often see -lines like `<% unless version == 'ga' -%>` within the file. These blocks -will omit the enclosure from being output to the GA provider. In the -rare case where you are promoting all fields to `ga` and these blocks -are no longer needed you can remove the `.erb` extension. - -### Create, Read, Update, Delete -As far as terraform schema is concerned these are the functions we -need to provide for terraform to be able to provision and delete -resources. In editing any fields you'll likely be adding functionality to -these functions or implementing them wholesale. - - -### Expanders and Flatteners -Expanders and flatteners are concepts created to simplify common patterns -and add conformity/code consistency. Essentially expanders are functions -used to segregate some translation from terraform representation to api representation. -We will use these to encapsulate this translation for blocks and/or complicated fields. -This allows our code to be concise and functionality to be readable and easily -apparent by separating these into their own functions. While expanders are used -for terraform to api, flatteners do just the opposite. Converting api to terraform. - -Thus -* expanders - helper functions used for translating tf -> api representation -* flatteners - helper functions used for translating api -> tf representation - -## Adding a new field to the schema -To add a new field you will have to compare an existing resource -to it's respective rest api documentation. Dependant on how the api implements -the field we will in almost all cases mirror the structure. For example if there is -an `enabled` field nested under a ``IdentityServiceConfig`` block we will mirror -this within the schema. - -Thus the block for terraform to utilize this field would then be -```terraform -resource "x" "y" { - identity_service_config{ - enabled = true - } -} -``` - -You might think it convoluted to provide such a structure. Why not -simply provide a single `enable_identity_service_config`. One constant -has echoed through our mind as terraform developers through the years. -Api's are ever evolving. Mirroring the api gives us the best chance to stay -in step with that evolution. Therefore if `IdentityServiceConfig` is extended with new -parameters in the future we can cleanly encapsulate those into the existing block(s). - -As far as providing the field itself, it's fairly straightforward. Mirror the field -from the api and look to the other fields and the schema type in the SDK to see -what's available and how to structure it. For the documentation, copying the documentation -from the rest api will be the usual practice. - -If you are adding a field that is an ENUM from the api standpoint its best practice -to provide it as as a string to the provider. This field will likely have values -added to it by the api and this future proofs our provider to support new values without -haven't to make new additions. There will be rare exceptions, but generally its a good -practice. - -## Implement the respective flattener and/or expander for the new field -Once you've added the field to the schema you will implement the corresponding -expander/flattener. See [expanders and flatters](#expanders-and-flatteners) for -more context on what these fields are used for. Essentially we will be editing the -read, create, and update operations to parse the schema and call the api to make -the changes to the state of the resource. Following existing patterns to create -this operation will be the best way to implement this. As there are many unique ways -to implement a given field we won't get into specifics. - -For example a field in bigtable `google_sheets_options` containers two nested properties. -`range` and `skip_leading_rows`. - -```golang - // GoogleSheetsOptions: [Optional] Additional options if sourceFormat is set to GOOGLE_SHEETS. - "google_sheets_options": { - Type: schema.TypeList, - Optional: true, - MaxItems: 1, - Description: `Additional options if source_format is set to "GOOGLE_SHEETS".`, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - // Range: [Optional] Range of a sheet to query from. Only used when non-empty. - // Typical format: !: - "range": { - Type: schema.TypeString, - Optional: true, - Description: `Range of a sheet to query from. Only used when non-empty. At least one of range or skip_leading_rows must be set. Typical format: "sheet_name!top_left_cell_id:bottom_right_cell_id" For example: "sheet1!A1:B20"`, - AtLeastOneOf: []string{ - "external_data_configuration.0.google_sheets_options.0.skip_leading_rows", - "external_data_configuration.0.google_sheets_options.0.range", - }, - }, - // SkipLeadingRows: [Optional] The number of rows at the top - // of the sheet that BigQuery will skip when reading the data. - "skip_leading_rows": { - Type: schema.TypeInt, - Optional: true, - Description: `The number of rows at the top of the sheet that BigQuery will skip when reading the data. At least one of range or skip_leading_rows must be set.`, - AtLeastOneOf: []string{ - "external_data_configuration.0.google_sheets_options.0.skip_leading_rows", - "external_data_configuration.0.google_sheets_options.0.range", - }, - }, - }, - }, - }, -``` - -To simplify the implementation management of these fields can be delegated to expanders and -flatteners. - -```golang -func expandGoogleSheetsOptions(configured interface{}) *bigquery.GoogleSheetsOptions { - if len(configured.([]interface{})) == 0 { - return nil - } - - raw := configured.([]interface{})[0].(map[string]interface{}) - opts := &bigquery.GoogleSheetsOptions{} - - if v, ok := raw["range"]; ok { - opts.Range = v.(string) - } - - if v, ok := raw["skip_leading_rows"]; ok { - opts.SkipLeadingRows = int64(v.(int)) - } - return opts -} - -func flattenGoogleSheetsOptions(opts *bigquery.GoogleSheetsOptions) []map[string]interface{} { - result := map[string]interface{}{} - - if opts.Range != "" { - result["range"] = opts.Range - } - - if opts.SkipLeadingRows != 0 { - result["skip_leading_rows"] = opts.SkipLeadingRows - } - - return []map[string]interface{}{result} -} - -``` - -## Add a testcase for the field or extend an existing one -Once your field has been implemented, go to the corresponding test file for -your resource and extend it. If your field is updatable it's good practice to -have a two step apply to ensure that the field *can* be updated. You'll notice -a lot of our tests have a import state verify directly after apply. These -steps are important as they will essentially attempt to import the resource -you just provisioned and *verify* that the field values are consistent with the -applied state. Please test all fields you've added to the provider. It's important -for us to ensure all fields are usable and workable. - -## Add documentation for the field to the respective markdown file -See [Update handwritten provider documentation](/magic-modules/docs/how-to/update-handwritten-documentation) for more information. Essentially you will -just be opening the corresponding markdown file and adding documentation, likely -copied from the rest api to the markdown file. Follow the existing patterns there-in. - -## Beta features - -When the underlying API of a feature is not final (i.e. a `vN` version like -`v1` or `v2`), is in preview, or the API has no SLO we add it to the -`google-beta` provider rather than the `google `provider, allowing users to -self-select for the stability level they are comfortable with. - -Both the `google` and `google-beta` providers operate off of a shared codebase, -including for handwritten code. MMv1 allows us to write Go source files as -`.go.erb` templated source, and renders them as `.go` files in the downstream -repo. - -The sole generator feature you need to be aware of is a "version guard", what is -effectively a preprocessor directive implemented using Embedded Ruby (ERB). A -version guard is a snippet used across this codebase by convention guarding -versioned code on an `unless` clause in a version check. For example: - -``` - networkInterfaces, err := expandNetworkInterfaces(d, config) - if err != nil { - return nil, fmt.Errorf("Error creating network interfaces: %s", err) - } -<% unless version == 'ga' -%> - networkPerformanceConfig, err := expandNetworkPerformanceConfig(d, config) - if err != nil { - return nil, fmt.Errorf("Error creating network performance config: %s", err) - } -<% end -%> -``` - -In the snippet above, the `networkInterfaces` field is generally available and -is not guarded. The `networkPerformanceConfig` field is only available at beta, -and is guarded by `unless version == ga`, and the guarded block is terminated by -an `end` statement. - -If a service includes handwritten resources and mixed features or resources at -different versions, the client libraries used by each provider must be switched -using guards so that the stability level of the client library matches that of -the provider. For example, all handwritten Google Compute Engine (GCE) files -have the following guarded import: - -``` -<% if version == "ga" -%> - "google.golang.org/api/compute/v1" -<% else -%> - compute "google.golang.org/api/compute/v0.beta" -<% end -%> -``` - -This is not necessary for beta-only services, or for services that are generally -available in their entirety. - -### Adding a beta resource - -MMv1 doesn't selectively generate files, and any file that is beta-only must -have all of its contents guarded. When writing a resource that's available at -beta, start with the following snippet: - -``` - -<% autogen_exception -%> -package google - -<% unless version == 'ga' -%> - -// Add the implementation of the file here - -<% end -> -``` - -This will generate a blank file in the `google` provider. The resource file, -resource test file, and any service or resource specific utility files should be -guarded in this way. - -Documentation **should not** be guarded. Instead, write it as normal including -the following snippet above the first example. - -``` -~> **Warning:** This resource is in beta, and should be used with the terraform-provider-google-beta provider. -See [Provider Versions](https://terraform.io/docs/providers/google/guides/provider_versions.html) for more details on beta resources. -``` - -When registering the resource in -[`provider.go.erb`](https://github.com/GoogleCloudPlatform/magic-modules/blob/main/mmv1/third_party/terraform/utils/provider.go.erb), -the entry should be guarded: - -```diff - "google_monitoring_dashboard": resourceMonitoringDashboard(), -+ <% unless version == 'ga' -%> -+ "google_project_service_identity": resourceProjectServiceIdentity(), -+ <% end -%> - "google_service_networking_connection": resourceServiceNetworkingConnection(), -``` - -If this is a new service entirely, all service-specific entries like client -factory initialization should be guarded as well. However, new services should -generally be implemented using an alternate engine- either MMv1 or tpgtools/DCL. - -### Adding beta field(s) - -By contrast to beta resources, adding support for a beta field is much more -involved as small snippets of code throughout a resource file must be annotated. - -To begin with, add the field to the `Schema` of the resource with guards, i.e.: - -``` -<% unless version == 'ga' -%> - "network_performance_config": { - Type: schema.TypeList, - MaxItems: 1, - Optional: true, - ForceNew: true, - Description: `Configures network performance settings for the instance. If not specified, the instance will be created with its default network performance configuration.`, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "total_egress_bandwidth_tier": { - // ... - }, - }, - }, - }, -<% end -%> -``` - -Next, implement the d.Get/d.Set calls (for top level fields) or -expanders/flatteners for nested fields within guards. - -Even if there are other guarded fields, it's recommended that you add distinct -guards per feature- that way, promotion (covered below) will be simpler as -you'll only need to remove lines rather that move them around. - -### Promoting a beta feature - -"Promoting" a beta feature- making it available in the GA `google` provider when -the underlying feature or service has gone GA- requires removing the version -guards placed previously, so that the previously beta-only code is generated in -the `google` provider as well. - -For all promotions, ensure that you remove the guards in: - -* The documentation for the resource or field -* The test(s) for the resource or field. - -For whole resource promotions, you'll generally only need to remove the file-level -guards and the guards on the resource registration in `provider.go.erb`. - -For field promotions ensure that you remove the guards in: - -* The Resource schema -* The Resource CRUD methods (for top level fields) -* The Resource Expanders and Flatteners (for nested fields) - -When writing a changelog entry for a promotion, write it as if it was a new -field or resource, and suffix it with `(ga only)`. For example, if the -`google_container_cluster` resource was promoted to GA in your change: - -``` -\`\`\`release-note:new-resource -`google_container_cluster` (ga only) -\`\`\` -``` - -Alternatively, for field promotions, you may use "{{service}}: promoted -{{field}} in {{resource}} to GA", i.e. - -``` -\`\`\`release-note:enhancement -container: promoted `node_locations` field in google_container_cluster` to GA -\`\`\` -``` diff --git a/docs/content/reference/field-reference.md b/docs/content/reference/field-reference.md new file mode 100644 index 000000000000..5e75b08687d5 --- /dev/null +++ b/docs/content/reference/field-reference.md @@ -0,0 +1,6 @@ +--- +title: "Field YAML reference ↗" +weight: 30 +bookHref: "https://github.com/GoogleCloudPlatform/magic-modules/blob/main/mmv1/api/type.rb" +--- +FORCE MENU RENDER \ No newline at end of file diff --git a/docs/content/reference/iam-policy-reference.md b/docs/content/reference/iam-policy-reference.md new file mode 100644 index 000000000000..0b16f5a993f9 --- /dev/null +++ b/docs/content/reference/iam-policy-reference.md @@ -0,0 +1,6 @@ +--- +title: "IAM policy YAML reference ↗" +weight: 30 +bookHref: "https://github.com/GoogleCloudPlatform/magic-modules/blob/main/mmv1/api/resource/iam_policy.rb" +--- +FORCE MENU RENDER \ No newline at end of file diff --git a/docs/content/reference/resource-name-yaml-resource.md b/docs/content/reference/resource-reference.md similarity index 70% rename from docs/content/reference/resource-name-yaml-resource.md rename to docs/content/reference/resource-reference.md index e03d2e79fd18..e900ac89204d 100644 --- a/docs/content/reference/resource-name-yaml-resource.md +++ b/docs/content/reference/resource-reference.md @@ -1,6 +1,6 @@ --- -title: "ResourceName.yaml resource ↗" -weight: 0 +title: "Resource YAML reference ↗" +weight: 20 bookHref: "https://github.com/GoogleCloudPlatform/magic-modules/blob/main/mmv1/api/resource.rb" --- FORCE MENU RENDER \ No newline at end of file diff --git a/mmv1/products/alloydb/Backup.yaml b/mmv1/products/alloydb/Backup.yaml index 7ea866e7162f..15b58e58739c 100644 --- a/mmv1/products/alloydb/Backup.yaml +++ b/mmv1/products/alloydb/Backup.yaml @@ -23,26 +23,23 @@ references: !ruby/object:Api::Resource::ReferenceLinks guides: 'AlloyDB': 'https://cloud.google.com/alloydb/docs/' api: 'https://cloud.google.com/alloydb/docs/reference/rest/v1/projects.locations.backups/create' +timeouts: !ruby/object:Api::Timeouts + insert_minutes: 10 + update_minutes: 10 + delete_minutes: 10 async: !ruby/object:Api::OpAsync operation: !ruby/object:Api::OpAsync::Operation - path: 'name' base_url: '{{op_id}}' - wait_ms: 1000 - timeouts: !ruby/object:Api::Timeouts - insert_minutes: 10 - update_minutes: 10 - delete_minutes: 10 + path: 'unused' + wait_ms: 0 # unused result: !ruby/object:Api::OpAsync::Result - path: 'response' + path: 'unused' status: !ruby/object:Api::OpAsync::Status - path: 'done' - complete: true - allowed: - - true - - false + path: 'unused' + allowed: [] error: !ruby/object:Api::OpAsync::Error - path: 'error' - message: 'message' + path: 'unused' + message: 'unused' import_format: ['projects/{{project}}/locations/{{location}}/backups/{{backup_id}}'] autogen_async: true From e7dcd9e5ea29da0c9a0116424ee2dc629295b326 Mon Sep 17 00:00:00 2001 From: Riley Karson Date: Fri, 30 Jun 2023 11:01:40 -0700 Subject: [PATCH 20/55] Increase EdgeCacheKeyset timeout (#8233) --- mmv1/products/networkservices/EdgeCacheKeyset.yaml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/mmv1/products/networkservices/EdgeCacheKeyset.yaml b/mmv1/products/networkservices/EdgeCacheKeyset.yaml index 183d5048b17e..d8b79ef24b28 100644 --- a/mmv1/products/networkservices/EdgeCacheKeyset.yaml +++ b/mmv1/products/networkservices/EdgeCacheKeyset.yaml @@ -20,15 +20,19 @@ update_verb: :PATCH update_mask: true description: | EdgeCacheKeyset represents a collection of public keys used for validating signed requests. +references: !ruby/object:Api::Resource::ReferenceLinks + guides: + 'Create keysets': 'https://cloud.google.com/media-cdn/docs/create-keyset' + api: 'https://cloud.google.com/media-cdn/docs/reference/rest/v1/projects.locations.edgeCacheKeysets' async: !ruby/object:Api::OpAsync operation: !ruby/object:Api::OpAsync::Operation path: 'name' base_url: '{{op_id}}' wait_ms: 1000 timeouts: !ruby/object:Api::Timeouts - insert_minutes: 60 - update_minutes: 60 - delete_minutes: 60 + insert_minutes: 90 + update_minutes: 90 + delete_minutes: 90 result: !ruby/object:Api::OpAsync::Result path: 'response' status: !ruby/object:Api::OpAsync::Status From 70c3746fb0c7f68fdadcc6f877e043a0df27eee9 Mon Sep 17 00:00:00 2001 From: Riley Karson Date: Fri, 30 Jun 2023 11:01:51 -0700 Subject: [PATCH 21/55] Ignore node pool changes in GKE NAP test (#8234) --- .../terraform/tests/resource_container_cluster_test.go.erb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mmv1/third_party/terraform/tests/resource_container_cluster_test.go.erb b/mmv1/third_party/terraform/tests/resource_container_cluster_test.go.erb index b6bd192375ca..610edc990cee 100644 --- a/mmv1/third_party/terraform/tests/resource_container_cluster_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_container_cluster_test.go.erb @@ -3076,7 +3076,10 @@ func TestAccContainerCluster_nodeAutoprovisioningDefaultsBootDiskKmsKey(t *testi ResourceName: "google_container_cluster.nap_boot_disk_kms_key", ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"min_master_version"}, + ImportStateVerifyIgnore: []string{ + "min_master_version", + "node_pool", // cluster_autoscaling (node auto-provisioning) creates new node pools automatically + }, }, }, }) From 4cdd977e732c713c401b2cc362c0477a3945b7a8 Mon Sep 17 00:00:00 2001 From: "Stephen Lewis (Burrows)" Date: Fri, 30 Jun 2023 11:37:04 -0700 Subject: [PATCH 22/55] shortened expected turnaround time for reviews (#8241) * shortened expected turnaround time for reviews * simplified language --- docs/content/get-started/contributing.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/content/get-started/contributing.md b/docs/content/get-started/contributing.md index 5d6b396271a2..eb45269b3611 100644 --- a/docs/content/get-started/contributing.md +++ b/docs/content/get-started/contributing.md @@ -48,5 +48,5 @@ aliases: Where possible, take a look at the logs and see if you can figure out what needs to be fixed related to your change. The false positive rate on these tests is extremely high between changes in the API, Cloud Build bugs, and eventual consistency issues in test recordings so we don't expect contributors to wholly interpret the results — that's the responsibility of your reviewer. -1. If your assigned reviewer does not reply / review within a week, gently ping them on GitHub. +1. If your assigned reviewer does not respond to changes on a pull request within two US business days, ping them on the pull request. 1. After your PR is merged, it will be released to customers in around one to two weeks. From 88db6bace964f30e5fb4b3d2dcfa4c5e52825a7c Mon Sep 17 00:00:00 2001 From: Scott Suarez Date: Fri, 30 Jun 2023 12:45:04 -0700 Subject: [PATCH 23/55] Migrate breaking change documentation to hugo site (#8240) --- docs/content/develop/breaking-changes.md | 99 +++++++++++++++++++ tools/breaking-change-detector/GNUmakefile | 7 -- tools/breaking-change-detector/README.md | 13 +-- tools/breaking-change-detector/comparison.go | 5 +- .../constants/constants.go | 13 +-- .../docs/breaking-changes.md.tmpl | 68 ------------- tools/breaking-change-detector/docs/embed.go | 6 -- .../docs/generator.go | 37 ------- tools/breaking-change-detector/main.go | 24 +---- .../rules/message_context.go | 3 +- tools/breaking-change-detector/rules/rule.go | 6 +- .../rules/rule_test.go | 66 +++++++++++++ .../rules/rules_field.go | 10 +- .../rules/rules_field_test.go | 1 - .../rules/rules_provider.go | 4 +- .../rules/rules_resource_inventory.go | 4 +- .../rules/rules_resource_schema.go | 4 +- .../breaking-change-detector/rules/utility.go | 4 +- 18 files changed, 193 insertions(+), 181 deletions(-) create mode 100644 docs/content/develop/breaking-changes.md delete mode 100644 tools/breaking-change-detector/docs/breaking-changes.md.tmpl delete mode 100644 tools/breaking-change-detector/docs/embed.go delete mode 100644 tools/breaking-change-detector/docs/generator.go create mode 100644 tools/breaking-change-detector/rules/rule_test.go diff --git a/docs/content/develop/breaking-changes.md b/docs/content/develop/breaking-changes.md new file mode 100644 index 000000000000..a0f7d72bbda1 --- /dev/null +++ b/docs/content/develop/breaking-changes.md @@ -0,0 +1,99 @@ +--- +title: "Understanding breaking changes" +summary: "This page discusses provider versioning, handling of breaking changes, and rare exceptions within Terraform development." +weight: 12 +--- + + +# Breaking Changes and Provider Development + +## Provider Versioning +As a provider is developed, resources are added, old resources are updated, and bugs are fixed. These changes are [bundled together as a release](https://github.com/hashicorp/terraform-provider-google/releases/tag/v4.32.0). + +Releases are numerically defined with a version number in the form of `MAJOR.MINOR.PATCH`. Here, 'Patch' indicates bug fixes, 'Minor' represents new features, and 'Major' represents significant changes which would be breaking to the customer if committed. Once a release is published, the provider binary is copied to [Hashicorp's provider registry](https://registry.terraform.io/browse/providers). + +## Customer Trust +Terraform authors can write modular configurations, aptly named modules. These are shared within organizations and [online](https://registry.terraform.io/browse/modules). Terraform configurations can specify [provider requirements](https://www.terraform.io/language/providers/requirements), including a [version constraint field](https://www.terraform.io/language/providers/requirements#version-constraints). + +The configuration will then [tie these version constraints](https://www.terraform.io/language/expressions/version-constraints) to an approximate minor or exact full version. Maintaining trust and consistency on every `MINOR` or `MAJOR` version upgrade is critical. + +If breaking changes are allowed within `MINOR` versions, trust in the provider will be eroded and module creators will not have confidence in provider stability. This diminished trust will eventually lead to customers investing or deploying less to GCP. + +## Exceptions to Breaking Changes + +While we strive to minimize breaking changes, there are certain exceptions where they become unavoidable. Notably, breaking changes are permissible when existing functionality is demonstrably broken due to an API or provider-level issue. In such cases, the change does not impact users negatively, since there is no instance where the Terraform provider is currently using the affected field or resource correctly. + +For example, consider a situation involving the Google provider where an API endpoint we depend on changes its behavior or is deprecated. If the current implementation in the Terraform provider cannot adapt to this change and is thus broken, a breaking change would be necessary to restore the functionality. + +## Breaking Changes + +Having established that we want to avoid breaking changes, let's delve into what exactly constitutes a breaking change. We'll discuss this under four main categories and the rules within each. + +### Provider Configuration Level Breakages + +* Top-level behavior such as provider configuration and authentication changes. + +

Changing fundamental provider behavior (Undetectable)

+ +Including, but not limited to, modification of: authentication, environment variable usage, and constricting retry behavior. + +### Resource List Level Breakages + +* Resource/datasource naming conventions and entry differences. + +

Removing or Renaming a Resource

+ +In Terraform, resources should be retained whenever possible. Removal of a resource will result in a configuration breakage wherever a dependency on that resource exists. Renaming or removing resources are functionally equivalent in terms of configuration breakages. + +### Resource Level Breakages + +* Individual resource breakages like field entry removals or behavior within a resource. + +

Removing or Renaming a field

+ +In Terraform, fields should be retained whenever possible. Removal of a field will result in a configuration breakage wherever a dependency on that field exists. Renaming or removing a field are functionally equivalent in terms of configuration breakages. + +

Changing resource ID format (Undetectable)

+ +Terraform uses resource ID to read resource state from the API. Modification of the ID format will break the ability to parse the IDs from any deployments. + +

Changing resource ID import format (Undetectable)

+ +Automation external to our provider may rely on importing resources with a certain format. Removal or modification of existing formats will break this automation. + +### Field Level Breakages + +* Field-level conventions like attribute changes and naming conventions. + +

Changing Field Type

+ +While certain Field Type migrations may be supported at a technical level, it's a practice that we highly discourage. We see little value for these transitions vs the risk they impose. + +

Field becoming Required Field

+ +A field should not become 'Required' as existing configurations may not have this field defined, leading to broken configurations in sequential plans or applies.. If you are adding 'Required' to a field so a block won't remain empty, this can cause two issues. First, if it's a singular nested field, the block may gain more fields later and it's not clear whether the field is actually required so it may be misinterpreted by future contributors. Second, if users are defining empty blocks in existing configurations, this change will break them. Consider these points in admittance of this type of change. + +

Becoming a Computed only Field

+ +While a field can transition from 'Optional' to 'Optional+Computed', it should not change from 'Required' or 'Optional' to solely 'Computed'. This transition would effectively make the field read-only, thus breaking configs in sequential plan or applies where this field is defined in a configuration. + +

Optional and Computed to Optional

+ +A field should not transition from 'Computed + Optional' to 'Optional'. During a sequential apply, the Terraform state retains the previously computed value, which won't match the configuration, thus causing a discrepancy. + +

Adding or Changing a Default Value

+ +Adding a default value where one was not previously declared can work in a very limited subset of scenarios but is an all around 'not good' practice to engage in. Changing a default value will absolutely cause a breakage. The mechanism of break for both scenarios is current terraform deployments now gain a diff with sequential applies where the diff is the new or changed default value. + +

Growing Minimum Items

+ +'MinItems' cannot grow. Otherwise, existing terraform configurations that don't satisfy this rule will break. + +

Shrinking Maximum Items

+ +'MaxItems' cannot shrink. Otherwise, existing terraform configurations that don't satisfy this rule will break. + +

Changing field data format (Undetectable)

+ +Modification of the data format (either by the API or manually) will cause a diff in subsequent plans if that field is not Computed. This results in a breakage. API breaking changes are out of scope with respect to provider responsibility but we may make changes in response to API breakages in some instances to provide more customer stability. + diff --git a/tools/breaking-change-detector/GNUmakefile b/tools/breaking-change-detector/GNUmakefile index 797cc7018b84..129cb5468177 100644 --- a/tools/breaking-change-detector/GNUmakefile +++ b/tools/breaking-change-detector/GNUmakefile @@ -1,11 +1,4 @@ localsetup: -ifneq (,$(filter $(PROVIDER_VERSION),"google" "google-beta")) - echo "setting up environment for google-beta" - PROVIDER_VERSION="google-beta" -else - echo "setting up environment for $(PROVIDER_VERSION)" -endif - sed -i bak -E "s~google/provider/(.*)/([0-9A-Za-z-]*)~google/provider/\1/$(PROVIDER_VERSION)~" comparison.go ifneq ($(REPLACE_OLD),) diff --git a/tools/breaking-change-detector/README.md b/tools/breaking-change-detector/README.md index dbf6ae821825..41d0e9c94e57 100644 --- a/tools/breaking-change-detector/README.md +++ b/tools/breaking-change-detector/README.md @@ -10,18 +10,7 @@ Specifically protects customer expectations between [minor version](https://www. ### Program:mode-default ```bash -go run . -providerVersion="google" -``` - -### Program:mode-docs -output to console -```bash -go run . -docs -``` - -output to provider folder -```bash -go run . -docs -providerFolder="/go/src/github.com/hashicorp/terraform-provider-google" +go run . ``` ### Tests diff --git a/tools/breaking-change-detector/comparison.go b/tools/breaking-change-detector/comparison.go index 0388bf1e460c..dce6bc36153c 100644 --- a/tools/breaking-change-detector/comparison.go +++ b/tools/breaking-change-detector/comparison.go @@ -24,7 +24,7 @@ func compareResourceMaps(old, new map[string]*schema.Resource) []string { violatingResources := rule.IsRuleBreak(old, new) if len(violatingResources) > 0 { for _, resourceName := range violatingResources { - newMessage := rule.Message(*providerVersion, resourceName) + newMessage := rule.Message(resourceName) messages = append(messages, newMessage) } } @@ -51,7 +51,7 @@ func compareResourceSchema(resourceName string, old, new map[string]*schema.Sche violatingFields := rule.IsRuleBreak(oldCompressed, newCompressed) if len(violatingFields) > 0 { for _, fieldName := range violatingFields { - newMessage := rule.Message(*providerVersion, resourceName, fieldName) + newMessage := rule.Message(resourceName, fieldName) messages = append(messages, newMessage) } } @@ -79,7 +79,6 @@ func compareField(resourceName, fieldName string, old, new *schema.Schema) []str rules.MessageContext{ Resource: resourceName, Field: fieldName, - Version: *providerVersion, }, ) if breakageMessage != "" { diff --git a/tools/breaking-change-detector/constants/constants.go b/tools/breaking-change-detector/constants/constants.go index 4393b7560f8e..7bc71249c553 100644 --- a/tools/breaking-change-detector/constants/constants.go +++ b/tools/breaking-change-detector/constants/constants.go @@ -1,13 +1,10 @@ package constants -const BreakingChangeRelativeLocation = "/.github/" -const BreakingChangeFileName = "BREAKING_CHANGES.md" +const BreakingChangeRelativeLocation = "develop/" +const BreakingChangeFileName = "breaking-changes" -var providerUrls = map[string]string{ - "google": "https://github.com/hashicorp/terraform-provider-google/blob/main", - "google-beta": "https://github.com/hashicorp/terraform-provider-google-beta/blob/main", -} +var docsite = "https://googlecloudplatform.github.io/magic-modules" -func GetFileUrl(version, identifier string) string { - return providerUrls[version] + BreakingChangeRelativeLocation + BreakingChangeFileName + "#" + identifier +func GetFileUrl(identifier string) string { + return docsite + BreakingChangeRelativeLocation + BreakingChangeFileName + "#" + identifier } diff --git a/tools/breaking-change-detector/docs/breaking-changes.md.tmpl b/tools/breaking-change-detector/docs/breaking-changes.md.tmpl deleted file mode 100644 index de68710a93e4..000000000000 --- a/tools/breaking-change-detector/docs/breaking-changes.md.tmpl +++ /dev/null @@ -1,68 +0,0 @@ -{{- /* Copyright 2022 Google LLC. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. */ -}} ---- -# ---------------------------------------------------------------------------- -# -# *** AUTO GENERATED CODE *** Type: breaking-change-detector *** -# -# ---------------------------------------------------------------------------- -# -# This file is managed by Magic Modules (https:#github.com/GoogleCloudPlatform/magic-modules) -# Changes will need to be made to the breaking-change-detector within Magic Modules instead of here. -# -# ---------------------------------------------------------------------------- ---- - -# Breaking Changes and Provider Development - -## Provider Versioning -As a provider is developed; resources are added, old resources are updated, and bugs are fixed. -These changes are [bundled together as a release](https://github.com/hashicorp/terraform-provider-google/releases/tag/v4.32.0). -Releases are numerically defined with a version number in the form of `MAJOR.MINOR.PATCH`. -Patch indicates bug fixes, minor represents new features, and major represents significant changes -which would be breaking to the customer if committed. Once a release is published the provider binary is copied to -[Hashicorp's provider registry](https://registry.terraform.io/browse/providers). - -## Customer Trust -Terraform authors can write modular configurations, aptly named modules. These are shared within organizations and -[online](https://registry.terraform.io/browse/modules). Terraform configurations can specify [provider requirements](https://www.terraform.io/language/providers/requirements) -including a [version constraint field](https://www.terraform.io/language/providers/requirements#version-constraints). -The configuration will then [tie these version constraints](https://www.terraform.io/language/expressions/version-constraints) -to an approximate minor or exact full version. Maintaining trust and consistency on every `MINOR` or `MAJOR` version upgrade is critical. - -If breaking changes are allowed within `MINOR` versions, trust in the provider will be eroded and module creators will -not have confidence in provider stability. This diminished trust will eventually lead to customers investing or deploying less to GCP. - -## Breaking Changes - -Now that we understand what defines a breaking change and that we don't want them. -What exactly constitutes a breaking change? Bellow we'll -go into the four categories and rules therein. - - -{{ range $c := $.Categories -}} -{{ if $c.Rules -}} -### {{ $c.Name }} - -* {{ $c.Definition }} - -{{ range $r := $c.Rules -}} - -

{{ $r.Name }} {{if $r.Undetectable}}(Undetectable){{ end }}

- -* {{ $r.Definition }} - -{{ end }} -{{- end }} -{{- end }} \ No newline at end of file diff --git a/tools/breaking-change-detector/docs/embed.go b/tools/breaking-change-detector/docs/embed.go deleted file mode 100644 index b8cad60ab5b0..000000000000 --- a/tools/breaking-change-detector/docs/embed.go +++ /dev/null @@ -1,6 +0,0 @@ -package docs - -import _ "embed" - -//go:embed breaking-changes.md.tmpl -var markdownTemplate string diff --git a/tools/breaking-change-detector/docs/generator.go b/tools/breaking-change-detector/docs/generator.go deleted file mode 100644 index adb890fd0446..000000000000 --- a/tools/breaking-change-detector/docs/generator.go +++ /dev/null @@ -1,37 +0,0 @@ -package docs - -import ( - "bytes" - "fmt" - "os" - "path" - "text/template" - - "github.com/GoogleCloudPlatform/magic-modules/.ci/breaking-change-detector/constants" - "github.com/GoogleCloudPlatform/magic-modules/.ci/breaking-change-detector/rules" - "github.com/golang/glog" -) - -func Generate(outputPath string) { - rs := rules.GetRules() - tmpl, err := template.New("breaking-changes.md.tmpl").Parse(markdownTemplate) - if err != nil { - glog.Exit(err) - } - - contents := bytes.Buffer{} - if err = tmpl.ExecuteTemplate(&contents, "breaking-changes.md.tmpl", rs); err != nil { - glog.Exit(err) - } - - if outputPath == "" { - fmt.Printf("%v", contents.String()) - } else { - outName := constants.BreakingChangeFileName - err := os.WriteFile(path.Join(outputPath, outName), contents.Bytes(), 0644) - if err != nil { - glog.Exit(err) - } - } - -} diff --git a/tools/breaking-change-detector/main.go b/tools/breaking-change-detector/main.go index 644a0a6de297..10dcc7a4abe0 100644 --- a/tools/breaking-change-detector/main.go +++ b/tools/breaking-change-detector/main.go @@ -4,36 +4,18 @@ import ( "flag" "fmt" "sort" - - "github.com/GoogleCloudPlatform/magic-modules/.ci/breaking-change-detector/docs" - "github.com/golang/glog" ) -var docMode = flag.Bool("docs", false, "Switches the mode from running the comparison to creating a markdown file detailing the breaking change rules") -var providerFolder = flag.String("providerFolder", "", "The location of the provider folder to output documentation into.. if not provided the documentation will be output to console") -var providerVersion = flag.String("providerVersion", "google-beta", "The version of provider used, needed for documentation.") +var docMode = flag.Bool("docs", false, "legacy flag to not break existing CI can be removed after 7/10") +var providerFolder = flag.String("providerFolder", "", "legacy flag to not break existing CI can be removed after 7/10") func main() { flag.Parse() - validateParameters() - - if *docMode { - docs.Generate(*providerFolder) - } else { + if !*docMode { breakages := compare() sort.Strings(breakages) for _, breakage := range breakages { fmt.Println(breakage) } } - -} - -func validateParameters() { - if *providerFolder != "" && !*docMode { - glog.Exitln("parameter -docs must be set when specifying -providerFolder") - } - if *providerVersion != "google" && *providerVersion != "google-beta" { - glog.Exitln("only google and google-beta are supported provider versions") - } } diff --git a/tools/breaking-change-detector/rules/message_context.go b/tools/breaking-change-detector/rules/message_context.go index 0f1ea5ae031a..23307a91c786 100644 --- a/tools/breaking-change-detector/rules/message_context.go +++ b/tools/breaking-change-detector/rules/message_context.go @@ -10,7 +10,6 @@ import ( type MessageContext struct { Resource string Field string - Version string identifier string message string } @@ -20,5 +19,5 @@ func populateMessageContext(message string, mc MessageContext) string { field := fmt.Sprintf("`%s`", mc.Field) message = strings.ReplaceAll(message, "{{resource}}", resource) message = strings.ReplaceAll(message, "{{field}}", field) - return message + documentationReference(mc.Version, mc.identifier) + return message + documentationReference(mc.identifier) } diff --git a/tools/breaking-change-detector/rules/rule.go b/tools/breaking-change-detector/rules/rule.go index 972c0c0898b7..fd5d6d0ba649 100644 --- a/tools/breaking-change-detector/rules/rule.go +++ b/tools/breaking-change-detector/rules/rule.go @@ -2,7 +2,7 @@ package rules // Rule is an interface that all Rule // types implement. This give consistency -// for the documentation generation. +// for the potential documentation generation. type Rule interface { Name() string Definition() string @@ -19,13 +19,13 @@ type RuleCategory struct { } // Rules is a type to hold all existing -// rules. Exposed for documentation generator +// rules. Exposed for potential documentation generator type Rules struct { Categories []RuleCategory } // GetRules returns a list of all rules for -// documentation generation +// potential documentation generation func GetRules() *Rules { categories := []RuleCategory{ { diff --git a/tools/breaking-change-detector/rules/rule_test.go b/tools/breaking-change-detector/rules/rule_test.go new file mode 100644 index 000000000000..78215892ce23 --- /dev/null +++ b/tools/breaking-change-detector/rules/rule_test.go @@ -0,0 +1,66 @@ +package rules + +import ( + "fmt" + "io/ioutil" + "strings" + "testing" +) + +func TestUniqueRuleIdentifiers(t *testing.T) { + identifiers := getArrayOfIdentifiers() + // Create a map to track the identifiers + identifierMap := make(map[string]bool) + for _, id := range identifiers { + if identifierMap[id] { + t.Errorf("Duplicate identifier found: %s", id) + } + + // Add the identifier to the map + identifierMap[id] = true + } +} + +func TestMarkdownIdentifiers(t *testing.T) { + // Define the Markdown file path relative to the importer + mdFilePath := "../../../docs/content/develop/breaking-changes.md" + + // Read the Markdown file + mdContent, err := ioutil.ReadFile(mdFilePath) + if err != nil { + t.Fatalf("Failed to read or find Markdown file: %v", err) + } + + // Convert the Markdown content to a string + mdString := string(mdContent) + + // Define the identifiers to check + identifiers := getArrayOfIdentifiers() + + // Iterate over the identifiers and check if they have a corresponding

tag + for _, identifier := range identifiers { + // Define the expected

tag + expectedTag := fmt.Sprintf("

", identifier) + + // Check if the

tag exists in the Markdown string + if !strings.Contains(mdString, expectedTag) { + t.Errorf("Identifier %s does not have a corresponding

tag", identifier) + } + } +} + +func getArrayOfIdentifiers() []string { + var output []string + ruleCats := GetRules() + var rules []Rule + for _, rc := range ruleCats.Categories { + rules = append(rules, rc.Rules...) + } + + for _, r := range rules { + identifier := r.Identifier() + output = append(output, identifier) + } + + return output +} diff --git a/tools/breaking-change-detector/rules/rules_field.go b/tools/breaking-change-detector/rules/rules_field.go index b22173364cd9..be79462b10e4 100644 --- a/tools/breaking-change-detector/rules/rules_field.go +++ b/tools/breaking-change-detector/rules/rules_field.go @@ -33,7 +33,7 @@ var FieldRules = []FieldRule{ var fieldRule_ChangingFieldDataFormat = FieldRule{ name: "Changing field data format", definition: "Modification of the data format (either by the API or manually) will cause a diff in subsequent plans if that field is not Computed. This results in a breakage. API breaking changes are out of scope with respect to provider responsibility but we may make changes in response to API breakages in some instances to provide more customer stability.", - identifier: "field-changing-type", + identifier: "field-changing-data-format", } var fieldRule_ChangingType = FieldRule{ @@ -147,7 +147,7 @@ var fieldRule_GrowingMin = FieldRule{ name: "Growing Minimum Items", definition: "MinItems cannot grow. Otherwise existing terraform configurations that don't satisfy this rule will break.", message: "Field {{field}} MinItems went from {{oldMin}} to {{newMin}} on {{resource}}", - identifier: "field-certain-min-max", + identifier: "field-growing-min", isRuleBreak: fieldRule_GrowingMin_func, } @@ -167,7 +167,7 @@ var fieldRule_ShrinkingMax = FieldRule{ name: "Shrinking Maximum Items", definition: "MaxItems cannot shrink. Otherwise existing terraform configurations that don't satisfy this rule will break.", message: "Field {{field}} MinItems went from {{oldMax}} to {{newMax}} on {{resource}}", - identifier: "field-certain-min-max", + identifier: "field-shrinking-max", isRuleBreak: fieldRule_ShrinkingMax_func, } @@ -208,13 +208,13 @@ func (fr FieldRule) Identifier() string { // Message - a message to to inform the user // of a breakage. -func (fr FieldRule) messages(version, resource, field string) string { +func (fr FieldRule) messages(resource, field string) string { msg := fr.message resource = fmt.Sprintf("`%s`", resource) field = fmt.Sprintf("`%s`", field) msg = strings.ReplaceAll(msg, "{{resource}}", resource) msg = strings.ReplaceAll(msg, "{{field}}", field) - return msg + documentationReference(version, fr.identifier) + return msg + documentationReference(fr.identifier) } // IsRuleBreak - compares the fields and returns diff --git a/tools/breaking-change-detector/rules/rules_field_test.go b/tools/breaking-change-detector/rules/rules_field_test.go index 98bfc3f09bf8..1b485d62c195 100644 --- a/tools/breaking-change-detector/rules/rules_field_test.go +++ b/tools/breaking-change-detector/rules/rules_field_test.go @@ -452,7 +452,6 @@ func TestBreakingMessage(t *testing.T) { MessageContext{ Resource: "a", Field: "b", - Version: "beta", }, ) diff --git a/tools/breaking-change-detector/rules/rules_provider.go b/tools/breaking-change-detector/rules/rules_provider.go index aef0b61519d0..ca0df309686a 100644 --- a/tools/breaking-change-detector/rules/rules_provider.go +++ b/tools/breaking-change-detector/rules/rules_provider.go @@ -54,11 +54,11 @@ func (prc ProviderConfigRule) Identifier() string { // Message - a message to to inform the user // of a breakage. -func (prc ProviderConfigRule) Message(version, resource string) string { +func (prc ProviderConfigRule) Message(resource string) string { msg := prc.message resource = fmt.Sprintf("`%s`", resource) msg = strings.ReplaceAll(msg, "{{resource}}", resource) - return msg + documentationReference(version, prc.identifier) + return msg + documentationReference(prc.identifier) } // IsRuleBreak - compares resource entries and returns diff --git a/tools/breaking-change-detector/rules/rules_resource_inventory.go b/tools/breaking-change-detector/rules/rules_resource_inventory.go index ea624c78b2a3..8e1d6083f50c 100644 --- a/tools/breaking-change-detector/rules/rules_resource_inventory.go +++ b/tools/breaking-change-detector/rules/rules_resource_inventory.go @@ -66,11 +66,11 @@ func (rm ResourceInventoryRule) Identifier() string { // Message - a message to to inform the user // of a breakage. -func (rm ResourceInventoryRule) Message(version, resource string) string { +func (rm ResourceInventoryRule) Message(resource string) string { msg := rm.message resource = fmt.Sprintf("`%s`", resource) msg = strings.ReplaceAll(msg, "{{resource}}", resource) - return msg + documentationReference(version, rm.identifier) + return msg + documentationReference(rm.identifier) } // IsRuleBreak - compares resource entries and returns diff --git a/tools/breaking-change-detector/rules/rules_resource_schema.go b/tools/breaking-change-detector/rules/rules_resource_schema.go index 3c4d0462b2c3..3929238afc94 100644 --- a/tools/breaking-change-detector/rules/rules_resource_schema.go +++ b/tools/breaking-change-detector/rules/rules_resource_schema.go @@ -77,13 +77,13 @@ func (rs ResourceSchemaRule) Identifier() string { // Message - a message to to inform the user // of a breakage. -func (rs ResourceSchemaRule) Message(version, resource, field string) string { +func (rs ResourceSchemaRule) Message(resource, field string) string { msg := rs.message resource = fmt.Sprintf("`%s`", resource) field = fmt.Sprintf("`%s`", field) msg = strings.ReplaceAll(msg, "{{resource}}", resource) msg = strings.ReplaceAll(msg, "{{field}}", field) - return msg + documentationReference(version, rs.identifier) + return msg + documentationReference(rs.identifier) } // IsRuleBreak - compares the field entries and returns diff --git a/tools/breaking-change-detector/rules/utility.go b/tools/breaking-change-detector/rules/utility.go index d6ee8da121f1..615befeb5b6e 100644 --- a/tools/breaking-change-detector/rules/utility.go +++ b/tools/breaking-change-detector/rules/utility.go @@ -7,8 +7,8 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) -func documentationReference(version, identifier string) string { - return fmt.Sprintf(" - [reference](%s)", constants.GetFileUrl(version, identifier)) +func documentationReference(identifier string) string { + return fmt.Sprintf(" - [reference](%s)", constants.GetFileUrl(identifier)) } func getValueType(valueType schema.ValueType) string { From a4bacb7296654f2af1e29cf942b186125fb11166 Mon Sep 17 00:00:00 2001 From: Sam Levenick Date: Fri, 30 Jun 2023 12:54:46 -0700 Subject: [PATCH 24/55] Update resource_firebase_extensions_instance_test.go.erb (#8248) Move hard-coded path to use import_path() --- .../tests/resource_firebase_extensions_instance_test.go.erb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mmv1/third_party/terraform/tests/resource_firebase_extensions_instance_test.go.erb b/mmv1/third_party/terraform/tests/resource_firebase_extensions_instance_test.go.erb index 17194aefaca8..7c96841eaac8 100644 --- a/mmv1/third_party/terraform/tests/resource_firebase_extensions_instance_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_firebase_extensions_instance_test.go.erb @@ -7,7 +7,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-provider-google-beta/google-beta/acctest" + "<%= import_path() -%>/acctest" ) func TestAccFirebaseExtensionsInstance_firebaseExtentionsInstanceResizeImageUpdate(t *testing.T) { @@ -148,4 +148,4 @@ resource "google_firebase_extensions_instance" "resize_image" { `, context) } -<% end -%> \ No newline at end of file +<% end -%> From 1d6a7e0df8d30cf9038f2e6eca940e26bf227e8e Mon Sep 17 00:00:00 2001 From: Shuya Ma <87669292+shuyama1@users.noreply.github.com> Date: Fri, 30 Jun 2023 13:04:47 -0700 Subject: [PATCH 25/55] Added link to docsite for opening a documentation issue in the TPG tracker (#8238) --- docs/layouts/partials/docs/footer.html | 35 ++++++++++++++++++++++++++ docs/static/report.svg | 1 + 2 files changed, 36 insertions(+) create mode 100644 docs/layouts/partials/docs/footer.html create mode 100644 docs/static/report.svg diff --git a/docs/layouts/partials/docs/footer.html b/docs/layouts/partials/docs/footer.html new file mode 100644 index 000000000000..6a442d4c1ae4 --- /dev/null +++ b/docs/layouts/partials/docs/footer.html @@ -0,0 +1,35 @@ +
+ +{{ if and .GitInfo .Site.Params.BookRepo }} +
+ {{- $date := partial "docs/date" (dict "Date" .GitInfo.AuthorDate.Local "Format" .Site.Params.BookDateFormat) -}} + {{- $commitPath := default "commit" .Site.Params.BookCommitPath -}} + + Calendar + {{ $date }} + +
+{{ end }} + +{{ if and .File .Site.Params.BookRepo .Site.Params.BookEditPath }} + + + +{{ end }} + +
+ +{{ $script := resources.Get "clipboard.js" | resources.Minify }} +{{ with $script.Content }} + +{{ end }} diff --git a/docs/static/report.svg b/docs/static/report.svg new file mode 100644 index 000000000000..ba526c842aa9 --- /dev/null +++ b/docs/static/report.svg @@ -0,0 +1 @@ + \ No newline at end of file From ba8a4c3d260060ae0cedbb8dc47d88b200418aed Mon Sep 17 00:00:00 2001 From: Scott Suarez Date: Fri, 30 Jun 2023 13:49:13 -0700 Subject: [PATCH 26/55] Fix hugo site search functionality (#8243) --- docs/README.md | 11 ++++++++++- docs/go.mod | 2 +- docs/go.sum | 2 ++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/docs/README.md b/docs/README.md index be33b831852e..cbeb9275d177 100644 --- a/docs/README.md +++ b/docs/README.md @@ -8,4 +8,13 @@ To view locally: If you are having deployment issues, try to reset your hugo module cache. -* `hugo mod clean` \ No newline at end of file +* `hugo mod clean` + +To upgrade the theme version: +1. find the version you want at https://github.com/alex-shpak/hugo-book/commits/master +2. Run the following +```bash +go get github.com/alex-shpak/hugo-book@{{commit_hash}} +## example +## go get github.com/alex-shpak/hugo-book@d86d5e70c7c0d787675b13d9aee749c1a8b34776 +``` diff --git a/docs/go.mod b/docs/go.mod index 0da51c289342..bb57693d8662 100644 --- a/docs/go.mod +++ b/docs/go.mod @@ -3,7 +3,7 @@ module github.com/GoogleCloudPlatform/magic-modules/docs go 1.19 require ( - github.com/alex-shpak/hugo-book v0.0.0-20221111100854-d5b75f4fb3aa // indirect + github.com/alex-shpak/hugo-book v0.0.0-20230424134111-d86d5e70c7c0 // indirect github.com/h-enk/doks-child-theme v0.5.0 // indirect github.com/theNewDynamic/gohugo-theme-ananke v0.0.0-20221031153459-b393088d0930 // indirect ) diff --git a/docs/go.sum b/docs/go.sum index c30100d18afe..daa3986d8c39 100644 --- a/docs/go.sum +++ b/docs/go.sum @@ -1,5 +1,7 @@ github.com/alex-shpak/hugo-book v0.0.0-20221111100854-d5b75f4fb3aa h1:VthswmcR+7NtpamidIRuFq+8JRAz4v+s7xVJ0MmeLqM= github.com/alex-shpak/hugo-book v0.0.0-20221111100854-d5b75f4fb3aa/go.mod h1:L4NMyzbn15fpLIpmmtDg9ZFFyTZzw87/lk7M2bMQ7ds= +github.com/alex-shpak/hugo-book v0.0.0-20230424134111-d86d5e70c7c0 h1:Bj/rhvEOix4TXwbzlZttiIi+5fTOqT3aQs1zMsprIXQ= +github.com/alex-shpak/hugo-book v0.0.0-20230424134111-d86d5e70c7c0/go.mod h1:L4NMyzbn15fpLIpmmtDg9ZFFyTZzw87/lk7M2bMQ7ds= github.com/h-enk/doks-child-theme v0.5.0 h1:OrLbcGv6GfhDMs8O2OK93e0hUMvV1aygJWeAdKMcdiU= github.com/h-enk/doks-child-theme v0.5.0/go.mod h1:SCLBJIX7W4LH6rbaY9v31i1fwk0DRYoVwDWNMiRpE78= github.com/theNewDynamic/gohugo-theme-ananke v0.0.0-20221031153459-b393088d0930 h1:HH3nIivNlAVSYE9dvB0MD/cWunI1FpN6RDS6FziSFcs= From 1825b22c529c8e3d8df7beed775d68f8c47b413a Mon Sep 17 00:00:00 2001 From: Thomas Rodgers Date: Fri, 30 Jun 2023 14:18:29 -0700 Subject: [PATCH 27/55] Add an email for diff step (#8230) --- .github/workflows/pre-build-validation.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/pre-build-validation.yml b/.github/workflows/pre-build-validation.yml index 61f17249d72f..ecbc24a2a38a 100644 --- a/.github/workflows/pre-build-validation.yml +++ b/.github/workflows/pre-build-validation.yml @@ -39,6 +39,7 @@ jobs: run: | cd repo git config user.name "modular-magician" + git config user.email "magic-modules@google.com" git merge --no-ff origin/main yamlfiles=$(git diff --name-only origin/main -- mmv1/products) if [ ! -z "$yamlfiles" ]; then From 1da5379336a65d64d2d55c2db725825f532f32a8 Mon Sep 17 00:00:00 2001 From: Zhenhua Li Date: Fri, 30 Jun 2023 16:39:57 -0700 Subject: [PATCH 28/55] Move bootstrap utility functons to the acctest package (#8244) * Move bootstrap utility functons to the acctest package * Remove unrelated changes. --- mmv1/products/alloydb/Backup.yaml | 4 +- .../products/artifactregistry/Repository.yaml | 2 +- .../cloudbuild/BitbucketServerConfig.yaml | 2 +- mmv1/products/cloudfunctions2/Function.yaml | 8 +- mmv1/products/compute/MachineImage.yaml | 2 +- mmv1/products/datastream/Stream.yaml | 4 +- mmv1/products/healthcare/DicomStore.yaml | 2 +- mmv1/products/healthcare/FhirStore.yaml | 2 +- mmv1/products/memcache/Instance.yaml | 2 +- .../privateca/CertificateAuthority.yaml | 8 +- mmv1/products/redis/Instance.yaml | 10 +- mmv1/products/vertexai/Featurestore.yaml | 6 +- .../vertexai/FeaturestoreEntitytype.yaml | 4 +- mmv1/products/vertexai/IndexEndpoint.yaml | 2 +- mmv1/products/vertexai/Tensorboard.yaml | 2 +- .../acctest/bootstrap_iam_test_utils.go | 102 ++ .../terraform/acctest/bootstrap_test_utils.go | 1084 +++++++++++++++++ .../data_source_certificate_authority_test.go | 2 +- .../data_source_google_kms_crypto_key_test.go | 2 +- ...urce_google_kms_crypto_key_version_test.go | 6 +- .../data_source_google_kms_key_ring_test.go | 2 +- ...ource_google_kms_secret_ciphertext_test.go | 2 +- ...oogle_service_account_access_token_test.go | 2 +- ...ce_google_service_account_id_token_test.go | 2 +- ..._source_google_service_account_jwt_test.go | 2 +- .../tests/data_source_sql_backup_run_test.go | 2 +- ...er_service_perimeter_egress_policy_test.go | 2 +- ...r_service_perimeter_ingress_policy_test.go | 2 +- ...manager_service_perimeter_resource_test.go | 2 +- .../tests/resource_alloydb_backup_test.go | 4 +- .../tests/resource_big_query_dataset_test.go | 2 +- .../tests/resource_bigquery_table_test.go | 2 +- .../tests/resource_bigtable_instance_test.go | 4 +- ..._binary_authorization_attestor_test.go.erb | 2 +- ...loud_identity_group_membership_test.go.erb | 2 +- .../resource_cloudfunction2_function_test.go | 2 +- ...source_cloudfunctions_function_test.go.erb | 2 +- .../resource_composer_environment_test.go.erb | 6 +- .../tests/resource_compute_disk_test.go.erb | 4 +- .../tests/resource_compute_image_test.go.erb | 2 +- ...urce_compute_instance_template_test.go.erb | 12 +- .../resource_compute_instance_test.go.erb | 4 +- ...mpute_region_instance_template_test.go.erb | 4 +- ...urce_container_analysis_occurrence_test.go | 12 +- .../resource_container_cluster_test.go.erb | 16 +- .../resource_container_node_pool_test.go.erb | 2 +- ...oss_prevention_deidentify_template_test.go | 24 +- .../tests/resource_dataflow_job_test.go.erb | 2 +- .../resource_dataproc_cluster_test.go.erb | 6 +- .../resource_eventarc_channel_test.go.erb | 4 +- ...eventarc_google_channel_config_test.go.erb | 4 +- .../resource_eventarc_trigger_test.go.erb | 4 +- .../resource_kms_secret_ciphertext_test.go | 2 +- .../tests/resource_memcache_instance_test.go | 2 +- ...ce_privateca_certificate_authority_test.go | 8 +- .../tests/resource_pubsub_topic_test.go | 4 +- ...resource_secret_manager_secret_test.go.erb | 4 +- ...urce_service_networking_connection_test.go | 4 +- .../resource_sql_database_instance_test.go | 26 +- .../resource_storage_bucket_object_test.go | 2 +- .../tests/resource_vertex_ai_endpoint_test.go | 4 +- .../resource_vertex_ai_index_endpoint_test.go | 2 +- ...ource_vertex_ai_metadata_store_test.go.erb | 2 +- .../tests/resource_workflows_workflow_test.go | 4 +- .../utils/bootstrap_iam_test_utils.go | 66 +- .../terraform/utils/bootstrap_test_utils.go | 1013 +-------------- .../terraform/utils/provider_test.go.erb | 6 +- 67 files changed, 1357 insertions(+), 1192 deletions(-) create mode 100644 mmv1/third_party/terraform/acctest/bootstrap_iam_test_utils.go create mode 100644 mmv1/third_party/terraform/acctest/bootstrap_test_utils.go diff --git a/mmv1/products/alloydb/Backup.yaml b/mmv1/products/alloydb/Backup.yaml index 15b58e58739c..1131483c09cf 100644 --- a/mmv1/products/alloydb/Backup.yaml +++ b/mmv1/products/alloydb/Backup.yaml @@ -53,7 +53,7 @@ examples: alloydb_instance_name: 'alloydb-instance' network_name: 'alloydb-network' test_vars_overrides: - network_name: 'BootstrapSharedTestNetwork(t, "alloydb-basic")' + network_name: 'acctest.BootstrapSharedTestNetwork(t, "alloydb-basic")' ignore_read_extra: - 'reconciling' - 'update_time' @@ -66,7 +66,7 @@ examples: alloydb_instance_name: 'alloydb-instance' network_name: 'alloydb-network' test_vars_overrides: - network_name: 'BootstrapSharedTestNetwork(t, "alloydb-full")' + network_name: 'acctest.BootstrapSharedTestNetwork(t, "alloydb-full")' ignore_read_extra: - 'reconciling' - 'update_time' diff --git a/mmv1/products/artifactregistry/Repository.yaml b/mmv1/products/artifactregistry/Repository.yaml index 7f02acfe3512..a61e054d98a9 100644 --- a/mmv1/products/artifactregistry/Repository.yaml +++ b/mmv1/products/artifactregistry/Repository.yaml @@ -66,7 +66,7 @@ examples: repository_id: 'my-repository' kms_key_name: 'kms-key' test_vars_overrides: - kms_key_name: 'BootstrapKMSKeyInLocation(t, "us-central1").CryptoKey.Name' + kms_key_name: 'acctest.BootstrapKMSKeyInLocation(t, "us-central1").CryptoKey.Name' - !ruby/object:Provider::Terraform::Examples name: 'artifact_registry_repository_virtual' primary_resource_id: 'my-repo' diff --git a/mmv1/products/cloudbuild/BitbucketServerConfig.yaml b/mmv1/products/cloudbuild/BitbucketServerConfig.yaml index e93c0022c803..dd00668201ff 100644 --- a/mmv1/products/cloudbuild/BitbucketServerConfig.yaml +++ b/mmv1/products/cloudbuild/BitbucketServerConfig.yaml @@ -64,7 +64,7 @@ examples: config_id: 'bbs-config' network_name: 'vpc-network' test_vars_overrides: - network_name: 'BootstrapSharedTestNetwork(t, "peered-network")' + network_name: 'acctest.BootstrapSharedTestNetwork(t, "peered-network")' custom_code: !ruby/object:Provider::Terraform::CustomCode encoder: templates/terraform/encoders/cloudbuild_bitbucketserver_config.go.erb post_create: templates/terraform/post_create/cloudbuild_bitbucketserver_config.go.erb diff --git a/mmv1/products/cloudfunctions2/Function.yaml b/mmv1/products/cloudfunctions2/Function.yaml index ee3bc696f1cc..7cad1ba4d3f1 100644 --- a/mmv1/products/cloudfunctions2/Function.yaml +++ b/mmv1/products/cloudfunctions2/Function.yaml @@ -126,7 +126,7 @@ examples: zip_path: '"./test-fixtures/cloudfunctions2/function-source-eventarc-gcs.zip"' primary_resource_id: '"terraform-test"' policyChanged: - "BootstrapPSARole(t, \"service-\", \"gcp-sa-pubsub\", + "acctest.BootstrapPSARole(t, \"service-\", \"gcp-sa-pubsub\", \"roles/cloudkms.cryptoKeyEncrypterDecrypter\"\ )" # ignore these fields during import step @@ -148,7 +148,7 @@ examples: zip_path: '"./test-fixtures/cloudfunctions2/function-source-eventarc-gcs.zip"' primary_resource_id: '"terraform-test"' policyChanged: - "BootstrapPSARole(t, \"service-\", \"gcp-sa-pubsub\", + "acctest.BootstrapPSARole(t, \"service-\", \"gcp-sa-pubsub\", \"roles/cloudkms.cryptoKeyEncrypterDecrypter\"\ )" # ignore these fields during import step @@ -169,7 +169,7 @@ examples: zip_path: '"./test-fixtures/cloudfunctions2/function-source.zip"' location: '"us-central1"' policyChanged: - "BootstrapPSARole(t, \"service-\", \"gcp-sa-pubsub\", + "acctest.BootstrapPSARole(t, \"service-\", \"gcp-sa-pubsub\", \"roles/cloudkms.cryptoKeyEncrypterDecrypter\"\ )" # ignore these fields during import step @@ -190,7 +190,7 @@ examples: zip_path: '"./test-fixtures/cloudfunctions2/function-source.zip"' location: '"us-central1"' policyChanged: - "BootstrapPSARole(t, \"service-\", \"gcp-sa-pubsub\", + "acctest.BootstrapPSARole(t, \"service-\", \"gcp-sa-pubsub\", \"roles/cloudkms.cryptoKeyEncrypterDecrypter\"\ )" # ignore these fields during import step diff --git a/mmv1/products/compute/MachineImage.yaml b/mmv1/products/compute/MachineImage.yaml index e4fa8a754657..e8f20d4901dd 100644 --- a/mmv1/products/compute/MachineImage.yaml +++ b/mmv1/products/compute/MachineImage.yaml @@ -70,7 +70,7 @@ examples: keyring_name: 'keyring' test_vars_overrides: policyChanged: - 'BootstrapPSARole(t, "service-", "compute-system", + 'acctest.BootstrapPSARole(t, "service-", "compute-system", "roles/cloudkms.cryptoKeyEncrypterDecrypter")' properties: diff --git a/mmv1/products/datastream/Stream.yaml b/mmv1/products/datastream/Stream.yaml index 5ece06eef3a1..039b51a75457 100644 --- a/mmv1/products/datastream/Stream.yaml +++ b/mmv1/products/datastream/Stream.yaml @@ -86,7 +86,7 @@ examples: stream_cmek: 'kms-name' test_vars_overrides: deletion_protection: 'false' - stream_cmek: 'BootstrapKMSKeyInLocation(t, "us-central1").CryptoKey.Name' + stream_cmek: 'acctest.BootstrapKMSKeyInLocation(t, "us-central1").CryptoKey.Name' - !ruby/object:Provider::Terraform::Examples name: 'datastream_stream_postgresql' primary_resource_id: 'default' @@ -135,7 +135,7 @@ examples: test_vars_overrides: deletion_protection: 'false' bigquery_destination_table_kms_key_name: - 'BootstrapKMSKeyInLocation(t, "us-central1").CryptoKey.Name' + 'acctest.BootstrapKMSKeyInLocation(t, "us-central1").CryptoKey.Name' parameters: - !ruby/object:Api::Type::String diff --git a/mmv1/products/healthcare/DicomStore.yaml b/mmv1/products/healthcare/DicomStore.yaml index 63d0fd4d65fd..90ab6b2cbd86 100644 --- a/mmv1/products/healthcare/DicomStore.yaml +++ b/mmv1/products/healthcare/DicomStore.yaml @@ -48,7 +48,7 @@ examples: bq_table_name: 'dicom_bq_tb' test_vars_overrides: policyChanged: - ' BootstrapPSARoles(t, "service-", "gcp-sa-healthcare", + ' acctest.BootstrapPSARoles(t, "service-", "gcp-sa-healthcare", []string{"roles/bigquery.dataEditor", "roles/bigquery.jobUser"})' custom_code: !ruby/object:Provider::Terraform::CustomCode decoder: templates/terraform/decoders/long_name_to_self_link.go.erb diff --git a/mmv1/products/healthcare/FhirStore.yaml b/mmv1/products/healthcare/FhirStore.yaml index ca9d9e9605b6..195ad7134e2a 100644 --- a/mmv1/products/healthcare/FhirStore.yaml +++ b/mmv1/products/healthcare/FhirStore.yaml @@ -46,7 +46,7 @@ examples: bq_dataset_name: 'bq_example_dataset' test_vars_overrides: policyChanged: - ' BootstrapPSARoles(t, "service-", "gcp-sa-healthcare", + ' acctest.BootstrapPSARoles(t, "service-", "gcp-sa-healthcare", []string{"roles/bigquery.dataEditor", "roles/bigquery.jobUser"})' - !ruby/object:Provider::Terraform::Examples name: 'healthcare_fhir_store_notification_config' diff --git a/mmv1/products/memcache/Instance.yaml b/mmv1/products/memcache/Instance.yaml index 1e123a97c0a8..c35dadebdbd0 100644 --- a/mmv1/products/memcache/Instance.yaml +++ b/mmv1/products/memcache/Instance.yaml @@ -40,7 +40,7 @@ examples: network_name: 'test-network' address_name: 'address' test_vars_overrides: - network_name: 'BootstrapSharedTestNetwork(t, "memcache-private")' + network_name: 'acctest.BootstrapSharedTestNetwork(t, "memcache-private")' parameters: - !ruby/object:Api::Type::String name: 'region' diff --git a/mmv1/products/privateca/CertificateAuthority.yaml b/mmv1/products/privateca/CertificateAuthority.yaml index 90faa2984386..99d9e118c14f 100644 --- a/mmv1/products/privateca/CertificateAuthority.yaml +++ b/mmv1/products/privateca/CertificateAuthority.yaml @@ -63,7 +63,7 @@ examples: pool_location: 'us-central1' deletion_protection: 'true' test_vars_overrides: - pool_name: 'BootstrapSharedCaPoolInLocation(t, "us-central1")' + pool_name: 'acctest.BootstrapSharedCaPoolInLocation(t, "us-central1")' pool_location: '"us-central1"' deletion_protection: 'false' ignore_read_extra: @@ -81,7 +81,7 @@ examples: pool_location: 'us-central1' deletion_protection: 'true' test_vars_overrides: - pool_name: 'BootstrapSharedCaPoolInLocation(t, "us-central1")' + pool_name: 'acctest.BootstrapSharedCaPoolInLocation(t, "us-central1")' pool_location: '"us-central1"' deletion_protection: 'false' ignore_read_extra: @@ -103,9 +103,9 @@ examples: deletion_protection: 'true' test_vars_overrides: kms_key_name: - 'BootstrapKMSKeyWithPurposeInLocation(t, "ASYMMETRIC_SIGN", + 'acctest.BootstrapKMSKeyWithPurposeInLocation(t, "ASYMMETRIC_SIGN", "us-central1").CryptoKey.Name' - pool_name: 'BootstrapSharedCaPoolInLocation(t, "us-central1")' + pool_name: 'acctest.BootstrapSharedCaPoolInLocation(t, "us-central1")' pool_location: '"us-central1"' deletion_protection: 'false' ignore_read_extra: diff --git a/mmv1/products/redis/Instance.yaml b/mmv1/products/redis/Instance.yaml index 66e63657fcbb..127c32b2a757 100644 --- a/mmv1/products/redis/Instance.yaml +++ b/mmv1/products/redis/Instance.yaml @@ -49,7 +49,7 @@ examples: instance_name: 'ha-memory-cache' network_name: 'redis-test-network' test_vars_overrides: - network_name: 'BootstrapSharedTestNetwork(t, "redis-full")' + network_name: 'acctest.BootstrapSharedTestNetwork(t, "redis-full")' - !ruby/object:Provider::Terraform::Examples name: 'redis_instance_full_with_persistence_config' primary_resource_id: 'cache-persis' @@ -57,7 +57,7 @@ examples: instance_name: 'ha-memory-cache-persis' network_name: 'redis-test-network' test_vars_overrides: - network_name: 'BootstrapSharedTestNetwork(t, "redis-full-persis")' + network_name: 'acctest.BootstrapSharedTestNetwork(t, "redis-full-persis")' - !ruby/object:Provider::Terraform::Examples name: 'redis_instance_private_service' # Temporary for servicenetworking problems @@ -68,7 +68,7 @@ examples: address_name: 'address' network_name: 'redis-test-network' test_vars_overrides: - network_name: 'BootstrapSharedTestNetwork(t, "redis-private")' + network_name: 'acctest.BootstrapSharedTestNetwork(t, "redis-private")' - !ruby/object:Provider::Terraform::Examples name: 'redis_instance_mrr' primary_resource_id: 'cache' @@ -76,7 +76,7 @@ examples: instance_name: 'mrr-memory-cache' network_name: 'redis-test-network' test_vars_overrides: - network_name: 'BootstrapSharedTestNetwork(t, "redis-mrr")' + network_name: 'acctest.BootstrapSharedTestNetwork(t, "redis-mrr")' - !ruby/object:Provider::Terraform::Examples name: 'redis_instance_cmek' primary_resource_id: 'cache' @@ -85,7 +85,7 @@ examples: instance_name: 'cmek-memory-cache' network_name: 'redis-test-network' test_vars_overrides: - network_name: 'BootstrapSharedTestNetwork(t, "redis-cmek")' + network_name: 'acctest.BootstrapSharedTestNetwork(t, "redis-cmek")' parameters: # TODO: resourceref? - !ruby/object:Api::Type::String diff --git a/mmv1/products/vertexai/Featurestore.yaml b/mmv1/products/vertexai/Featurestore.yaml index f0cd9e06baa6..d8ce854c04d3 100644 --- a/mmv1/products/vertexai/Featurestore.yaml +++ b/mmv1/products/vertexai/Featurestore.yaml @@ -66,7 +66,7 @@ examples: org_id: :ORG_ID billing_account: :BILLING_ACCT test_vars_overrides: - kms_key_name: 'BootstrapKMSKeyInLocation(t, "us-central1").CryptoKey.Name' + kms_key_name: 'acctest.BootstrapKMSKeyInLocation(t, "us-central1").CryptoKey.Name' ignore_read_extra: - 'force_destroy' - !ruby/object:Provider::Terraform::Examples @@ -83,7 +83,7 @@ examples: org_id: :ORG_ID billing_account: :BILLING_ACCT test_vars_overrides: - kms_key_name: 'BootstrapKMSKeyInLocation(t, "us-central1").CryptoKey.Name' + kms_key_name: 'acctest.BootstrapKMSKeyInLocation(t, "us-central1").CryptoKey.Name' ignore_read_extra: - 'force_destroy' min_version: beta @@ -101,7 +101,7 @@ examples: org_id: :ORG_ID billing_account: :BILLING_ACCT test_vars_overrides: - kms_key_name: 'BootstrapKMSKeyInLocation(t, "us-central1").CryptoKey.Name' + kms_key_name: 'acctest.BootstrapKMSKeyInLocation(t, "us-central1").CryptoKey.Name' ignore_read_extra: - 'force_destroy' custom_code: !ruby/object:Provider::Terraform::CustomCode diff --git a/mmv1/products/vertexai/FeaturestoreEntitytype.yaml b/mmv1/products/vertexai/FeaturestoreEntitytype.yaml index 2a89f456bb96..d8d0fb46b2cd 100644 --- a/mmv1/products/vertexai/FeaturestoreEntitytype.yaml +++ b/mmv1/products/vertexai/FeaturestoreEntitytype.yaml @@ -75,7 +75,7 @@ examples: org_id: :ORG_ID billing_account: :BILLING_ACCT test_vars_overrides: - kms_key_name: 'BootstrapKMSKeyInLocation(t, "us-central1").CryptoKey.Name' + kms_key_name: 'acctest.BootstrapKMSKeyInLocation(t, "us-central1").CryptoKey.Name' - !ruby/object:Provider::Terraform::Examples name: 'vertex_ai_featurestore_entitytype_with_beta_fields' primary_resource_id: 'entity' @@ -87,7 +87,7 @@ examples: org_id: :ORG_ID billing_account: :BILLING_ACCT test_vars_overrides: - kms_key_name: 'BootstrapKMSKeyInLocation(t, "us-central1").CryptoKey.Name' + kms_key_name: 'acctest.BootstrapKMSKeyInLocation(t, "us-central1").CryptoKey.Name' min_version: beta custom_code: !ruby/object:Provider::Terraform::CustomCode pre_create: templates/terraform/constants/vertex_ai_featurestore_entitytype.go.erb diff --git a/mmv1/products/vertexai/IndexEndpoint.yaml b/mmv1/products/vertexai/IndexEndpoint.yaml index 945f6539ef5f..029746f160c9 100644 --- a/mmv1/products/vertexai/IndexEndpoint.yaml +++ b/mmv1/products/vertexai/IndexEndpoint.yaml @@ -52,7 +52,7 @@ examples: address_name: "address-name" network_name: "network-name" test_vars_overrides: - network_name: 'BootstrapSharedTestNetwork(t, "vertex-ai-index-endpoint")' + network_name: 'acctest.BootstrapSharedTestNetwork(t, "vertex-ai-index-endpoint")' parameters: - !ruby/object:Api::Type::String name: region diff --git a/mmv1/products/vertexai/Tensorboard.yaml b/mmv1/products/vertexai/Tensorboard.yaml index 5ebf6760aa8b..99c2895a1e1c 100644 --- a/mmv1/products/vertexai/Tensorboard.yaml +++ b/mmv1/products/vertexai/Tensorboard.yaml @@ -56,7 +56,7 @@ examples: display_name: 'terraform' kms_key_name: 'kms-name' test_vars_overrides: - kms_key_name: 'BootstrapKMSKeyInLocation(t, "us-central1").CryptoKey.Name' + kms_key_name: 'acctest.BootstrapKMSKeyInLocation(t, "us-central1").CryptoKey.Name' ignore_read_extra: - 'project' custom_code: !ruby/object:Provider::Terraform::CustomCode diff --git a/mmv1/third_party/terraform/acctest/bootstrap_iam_test_utils.go b/mmv1/third_party/terraform/acctest/bootstrap_iam_test_utils.go new file mode 100644 index 000000000000..5cd5b5de3451 --- /dev/null +++ b/mmv1/third_party/terraform/acctest/bootstrap_iam_test_utils.go @@ -0,0 +1,102 @@ +package acctest + +import ( + "fmt" + "log" + "testing" + + "github.com/hashicorp/terraform-provider-google/google/envvar" + "github.com/hashicorp/terraform-provider-google/google/tpgiamresource" + cloudresourcemanager "google.golang.org/api/cloudresourcemanager/v1" +) + +// BootstrapAllPSARoles ensures that the given project's IAM +// policy grants the given service agents the given roles. +// prefix is usually "service-" and indicates the service agent should have the +// given prefix before the project number. +// This is important to bootstrap because using iam policy resources means that +// deleting them removes permissions for concurrent tests. +// Return whether the bindings changed. +func BootstrapAllPSARoles(t *testing.T, prefix string, agentNames, roles []string) bool { + config := BootstrapConfig(t) + if config == nil { + t.Fatal("Could not bootstrap a config for BootstrapAllPSARoles.") + } + client := config.NewResourceManagerClient(config.UserAgent) + + // Get the project since we need its number, id, and policy. + project, err := client.Projects.Get(envvar.GetTestProjectFromEnv()).Do() + if err != nil { + t.Fatalf("Error getting project with id %q: %s", project.ProjectId, err) + } + + getPolicyRequest := &cloudresourcemanager.GetIamPolicyRequest{} + policy, err := client.Projects.GetIamPolicy(project.ProjectId, getPolicyRequest).Do() + if err != nil { + t.Fatalf("Error getting project iam policy: %v", err) + } + + members := make([]string, len(agentNames)) + for i, agentName := range agentNames { + members[i] = fmt.Sprintf("serviceAccount:%s%d@%s.iam.gserviceaccount.com", prefix, project.ProjectNumber, agentName) + } + + // Create the bindings we need to add to the policy. + var newBindings []*cloudresourcemanager.Binding + for _, role := range roles { + newBindings = append(newBindings, &cloudresourcemanager.Binding{ + Role: role, + Members: members, + }) + } + + mergedBindings := tpgiamresource.MergeBindings(append(policy.Bindings, newBindings...)) + + if !tpgiamresource.CompareBindings(policy.Bindings, mergedBindings) { + addedBindings := tpgiamresource.MissingBindings(policy.Bindings, mergedBindings) + for _, missingBinding := range addedBindings { + log.Printf("[DEBUG] Adding binding: %+v", missingBinding) + } + // The policy must change. + policy.Bindings = mergedBindings + setPolicyRequest := &cloudresourcemanager.SetIamPolicyRequest{Policy: policy} + policy, err = client.Projects.SetIamPolicy(project.ProjectId, setPolicyRequest).Do() + if err != nil { + t.Fatalf("Error setting project iam policy: %v", err) + } + msg := "Added the following bindings to the test project's IAM policy:\n" + for _, binding := range addedBindings { + msg += fmt.Sprintf("Members: %q, Role: %q\n", binding.Members, binding.Role) + } + msg += "Retry the test in a few minutes." + t.Error(msg) + return true + } + return false +} + +// BootstrapAllPSARole is a version of BootstrapAllPSARoles for granting a +// single role to multiple service agents. +func BootstrapAllPSARole(t *testing.T, prefix string, agentNames []string, role string) bool { + return BootstrapAllPSARoles(t, prefix, agentNames, []string{role}) +} + +// BootstrapPSARoles is a version of BootstrapAllPSARoles for granting roles to +// a single service agent. +func BootstrapPSARoles(t *testing.T, prefix, agentName string, roles []string) bool { + return BootstrapAllPSARoles(t, prefix, []string{agentName}, roles) +} + +// BootstrapPSARole is a simplified version of BootstrapPSARoles for granting a +// single role to a single service agent. +func BootstrapPSARole(t *testing.T, prefix, agentName, role string) bool { + return BootstrapPSARoles(t, prefix, agentName, []string{role}) +} + +// Returns the bindings that are in the first set of bindings but not the second. +// +// Deprecated: For backward compatibility missingBindings is still working, +// but all new code should use MissingBindings in the tpgiamresource package instead. +func missingBindings(a, b []*cloudresourcemanager.Binding) []*cloudresourcemanager.Binding { + return tpgiamresource.MissingBindings(a, b) +} diff --git a/mmv1/third_party/terraform/acctest/bootstrap_test_utils.go b/mmv1/third_party/terraform/acctest/bootstrap_test_utils.go new file mode 100644 index 000000000000..9f14e6d713c8 --- /dev/null +++ b/mmv1/third_party/terraform/acctest/bootstrap_test_utils.go @@ -0,0 +1,1084 @@ +package acctest + +import ( + "context" + "fmt" + "log" + "os" + "strings" + "testing" + "time" + + "github.com/hashicorp/terraform-provider-google/google/envvar" + tpgcompute "github.com/hashicorp/terraform-provider-google/google/services/compute" + "github.com/hashicorp/terraform-provider-google/google/services/privateca" + "github.com/hashicorp/terraform-provider-google/google/services/resourcemanager" + "github.com/hashicorp/terraform-provider-google/google/services/sql" + "github.com/hashicorp/terraform-provider-google/google/tpgiamresource" + "github.com/hashicorp/terraform-provider-google/google/tpgresource" + transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" + + "google.golang.org/api/cloudbilling/v1" + cloudkms "google.golang.org/api/cloudkms/v1" + cloudresourcemanager "google.golang.org/api/cloudresourcemanager/v1" + iam "google.golang.org/api/iam/v1" + "google.golang.org/api/iamcredentials/v1" + "google.golang.org/api/serviceusage/v1" + sqladmin "google.golang.org/api/sqladmin/v1beta4" +) + +var SharedKeyRing = "tftest-shared-keyring-1" +var SharedCryptoKey = map[string]string{ + "ENCRYPT_DECRYPT": "tftest-shared-key-1", + "ASYMMETRIC_SIGN": "tftest-shared-sign-key-1", + "ASYMMETRIC_DECRYPT": "tftest-shared-decrypt-key-1", +} + +type BootstrappedKMS struct { + *cloudkms.KeyRing + *cloudkms.CryptoKey +} + +func BootstrapKMSKey(t *testing.T) BootstrappedKMS { + return BootstrapKMSKeyInLocation(t, "global") +} + +func BootstrapKMSKeyInLocation(t *testing.T, locationID string) BootstrappedKMS { + return BootstrapKMSKeyWithPurposeInLocation(t, "ENCRYPT_DECRYPT", locationID) +} + +// BootstrapKMSKeyWithPurpose returns a KMS key in the "global" location. +// See BootstrapKMSKeyWithPurposeInLocation. +func BootstrapKMSKeyWithPurpose(t *testing.T, purpose string) BootstrappedKMS { + return BootstrapKMSKeyWithPurposeInLocation(t, purpose, "global") +} + +/** +* BootstrapKMSKeyWithPurposeInLocation will return a KMS key in a +* particular location with the given purpose that can be used +* in tests that are testing KMS integration with other resources. +* +* This will either return an existing key or create one if it hasn't been created +* in the project yet. The motivation is because keyrings don't get deleted and we +* don't want a linear growth of disabled keyrings in a project. We also don't want +* to incur the overhead of creating a new project for each test that needs to use +* a KMS key. +**/ +func BootstrapKMSKeyWithPurposeInLocation(t *testing.T, purpose, locationID string) BootstrappedKMS { + return BootstrapKMSKeyWithPurposeInLocationAndName(t, purpose, locationID, SharedCryptoKey[purpose]) +} + +func BootstrapKMSKeyWithPurposeInLocationAndName(t *testing.T, purpose, locationID, keyShortName string) BootstrappedKMS { + config := BootstrapConfig(t) + if config == nil { + return BootstrappedKMS{ + &cloudkms.KeyRing{}, + &cloudkms.CryptoKey{}, + } + } + + projectID := envvar.GetTestProjectFromEnv() + keyRingParent := fmt.Sprintf("projects/%s/locations/%s", projectID, locationID) + keyRingName := fmt.Sprintf("%s/keyRings/%s", keyRingParent, SharedKeyRing) + keyParent := fmt.Sprintf("projects/%s/locations/%s/keyRings/%s", projectID, locationID, SharedKeyRing) + keyName := fmt.Sprintf("%s/cryptoKeys/%s", keyParent, keyShortName) + + // Get or Create the hard coded shared keyring for testing + kmsClient := config.NewKmsClient(config.UserAgent) + keyRing, err := kmsClient.Projects.Locations.KeyRings.Get(keyRingName).Do() + if err != nil { + if transport_tpg.IsGoogleApiErrorWithCode(err, 404) { + keyRing, err = kmsClient.Projects.Locations.KeyRings.Create(keyRingParent, &cloudkms.KeyRing{}). + KeyRingId(SharedKeyRing).Do() + if err != nil { + t.Errorf("Unable to bootstrap KMS key. Cannot create keyRing: %s", err) + } + } else { + t.Errorf("Unable to bootstrap KMS key. Cannot retrieve keyRing: %s", err) + } + } + + if keyRing == nil { + t.Fatalf("Unable to bootstrap KMS key. keyRing is nil!") + } + + // Get or Create the hard coded, shared crypto key for testing + cryptoKey, err := kmsClient.Projects.Locations.KeyRings.CryptoKeys.Get(keyName).Do() + if err != nil { + if transport_tpg.IsGoogleApiErrorWithCode(err, 404) { + algos := map[string]string{ + "ENCRYPT_DECRYPT": "GOOGLE_SYMMETRIC_ENCRYPTION", + "ASYMMETRIC_SIGN": "RSA_SIGN_PKCS1_4096_SHA512", + "ASYMMETRIC_DECRYPT": "RSA_DECRYPT_OAEP_4096_SHA512", + } + template := cloudkms.CryptoKeyVersionTemplate{ + Algorithm: algos[purpose], + } + + newKey := cloudkms.CryptoKey{ + Purpose: purpose, + VersionTemplate: &template, + } + + cryptoKey, err = kmsClient.Projects.Locations.KeyRings.CryptoKeys.Create(keyParent, &newKey). + CryptoKeyId(keyShortName).Do() + if err != nil { + t.Errorf("Unable to bootstrap KMS key. Cannot create new CryptoKey: %s", err) + } + + } else { + t.Errorf("Unable to bootstrap KMS key. Cannot call CryptoKey service: %s", err) + } + } + + if cryptoKey == nil { + t.Fatalf("Unable to bootstrap KMS key. CryptoKey is nil!") + } + + return BootstrappedKMS{ + keyRing, + cryptoKey, + } +} + +var serviceAccountEmail = "tf-bootstrap-service-account" +var serviceAccountDisplay = "Bootstrapped Service Account for Terraform tests" + +// Some tests need a second service account, other than the test runner, to assert functionality on. +// This provides a well-known service account that can be used when dynamically creating a service +// account isn't an option. +func getOrCreateServiceAccount(config *transport_tpg.Config, project string) (*iam.ServiceAccount, error) { + name := fmt.Sprintf("projects/%s/serviceAccounts/%s@%s.iam.gserviceaccount.com", project, serviceAccountEmail, project) + log.Printf("[DEBUG] Verifying %s as bootstrapped service account.\n", name) + + sa, err := config.NewIamClient(config.UserAgent).Projects.ServiceAccounts.Get(name).Do() + if err != nil && !transport_tpg.IsGoogleApiErrorWithCode(err, 404) { + return nil, err + } + + if sa == nil { + log.Printf("[DEBUG] Account missing. Creating %s as bootstrapped service account.\n", name) + sa = &iam.ServiceAccount{ + DisplayName: serviceAccountDisplay, + } + + r := &iam.CreateServiceAccountRequest{ + AccountId: serviceAccountEmail, + ServiceAccount: sa, + } + sa, err = config.NewIamClient(config.UserAgent).Projects.ServiceAccounts.Create("projects/"+project, r).Do() + if err != nil { + return nil, err + } + } + + return sa, nil +} + +// In order to test impersonation we need to grant the testRunner's account the ability to grant tokens +// on a different service account. Granting permissions takes time and there is no operation to wait on +// so instead this creates a single service account once per test-suite with the correct permissions. +// The first time this test is run it will fail, but subsequent runs will succeed. +func impersonationServiceAccountPermissions(config *transport_tpg.Config, sa *iam.ServiceAccount, testRunner string) error { + log.Printf("[DEBUG] Setting service account permissions.\n") + policy := iam.Policy{ + Bindings: []*iam.Binding{}, + } + + binding := &iam.Binding{ + Role: "roles/iam.serviceAccountTokenCreator", + Members: []string{"serviceAccount:" + sa.Email, "serviceAccount:" + testRunner}, + } + policy.Bindings = append(policy.Bindings, binding) + + // Overwrite the roles each time on this service account. This is because this account is + // only created for the test suite and will stop snowflaking of permissions to get tests + // to run. Overwriting permissions on 1 service account shouldn't affect others. + _, err := config.NewIamClient(config.UserAgent).Projects.ServiceAccounts.SetIamPolicy(sa.Name, &iam.SetIamPolicyRequest{ + Policy: &policy, + }).Do() + if err != nil { + return err + } + + return nil +} + +func BootstrapServiceAccount(t *testing.T, project, testRunner string) string { + config := BootstrapConfig(t) + if config == nil { + return "" + } + + sa, err := getOrCreateServiceAccount(config, project) + if err != nil { + t.Fatalf("Bootstrapping failed. Cannot retrieve service account, %s", err) + } + + err = impersonationServiceAccountPermissions(config, sa, testRunner) + if err != nil { + t.Fatalf("Bootstrapping failed. Cannot set service account permissions, %s", err) + } + + return sa.Email +} + +const SharedTestADDomainPrefix = "tf-bootstrap-ad" + +func BootstrapSharedTestADDomain(t *testing.T, testId string, networkName string) string { + project := envvar.GetTestProjectFromEnv() + sharedADDomain := fmt.Sprintf("%s.%s.com", SharedTestADDomainPrefix, testId) + adDomainName := fmt.Sprintf("projects/%s/locations/global/domains/%s", project, sharedADDomain) + + config := BootstrapConfig(t) + if config == nil { + return "" + } + + log.Printf("[DEBUG] Getting shared test active directory domain %q", adDomainName) + getURL := fmt.Sprintf("%s%s", config.ActiveDirectoryBasePath, adDomainName) + _, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ + Config: config, + Method: "GET", + Project: project, + RawURL: getURL, + UserAgent: config.UserAgent, + Timeout: 4 * time.Minute, + }) + if err != nil && transport_tpg.IsGoogleApiErrorWithCode(err, 404) { + log.Printf("[DEBUG] AD domain %q not found, bootstrapping", sharedADDomain) + postURL := fmt.Sprintf("%sprojects/%s/locations/global/domains?domainName=%s", config.ActiveDirectoryBasePath, project, sharedADDomain) + domainObj := map[string]interface{}{ + "locations": []string{"us-central1"}, + "reservedIpRange": "10.0.1.0/24", + "authorizedNetworks": []string{fmt.Sprintf("projects/%s/global/networks/%s", project, networkName)}, + } + + _, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ + Config: config, + Method: "POST", + Project: project, + RawURL: postURL, + UserAgent: config.UserAgent, + Body: domainObj, + Timeout: 60 * time.Minute, + }) + if err != nil { + t.Fatalf("Error bootstrapping shared active directory domain %q: %s", adDomainName, err) + } + + log.Printf("[DEBUG] Waiting for active directory domain creation to finish") + } + + _, err = transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ + Config: config, + Method: "GET", + Project: project, + RawURL: getURL, + UserAgent: config.UserAgent, + Timeout: 4 * time.Minute, + }) + + if err != nil { + t.Fatalf("Error getting shared active directory domain %q: %s", adDomainName, err) + } + + return sharedADDomain +} + +const SharedTestNetworkPrefix = "tf-bootstrap-net-" + +// BootstrapSharedTestNetwork will return a persistent compute network for a +// test or set of tests. +// +// Resources like service_networking_connection use a consumer network and +// create a complementing tenant network which we don't control. These tenant +// networks never get cleaned up and they can accumulate to the point where a +// limit is reached for the organization. By reusing a consumer network across +// test runs, we can reduce the number of tenant networks that are needed. +// See b/146351146 for more context. +// +// testId specifies the test for which a shared network is used/initialized. +// Note that if the network is being used for a service_networking_connection, +// the same testId should generally not be used across tests, to avoid race +// conditions where multiple tests attempt to modify the connection at once. +// +// Returns the name of a network, creating it if it hasn't been created in the +// test project. +func BootstrapSharedTestNetwork(t *testing.T, testId string) string { + project := envvar.GetTestProjectFromEnv() + networkName := SharedTestNetworkPrefix + testId + + config := BootstrapConfig(t) + if config == nil { + return "" + } + + log.Printf("[DEBUG] Getting shared test network %q", networkName) + _, err := config.NewComputeClient(config.UserAgent).Networks.Get(project, networkName).Do() + if err != nil && transport_tpg.IsGoogleApiErrorWithCode(err, 404) { + log.Printf("[DEBUG] Network %q not found, bootstrapping", networkName) + url := fmt.Sprintf("%sprojects/%s/global/networks", config.ComputeBasePath, project) + netObj := map[string]interface{}{ + "name": networkName, + "autoCreateSubnetworks": false, + } + + res, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ + Config: config, + Method: "POST", + Project: project, + RawURL: url, + UserAgent: config.UserAgent, + Body: netObj, + Timeout: 4 * time.Minute, + }) + if err != nil { + t.Fatalf("Error bootstrapping shared test network %q: %s", networkName, err) + } + + log.Printf("[DEBUG] Waiting for network creation to finish") + err = tpgcompute.ComputeOperationWaitTime(config, res, project, "Error bootstrapping shared test network", config.UserAgent, 4*time.Minute) + if err != nil { + t.Fatalf("Error bootstrapping shared test network %q: %s", networkName, err) + } + } + + network, err := config.NewComputeClient(config.UserAgent).Networks.Get(project, networkName).Do() + if err != nil { + t.Errorf("Error getting shared test network %q: %s", networkName, err) + } + if network == nil { + t.Fatalf("Error getting shared test network %q: is nil", networkName) + } + return network.Name +} + +var SharedServicePerimeterProjectPrefix = "tf-bootstrap-sp-" + +func BootstrapServicePerimeterProjects(t *testing.T, desiredProjects int) []*cloudresourcemanager.Project { + config := BootstrapConfig(t) + if config == nil { + return nil + } + + org := envvar.GetTestOrgFromEnv(t) + + // The filter endpoint works differently if you provide both the parent id and parent type, and + // doesn't seem to allow for prefix matching. Don't change this to include the parent type unless + // that API behavior changes. + prefixFilter := fmt.Sprintf("id:%s* parent.id:%s", SharedServicePerimeterProjectPrefix, org) + res, err := config.NewResourceManagerClient(config.UserAgent).Projects.List().Filter(prefixFilter).Do() + if err != nil { + t.Fatalf("Error getting shared test projects: %s", err) + } + + projects := res.Projects + for len(projects) < desiredProjects { + pid := SharedServicePerimeterProjectPrefix + RandString(t, 10) + project := &cloudresourcemanager.Project{ + ProjectId: pid, + Name: "TF Service Perimeter Test", + Parent: &cloudresourcemanager.ResourceId{ + Type: "organization", + Id: org, + }, + } + op, err := config.NewResourceManagerClient(config.UserAgent).Projects.Create(project).Do() + if err != nil { + t.Fatalf("Error bootstrapping shared test project: %s", err) + } + + opAsMap, err := tpgresource.ConvertToMap(op) + if err != nil { + t.Fatalf("Error bootstrapping shared test project: %s", err) + } + + err = resourcemanager.ResourceManagerOperationWaitTime(config, opAsMap, "creating project", config.UserAgent, 4) + if err != nil { + t.Fatalf("Error bootstrapping shared test project: %s", err) + } + + p, err := config.NewResourceManagerClient(config.UserAgent).Projects.Get(pid).Do() + if err != nil { + t.Fatalf("Error getting shared test project: %s", err) + } + projects = append(projects, p) + } + + return projects +} + +func RemoveContainerServiceAgentRoleFromContainerEngineRobot(t *testing.T, project *cloudresourcemanager.Project) { + config := BootstrapConfig(t) + if config == nil { + return + } + + client := config.NewResourceManagerClient(config.UserAgent) + containerEngineRobot := fmt.Sprintf("serviceAccount:service-%d@container-engine-robot.iam.gserviceaccount.com", project.ProjectNumber) + getPolicyRequest := &cloudresourcemanager.GetIamPolicyRequest{} + policy, err := client.Projects.GetIamPolicy(project.ProjectId, getPolicyRequest).Do() + if err != nil { + t.Fatalf("error getting project iam policy: %v", err) + } + roleFound := false + changed := false + for _, binding := range policy.Bindings { + if binding.Role == "roles/container.serviceAgent" { + memberFound := false + for i, member := range binding.Members { + if member == containerEngineRobot { + binding.Members[i] = binding.Members[len(binding.Members)-1] + memberFound = true + } + } + if memberFound { + binding.Members = binding.Members[:len(binding.Members)-1] + changed = true + } + } else if binding.Role == "roles/editor" { + memberFound := false + for _, member := range binding.Members { + if member == containerEngineRobot { + memberFound = true + break + } + } + if !memberFound { + binding.Members = append(binding.Members, containerEngineRobot) + changed = true + } + roleFound = true + } + } + if !roleFound { + policy.Bindings = append(policy.Bindings, &cloudresourcemanager.Binding{ + Members: []string{containerEngineRobot}, + Role: "roles/editor", + }) + changed = true + } + if changed { + setPolicyRequest := &cloudresourcemanager.SetIamPolicyRequest{Policy: policy} + policy, err = client.Projects.SetIamPolicy(project.ProjectId, setPolicyRequest).Do() + if err != nil { + t.Fatalf("error setting project iam policy: %v", err) + } + } +} + +// BootstrapProject will create or get a project named +// "" that will persist across test runs, +// where projectIDSuffix is based off of getTestProjectFromEnv(). The reason +// for the naming is to isolate bootstrapped projects by test environment. +// Given the existing projects being used by our team, the prefix provided to +// this function can be no longer than 18 characters. +func BootstrapProject(t *testing.T, projectIDPrefix, billingAccount string, services []string) *cloudresourcemanager.Project { + config := BootstrapConfig(t) + if config == nil { + return nil + } + + projectIDSuffix := strings.Replace(envvar.GetTestProjectFromEnv(), "ci-test-project-", "", 1) + projectID := projectIDPrefix + projectIDSuffix + + crmClient := config.NewResourceManagerClient(config.UserAgent) + + project, err := crmClient.Projects.Get(projectID).Do() + if err != nil { + if !transport_tpg.IsGoogleApiErrorWithCode(err, 403) { + t.Fatalf("Error getting bootstrapped project: %s", err) + } + org := envvar.GetTestOrgFromEnv(t) + + op, err := crmClient.Projects.Create(&cloudresourcemanager.Project{ + ProjectId: projectID, + Name: "Bootstrapped Test Project", + Parent: &cloudresourcemanager.ResourceId{ + Type: "organization", + Id: org, + }, + }).Do() + if err != nil { + t.Fatalf("Error creating bootstrapped test project: %s", err) + } + + opAsMap, err := tpgresource.ConvertToMap(op) + if err != nil { + t.Fatalf("Error converting create project operation to map: %s", err) + } + + err = resourcemanager.ResourceManagerOperationWaitTime(config, opAsMap, "creating project", config.UserAgent, 4*time.Minute) + if err != nil { + t.Fatalf("Error waiting for create project operation: %s", err) + } + + project, err = crmClient.Projects.Get(projectID).Do() + if err != nil { + t.Fatalf("Error getting bootstrapped project: %s", err) + } + + } + + if project.LifecycleState == "DELETE_REQUESTED" { + _, err := crmClient.Projects.Undelete(projectID, &cloudresourcemanager.UndeleteProjectRequest{}).Do() + if err != nil { + t.Fatalf("Error undeleting bootstrapped project: %s", err) + } + } + + if billingAccount != "" { + billingClient := config.NewBillingClient(config.UserAgent) + var pbi *cloudbilling.ProjectBillingInfo + err = transport_tpg.Retry(transport_tpg.RetryOptions{ + RetryFunc: func() error { + var reqErr error + pbi, reqErr = billingClient.Projects.GetBillingInfo(resourcemanager.PrefixedProject(projectID)).Do() + return reqErr + }, + Timeout: 30 * time.Second, + }) + if err != nil { + t.Fatalf("Error getting billing info for project %q: %v", projectID, err) + } + if strings.TrimPrefix(pbi.BillingAccountName, "billingAccounts/") != billingAccount { + pbi.BillingAccountName = "billingAccounts/" + billingAccount + err := transport_tpg.Retry(transport_tpg.RetryOptions{ + RetryFunc: func() error { + _, err := config.NewBillingClient(config.UserAgent).Projects.UpdateBillingInfo(resourcemanager.PrefixedProject(projectID), pbi).Do() + return err + }, + Timeout: 2 * time.Minute, + }) + if err != nil { + t.Fatalf("Error setting billing account for project %q to %q: %s", projectID, billingAccount, err) + } + } + } + + if len(services) > 0 { + + enabledServices, err := resourcemanager.ListCurrentlyEnabledServices(projectID, "", config.UserAgent, config, 1*time.Minute) + if err != nil { + t.Fatalf("Error listing services for project %q: %s", projectID, err) + } + + servicesToEnable := make([]string, 0, len(services)) + for _, service := range services { + if _, ok := enabledServices[service]; !ok { + servicesToEnable = append(servicesToEnable, service) + } + } + + if len(servicesToEnable) > 0 { + if err := resourcemanager.EnableServiceUsageProjectServices(servicesToEnable, projectID, "", config.UserAgent, config, 10*time.Minute); err != nil { + t.Fatalf("Error enabling services for project %q: %s", projectID, err) + } + } + } + + return project +} + +// BootstrapConfig returns a Config pulled from the environment. +func BootstrapConfig(t *testing.T) *transport_tpg.Config { + if v := os.Getenv("TF_ACC"); v == "" { + t.Skip("Acceptance tests and bootstrapping skipped unless env 'TF_ACC' set") + return nil + } + + config := &transport_tpg.Config{ + Credentials: envvar.GetTestCredsFromEnv(), + Project: envvar.GetTestProjectFromEnv(), + Region: envvar.GetTestRegionFromEnv(), + Zone: envvar.GetTestZoneFromEnv(), + } + + transport_tpg.ConfigureBasePaths(config) + + if err := config.LoadAndValidate(context.Background()); err != nil { + t.Fatalf("Bootstrapping failed. Unable to load test config: %s", err) + } + return config +} + +// SQL Instance names are not reusable for a week after deletion +const SharedTestSQLInstanceNamePrefix = "tf-bootstrap-" + +// BootstrapSharedSQLInstanceBackupRun will return a shared SQL db instance that +// has a backup created for it. +func BootstrapSharedSQLInstanceBackupRun(t *testing.T) string { + project := envvar.GetTestProjectFromEnv() + + config := BootstrapConfig(t) + if config == nil { + return "" + } + + log.Printf("[DEBUG] Getting list of existing sql instances") + + instances, err := config.NewSqlAdminClient(config.UserAgent).Instances.List(project).Do() + if err != nil { + t.Fatalf("Unable to bootstrap SQL Instance. Cannot retrieve instance list: %s", err) + } + + var bootstrapInstance *sqladmin.DatabaseInstance + + // Look for any existing bootstrap instances + for _, i := range instances.Items { + if strings.HasPrefix(i.Name, SharedTestSQLInstanceNamePrefix) { + bootstrapInstance = i + break + } + } + + if bootstrapInstance == nil { + bootstrapInstanceName := SharedTestSQLInstanceNamePrefix + RandString(t, 10) + log.Printf("[DEBUG] Bootstrap SQL Instance not found, bootstrapping new instance %s", bootstrapInstanceName) + + backupConfig := &sqladmin.BackupConfiguration{ + Enabled: true, + PointInTimeRecoveryEnabled: true, + } + settings := &sqladmin.Settings{ + Tier: "db-f1-micro", + BackupConfiguration: backupConfig, + } + bootstrapInstance = &sqladmin.DatabaseInstance{ + Name: bootstrapInstanceName, + Region: "us-central1", + Settings: settings, + DatabaseVersion: "POSTGRES_11", + } + + var op *sqladmin.Operation + err = transport_tpg.Retry(transport_tpg.RetryOptions{ + RetryFunc: func() (operr error) { + op, operr = config.NewSqlAdminClient(config.UserAgent).Instances.Insert(project, bootstrapInstance).Do() + return operr + }, + Timeout: 20 * time.Minute, + ErrorRetryPredicates: []transport_tpg.RetryErrorPredicateFunc{transport_tpg.IsSqlOperationInProgressError}, + }) + if err != nil { + t.Fatalf("Error, failed to create instance %s: %s", bootstrapInstance.Name, err) + } + err = sql.SqlAdminOperationWaitTime(config, op, project, "Create Instance", config.UserAgent, 40*time.Minute) + if err != nil { + t.Fatalf("Error, failed to create instance %s: %s", bootstrapInstance.Name, err) + } + } + + // Look for backups in bootstrap instance + res, err := config.NewSqlAdminClient(config.UserAgent).BackupRuns.List(project, bootstrapInstance.Name).Do() + if err != nil { + t.Fatalf("Unable to bootstrap SQL Instance. Cannot retrieve backup list: %s", err) + } + backupsList := res.Items + if len(backupsList) == 0 { + log.Printf("[DEBUG] No backups found for %s, creating backup", bootstrapInstance.Name) + backupRun := &sqladmin.BackupRun{ + Instance: bootstrapInstance.Name, + } + + var op *sqladmin.Operation + err = transport_tpg.Retry(transport_tpg.RetryOptions{ + RetryFunc: func() (operr error) { + op, operr = config.NewSqlAdminClient(config.UserAgent).BackupRuns.Insert(project, bootstrapInstance.Name, backupRun).Do() + return operr + }, + Timeout: 20 * time.Minute, + ErrorRetryPredicates: []transport_tpg.RetryErrorPredicateFunc{transport_tpg.IsSqlOperationInProgressError}, + }) + if err != nil { + t.Fatalf("Error, failed to create instance backup: %s", err) + } + err = sql.SqlAdminOperationWaitTime(config, op, project, "Backup Instance", config.UserAgent, 20*time.Minute) + if err != nil { + t.Fatalf("Error, failed to create instance backup: %s", err) + } + } + + return bootstrapInstance.Name +} + +func BootstrapSharedCaPoolInLocation(t *testing.T, location string) string { + project := envvar.GetTestProjectFromEnv() + poolName := "static-ca-pool" + + config := BootstrapConfig(t) + if config == nil { + return "" + } + + log.Printf("[DEBUG] Getting shared CA pool %q", poolName) + url := fmt.Sprintf("%sprojects/%s/locations/%s/caPools/%s", config.PrivatecaBasePath, project, location, poolName) + _, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ + Config: config, + Method: "GET", + Project: project, + RawURL: url, + UserAgent: config.UserAgent, + }) + if err != nil { + log.Printf("[DEBUG] CA pool %q not found, bootstrapping", poolName) + poolObj := map[string]interface{}{ + "tier": "ENTERPRISE", + } + createUrl := fmt.Sprintf("%sprojects/%s/locations/%s/caPools?caPoolId=%s", config.PrivatecaBasePath, project, location, poolName) + res, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ + Config: config, + Method: "POST", + Project: project, + RawURL: createUrl, + UserAgent: config.UserAgent, + Body: poolObj, + Timeout: 4 * time.Minute, + }) + if err != nil { + t.Fatalf("Error bootstrapping shared CA pool %q: %s", poolName, err) + } + + log.Printf("[DEBUG] Waiting for CA pool creation to finish") + var opRes map[string]interface{} + err = privateca.PrivatecaOperationWaitTimeWithResponse( + config, res, &opRes, project, "Creating CA pool", config.UserAgent, + 4*time.Minute) + if err != nil { + t.Errorf("Error getting shared CA pool %q: %s", poolName, err) + } + _, err = transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ + Config: config, + Method: "GET", + Project: project, + RawURL: url, + UserAgent: config.UserAgent, + }) + if err != nil { + t.Errorf("Error getting shared CA pool %q: %s", poolName, err) + } + } + return poolName +} + +func BootstrapSubnet(t *testing.T, subnetName string, networkName string) string { + projectID := envvar.GetTestProjectFromEnv() + region := envvar.GetTestRegionFromEnv() + + config := BootstrapConfig(t) + if config == nil { + t.Fatal("Could not bootstrap config.") + } + + computeService := config.NewComputeClient(config.UserAgent) + if computeService == nil { + t.Fatal("Could not create compute client.") + } + + // In order to create a networkAttachment we need to bootstrap a subnet. + _, err := computeService.Subnetworks.Get(projectID, region, subnetName).Do() + if err != nil && transport_tpg.IsGoogleApiErrorWithCode(err, 404) { + log.Printf("[DEBUG] Subnet %q not found, bootstrapping", subnetName) + + networkUrl := fmt.Sprintf("%sprojects/%s/global/networks/%s", config.ComputeBasePath, projectID, networkName) + url := fmt.Sprintf("%sprojects/%s/regions/%s/subnetworks", config.ComputeBasePath, projectID, region) + + subnetObj := map[string]interface{}{ + "name": subnetName, + "region ": region, + "network": networkUrl, + "ipCidrRange": "10.77.1.0/28", + } + + res, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ + Config: config, + Method: "POST", + Project: projectID, + RawURL: url, + UserAgent: config.UserAgent, + Body: subnetObj, + Timeout: 4 * time.Minute, + }) + + log.Printf("Response is, %s", res) + if err != nil { + t.Fatalf("Error bootstrapping test subnet %s: %s", subnetName, err) + } + + log.Printf("[DEBUG] Waiting for network creation to finish") + err = tpgcompute.ComputeOperationWaitTime(config, res, projectID, "Error bootstrapping test subnet", config.UserAgent, 4*time.Minute) + if err != nil { + t.Fatalf("Error bootstrapping test subnet %s: %s", subnetName, err) + } + } + + subnet, err := computeService.Subnetworks.Get(projectID, region, subnetName).Do() + + if subnet == nil { + t.Fatalf("Error getting test subnet %s: is nil", subnetName) + } + + if err != nil { + t.Fatalf("Error getting test subnet %s: %s", subnetName, err) + } + return subnet.Name +} + +func BootstrapNetworkAttachment(t *testing.T, networkAttachmentName string, subnetName string) string { + projectID := envvar.GetTestProjectFromEnv() + region := envvar.GetTestRegionFromEnv() + + config := BootstrapConfig(t) + if config == nil { + return "" + } + + computeService := config.NewComputeClient(config.UserAgent) + if computeService == nil { + return "" + } + + networkAttachment, err := computeService.NetworkAttachments.Get(projectID, region, networkAttachmentName).Do() + if err != nil && transport_tpg.IsGoogleApiErrorWithCode(err, 404) { + // Create Network Attachment Here. + log.Printf("[DEBUG] Network Attachment %s not found, bootstrapping", networkAttachmentName) + url := fmt.Sprintf("%sprojects/%s/regions/%s/networkAttachments", config.ComputeBasePath, projectID, region) + + subnetURL := fmt.Sprintf("%sprojects/%s/regions/%s/subnetworks/%s", config.ComputeBasePath, projectID, region, subnetName) + networkAttachmentObj := map[string]interface{}{ + "name": networkAttachmentName, + "region": region, + "subnetworks": []string{subnetURL}, + "connectionPreference": "ACCEPT_AUTOMATIC", + } + + res, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ + Config: config, + Method: "POST", + Project: projectID, + RawURL: url, + UserAgent: config.UserAgent, + Body: networkAttachmentObj, + Timeout: 4 * time.Minute, + }) + if err != nil { + t.Fatalf("Error bootstrapping test Network Attachment %s: %s", networkAttachmentName, err) + } + + log.Printf("[DEBUG] Waiting for network creation to finish") + err = tpgcompute.ComputeOperationWaitTime(config, res, projectID, "Error bootstrapping shared test subnet", config.UserAgent, 4*time.Minute) + if err != nil { + t.Fatalf("Error bootstrapping test Network Attachment %s: %s", networkAttachmentName, err) + } + } + + networkAttachment, err = computeService.NetworkAttachments.Get(projectID, region, networkAttachmentName).Do() + + if networkAttachment == nil { + t.Fatalf("Error getting test network attachment %s: is nil", networkAttachmentName) + } + + if err != nil { + t.Fatalf("Error getting test Network Attachment %s: %s", networkAttachmentName, err) + } + + return networkAttachment.Name +} + +func SetupProjectsAndGetAccessToken(org, billing, pid, service string, config *transport_tpg.Config) (string, error) { + // Create project-1 and project-2 + rmService := config.NewResourceManagerClient(config.UserAgent) + + project := &cloudresourcemanager.Project{ + ProjectId: pid, + Name: pid, + Parent: &cloudresourcemanager.ResourceId{ + Id: org, + Type: "organization", + }, + } + + var op *cloudresourcemanager.Operation + err := transport_tpg.Retry(transport_tpg.RetryOptions{ + RetryFunc: func() (reqErr error) { + op, reqErr = rmService.Projects.Create(project).Do() + return reqErr + }, + Timeout: 5 * time.Minute, + }) + if err != nil { + return "", err + } + + // Wait for the operation to complete + opAsMap, err := tpgresource.ConvertToMap(op) + if err != nil { + return "", err + } + + waitErr := resourcemanager.ResourceManagerOperationWaitTime(config, opAsMap, "creating project", config.UserAgent, 5*time.Minute) + if waitErr != nil { + return "", waitErr + } + + ba := &cloudbilling.ProjectBillingInfo{ + BillingAccountName: fmt.Sprintf("billingAccounts/%s", billing), + } + _, err = config.NewBillingClient(config.UserAgent).Projects.UpdateBillingInfo(resourcemanager.PrefixedProject(pid), ba).Do() + if err != nil { + return "", err + } + + p2 := fmt.Sprintf("%s-2", pid) + project.ProjectId = p2 + project.Name = fmt.Sprintf("%s-2", pid) + + err = transport_tpg.Retry(transport_tpg.RetryOptions{ + RetryFunc: func() (reqErr error) { + op, reqErr = rmService.Projects.Create(project).Do() + return reqErr + }, + Timeout: 5 * time.Minute, + }) + if err != nil { + return "", err + } + + // Wait for the operation to complete + opAsMap, err = tpgresource.ConvertToMap(op) + if err != nil { + return "", err + } + + waitErr = resourcemanager.ResourceManagerOperationWaitTime(config, opAsMap, "creating project", config.UserAgent, 5*time.Minute) + if waitErr != nil { + return "", waitErr + } + + _, err = config.NewBillingClient(config.UserAgent).Projects.UpdateBillingInfo(resourcemanager.PrefixedProject(p2), ba).Do() + if err != nil { + return "", err + } + + // Enable the appropriate service in project-2 only + suService := config.NewServiceUsageClient(config.UserAgent) + + serviceReq := &serviceusage.BatchEnableServicesRequest{ + ServiceIds: []string{fmt.Sprintf("%s.googleapis.com", service)}, + } + + _, err = suService.Services.BatchEnable(fmt.Sprintf("projects/%s", p2), serviceReq).Do() + if err != nil { + return "", err + } + + // Enable the test runner to create service accounts and get an access token on behalf of + // the project 1 service account + curEmail, err := transport_tpg.GetCurrentUserEmail(config, config.UserAgent) + if err != nil { + return "", err + } + + proj1SATokenCreator := &cloudresourcemanager.Binding{ + Members: []string{fmt.Sprintf("serviceAccount:%s", curEmail)}, + Role: "roles/iam.serviceAccountTokenCreator", + } + + proj1SACreator := &cloudresourcemanager.Binding{ + Members: []string{fmt.Sprintf("serviceAccount:%s", curEmail)}, + Role: "roles/iam.serviceAccountCreator", + } + + bindings := tpgiamresource.MergeBindings([]*cloudresourcemanager.Binding{proj1SATokenCreator, proj1SACreator}) + + p, err := rmService.Projects.GetIamPolicy(pid, + &cloudresourcemanager.GetIamPolicyRequest{ + Options: &cloudresourcemanager.GetPolicyOptions{ + RequestedPolicyVersion: tpgiamresource.IamPolicyVersion, + }, + }).Do() + if err != nil { + return "", err + } + + p.Bindings = tpgiamresource.MergeBindings(append(p.Bindings, bindings...)) + _, err = config.NewResourceManagerClient(config.UserAgent).Projects.SetIamPolicy(pid, + &cloudresourcemanager.SetIamPolicyRequest{ + Policy: p, + UpdateMask: "bindings,etag,auditConfigs", + }).Do() + if err != nil { + return "", err + } + + // Create a service account for project-1 + sa1, err := getOrCreateServiceAccount(config, pid) + if err != nil { + return "", err + } + + // Add permissions to service accounts + + // Permission needed for user_project_override + proj2ServiceUsageBinding := &cloudresourcemanager.Binding{ + Members: []string{fmt.Sprintf("serviceAccount:%s", sa1.Email)}, + Role: "roles/serviceusage.serviceUsageConsumer", + } + + // Admin permission for service + proj2ServiceAdminBinding := &cloudresourcemanager.Binding{ + Members: []string{fmt.Sprintf("serviceAccount:%s", sa1.Email)}, + Role: fmt.Sprintf("roles/%s.admin", service), + } + + bindings = tpgiamresource.MergeBindings([]*cloudresourcemanager.Binding{proj2ServiceUsageBinding, proj2ServiceAdminBinding}) + + // For KMS test only + if service == "cloudkms" { + proj2CryptoKeyBinding := &cloudresourcemanager.Binding{ + Members: []string{fmt.Sprintf("serviceAccount:%s", sa1.Email)}, + Role: "roles/cloudkms.cryptoKeyEncrypter", + } + + bindings = tpgiamresource.MergeBindings(append(bindings, proj2CryptoKeyBinding)) + } + + p, err = rmService.Projects.GetIamPolicy(p2, + &cloudresourcemanager.GetIamPolicyRequest{ + Options: &cloudresourcemanager.GetPolicyOptions{ + RequestedPolicyVersion: tpgiamresource.IamPolicyVersion, + }, + }).Do() + if err != nil { + return "", err + } + + p.Bindings = tpgiamresource.MergeBindings(append(p.Bindings, bindings...)) + _, err = config.NewResourceManagerClient(config.UserAgent).Projects.SetIamPolicy(p2, + &cloudresourcemanager.SetIamPolicyRequest{ + Policy: p, + UpdateMask: "bindings,etag,auditConfigs", + }).Do() + if err != nil { + return "", err + } + + // The token creator IAM API call returns success long before the policy is + // actually usable. Wait a solid 2 minutes to ensure we can use it. + time.Sleep(2 * time.Minute) + + iamCredsService := config.NewIamCredentialsClient(config.UserAgent) + tokenRequest := &iamcredentials.GenerateAccessTokenRequest{ + Lifetime: "300s", + Scope: []string{"https://www.googleapis.com/auth/cloud-platform"}, + } + atResp, err := iamCredsService.Projects.ServiceAccounts.GenerateAccessToken(fmt.Sprintf("projects/-/serviceAccounts/%s", sa1.Email), tokenRequest).Do() + if err != nil { + return "", err + } + + accessToken := atResp.AccessToken + + return accessToken, nil +} diff --git a/mmv1/third_party/terraform/tests/data_source_certificate_authority_test.go b/mmv1/third_party/terraform/tests/data_source_certificate_authority_test.go index c4692c3a3c52..9bcac979412c 100644 --- a/mmv1/third_party/terraform/tests/data_source_certificate_authority_test.go +++ b/mmv1/third_party/terraform/tests/data_source_certificate_authority_test.go @@ -11,7 +11,7 @@ func TestAccDataSourcePrivatecaCertificateAuthority_privatecaCertificateAuthorit t.Parallel() context := map[string]interface{}{ - "pool_name": BootstrapSharedCaPoolInLocation(t, "us-central1"), + "pool_name": acctest.BootstrapSharedCaPoolInLocation(t, "us-central1"), "pool_location": "us-central1", "random_suffix": RandString(t, 10), } diff --git a/mmv1/third_party/terraform/tests/data_source_google_kms_crypto_key_test.go b/mmv1/third_party/terraform/tests/data_source_google_kms_crypto_key_test.go index c69de556ddd4..871678eb7d99 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_kms_crypto_key_test.go +++ b/mmv1/third_party/terraform/tests/data_source_google_kms_crypto_key_test.go @@ -11,7 +11,7 @@ import ( ) func TestAccDataSourceGoogleKmsCryptoKey_basic(t *testing.T) { - kms := BootstrapKMSKey(t) + kms := acctest.BootstrapKMSKey(t) // Name in the KMS client is in the format projects//locations//keyRings//cryptoKeys/ keyParts := strings.Split(kms.CryptoKey.Name, "/") diff --git a/mmv1/third_party/terraform/tests/data_source_google_kms_crypto_key_version_test.go b/mmv1/third_party/terraform/tests/data_source_google_kms_crypto_key_version_test.go index c08794192787..ef35ba9a6c16 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_kms_crypto_key_version_test.go +++ b/mmv1/third_party/terraform/tests/data_source_google_kms_crypto_key_version_test.go @@ -9,9 +9,9 @@ import ( ) func TestAccDataSourceGoogleKmsCryptoKeyVersion_basic(t *testing.T) { - asymSignKey := BootstrapKMSKeyWithPurpose(t, "ASYMMETRIC_SIGN") - asymDecrKey := BootstrapKMSKeyWithPurpose(t, "ASYMMETRIC_DECRYPT") - symKey := BootstrapKMSKey(t) + asymSignKey := acctest.BootstrapKMSKeyWithPurpose(t, "ASYMMETRIC_SIGN") + asymDecrKey := acctest.BootstrapKMSKeyWithPurpose(t, "ASYMMETRIC_DECRYPT") + symKey := acctest.BootstrapKMSKey(t) VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, diff --git a/mmv1/third_party/terraform/tests/data_source_google_kms_key_ring_test.go b/mmv1/third_party/terraform/tests/data_source_google_kms_key_ring_test.go index 0bcac2c66c88..eb750215fdb9 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_kms_key_ring_test.go +++ b/mmv1/third_party/terraform/tests/data_source_google_kms_key_ring_test.go @@ -11,7 +11,7 @@ import ( ) func TestAccDataSourceGoogleKmsKeyRing_basic(t *testing.T) { - kms := BootstrapKMSKey(t) + kms := acctest.BootstrapKMSKey(t) keyParts := strings.Split(kms.KeyRing.Name, "/") keyRingId := keyParts[len(keyParts)-1] diff --git a/mmv1/third_party/terraform/tests/data_source_google_kms_secret_ciphertext_test.go b/mmv1/third_party/terraform/tests/data_source_google_kms_secret_ciphertext_test.go index 637c9372db53..c94ddac2d7ff 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_kms_secret_ciphertext_test.go +++ b/mmv1/third_party/terraform/tests/data_source_google_kms_secret_ciphertext_test.go @@ -12,7 +12,7 @@ import ( func TestAccDataKmsSecretCiphertext_basic(t *testing.T) { t.Parallel() - kms := BootstrapKMSKey(t) + kms := acctest.BootstrapKMSKey(t) plaintext := fmt.Sprintf("secret-%s", RandString(t, 10)) diff --git a/mmv1/third_party/terraform/tests/data_source_google_service_account_access_token_test.go b/mmv1/third_party/terraform/tests/data_source_google_service_account_access_token_test.go index e98bc9cb9ad5..d009a9cf6964 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_service_account_access_token_test.go +++ b/mmv1/third_party/terraform/tests/data_source_google_service_account_access_token_test.go @@ -34,7 +34,7 @@ func TestAccDataSourceGoogleServiceAccountAccessToken_basic(t *testing.T) { resourceName := "data.google_service_account_access_token.default" serviceAccount := envvar.GetTestServiceAccountFromEnv(t) - targetServiceAccountEmail := BootstrapServiceAccount(t, envvar.GetTestProjectFromEnv(), serviceAccount) + targetServiceAccountEmail := acctest.BootstrapServiceAccount(t, envvar.GetTestProjectFromEnv(), serviceAccount) VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, diff --git a/mmv1/third_party/terraform/tests/data_source_google_service_account_id_token_test.go b/mmv1/third_party/terraform/tests/data_source_google_service_account_id_token_test.go index 3f974ca3d3b0..e064684e9fd8 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_service_account_id_token_test.go +++ b/mmv1/third_party/terraform/tests/data_source_google_service_account_id_token_test.go @@ -73,7 +73,7 @@ func TestAccDataSourceGoogleServiceAccountIdToken_impersonation(t *testing.T) { resourceName := "data.google_service_account_id_token.default" serviceAccount := envvar.GetTestServiceAccountFromEnv(t) - targetServiceAccountEmail := BootstrapServiceAccount(t, envvar.GetTestProjectFromEnv(), serviceAccount) + targetServiceAccountEmail := acctest.BootstrapServiceAccount(t, envvar.GetTestProjectFromEnv(), serviceAccount) resource.Test(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, diff --git a/mmv1/third_party/terraform/tests/data_source_google_service_account_jwt_test.go b/mmv1/third_party/terraform/tests/data_source_google_service_account_jwt_test.go index a9ae202718c8..bfdbc21d265d 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_service_account_jwt_test.go +++ b/mmv1/third_party/terraform/tests/data_source_google_service_account_jwt_test.go @@ -100,7 +100,7 @@ func TestAccDataSourceGoogleServiceAccountJwt(t *testing.T) { resourceName := "data.google_service_account_jwt.default" serviceAccount := envvar.GetTestServiceAccountFromEnv(t) - targetServiceAccountEmail := BootstrapServiceAccount(t, envvar.GetTestProjectFromEnv(), serviceAccount) + targetServiceAccountEmail := acctest.BootstrapServiceAccount(t, envvar.GetTestProjectFromEnv(), serviceAccount) staticTime := time.Now() diff --git a/mmv1/third_party/terraform/tests/data_source_sql_backup_run_test.go b/mmv1/third_party/terraform/tests/data_source_sql_backup_run_test.go index dcb75730168e..1bb79c20e5ab 100644 --- a/mmv1/third_party/terraform/tests/data_source_sql_backup_run_test.go +++ b/mmv1/third_party/terraform/tests/data_source_sql_backup_run_test.go @@ -15,7 +15,7 @@ func TestAccDataSourceSqlBackupRun_basic(t *testing.T) { acctest.SkipIfVcr(t) t.Parallel() - instance := BootstrapSharedSQLInstanceBackupRun(t) + instance := acctest.BootstrapSharedSQLInstanceBackupRun(t) VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, diff --git a/mmv1/third_party/terraform/tests/resource_access_context_manager_service_perimeter_egress_policy_test.go b/mmv1/third_party/terraform/tests/resource_access_context_manager_service_perimeter_egress_policy_test.go index 56e409958570..be42275dbafb 100644 --- a/mmv1/third_party/terraform/tests/resource_access_context_manager_service_perimeter_egress_policy_test.go +++ b/mmv1/third_party/terraform/tests/resource_access_context_manager_service_perimeter_egress_policy_test.go @@ -19,7 +19,7 @@ func testAccAccessContextManagerServicePerimeterEgressPolicy_basicTest(t *testin // Multiple fine-grained resources acctest.SkipIfVcr(t) org := envvar.GetTestOrgFromEnv(t) - //projects := BootstrapServicePerimeterProjects(t, 1) + //projects := acctest.BootstrapServicePerimeterProjects(t, 1) policyTitle := RandString(t, 10) perimeterTitle := "perimeter" diff --git a/mmv1/third_party/terraform/tests/resource_access_context_manager_service_perimeter_ingress_policy_test.go b/mmv1/third_party/terraform/tests/resource_access_context_manager_service_perimeter_ingress_policy_test.go index 51fcad6f051a..bb468ed0e11c 100644 --- a/mmv1/third_party/terraform/tests/resource_access_context_manager_service_perimeter_ingress_policy_test.go +++ b/mmv1/third_party/terraform/tests/resource_access_context_manager_service_perimeter_ingress_policy_test.go @@ -19,7 +19,7 @@ func testAccAccessContextManagerServicePerimeterIngressPolicy_basicTest(t *testi // Multiple fine-grained resources acctest.SkipIfVcr(t) org := envvar.GetTestOrgFromEnv(t) - //projects := BootstrapServicePerimeterProjects(t, 1) + //projects := acctest.BootstrapServicePerimeterProjects(t, 1) policyTitle := RandString(t, 10) perimeterTitle := "perimeter" diff --git a/mmv1/third_party/terraform/tests/resource_access_context_manager_service_perimeter_resource_test.go b/mmv1/third_party/terraform/tests/resource_access_context_manager_service_perimeter_resource_test.go index d9c99571586e..98b981c6674e 100644 --- a/mmv1/third_party/terraform/tests/resource_access_context_manager_service_perimeter_resource_test.go +++ b/mmv1/third_party/terraform/tests/resource_access_context_manager_service_perimeter_resource_test.go @@ -19,7 +19,7 @@ func testAccAccessContextManagerServicePerimeterResource_basicTest(t *testing.T) // Multiple fine-grained resources acctest.SkipIfVcr(t) org := envvar.GetTestOrgFromEnv(t) - projects := BootstrapServicePerimeterProjects(t, 2) + projects := acctest.BootstrapServicePerimeterProjects(t, 2) policyTitle := "my policy" perimeterTitle := "perimeter" diff --git a/mmv1/third_party/terraform/tests/resource_alloydb_backup_test.go b/mmv1/third_party/terraform/tests/resource_alloydb_backup_test.go index 6c22ffa39d93..1a5df7757286 100644 --- a/mmv1/third_party/terraform/tests/resource_alloydb_backup_test.go +++ b/mmv1/third_party/terraform/tests/resource_alloydb_backup_test.go @@ -11,7 +11,7 @@ func TestAccAlloydbBackup_update(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "network_name": BootstrapSharedTestNetwork(t, "alloydb-update"), + "network_name": acctest.BootstrapSharedTestNetwork(t, "alloydb-update"), "random_suffix": RandString(t, 10), } @@ -171,7 +171,7 @@ func TestAccAlloydbBackup_usingCMEK(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "network_name": BootstrapSharedTestNetwork(t, "alloydb-cmek"), + "network_name": acctest.BootstrapSharedTestNetwork(t, "alloydb-cmek"), "random_suffix": RandString(t, 10), "key_name": "tf-test-key-" + RandString(t, 10), } diff --git a/mmv1/third_party/terraform/tests/resource_big_query_dataset_test.go b/mmv1/third_party/terraform/tests/resource_big_query_dataset_test.go index acdb86a25690..ac4e75bc2109 100644 --- a/mmv1/third_party/terraform/tests/resource_big_query_dataset_test.go +++ b/mmv1/third_party/terraform/tests/resource_big_query_dataset_test.go @@ -147,7 +147,7 @@ func TestAccBigQueryDataset_regionalLocation(t *testing.T) { func TestAccBigQueryDataset_cmek(t *testing.T) { t.Parallel() - kms := BootstrapKMSKeyInLocation(t, "us") + kms := acctest.BootstrapKMSKeyInLocation(t, "us") pid := envvar.GetTestProjectFromEnv() datasetID1 := fmt.Sprintf("tf_test_%s", RandString(t, 10)) diff --git a/mmv1/third_party/terraform/tests/resource_bigquery_table_test.go b/mmv1/third_party/terraform/tests/resource_bigquery_table_test.go index 58d445bbe6b7..caa0c2497a8e 100644 --- a/mmv1/third_party/terraform/tests/resource_bigquery_table_test.go +++ b/mmv1/third_party/terraform/tests/resource_bigquery_table_test.go @@ -50,7 +50,7 @@ func TestAccBigQueryTable_Kms(t *testing.T) { resourceName := "google_bigquery_table.test" datasetID := fmt.Sprintf("tf_test_%s", RandString(t, 10)) tableID := fmt.Sprintf("tf_test_%s", RandString(t, 10)) - kms := BootstrapKMSKey(t) + kms := acctest.BootstrapKMSKey(t) cryptoKeyName := kms.CryptoKey.Name VcrTest(t, resource.TestCase{ diff --git a/mmv1/third_party/terraform/tests/resource_bigtable_instance_test.go b/mmv1/third_party/terraform/tests/resource_bigtable_instance_test.go index 375b26aaa9c9..e12b870e3a8a 100644 --- a/mmv1/third_party/terraform/tests/resource_bigtable_instance_test.go +++ b/mmv1/third_party/terraform/tests/resource_bigtable_instance_test.go @@ -177,8 +177,8 @@ func TestAccBigtableInstance_kms(t *testing.T) { acctest.SkipIfVcr(t) t.Parallel() - kms1 := BootstrapKMSKeyInLocation(t, "us-central1") - kms2 := BootstrapKMSKeyInLocation(t, "us-east1") + kms1 := acctest.BootstrapKMSKeyInLocation(t, "us-central1") + kms2 := acctest.BootstrapKMSKeyInLocation(t, "us-east1") pid := envvar.GetTestProjectFromEnv() instanceName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) diff --git a/mmv1/third_party/terraform/tests/resource_binary_authorization_attestor_test.go.erb b/mmv1/third_party/terraform/tests/resource_binary_authorization_attestor_test.go.erb index 2a3c49bf07a5..1aab40db6977 100644 --- a/mmv1/third_party/terraform/tests/resource_binary_authorization_attestor_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_binary_authorization_attestor_test.go.erb @@ -98,7 +98,7 @@ func TestAccBinaryAuthorizationAttestor_full(t *testing.T) { func TestAccBinaryAuthorizationAttestor_kms(t *testing.T) { t.Parallel() - kms := BootstrapKMSKeyWithPurpose(t, "ASYMMETRIC_SIGN") + kms := acctest.BootstrapKMSKeyWithPurpose(t, "ASYMMETRIC_SIGN") attestorName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) VcrTest(t, resource.TestCase{ diff --git a/mmv1/third_party/terraform/tests/resource_cloud_identity_group_membership_test.go.erb b/mmv1/third_party/terraform/tests/resource_cloud_identity_group_membership_test.go.erb index 81732e9d3811..bb7b94fe6f47 100644 --- a/mmv1/third_party/terraform/tests/resource_cloud_identity_group_membership_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_cloud_identity_group_membership_test.go.erb @@ -193,7 +193,7 @@ func testAccCloudIdentityGroupMembership_membershipDoesNotExistTest(t *testing.T saId := "tf-test-sa-" + RandString(t, 10) project := envvar.GetTestProjectFromEnv() - config := BootstrapConfig(t) + config := acctest.BootstrapConfig(t) r := &iam.CreateServiceAccountRequest{ AccountId: saId, diff --git a/mmv1/third_party/terraform/tests/resource_cloudfunction2_function_test.go b/mmv1/third_party/terraform/tests/resource_cloudfunction2_function_test.go index ec5d7fa310b4..041b5a977c25 100644 --- a/mmv1/third_party/terraform/tests/resource_cloudfunction2_function_test.go +++ b/mmv1/third_party/terraform/tests/resource_cloudfunction2_function_test.go @@ -183,7 +183,7 @@ func TestAccCloudFunctions2Function_fullUpdate(t *testing.T) { "random_suffix": RandString(t, 10), } - if BootstrapPSARole(t, "service-", "gcp-sa-pubsub", "roles/cloudkms.cryptoKeyEncrypterDecrypter") { + if acctest.BootstrapPSARole(t, "service-", "gcp-sa-pubsub", "roles/cloudkms.cryptoKeyEncrypterDecrypter") { t.Fatal("Stopping the test because a binding was added.") } diff --git a/mmv1/third_party/terraform/tests/resource_cloudfunctions_function_test.go.erb b/mmv1/third_party/terraform/tests/resource_cloudfunctions_function_test.go.erb index f1e78e3d4846..33ab66f3a54c 100644 --- a/mmv1/third_party/terraform/tests/resource_cloudfunctions_function_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_cloudfunctions_function_test.go.erb @@ -300,7 +300,7 @@ func TestAccCloudFunctionsFunction_dockerRepository(t *testing.T) { <% unless version == "ga" -%> func TestAccCloudFunctionsFunction_cmek(t *testing.T) { t.Parallel() - kmsKey := BootstrapKMSKeyInLocation(t, "us-central1") + kmsKey := acctest.BootstrapKMSKeyInLocation(t, "us-central1") funcResourceName := "google_cloudfunctions_function.function" arRepoName := fmt.Sprintf("tf-cmek-test-docker-repository-%s", RandString(t, 10)) functionName := fmt.Sprintf("tf-cmek-test-%s", RandString(t, 10)) diff --git a/mmv1/third_party/terraform/tests/resource_composer_environment_test.go.erb b/mmv1/third_party/terraform/tests/resource_composer_environment_test.go.erb index 5c5d026f34a9..9bcb553b283e 100644 --- a/mmv1/third_party/terraform/tests/resource_composer_environment_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_composer_environment_test.go.erb @@ -317,7 +317,7 @@ func TestAccComposerEnvironment_withWebServerConfig(t *testing.T) { func TestAccComposerEnvironment_withEncryptionConfigComposer1(t *testing.T) { t.Parallel() - kms := BootstrapKMSKeyInLocation(t, "us-central1") + kms := acctest.BootstrapKMSKeyInLocation(t, "us-central1") pid := envvar.GetTestProjectFromEnv() grantServiceAgentsRole(t, "service-", allComposerServiceAgents(), "roles/cloudkms.cryptoKeyEncrypterDecrypter") envName := fmt.Sprintf("%s-%d", testComposerEnvironmentPrefix, RandInt(t)) @@ -353,7 +353,7 @@ func TestAccComposerEnvironment_withEncryptionConfigComposer1(t *testing.T) { func TestAccComposerEnvironment_withEncryptionConfigComposer2(t *testing.T) { t.Parallel() - kms := BootstrapKMSKeyInLocation(t, "us-central1") + kms := acctest.BootstrapKMSKeyInLocation(t, "us-central1") pid := envvar.GetTestProjectFromEnv() grantServiceAgentsRole(t, "service-", allComposerServiceAgents(), "roles/cloudkms.cryptoKeyEncrypterDecrypter") envName := fmt.Sprintf("%s-%d", testComposerEnvironmentPrefix, RandInt(t)) @@ -1010,7 +1010,7 @@ func TestAccComposerEnvironment_fixPyPiPackages(t *testing.T) { // This bootstraps the IAM roles needed for the service agents. func grantServiceAgentsRole(t *testing.T, prefix string, agentNames []string, role string) { - if BootstrapAllPSARole(t, prefix, agentNames, role) { + if acctest.BootstrapAllPSARole(t, prefix, agentNames, role) { // Fail this test run because the policy needs time to reconcile. t.Fatal("Stopping test because permissions were added.") } diff --git a/mmv1/third_party/terraform/tests/resource_compute_disk_test.go.erb b/mmv1/third_party/terraform/tests/resource_compute_disk_test.go.erb index 34b27abed81f..dc2a99ea4256 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_disk_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_compute_disk_test.go.erb @@ -519,13 +519,13 @@ func TestAccComputeDisk_encryption(t *testing.T) { func TestAccComputeDisk_encryptionKMS(t *testing.T) { t.Parallel() - kms := BootstrapKMSKey(t) + kms := acctest.BootstrapKMSKey(t) pid := envvar.GetTestProjectFromEnv() diskName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) importID := fmt.Sprintf("%s/%s/%s", pid, "us-central1-a", diskName) var disk compute.Disk - if BootstrapPSARole(t, "service-", "compute-system", "roles/cloudkms.cryptoKeyEncrypterDecrypter") { + if acctest.BootstrapPSARole(t, "service-", "compute-system", "roles/cloudkms.cryptoKeyEncrypterDecrypter") { t.Fatal("Stopping the test because a role was added to the policy.") } diff --git a/mmv1/third_party/terraform/tests/resource_compute_image_test.go.erb b/mmv1/third_party/terraform/tests/resource_compute_image_test.go.erb index ae1c60785da2..a6bfb18ff0a1 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_image_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_compute_image_test.go.erb @@ -223,7 +223,7 @@ func TestAccComputeImage_resolveImage(t *testing.T) { func TestAccComputeImage_imageEncryptionKey(t *testing.T) { t.Parallel() - kmsKey := BootstrapKMSKeyInLocation(t, "us-central1") + kmsKey := acctest.BootstrapKMSKeyInLocation(t, "us-central1") kmsKeyName := tpgresource.GetResourceNameFromSelfLink(kmsKey.CryptoKey.Name) kmsRingName := tpgresource.GetResourceNameFromSelfLink(kmsKey.KeyRing.Name) diff --git a/mmv1/third_party/terraform/tests/resource_compute_instance_template_test.go.erb b/mmv1/third_party/terraform/tests/resource_compute_instance_template_test.go.erb index d16738a0305f..714dd04b6b84 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_instance_template_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_compute_instance_template_test.go.erb @@ -574,7 +574,7 @@ func TestAccComputeInstanceTemplate_EncryptKMS(t *testing.T) { t.Parallel() var instanceTemplate compute.InstanceTemplate - kms := BootstrapKMSKey(t) + kms := acctest.BootstrapKMSKey(t) VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, @@ -1075,7 +1075,7 @@ func TestAccComputeInstanceTemplate_sourceSnapshotEncryptionKey(t *testing.T) { t.Parallel() var instanceTemplate compute.InstanceTemplate - kmsKey := BootstrapKMSKeyInLocation(t, "us-central1") + kmsKey := acctest.BootstrapKMSKeyInLocation(t, "us-central1") context := map[string]interface{}{ "kms_ring_name": tpgresource.GetResourceNameFromSelfLink(kmsKey.KeyRing.Name), @@ -1110,7 +1110,7 @@ func TestAccComputeInstanceTemplate_sourceImageEncryptionKey(t *testing.T) { t.Parallel() var instanceTemplate compute.InstanceTemplate - kmsKey := BootstrapKMSKeyInLocation(t, "us-central1") + kmsKey := acctest.BootstrapKMSKeyInLocation(t, "us-central1") context := map[string]interface{}{ "kms_ring_name": tpgresource.GetResourceNameFromSelfLink(kmsKey.KeyRing.Name), @@ -1146,9 +1146,9 @@ func TestAccComputeInstanceTemplate_NetworkAttachment(t *testing.T) { var instanceTemplate compute.InstanceTemplate - testNetworkName := BootstrapSharedTestNetwork(t, "attachment-network") - subnetName := BootstrapSubnet(t, "tf-test-subnet", testNetworkName) - networkAttachmentName := BootstrapNetworkAttachment(t, "tf-test-attachment", subnetName) + testNetworkName := acctest.BootstrapSharedTestNetwork(t, "attachment-network") + subnetName := acctest.BootstrapSubnet(t, "tf-test-subnet", testNetworkName) + networkAttachmentName := acctest.BootstrapNetworkAttachment(t, "tf-test-attachment", subnetName) // Need to have the full network attachment name in the format project/{project_id}/regions/{region_id}/networkAttachments/{networkAttachmentName} fullFormNetworkAttachmentName := fmt.Sprintf("projects/%s/regions/%s/networkAttachments/%s", envvar.GetTestProjectFromEnv(), envvar.GetTestRegionFromEnv(), networkAttachmentName) diff --git a/mmv1/third_party/terraform/tests/resource_compute_instance_test.go.erb b/mmv1/third_party/terraform/tests/resource_compute_instance_test.go.erb index ad75a166452d..9d8154fb40cf 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_instance_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_compute_instance_test.go.erb @@ -399,7 +399,7 @@ func TestAccComputeInstance_kmsDiskEncryption(t *testing.T) { var instance compute.Instance var instanceName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) - kms := BootstrapKMSKey(t) + kms := acctest.BootstrapKMSKey(t) bootKmsKeyName := kms.CryptoKey.Name diskNameToEncryptionKey := map[string]*compute.CustomerEncryptionKey{ @@ -414,7 +414,7 @@ func TestAccComputeInstance_kmsDiskEncryption(t *testing.T) { }, } - if BootstrapPSARole(t, "service-", "compute-system", "roles/cloudkms.cryptoKeyEncrypterDecrypter") { + if acctest.BootstrapPSARole(t, "service-", "compute-system", "roles/cloudkms.cryptoKeyEncrypterDecrypter") { t.Fatal("Stopping the test because a role was added to the policy.") } diff --git a/mmv1/third_party/terraform/tests/resource_compute_region_instance_template_test.go.erb b/mmv1/third_party/terraform/tests/resource_compute_region_instance_template_test.go.erb index 3468c237c8b7..f58a5ed7d000 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_region_instance_template_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_compute_region_instance_template_test.go.erb @@ -1027,7 +1027,7 @@ func TestAccComputeRegionInstanceTemplate_sourceSnapshotEncryptionKey(t *testing t.Parallel() var instanceTemplate compute.InstanceTemplate - kmsKey := BootstrapKMSKeyInLocation(t, "us-central1") + kmsKey := acctest.BootstrapKMSKeyInLocation(t, "us-central1") context := map[string]interface{}{ "kms_ring_name": tpgresource.GetResourceNameFromSelfLink(kmsKey.KeyRing.Name), @@ -1062,7 +1062,7 @@ func TestAccComputeRegionInstanceTemplate_sourceImageEncryptionKey(t *testing.T) t.Parallel() var instanceTemplate compute.InstanceTemplate - kmsKey := BootstrapKMSKeyInLocation(t, "us-central1") + kmsKey := acctest.BootstrapKMSKeyInLocation(t, "us-central1") context := map[string]interface{}{ "kms_ring_name": tpgresource.GetResourceNameFromSelfLink(kmsKey.KeyRing.Name), diff --git a/mmv1/third_party/terraform/tests/resource_container_analysis_occurrence_test.go b/mmv1/third_party/terraform/tests/resource_container_analysis_occurrence_test.go index 81f0c955fda3..e9cd96318d2c 100644 --- a/mmv1/third_party/terraform/tests/resource_container_analysis_occurrence_test.go +++ b/mmv1/third_party/terraform/tests/resource_container_analysis_occurrence_test.go @@ -34,7 +34,7 @@ func getTestOccurrenceAttestationPayload(t *testing.T) string { func getSignedTestOccurrenceAttestationPayload( t *testing.T, config *transport_tpg.Config, - signingKey BootstrappedKMS, rawPayload string) string { + signingKey acctest.BootstrappedKMS, rawPayload string) string { pbytes := []byte(rawPayload) ssum := sha512.Sum512(pbytes) hashed := base64.StdEncoding.EncodeToString(ssum[:]) @@ -57,12 +57,12 @@ func TestAccContainerAnalysisOccurrence_basic(t *testing.T) { t.Parallel() randSuffix := RandString(t, 10) - config := BootstrapConfig(t) + config := acctest.BootstrapConfig(t) if config == nil { return } - signKey := BootstrapKMSKeyWithPurpose(t, "ASYMMETRIC_SIGN") + signKey := acctest.BootstrapKMSKeyWithPurpose(t, "ASYMMETRIC_SIGN") payload := getTestOccurrenceAttestationPayload(t) signed := getSignedTestOccurrenceAttestationPayload(t, config, signKey, payload) params := map[string]interface{}{ @@ -95,16 +95,16 @@ func TestAccContainerAnalysisOccurrence_multipleSignatures(t *testing.T) { t.Parallel() randSuffix := RandString(t, 10) - config := BootstrapConfig(t) + config := acctest.BootstrapConfig(t) if config == nil { return } payload := getTestOccurrenceAttestationPayload(t) - key1 := BootstrapKMSKeyWithPurposeInLocationAndName(t, "ASYMMETRIC_SIGN", "global", "tf-bootstrap-binauthz-key1") + key1 := acctest.BootstrapKMSKeyWithPurposeInLocationAndName(t, "ASYMMETRIC_SIGN", "global", "tf-bootstrap-binauthz-key1") signature1 := getSignedTestOccurrenceAttestationPayload(t, config, key1, payload) - key2 := BootstrapKMSKeyWithPurposeInLocationAndName(t, "ASYMMETRIC_SIGN", "global", "tf-bootstrap-binauthz-key2") + key2 := acctest.BootstrapKMSKeyWithPurposeInLocationAndName(t, "ASYMMETRIC_SIGN", "global", "tf-bootstrap-binauthz-key2") signature2 := getSignedTestOccurrenceAttestationPayload(t, config, key2, payload) paramsMultipleSignatures := map[string]interface{}{ diff --git a/mmv1/third_party/terraform/tests/resource_container_cluster_test.go.erb b/mmv1/third_party/terraform/tests/resource_container_cluster_test.go.erb index 610edc990cee..78a9106e7f65 100644 --- a/mmv1/third_party/terraform/tests/resource_container_cluster_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_container_cluster_test.go.erb @@ -1369,9 +1369,9 @@ func TestAccContainerCluster_withBootDiskKmsKey(t *testing.T) { t.Parallel() clusterName := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) - kms := BootstrapKMSKeyInLocation(t, "us-central1") + kms := acctest.BootstrapKMSKeyInLocation(t, "us-central1") - if BootstrapPSARole(t, "service-", "compute-system", "roles/cloudkms.cryptoKeyEncrypterDecrypter") { + if acctest.BootstrapPSARole(t, "service-", "compute-system", "roles/cloudkms.cryptoKeyEncrypterDecrypter") { t.Fatal("Stopping the test because a role was added to the policy.") } @@ -3058,9 +3058,9 @@ func TestAccContainerCluster_nodeAutoprovisioningDefaultsBootDiskKmsKey(t *testi t.Parallel() clusterName := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) - kms := BootstrapKMSKeyInLocation(t, "us-central1") + kms := acctest.BootstrapKMSKeyInLocation(t, "us-central1") - if BootstrapPSARole(t, "service-", "compute-system", "roles/cloudkms.cryptoKeyEncrypterDecrypter") { + if acctest.BootstrapPSARole(t, "service-", "compute-system", "roles/cloudkms.cryptoKeyEncrypterDecrypter") { t.Fatal("Stopping the test because a role was added to the policy.") } @@ -3308,7 +3308,7 @@ func TestAccContainerCluster_withDatabaseEncryption(t *testing.T) { // deleted. Also, we need to create the key in the same location as the // cluster as GKE does not support the "global" location for KMS keys. // See https://cloud.google.com/kubernetes-engine/docs/how-to/encrypting-secrets#creating_a_key - kmsData := BootstrapKMSKeyInLocation(t, "us-central1") + kmsData := acctest.BootstrapKMSKeyInLocation(t, "us-central1") VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, @@ -4597,8 +4597,8 @@ func TestAccContainerCluster_failedCreation(t *testing.T) { clusterName := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) - project := BootstrapProject(t, "tf-fail-cluster-", envvar.GetTestBillingAccountFromEnv(t), []string{"container.googleapis.com"}) - RemoveContainerServiceAgentRoleFromContainerEngineRobot(t, project) + project := acctest.BootstrapProject(t, "tf-fail-cluster-", envvar.GetTestBillingAccountFromEnv(t), []string{"container.googleapis.com"}) + acctest.RemoveContainerServiceAgentRoleFromContainerEngineRobot(t, project) VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, @@ -7040,7 +7040,7 @@ func testAccContainerCluster_updateCostManagementConfig(projectID string, cluste }`, projectID, clusterName, enabled) } -func testAccContainerCluster_withDatabaseEncryption(clusterName string, kmsData BootstrappedKMS) string { +func testAccContainerCluster_withDatabaseEncryption(clusterName string, kmsData acctest.BootstrappedKMS) string { return fmt.Sprintf(` data "google_project" "project" { } diff --git a/mmv1/third_party/terraform/tests/resource_container_node_pool_test.go.erb b/mmv1/third_party/terraform/tests/resource_container_node_pool_test.go.erb index b6af82c4ddb0..a680181755ea 100644 --- a/mmv1/third_party/terraform/tests/resource_container_node_pool_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_container_node_pool_test.go.erb @@ -624,7 +624,7 @@ func TestAccContainerNodePool_withBootDiskKmsKey(t *testing.T) { cluster := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) np := fmt.Sprintf("tf-test-np-%s", RandString(t, 10)) - if BootstrapPSARole(t, "service-", "compute-system", "roles/cloudkms.cryptoKeyEncrypterDecrypter") { + if acctest.BootstrapPSARole(t, "service-", "compute-system", "roles/cloudkms.cryptoKeyEncrypterDecrypter") { t.Fatal("Stopping the test because a role was added to the policy.") } diff --git a/mmv1/third_party/terraform/tests/resource_data_loss_prevention_deidentify_template_test.go b/mmv1/third_party/terraform/tests/resource_data_loss_prevention_deidentify_template_test.go index 7e394767b5e9..956d770dbc1a 100644 --- a/mmv1/third_party/terraform/tests/resource_data_loss_prevention_deidentify_template_test.go +++ b/mmv1/third_party/terraform/tests/resource_data_loss_prevention_deidentify_template_test.go @@ -14,7 +14,7 @@ func TestAccDataLossPreventionDeidentifyTemplate_dlpDeidentifyTemplate_infoTypeT context := map[string]interface{}{ "organization": envvar.GetTestOrgFromEnv(t), "random_suffix": RandString(t, 10), - "kms_key_name": BootstrapKMSKey(t).CryptoKey.Name, // global KMS key + "kms_key_name": acctest.BootstrapKMSKey(t).CryptoKey.Name, // global KMS key } VcrTest(t, resource.TestCase{ @@ -456,7 +456,7 @@ func TestAccDataLossPreventionDeidentifyTemplate_dlpDeidentifyTemplate_recordTra context := map[string]interface{}{ "organization": envvar.GetTestOrgFromEnv(t), "random_suffix": RandString(t, 10), - "kms_key_name": BootstrapKMSKey(t).CryptoKey.Name, // global KMS key + "kms_key_name": acctest.BootstrapKMSKey(t).CryptoKey.Name, // global KMS key } VcrTest(t, resource.TestCase{ @@ -1048,7 +1048,7 @@ func TestAccDataLossPreventionDeidentifyTemplate_dlpDeidentifyTemplate_imageTran context := map[string]interface{}{ "organization": envvar.GetTestOrgFromEnv(t), "random_suffix": RandString(t, 10), - "kms_key_name": BootstrapKMSKey(t).CryptoKey.Name, // global KMS key + "kms_key_name": acctest.BootstrapKMSKey(t).CryptoKey.Name, // global KMS key } VcrTest(t, resource.TestCase{ @@ -1153,7 +1153,7 @@ func TestAccDataLossPreventionDeidentifyTemplate_dlpDeidentifyTemplate_infoTypeT context := map[string]interface{}{ "organization": envvar.GetTestOrgFromEnv(t), "random_suffix": RandString(t, 10), - "kms_key_name": BootstrapKMSKey(t).CryptoKey.Name, // global KMS key + "kms_key_name": acctest.BootstrapKMSKey(t).CryptoKey.Name, // global KMS key } VcrTest(t, resource.TestCase{ @@ -1485,7 +1485,7 @@ func TestAccDataLossPreventionDeidentifyTemplate_dlpDeidentifyTemplate_infoTypeT context := map[string]interface{}{ "organization": envvar.GetTestOrgFromEnv(t), "random_suffix": RandString(t, 10), - "kms_key_name": BootstrapKMSKey(t).CryptoKey.Name, // global KMS key + "kms_key_name": acctest.BootstrapKMSKey(t).CryptoKey.Name, // global KMS key } VcrTest(t, resource.TestCase{ @@ -1794,7 +1794,7 @@ func TestAccDataLossPreventionDeidentifyTemplate_dlpDeidentifyTemplate_infoTypeT context := map[string]interface{}{ "organization": envvar.GetTestOrgFromEnv(t), "random_suffix": RandString(t, 10), - "kms_key_name": BootstrapKMSKey(t).CryptoKey.Name, // global KMS key + "kms_key_name": acctest.BootstrapKMSKey(t).CryptoKey.Name, // global KMS key } VcrTest(t, resource.TestCase{ @@ -1892,7 +1892,7 @@ func TestAccDataLossPreventionDeidentifyTemplate_dlpDeidentifyTemplate_infoTypeT context := map[string]interface{}{ "organization": envvar.GetTestOrgFromEnv(t), "random_suffix": RandString(t, 10), - "kms_key_name": BootstrapKMSKey(t).CryptoKey.Name, // global KMS key + "kms_key_name": acctest.BootstrapKMSKey(t).CryptoKey.Name, // global KMS key } VcrTest(t, resource.TestCase{ @@ -2039,7 +2039,7 @@ func TestAccDataLossPreventionDeidentifyTemplate_dlpDeidentifyTemplate_recordTra context := map[string]interface{}{ "organization": envvar.GetTestOrgFromEnv(t), - "kms_key_name": BootstrapKMSKey(t).CryptoKey.Name, // global KMS key + "kms_key_name": acctest.BootstrapKMSKey(t).CryptoKey.Name, // global KMS key } VcrTest(t, resource.TestCase{ @@ -3330,7 +3330,7 @@ func TestAccDataLossPreventionDeidentifyTemplate_dlpDeidentifyTemplate_recordTra context := map[string]interface{}{ "organization": envvar.GetTestOrgFromEnv(t), - "kms_key_name": BootstrapKMSKey(t).CryptoKey.Name, // global KMS key + "kms_key_name": acctest.BootstrapKMSKey(t).CryptoKey.Name, // global KMS key } VcrTest(t, resource.TestCase{ @@ -4089,7 +4089,7 @@ func TestAccDataLossPreventionDeidentifyTemplate_dlpDeidentifyTemplate_recordTra context := map[string]interface{}{ "organization": envvar.GetTestOrgFromEnv(t), - "kms_key_name": BootstrapKMSKey(t).CryptoKey.Name, // global KMS key + "kms_key_name": acctest.BootstrapKMSKey(t).CryptoKey.Name, // global KMS key } VcrTest(t, resource.TestCase{ @@ -4314,7 +4314,7 @@ func TestAccDataLossPreventionDeidentifyTemplate_dlpDeidentifyTemplate_recordTra context := map[string]interface{}{ "organization": envvar.GetTestOrgFromEnv(t), - "kms_key_name": BootstrapKMSKey(t).CryptoKey.Name, // global KMS key + "kms_key_name": acctest.BootstrapKMSKey(t).CryptoKey.Name, // global KMS key } VcrTest(t, resource.TestCase{ @@ -4554,7 +4554,7 @@ func TestAccDataLossPreventionDeidentifyTemplate_dlpDeidentifyTemplate_recordTra context := map[string]interface{}{ "organization": envvar.GetTestOrgFromEnv(t), - "kms_key_name": BootstrapKMSKey(t).CryptoKey.Name, // global KMS key + "kms_key_name": acctest.BootstrapKMSKey(t).CryptoKey.Name, // global KMS key } VcrTest(t, resource.TestCase{ diff --git a/mmv1/third_party/terraform/tests/resource_dataflow_job_test.go.erb b/mmv1/third_party/terraform/tests/resource_dataflow_job_test.go.erb index c168ffdee96c..bcaff0c3e066 100644 --- a/mmv1/third_party/terraform/tests/resource_dataflow_job_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_dataflow_job_test.go.erb @@ -301,7 +301,7 @@ func TestAccDataflowJob_withKmsKey(t *testing.T) { job := "tf-test-dataflow-job-" + randStr zone := "us-central1-f" - if BootstrapPSARole(t, "service-", "compute-system", "roles/cloudkms.cryptoKeyEncrypterDecrypter") { + if acctest.BootstrapPSARole(t, "service-", "compute-system", "roles/cloudkms.cryptoKeyEncrypterDecrypter") { t.Fatal("Stopping the test because a role was added to the policy.") } diff --git a/mmv1/third_party/terraform/tests/resource_dataproc_cluster_test.go.erb b/mmv1/third_party/terraform/tests/resource_dataproc_cluster_test.go.erb index 0f2c65b7beff..a27cc5891393 100644 --- a/mmv1/third_party/terraform/tests/resource_dataproc_cluster_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_dataproc_cluster_test.go.erb @@ -750,9 +750,9 @@ func TestAccDataprocCluster_KMS(t *testing.T) { t.Parallel() rnd := RandString(t, 10) - kms := BootstrapKMSKey(t) + kms := acctest.BootstrapKMSKey(t) - if BootstrapPSARole(t, "service-", "compute-system", "roles/cloudkms.cryptoKeyEncrypterDecrypter") { + if acctest.BootstrapPSARole(t, "service-", "compute-system", "roles/cloudkms.cryptoKeyEncrypterDecrypter") { t.Fatal("Stopping the test because a role was added to the policy.") } @@ -776,7 +776,7 @@ func TestAccDataprocCluster_withKerberos(t *testing.T) { t.Parallel() rnd := RandString(t, 10) - kms := BootstrapKMSKey(t) + kms := acctest.BootstrapKMSKey(t) var cluster dataproc.Cluster VcrTest(t, resource.TestCase{ diff --git a/mmv1/third_party/terraform/tests/resource_eventarc_channel_test.go.erb b/mmv1/third_party/terraform/tests/resource_eventarc_channel_test.go.erb index d67511d25bd7..d6db6b1a945e 100644 --- a/mmv1/third_party/terraform/tests/resource_eventarc_channel_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_eventarc_channel_test.go.erb @@ -48,8 +48,8 @@ func TestAccEventarcChannel_cryptoKeyUpdate(t *testing.T) { t.Parallel() region := envvar.GetTestRegionFromEnv() - key1 := BootstrapKMSKeyWithPurposeInLocationAndName(t, "ENCRYPT_DECRYPT", region, "tf-bootstrap-eventarc-channel-key1") - key2 := BootstrapKMSKeyWithPurposeInLocationAndName(t, "ENCRYPT_DECRYPT", region, "tf-bootstrap-eventarc-channel-key2") + key1 := acctest.BootstrapKMSKeyWithPurposeInLocationAndName(t, "ENCRYPT_DECRYPT", region, "tf-bootstrap-eventarc-channel-key1") + key2 := acctest.BootstrapKMSKeyWithPurposeInLocationAndName(t, "ENCRYPT_DECRYPT", region, "tf-bootstrap-eventarc-channel-key2") context := map[string]interface{}{ "region": region, diff --git a/mmv1/third_party/terraform/tests/resource_eventarc_google_channel_config_test.go.erb b/mmv1/third_party/terraform/tests/resource_eventarc_google_channel_config_test.go.erb index 52a42eb6419e..3b498fa4b5f7 100644 --- a/mmv1/third_party/terraform/tests/resource_eventarc_google_channel_config_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_eventarc_google_channel_config_test.go.erb @@ -48,8 +48,8 @@ func TestAccEventarcGoogleChannelConfig_cryptoKeyUpdate(t *testing.T) { t.Parallel() region := envvar.GetTestRegionFromEnv() - key1 := BootstrapKMSKeyWithPurposeInLocationAndName(t, "ENCRYPT_DECRYPT", region, "tf-bootstrap-eventarc-google-channel-config-key1") - key2 := BootstrapKMSKeyWithPurposeInLocationAndName(t, "ENCRYPT_DECRYPT", region, "tf-bootstrap-eventarc-google-channel-config-key2") + key1 := acctest.BootstrapKMSKeyWithPurposeInLocationAndName(t, "ENCRYPT_DECRYPT", region, "tf-bootstrap-eventarc-google-channel-config-key1") + key2 := acctest.BootstrapKMSKeyWithPurposeInLocationAndName(t, "ENCRYPT_DECRYPT", region, "tf-bootstrap-eventarc-google-channel-config-key2") context := map[string]interface{}{ "project_name": envvar.GetTestProjectFromEnv(), diff --git a/mmv1/third_party/terraform/tests/resource_eventarc_trigger_test.go.erb b/mmv1/third_party/terraform/tests/resource_eventarc_trigger_test.go.erb index 533c3f61cd66..30ccf20c634e 100644 --- a/mmv1/third_party/terraform/tests/resource_eventarc_trigger_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_eventarc_trigger_test.go.erb @@ -23,8 +23,8 @@ func TestAccEventarcTrigger_channel(t *testing.T) { t.Parallel() region := envvar.GetTestRegionFromEnv() - key1 := BootstrapKMSKeyWithPurposeInLocationAndName(t, "ENCRYPT_DECRYPT", region, "tf-bootstrap-eventarc-trigger-key1") - key2 := BootstrapKMSKeyWithPurposeInLocationAndName(t, "ENCRYPT_DECRYPT", region, "tf-bootstrap-eventarc-trigger-key2") + key1 := acctest.BootstrapKMSKeyWithPurposeInLocationAndName(t, "ENCRYPT_DECRYPT", region, "tf-bootstrap-eventarc-trigger-key1") + key2 := acctest.BootstrapKMSKeyWithPurposeInLocationAndName(t, "ENCRYPT_DECRYPT", region, "tf-bootstrap-eventarc-trigger-key2") context := map[string]interface{}{ "region": region, diff --git a/mmv1/third_party/terraform/tests/resource_kms_secret_ciphertext_test.go b/mmv1/third_party/terraform/tests/resource_kms_secret_ciphertext_test.go index 737ae435ec01..bc6e9ea5a062 100644 --- a/mmv1/third_party/terraform/tests/resource_kms_secret_ciphertext_test.go +++ b/mmv1/third_party/terraform/tests/resource_kms_secret_ciphertext_test.go @@ -16,7 +16,7 @@ import ( func TestAccKmsSecretCiphertext_basic(t *testing.T) { t.Parallel() - kms := BootstrapKMSKey(t) + kms := acctest.BootstrapKMSKey(t) plaintext := fmt.Sprintf("secret-%s", RandString(t, 10)) aad := "plainaad" diff --git a/mmv1/third_party/terraform/tests/resource_memcache_instance_test.go b/mmv1/third_party/terraform/tests/resource_memcache_instance_test.go index 18bfbd5ce9c2..dbb111255537 100644 --- a/mmv1/third_party/terraform/tests/resource_memcache_instance_test.go +++ b/mmv1/third_party/terraform/tests/resource_memcache_instance_test.go @@ -15,7 +15,7 @@ func TestAccMemcacheInstance_update(t *testing.T) { prefix := fmt.Sprintf("%d", RandInt(t)) name := fmt.Sprintf("tf-test-%s", prefix) - network := BootstrapSharedTestNetwork(t, "memcache-update") + network := acctest.BootstrapSharedTestNetwork(t, "memcache-update") VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, diff --git a/mmv1/third_party/terraform/tests/resource_privateca_certificate_authority_test.go b/mmv1/third_party/terraform/tests/resource_privateca_certificate_authority_test.go index 7c8d6d3849dc..79cce329ec8d 100644 --- a/mmv1/third_party/terraform/tests/resource_privateca_certificate_authority_test.go +++ b/mmv1/third_party/terraform/tests/resource_privateca_certificate_authority_test.go @@ -11,7 +11,7 @@ func TestAccPrivatecaCertificateAuthority_privatecaCertificateAuthorityUpdate(t t.Parallel() context := map[string]interface{}{ - "pool_name": BootstrapSharedCaPoolInLocation(t, "us-central1"), + "pool_name": acctest.BootstrapSharedCaPoolInLocation(t, "us-central1"), "pool_location": "us-central1", "deletion_protection": false, "random_suffix": RandString(t, 10), @@ -63,7 +63,7 @@ func TestAccPrivatecaCertificateAuthority_rootCaManageDesiredState(t *testing.T) random_suffix := RandString(t, 10) context_staged := map[string]interface{}{ - "pool_name": BootstrapSharedCaPoolInLocation(t, "us-central1"), + "pool_name": acctest.BootstrapSharedCaPoolInLocation(t, "us-central1"), "pool_location": "us-central1", "deletion_protection": false, "random_suffix": random_suffix, @@ -71,7 +71,7 @@ func TestAccPrivatecaCertificateAuthority_rootCaManageDesiredState(t *testing.T) } context_enabled := map[string]interface{}{ - "pool_name": BootstrapSharedCaPoolInLocation(t, "us-central1"), + "pool_name": acctest.BootstrapSharedCaPoolInLocation(t, "us-central1"), "pool_location": "us-central1", "deletion_protection": false, "random_suffix": random_suffix, @@ -79,7 +79,7 @@ func TestAccPrivatecaCertificateAuthority_rootCaManageDesiredState(t *testing.T) } context_disabled := map[string]interface{}{ - "pool_name": BootstrapSharedCaPoolInLocation(t, "us-central1"), + "pool_name": acctest.BootstrapSharedCaPoolInLocation(t, "us-central1"), "pool_location": "us-central1", "deletion_protection": false, "random_suffix": random_suffix, diff --git a/mmv1/third_party/terraform/tests/resource_pubsub_topic_test.go b/mmv1/third_party/terraform/tests/resource_pubsub_topic_test.go index dfd65c55e84f..58e632a42cbb 100644 --- a/mmv1/third_party/terraform/tests/resource_pubsub_topic_test.go +++ b/mmv1/third_party/terraform/tests/resource_pubsub_topic_test.go @@ -43,10 +43,10 @@ func TestAccPubsubTopic_update(t *testing.T) { func TestAccPubsubTopic_cmek(t *testing.T) { t.Parallel() - kms := BootstrapKMSKey(t) + kms := acctest.BootstrapKMSKey(t) topicName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - if BootstrapPSARole(t, "service-", "gcp-sa-pubsub", "roles/cloudkms.cryptoKeyEncrypterDecrypter") { + if acctest.BootstrapPSARole(t, "service-", "gcp-sa-pubsub", "roles/cloudkms.cryptoKeyEncrypterDecrypter") { t.Fatal("Stopping the test because a role was added to the policy.") } diff --git a/mmv1/third_party/terraform/tests/resource_secret_manager_secret_test.go.erb b/mmv1/third_party/terraform/tests/resource_secret_manager_secret_test.go.erb index 8401fb0a2e92..e3093cfd896f 100644 --- a/mmv1/third_party/terraform/tests/resource_secret_manager_secret_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_secret_manager_secret_test.go.erb @@ -38,8 +38,8 @@ func TestAccSecretManagerSecret_import(t *testing.T) { func TestAccSecretManagerSecret_cmek(t *testing.T) { t.Parallel() - kmscentral := BootstrapKMSKeyInLocation(t, "us-central1") - kmseast := BootstrapKMSKeyInLocation(t, "us-east1") + kmscentral := acctest.BootstrapKMSKeyInLocation(t, "us-central1") + kmseast := acctest.BootstrapKMSKeyInLocation(t, "us-east1") context1 := map[string]interface{}{ "pid": envvar.GetTestProjectFromEnv(), "random_suffix": RandString(t, 10), diff --git a/mmv1/third_party/terraform/tests/resource_service_networking_connection_test.go b/mmv1/third_party/terraform/tests/resource_service_networking_connection_test.go index a913be293102..92f9bab6faab 100644 --- a/mmv1/third_party/terraform/tests/resource_service_networking_connection_test.go +++ b/mmv1/third_party/terraform/tests/resource_service_networking_connection_test.go @@ -13,7 +13,7 @@ import ( func TestAccServiceNetworkingConnection_create(t *testing.T) { t.Parallel() - network := BootstrapSharedTestNetwork(t, "service-networking-connection-create") + network := acctest.BootstrapSharedTestNetwork(t, "service-networking-connection-create") addr := fmt.Sprintf("tf-test-%s", RandString(t, 10)) service := "servicenetworking.googleapis.com" @@ -37,7 +37,7 @@ func TestAccServiceNetworkingConnection_create(t *testing.T) { func TestAccServiceNetworkingConnection_update(t *testing.T) { t.Parallel() - network := BootstrapSharedTestNetwork(t, "service-networking-connection-update") + network := acctest.BootstrapSharedTestNetwork(t, "service-networking-connection-update") addr1 := fmt.Sprintf("tf-test-%s", RandString(t, 10)) addr2 := fmt.Sprintf("tf-test-%s", RandString(t, 10)) service := "servicenetworking.googleapis.com" diff --git a/mmv1/third_party/terraform/tests/resource_sql_database_instance_test.go b/mmv1/third_party/terraform/tests/resource_sql_database_instance_test.go index 9674bfd8bf7a..135010977665 100644 --- a/mmv1/third_party/terraform/tests/resource_sql_database_instance_test.go +++ b/mmv1/third_party/terraform/tests/resource_sql_database_instance_test.go @@ -178,7 +178,7 @@ func TestAccSqlDatabaseInstance_deleteDefaultUserBeforeSubsequentApiCalls(t *tes databaseName := "tf-test-" + RandString(t, 10) addressName := "tf-test-" + RandString(t, 10) - networkName := BootstrapSharedTestNetwork(t, "sql-instance-private-clone-2") + networkName := acctest.BootstrapSharedTestNetwork(t, "sql-instance-private-clone-2") // 1. Create an instance. // 2. Add a root@'%' user. @@ -736,7 +736,7 @@ func TestAccSqlDatabaseInstance_withPrivateNetwork_withoutAllocatedIpRange(t *te databaseName := "tf-test-" + RandString(t, 10) addressName := "tf-test-" + RandString(t, 10) - networkName := BootstrapSharedTestNetwork(t, "sql-instance-private") + networkName := acctest.BootstrapSharedTestNetwork(t, "sql-instance-private") VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, @@ -790,9 +790,9 @@ func TestAccSqlDatabaseInstance_withPrivateNetwork_withAllocatedIpRange(t *testi databaseName := "tf-test-" + RandString(t, 10) addressName := "tf-test-" + RandString(t, 10) - networkName := BootstrapSharedTestNetwork(t, "sql-instance-private-allocated-ip-range") + networkName := acctest.BootstrapSharedTestNetwork(t, "sql-instance-private-allocated-ip-range") addressName_update := "tf-test-" + RandString(t, 10) + "update" - networkName_update := BootstrapSharedTestNetwork(t, "sql-instance-private-allocated-ip-range-update") + networkName_update := acctest.BootstrapSharedTestNetwork(t, "sql-instance-private-allocated-ip-range-update") VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, @@ -828,7 +828,7 @@ func TestAccSqlDatabaseInstance_withPrivateNetwork_withAllocatedIpRangeReplica(t databaseName := "tf-test-" + RandString(t, 10) addressName := "tf-test-" + RandString(t, 10) - networkName := BootstrapSharedTestNetwork(t, "sql-instance-private-replica") + networkName := acctest.BootstrapSharedTestNetwork(t, "sql-instance-private-replica") VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, @@ -861,7 +861,7 @@ func TestAccSqlDatabaseInstance_withPrivateNetwork_withAllocatedIpRangeClone(t * databaseName := "tf-test-" + RandString(t, 10) addressName := "tf-test-" + RandString(t, 10) - networkName := BootstrapSharedTestNetwork(t, "sql-instance-private-clone") + networkName := acctest.BootstrapSharedTestNetwork(t, "sql-instance-private-clone") VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, @@ -894,7 +894,7 @@ func TestAccSqlDatabaseInstance_createFromBackup(t *testing.T) { context := map[string]interface{}{ "random_suffix": RandString(t, 10), - "original_db_name": BootstrapSharedSQLInstanceBackupRun(t), + "original_db_name": acctest.BootstrapSharedSQLInstanceBackupRun(t), } VcrTest(t, resource.TestCase{ @@ -922,7 +922,7 @@ func TestAccSqlDatabaseInstance_backupUpdate(t *testing.T) { context := map[string]interface{}{ "random_suffix": RandString(t, 10), - "original_db_name": BootstrapSharedSQLInstanceBackupRun(t), + "original_db_name": acctest.BootstrapSharedSQLInstanceBackupRun(t), } VcrTest(t, resource.TestCase{ @@ -959,7 +959,7 @@ func TestAccSqlDatabaseInstance_basicClone(t *testing.T) { context := map[string]interface{}{ "random_suffix": RandString(t, 10), - "original_db_name": BootstrapSharedSQLInstanceBackupRun(t), + "original_db_name": acctest.BootstrapSharedSQLInstanceBackupRun(t), } VcrTest(t, resource.TestCase{ @@ -987,7 +987,7 @@ func TestAccSqlDatabaseInstance_cloneWithSettings(t *testing.T) { context := map[string]interface{}{ "random_suffix": RandString(t, 10), - "original_db_name": BootstrapSharedSQLInstanceBackupRun(t), + "original_db_name": acctest.BootstrapSharedSQLInstanceBackupRun(t), } VcrTest(t, resource.TestCase{ @@ -1015,7 +1015,7 @@ func TestAccSqlDatabaseInstance_cloneWithDatabaseNames(t *testing.T) { context := map[string]interface{}{ "random_suffix": RandString(t, 10), - "original_db_name": BootstrapSharedSQLInstanceBackupRun(t), + "original_db_name": acctest.BootstrapSharedSQLInstanceBackupRun(t), } VcrTest(t, resource.TestCase{ @@ -1261,10 +1261,10 @@ func TestAccSqlDatabaseInstance_ActiveDirectory(t *testing.T) { t.Parallel() databaseName := "tf-test-" + RandString(t, 10) - networkName := BootstrapSharedTestNetwork(t, "sql-instance-private-test-ad") + networkName := acctest.BootstrapSharedTestNetwork(t, "sql-instance-private-test-ad") addressName := "tf-test-" + RandString(t, 10) rootPassword := RandString(t, 15) - adDomainName := BootstrapSharedTestADDomain(t, "test-domain", networkName) + adDomainName := acctest.BootstrapSharedTestADDomain(t, "test-domain", networkName) VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, diff --git a/mmv1/third_party/terraform/tests/resource_storage_bucket_object_test.go b/mmv1/third_party/terraform/tests/resource_storage_bucket_object_test.go index 6a143304c98e..98bb97312fe4 100644 --- a/mmv1/third_party/terraform/tests/resource_storage_bucket_object_test.go +++ b/mmv1/third_party/terraform/tests/resource_storage_bucket_object_test.go @@ -312,7 +312,7 @@ func TestAccStorageObject_metadata(t *testing.T) { func TestAccStorageObjectKms(t *testing.T) { t.Parallel() - kms := BootstrapKMSKeyInLocation(t, "us") + kms := acctest.BootstrapKMSKeyInLocation(t, "us") bucketName := testBucketName(t) data := []byte("data data data") h := md5.New() diff --git a/mmv1/third_party/terraform/tests/resource_vertex_ai_endpoint_test.go b/mmv1/third_party/terraform/tests/resource_vertex_ai_endpoint_test.go index 801a5fddf0ed..161298c3a762 100644 --- a/mmv1/third_party/terraform/tests/resource_vertex_ai_endpoint_test.go +++ b/mmv1/third_party/terraform/tests/resource_vertex_ai_endpoint_test.go @@ -17,8 +17,8 @@ func TestAccVertexAIEndpoint_vertexAiEndpointNetwork(t *testing.T) { context := map[string]interface{}{ "endpoint_name": fmt.Sprint(RandInt(t) % 9999999999), - "kms_key_name": BootstrapKMSKeyInLocation(t, "us-central1").CryptoKey.Name, - "network_name": BootstrapSharedTestNetwork(t, "vertex-ai-endpoint-update"), + "kms_key_name": acctest.BootstrapKMSKeyInLocation(t, "us-central1").CryptoKey.Name, + "network_name": acctest.BootstrapSharedTestNetwork(t, "vertex-ai-endpoint-update"), "random_suffix": RandString(t, 10), } diff --git a/mmv1/third_party/terraform/tests/resource_vertex_ai_index_endpoint_test.go b/mmv1/third_party/terraform/tests/resource_vertex_ai_index_endpoint_test.go index e2e409e9ba68..ae850eaab65a 100644 --- a/mmv1/third_party/terraform/tests/resource_vertex_ai_index_endpoint_test.go +++ b/mmv1/third_party/terraform/tests/resource_vertex_ai_index_endpoint_test.go @@ -12,7 +12,7 @@ func TestAccVertexAIIndexEndpoint_updated(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "network_name": BootstrapSharedTestNetwork(t, "vertex-ai-index-endpoint-update"), + "network_name": acctest.BootstrapSharedTestNetwork(t, "vertex-ai-index-endpoint-update"), "random_suffix": RandString(t, 10), } diff --git a/mmv1/third_party/terraform/tests/resource_vertex_ai_metadata_store_test.go.erb b/mmv1/third_party/terraform/tests/resource_vertex_ai_metadata_store_test.go.erb index 22cf75f78c09..b35a31777424 100644 --- a/mmv1/third_party/terraform/tests/resource_vertex_ai_metadata_store_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_vertex_ai_metadata_store_test.go.erb @@ -17,7 +17,7 @@ import ( func TestAccVertexAIMetadataStore_vertexAiMetadataStoreExample(t *testing.T) { t.Parallel() - kms := BootstrapKMSKeyInLocation(t, "us-central1") + kms := acctest.BootstrapKMSKeyInLocation(t, "us-central1") name := fmt.Sprintf("tf-test-%s", RandString(t, 10)) VcrTest(t, resource.TestCase{ diff --git a/mmv1/third_party/terraform/tests/resource_workflows_workflow_test.go b/mmv1/third_party/terraform/tests/resource_workflows_workflow_test.go index 205bf95a6d5f..d45d75660e4d 100644 --- a/mmv1/third_party/terraform/tests/resource_workflows_workflow_test.go +++ b/mmv1/third_party/terraform/tests/resource_workflows_workflow_test.go @@ -157,8 +157,8 @@ func TestAccWorkflowsWorkflow_CMEK(t *testing.T) { t.Parallel() workflowName := fmt.Sprintf("tf-test-acc-workflow-%d", RandInt(t)) - kms := BootstrapKMSKeyInLocation(t, "us-central1") - if BootstrapPSARole(t, "service-", "gcp-sa-workflows", "roles/cloudkms.cryptoKeyEncrypterDecrypter") { + kms := acctest.BootstrapKMSKeyInLocation(t, "us-central1") + if acctest.BootstrapPSARole(t, "service-", "gcp-sa-workflows", "roles/cloudkms.cryptoKeyEncrypterDecrypter") { t.Fatal("Stopping the test because a role was added to the policy.") } diff --git a/mmv1/third_party/terraform/utils/bootstrap_iam_test_utils.go b/mmv1/third_party/terraform/utils/bootstrap_iam_test_utils.go index cf72dfbe2d72..adc1e79d8b5e 100644 --- a/mmv1/third_party/terraform/utils/bootstrap_iam_test_utils.go +++ b/mmv1/third_party/terraform/utils/bootstrap_iam_test_utils.go @@ -1,11 +1,9 @@ package google import ( - "fmt" - "log" "testing" - "github.com/hashicorp/terraform-provider-google/google/envvar" + "github.com/hashicorp/terraform-provider-google/google/acctest" "github.com/hashicorp/terraform-provider-google/google/tpgiamresource" cloudresourcemanager "google.golang.org/api/cloudresourcemanager/v1" ) @@ -18,79 +16,25 @@ import ( // deleting them removes permissions for concurrent tests. // Return whether the bindings changed. func BootstrapAllPSARoles(t *testing.T, prefix string, agentNames, roles []string) bool { - config := BootstrapConfig(t) - if config == nil { - t.Fatal("Could not bootstrap a config for BootstrapAllPSARoles.") - } - client := config.NewResourceManagerClient(config.UserAgent) - - // Get the project since we need its number, id, and policy. - project, err := client.Projects.Get(envvar.GetTestProjectFromEnv()).Do() - if err != nil { - t.Fatalf("Error getting project with id %q: %s", project.ProjectId, err) - } - - getPolicyRequest := &cloudresourcemanager.GetIamPolicyRequest{} - policy, err := client.Projects.GetIamPolicy(project.ProjectId, getPolicyRequest).Do() - if err != nil { - t.Fatalf("Error getting project iam policy: %v", err) - } - - members := make([]string, len(agentNames)) - for i, agentName := range agentNames { - members[i] = fmt.Sprintf("serviceAccount:%s%d@%s.iam.gserviceaccount.com", prefix, project.ProjectNumber, agentName) - } - - // Create the bindings we need to add to the policy. - var newBindings []*cloudresourcemanager.Binding - for _, role := range roles { - newBindings = append(newBindings, &cloudresourcemanager.Binding{ - Role: role, - Members: members, - }) - } - - mergedBindings := tpgiamresource.MergeBindings(append(policy.Bindings, newBindings...)) - - if !tpgiamresource.CompareBindings(policy.Bindings, mergedBindings) { - addedBindings := tpgiamresource.MissingBindings(policy.Bindings, mergedBindings) - for _, missingBinding := range addedBindings { - log.Printf("[DEBUG] Adding binding: %+v", missingBinding) - } - // The policy must change. - policy.Bindings = mergedBindings - setPolicyRequest := &cloudresourcemanager.SetIamPolicyRequest{Policy: policy} - policy, err = client.Projects.SetIamPolicy(project.ProjectId, setPolicyRequest).Do() - if err != nil { - t.Fatalf("Error setting project iam policy: %v", err) - } - msg := "Added the following bindings to the test project's IAM policy:\n" - for _, binding := range addedBindings { - msg += fmt.Sprintf("Members: %q, Role: %q\n", binding.Members, binding.Role) - } - msg += "Retry the test in a few minutes." - t.Error(msg) - return true - } - return false + return acctest.BootstrapAllPSARoles(t, prefix, agentNames, roles) } // BootstrapAllPSARole is a version of BootstrapAllPSARoles for granting a // single role to multiple service agents. func BootstrapAllPSARole(t *testing.T, prefix string, agentNames []string, role string) bool { - return BootstrapAllPSARoles(t, prefix, agentNames, []string{role}) + return acctest.BootstrapAllPSARole(t, prefix, agentNames, role) } // BootstrapPSARoles is a version of BootstrapAllPSARoles for granting roles to // a single service agent. func BootstrapPSARoles(t *testing.T, prefix, agentName string, roles []string) bool { - return BootstrapAllPSARoles(t, prefix, []string{agentName}, roles) + return acctest.BootstrapPSARoles(t, prefix, agentName, roles) } // BootstrapPSARole is a simplified version of BootstrapPSARoles for granting a // single role to a single service agent. func BootstrapPSARole(t *testing.T, prefix, agentName, role string) bool { - return BootstrapPSARoles(t, prefix, agentName, []string{role}) + return acctest.BootstrapPSARole(t, prefix, agentName, role) } // Returns the bindings that are in the first set of bindings but not the second. diff --git a/mmv1/third_party/terraform/utils/bootstrap_test_utils.go b/mmv1/third_party/terraform/utils/bootstrap_test_utils.go index 59e9f884727f..2e0b3b641697 100644 --- a/mmv1/third_party/terraform/utils/bootstrap_test_utils.go +++ b/mmv1/third_party/terraform/utils/bootstrap_test_utils.go @@ -1,56 +1,28 @@ package google import ( - "context" - "fmt" - "log" - "os" - "strings" "testing" - "time" - "github.com/hashicorp/terraform-provider-google/google/envvar" - tpgcompute "github.com/hashicorp/terraform-provider-google/google/services/compute" - "github.com/hashicorp/terraform-provider-google/google/services/privateca" - "github.com/hashicorp/terraform-provider-google/google/services/resourcemanager" - "github.com/hashicorp/terraform-provider-google/google/services/sql" - "github.com/hashicorp/terraform-provider-google/google/tpgiamresource" - "github.com/hashicorp/terraform-provider-google/google/tpgresource" + "github.com/hashicorp/terraform-provider-google/google/acctest" transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" - "google.golang.org/api/cloudbilling/v1" - cloudkms "google.golang.org/api/cloudkms/v1" cloudresourcemanager "google.golang.org/api/cloudresourcemanager/v1" - iam "google.golang.org/api/iam/v1" - "google.golang.org/api/iamcredentials/v1" - "google.golang.org/api/serviceusage/v1" - sqladmin "google.golang.org/api/sqladmin/v1beta4" ) -var SharedKeyRing = "tftest-shared-keyring-1" -var SharedCryptoKey = map[string]string{ - "ENCRYPT_DECRYPT": "tftest-shared-key-1", - "ASYMMETRIC_SIGN": "tftest-shared-sign-key-1", - "ASYMMETRIC_DECRYPT": "tftest-shared-decrypt-key-1", -} - -type BootstrappedKMS struct { - *cloudkms.KeyRing - *cloudkms.CryptoKey -} +type BootstrappedKMS = acctest.BootstrappedKMS -func BootstrapKMSKey(t *testing.T) BootstrappedKMS { - return BootstrapKMSKeyInLocation(t, "global") +func BootstrapKMSKey(t *testing.T) acctest.BootstrappedKMS { + return acctest.BootstrapKMSKey(t) } -func BootstrapKMSKeyInLocation(t *testing.T, locationID string) BootstrappedKMS { - return BootstrapKMSKeyWithPurposeInLocation(t, "ENCRYPT_DECRYPT", locationID) +func BootstrapKMSKeyInLocation(t *testing.T, locationID string) acctest.BootstrappedKMS { + return acctest.BootstrapKMSKeyInLocation(t, locationID) } // BootstrapKMSKeyWithPurpose returns a KMS key in the "global" location. // See BootstrapKMSKeyWithPurposeInLocation. -func BootstrapKMSKeyWithPurpose(t *testing.T, purpose string) BootstrappedKMS { - return BootstrapKMSKeyWithPurposeInLocation(t, purpose, "global") +func BootstrapKMSKeyWithPurpose(t *testing.T, purpose string) acctest.BootstrappedKMS { + return acctest.BootstrapKMSKeyWithPurpose(t, purpose) } /** @@ -64,230 +36,22 @@ func BootstrapKMSKeyWithPurpose(t *testing.T, purpose string) BootstrappedKMS { * to incur the overhead of creating a new project for each test that needs to use * a KMS key. **/ -func BootstrapKMSKeyWithPurposeInLocation(t *testing.T, purpose, locationID string) BootstrappedKMS { - return BootstrapKMSKeyWithPurposeInLocationAndName(t, purpose, locationID, SharedCryptoKey[purpose]) -} - -func BootstrapKMSKeyWithPurposeInLocationAndName(t *testing.T, purpose, locationID, keyShortName string) BootstrappedKMS { - config := BootstrapConfig(t) - if config == nil { - return BootstrappedKMS{ - &cloudkms.KeyRing{}, - &cloudkms.CryptoKey{}, - } - } - - projectID := envvar.GetTestProjectFromEnv() - keyRingParent := fmt.Sprintf("projects/%s/locations/%s", projectID, locationID) - keyRingName := fmt.Sprintf("%s/keyRings/%s", keyRingParent, SharedKeyRing) - keyParent := fmt.Sprintf("projects/%s/locations/%s/keyRings/%s", projectID, locationID, SharedKeyRing) - keyName := fmt.Sprintf("%s/cryptoKeys/%s", keyParent, keyShortName) - - // Get or Create the hard coded shared keyring for testing - kmsClient := config.NewKmsClient(config.UserAgent) - keyRing, err := kmsClient.Projects.Locations.KeyRings.Get(keyRingName).Do() - if err != nil { - if transport_tpg.IsGoogleApiErrorWithCode(err, 404) { - keyRing, err = kmsClient.Projects.Locations.KeyRings.Create(keyRingParent, &cloudkms.KeyRing{}). - KeyRingId(SharedKeyRing).Do() - if err != nil { - t.Errorf("Unable to bootstrap KMS key. Cannot create keyRing: %s", err) - } - } else { - t.Errorf("Unable to bootstrap KMS key. Cannot retrieve keyRing: %s", err) - } - } - - if keyRing == nil { - t.Fatalf("Unable to bootstrap KMS key. keyRing is nil!") - } - - // Get or Create the hard coded, shared crypto key for testing - cryptoKey, err := kmsClient.Projects.Locations.KeyRings.CryptoKeys.Get(keyName).Do() - if err != nil { - if transport_tpg.IsGoogleApiErrorWithCode(err, 404) { - algos := map[string]string{ - "ENCRYPT_DECRYPT": "GOOGLE_SYMMETRIC_ENCRYPTION", - "ASYMMETRIC_SIGN": "RSA_SIGN_PKCS1_4096_SHA512", - "ASYMMETRIC_DECRYPT": "RSA_DECRYPT_OAEP_4096_SHA512", - } - template := cloudkms.CryptoKeyVersionTemplate{ - Algorithm: algos[purpose], - } - - newKey := cloudkms.CryptoKey{ - Purpose: purpose, - VersionTemplate: &template, - } - - cryptoKey, err = kmsClient.Projects.Locations.KeyRings.CryptoKeys.Create(keyParent, &newKey). - CryptoKeyId(keyShortName).Do() - if err != nil { - t.Errorf("Unable to bootstrap KMS key. Cannot create new CryptoKey: %s", err) - } - - } else { - t.Errorf("Unable to bootstrap KMS key. Cannot call CryptoKey service: %s", err) - } - } - - if cryptoKey == nil { - t.Fatalf("Unable to bootstrap KMS key. CryptoKey is nil!") - } - - return BootstrappedKMS{ - keyRing, - cryptoKey, - } -} - -var serviceAccountEmail = "tf-bootstrap-service-account" -var serviceAccountDisplay = "Bootstrapped Service Account for Terraform tests" - -// Some tests need a second service account, other than the test runner, to assert functionality on. -// This provides a well-known service account that can be used when dynamically creating a service -// account isn't an option. -func getOrCreateServiceAccount(config *transport_tpg.Config, project string) (*iam.ServiceAccount, error) { - name := fmt.Sprintf("projects/%s/serviceAccounts/%s@%s.iam.gserviceaccount.com", project, serviceAccountEmail, project) - log.Printf("[DEBUG] Verifying %s as bootstrapped service account.\n", name) - - sa, err := config.NewIamClient(config.UserAgent).Projects.ServiceAccounts.Get(name).Do() - if err != nil && !transport_tpg.IsGoogleApiErrorWithCode(err, 404) { - return nil, err - } - - if sa == nil { - log.Printf("[DEBUG] Account missing. Creating %s as bootstrapped service account.\n", name) - sa = &iam.ServiceAccount{ - DisplayName: serviceAccountDisplay, - } - - r := &iam.CreateServiceAccountRequest{ - AccountId: serviceAccountEmail, - ServiceAccount: sa, - } - sa, err = config.NewIamClient(config.UserAgent).Projects.ServiceAccounts.Create("projects/"+project, r).Do() - if err != nil { - return nil, err - } - } - - return sa, nil +func BootstrapKMSKeyWithPurposeInLocation(t *testing.T, purpose, locationID string) acctest.BootstrappedKMS { + return acctest.BootstrapKMSKeyWithPurposeInLocation(t, purpose, locationID) } -// In order to test impersonation we need to grant the testRunner's account the ability to grant tokens -// on a different service account. Granting permissions takes time and there is no operation to wait on -// so instead this creates a single service account once per test-suite with the correct permissions. -// The first time this test is run it will fail, but subsequent runs will succeed. -func impersonationServiceAccountPermissions(config *transport_tpg.Config, sa *iam.ServiceAccount, testRunner string) error { - log.Printf("[DEBUG] Setting service account permissions.\n") - policy := iam.Policy{ - Bindings: []*iam.Binding{}, - } - - binding := &iam.Binding{ - Role: "roles/iam.serviceAccountTokenCreator", - Members: []string{"serviceAccount:" + sa.Email, "serviceAccount:" + testRunner}, - } - policy.Bindings = append(policy.Bindings, binding) - - // Overwrite the roles each time on this service account. This is because this account is - // only created for the test suite and will stop snowflaking of permissions to get tests - // to run. Overwriting permissions on 1 service account shouldn't affect others. - _, err := config.NewIamClient(config.UserAgent).Projects.ServiceAccounts.SetIamPolicy(sa.Name, &iam.SetIamPolicyRequest{ - Policy: &policy, - }).Do() - if err != nil { - return err - } - - return nil +func BootstrapKMSKeyWithPurposeInLocationAndName(t *testing.T, purpose, locationID, keyShortName string) acctest.BootstrappedKMS { + return acctest.BootstrapKMSKeyWithPurposeInLocationAndName(t, purpose, locationID, keyShortName) } func BootstrapServiceAccount(t *testing.T, project, testRunner string) string { - config := BootstrapConfig(t) - if config == nil { - return "" - } - - sa, err := getOrCreateServiceAccount(config, project) - if err != nil { - t.Fatalf("Bootstrapping failed. Cannot retrieve service account, %s", err) - } - - err = impersonationServiceAccountPermissions(config, sa, testRunner) - if err != nil { - t.Fatalf("Bootstrapping failed. Cannot set service account permissions, %s", err) - } - - return sa.Email + return acctest.BootstrapServiceAccount(t, project, testRunner) } -const SharedTestADDomainPrefix = "tf-bootstrap-ad" - func BootstrapSharedTestADDomain(t *testing.T, testId string, networkName string) string { - project := envvar.GetTestProjectFromEnv() - sharedADDomain := fmt.Sprintf("%s.%s.com", SharedTestADDomainPrefix, testId) - adDomainName := fmt.Sprintf("projects/%s/locations/global/domains/%s", project, sharedADDomain) - - config := BootstrapConfig(t) - if config == nil { - return "" - } - - log.Printf("[DEBUG] Getting shared test active directory domain %q", adDomainName) - getURL := fmt.Sprintf("%s%s", config.ActiveDirectoryBasePath, adDomainName) - _, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "GET", - Project: project, - RawURL: getURL, - UserAgent: config.UserAgent, - Timeout: 4 * time.Minute, - }) - if err != nil && transport_tpg.IsGoogleApiErrorWithCode(err, 404) { - log.Printf("[DEBUG] AD domain %q not found, bootstrapping", sharedADDomain) - postURL := fmt.Sprintf("%sprojects/%s/locations/global/domains?domainName=%s", config.ActiveDirectoryBasePath, project, sharedADDomain) - domainObj := map[string]interface{}{ - "locations": []string{"us-central1"}, - "reservedIpRange": "10.0.1.0/24", - "authorizedNetworks": []string{fmt.Sprintf("projects/%s/global/networks/%s", project, networkName)}, - } - - _, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "POST", - Project: project, - RawURL: postURL, - UserAgent: config.UserAgent, - Body: domainObj, - Timeout: 60 * time.Minute, - }) - if err != nil { - t.Fatalf("Error bootstrapping shared active directory domain %q: %s", adDomainName, err) - } - - log.Printf("[DEBUG] Waiting for active directory domain creation to finish") - } - - _, err = transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "GET", - Project: project, - RawURL: getURL, - UserAgent: config.UserAgent, - Timeout: 4 * time.Minute, - }) - - if err != nil { - t.Fatalf("Error getting shared active directory domain %q: %s", adDomainName, err) - } - - return sharedADDomain + return acctest.BootstrapSharedTestADDomain(t, testId, networkName) } -const SharedTestNetworkPrefix = "tf-bootstrap-net-" - // BootstrapSharedTestNetwork will return a persistent compute network for a // test or set of tests. // @@ -306,166 +70,15 @@ const SharedTestNetworkPrefix = "tf-bootstrap-net-" // Returns the name of a network, creating it if it hasn't been created in the // test project. func BootstrapSharedTestNetwork(t *testing.T, testId string) string { - project := envvar.GetTestProjectFromEnv() - networkName := SharedTestNetworkPrefix + testId - - config := BootstrapConfig(t) - if config == nil { - return "" - } - - log.Printf("[DEBUG] Getting shared test network %q", networkName) - _, err := config.NewComputeClient(config.UserAgent).Networks.Get(project, networkName).Do() - if err != nil && transport_tpg.IsGoogleApiErrorWithCode(err, 404) { - log.Printf("[DEBUG] Network %q not found, bootstrapping", networkName) - url := fmt.Sprintf("%sprojects/%s/global/networks", config.ComputeBasePath, project) - netObj := map[string]interface{}{ - "name": networkName, - "autoCreateSubnetworks": false, - } - - res, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "POST", - Project: project, - RawURL: url, - UserAgent: config.UserAgent, - Body: netObj, - Timeout: 4 * time.Minute, - }) - if err != nil { - t.Fatalf("Error bootstrapping shared test network %q: %s", networkName, err) - } - - log.Printf("[DEBUG] Waiting for network creation to finish") - err = tpgcompute.ComputeOperationWaitTime(config, res, project, "Error bootstrapping shared test network", config.UserAgent, 4*time.Minute) - if err != nil { - t.Fatalf("Error bootstrapping shared test network %q: %s", networkName, err) - } - } - - network, err := config.NewComputeClient(config.UserAgent).Networks.Get(project, networkName).Do() - if err != nil { - t.Errorf("Error getting shared test network %q: %s", networkName, err) - } - if network == nil { - t.Fatalf("Error getting shared test network %q: is nil", networkName) - } - return network.Name + return acctest.BootstrapSharedTestNetwork(t, testId) } -var SharedServicePerimeterProjectPrefix = "tf-bootstrap-sp-" - func BootstrapServicePerimeterProjects(t *testing.T, desiredProjects int) []*cloudresourcemanager.Project { - config := BootstrapConfig(t) - if config == nil { - return nil - } - - org := envvar.GetTestOrgFromEnv(t) - - // The filter endpoint works differently if you provide both the parent id and parent type, and - // doesn't seem to allow for prefix matching. Don't change this to include the parent type unless - // that API behavior changes. - prefixFilter := fmt.Sprintf("id:%s* parent.id:%s", SharedServicePerimeterProjectPrefix, org) - res, err := config.NewResourceManagerClient(config.UserAgent).Projects.List().Filter(prefixFilter).Do() - if err != nil { - t.Fatalf("Error getting shared test projects: %s", err) - } - - projects := res.Projects - for len(projects) < desiredProjects { - pid := SharedServicePerimeterProjectPrefix + RandString(t, 10) - project := &cloudresourcemanager.Project{ - ProjectId: pid, - Name: "TF Service Perimeter Test", - Parent: &cloudresourcemanager.ResourceId{ - Type: "organization", - Id: org, - }, - } - op, err := config.NewResourceManagerClient(config.UserAgent).Projects.Create(project).Do() - if err != nil { - t.Fatalf("Error bootstrapping shared test project: %s", err) - } - - opAsMap, err := tpgresource.ConvertToMap(op) - if err != nil { - t.Fatalf("Error bootstrapping shared test project: %s", err) - } - - err = resourcemanager.ResourceManagerOperationWaitTime(config, opAsMap, "creating project", config.UserAgent, 4) - if err != nil { - t.Fatalf("Error bootstrapping shared test project: %s", err) - } - - p, err := config.NewResourceManagerClient(config.UserAgent).Projects.Get(pid).Do() - if err != nil { - t.Fatalf("Error getting shared test project: %s", err) - } - projects = append(projects, p) - } - - return projects + return acctest.BootstrapServicePerimeterProjects(t, desiredProjects) } func RemoveContainerServiceAgentRoleFromContainerEngineRobot(t *testing.T, project *cloudresourcemanager.Project) { - config := BootstrapConfig(t) - if config == nil { - return - } - - client := config.NewResourceManagerClient(config.UserAgent) - containerEngineRobot := fmt.Sprintf("serviceAccount:service-%d@container-engine-robot.iam.gserviceaccount.com", project.ProjectNumber) - getPolicyRequest := &cloudresourcemanager.GetIamPolicyRequest{} - policy, err := client.Projects.GetIamPolicy(project.ProjectId, getPolicyRequest).Do() - if err != nil { - t.Fatalf("error getting project iam policy: %v", err) - } - roleFound := false - changed := false - for _, binding := range policy.Bindings { - if binding.Role == "roles/container.serviceAgent" { - memberFound := false - for i, member := range binding.Members { - if member == containerEngineRobot { - binding.Members[i] = binding.Members[len(binding.Members)-1] - memberFound = true - } - } - if memberFound { - binding.Members = binding.Members[:len(binding.Members)-1] - changed = true - } - } else if binding.Role == "roles/editor" { - memberFound := false - for _, member := range binding.Members { - if member == containerEngineRobot { - memberFound = true - break - } - } - if !memberFound { - binding.Members = append(binding.Members, containerEngineRobot) - changed = true - } - roleFound = true - } - } - if !roleFound { - policy.Bindings = append(policy.Bindings, &cloudresourcemanager.Binding{ - Members: []string{containerEngineRobot}, - Role: "roles/editor", - }) - changed = true - } - if changed { - setPolicyRequest := &cloudresourcemanager.SetIamPolicyRequest{Policy: policy} - policy, err = client.Projects.SetIamPolicy(project.ProjectId, setPolicyRequest).Do() - if err != nil { - t.Fatalf("error setting project iam policy: %v", err) - } - } + acctest.RemoveContainerServiceAgentRoleFromContainerEngineRobot(t, project) } // BootstrapProject will create or get a project named @@ -475,610 +88,32 @@ func RemoveContainerServiceAgentRoleFromContainerEngineRobot(t *testing.T, proje // Given the existing projects being used by our team, the prefix provided to // this function can be no longer than 18 characters. func BootstrapProject(t *testing.T, projectIDPrefix, billingAccount string, services []string) *cloudresourcemanager.Project { - config := BootstrapConfig(t) - if config == nil { - return nil - } - - projectIDSuffix := strings.Replace(envvar.GetTestProjectFromEnv(), "ci-test-project-", "", 1) - projectID := projectIDPrefix + projectIDSuffix - - crmClient := config.NewResourceManagerClient(config.UserAgent) - - project, err := crmClient.Projects.Get(projectID).Do() - if err != nil { - if !transport_tpg.IsGoogleApiErrorWithCode(err, 403) { - t.Fatalf("Error getting bootstrapped project: %s", err) - } - org := envvar.GetTestOrgFromEnv(t) - - op, err := crmClient.Projects.Create(&cloudresourcemanager.Project{ - ProjectId: projectID, - Name: "Bootstrapped Test Project", - Parent: &cloudresourcemanager.ResourceId{ - Type: "organization", - Id: org, - }, - }).Do() - if err != nil { - t.Fatalf("Error creating bootstrapped test project: %s", err) - } - - opAsMap, err := tpgresource.ConvertToMap(op) - if err != nil { - t.Fatalf("Error converting create project operation to map: %s", err) - } - - err = resourcemanager.ResourceManagerOperationWaitTime(config, opAsMap, "creating project", config.UserAgent, 4*time.Minute) - if err != nil { - t.Fatalf("Error waiting for create project operation: %s", err) - } - - project, err = crmClient.Projects.Get(projectID).Do() - if err != nil { - t.Fatalf("Error getting bootstrapped project: %s", err) - } - - } - - if project.LifecycleState == "DELETE_REQUESTED" { - _, err := crmClient.Projects.Undelete(projectID, &cloudresourcemanager.UndeleteProjectRequest{}).Do() - if err != nil { - t.Fatalf("Error undeleting bootstrapped project: %s", err) - } - } - - if billingAccount != "" { - billingClient := config.NewBillingClient(config.UserAgent) - var pbi *cloudbilling.ProjectBillingInfo - err = transport_tpg.Retry(transport_tpg.RetryOptions{ - RetryFunc: func() error { - var reqErr error - pbi, reqErr = billingClient.Projects.GetBillingInfo(resourcemanager.PrefixedProject(projectID)).Do() - return reqErr - }, - Timeout: 30 * time.Second, - }) - if err != nil { - t.Fatalf("Error getting billing info for project %q: %v", projectID, err) - } - if strings.TrimPrefix(pbi.BillingAccountName, "billingAccounts/") != billingAccount { - pbi.BillingAccountName = "billingAccounts/" + billingAccount - err := transport_tpg.Retry(transport_tpg.RetryOptions{ - RetryFunc: func() error { - _, err := config.NewBillingClient(config.UserAgent).Projects.UpdateBillingInfo(resourcemanager.PrefixedProject(projectID), pbi).Do() - return err - }, - Timeout: 2 * time.Minute, - }) - if err != nil { - t.Fatalf("Error setting billing account for project %q to %q: %s", projectID, billingAccount, err) - } - } - } - - if len(services) > 0 { - - enabledServices, err := resourcemanager.ListCurrentlyEnabledServices(projectID, "", config.UserAgent, config, 1*time.Minute) - if err != nil { - t.Fatalf("Error listing services for project %q: %s", projectID, err) - } - - servicesToEnable := make([]string, 0, len(services)) - for _, service := range services { - if _, ok := enabledServices[service]; !ok { - servicesToEnable = append(servicesToEnable, service) - } - } - - if len(servicesToEnable) > 0 { - if err := resourcemanager.EnableServiceUsageProjectServices(servicesToEnable, projectID, "", config.UserAgent, config, 10*time.Minute); err != nil { - t.Fatalf("Error enabling services for project %q: %s", projectID, err) - } - } - } - - return project + return acctest.BootstrapProject(t, projectIDPrefix, billingAccount, services) } // BootstrapConfig returns a Config pulled from the environment. func BootstrapConfig(t *testing.T) *transport_tpg.Config { - if v := os.Getenv("TF_ACC"); v == "" { - t.Skip("Acceptance tests and bootstrapping skipped unless env 'TF_ACC' set") - return nil - } - - config := &transport_tpg.Config{ - Credentials: envvar.GetTestCredsFromEnv(), - Project: envvar.GetTestProjectFromEnv(), - Region: envvar.GetTestRegionFromEnv(), - Zone: envvar.GetTestZoneFromEnv(), - } - - transport_tpg.ConfigureBasePaths(config) - - if err := config.LoadAndValidate(context.Background()); err != nil { - t.Fatalf("Bootstrapping failed. Unable to load test config: %s", err) - } - return config + return acctest.BootstrapConfig(t) } -// SQL Instance names are not reusable for a week after deletion -const SharedTestSQLInstanceNamePrefix = "tf-bootstrap-" - // BootstrapSharedSQLInstanceBackupRun will return a shared SQL db instance that // has a backup created for it. func BootstrapSharedSQLInstanceBackupRun(t *testing.T) string { - project := envvar.GetTestProjectFromEnv() - - config := BootstrapConfig(t) - if config == nil { - return "" - } - - log.Printf("[DEBUG] Getting list of existing sql instances") - - instances, err := config.NewSqlAdminClient(config.UserAgent).Instances.List(project).Do() - if err != nil { - t.Fatalf("Unable to bootstrap SQL Instance. Cannot retrieve instance list: %s", err) - } - - var bootstrapInstance *sqladmin.DatabaseInstance - - // Look for any existing bootstrap instances - for _, i := range instances.Items { - if strings.HasPrefix(i.Name, SharedTestSQLInstanceNamePrefix) { - bootstrapInstance = i - break - } - } - - if bootstrapInstance == nil { - bootstrapInstanceName := SharedTestSQLInstanceNamePrefix + RandString(t, 10) - log.Printf("[DEBUG] Bootstrap SQL Instance not found, bootstrapping new instance %s", bootstrapInstanceName) - - backupConfig := &sqladmin.BackupConfiguration{ - Enabled: true, - PointInTimeRecoveryEnabled: true, - } - settings := &sqladmin.Settings{ - Tier: "db-f1-micro", - BackupConfiguration: backupConfig, - } - bootstrapInstance = &sqladmin.DatabaseInstance{ - Name: bootstrapInstanceName, - Region: "us-central1", - Settings: settings, - DatabaseVersion: "POSTGRES_11", - } - - var op *sqladmin.Operation - err = transport_tpg.Retry(transport_tpg.RetryOptions{ - RetryFunc: func() (operr error) { - op, operr = config.NewSqlAdminClient(config.UserAgent).Instances.Insert(project, bootstrapInstance).Do() - return operr - }, - Timeout: 20 * time.Minute, - ErrorRetryPredicates: []transport_tpg.RetryErrorPredicateFunc{transport_tpg.IsSqlOperationInProgressError}, - }) - if err != nil { - t.Fatalf("Error, failed to create instance %s: %s", bootstrapInstance.Name, err) - } - err = sql.SqlAdminOperationWaitTime(config, op, project, "Create Instance", config.UserAgent, 40*time.Minute) - if err != nil { - t.Fatalf("Error, failed to create instance %s: %s", bootstrapInstance.Name, err) - } - } - - // Look for backups in bootstrap instance - res, err := config.NewSqlAdminClient(config.UserAgent).BackupRuns.List(project, bootstrapInstance.Name).Do() - if err != nil { - t.Fatalf("Unable to bootstrap SQL Instance. Cannot retrieve backup list: %s", err) - } - backupsList := res.Items - if len(backupsList) == 0 { - log.Printf("[DEBUG] No backups found for %s, creating backup", bootstrapInstance.Name) - backupRun := &sqladmin.BackupRun{ - Instance: bootstrapInstance.Name, - } - - var op *sqladmin.Operation - err = transport_tpg.Retry(transport_tpg.RetryOptions{ - RetryFunc: func() (operr error) { - op, operr = config.NewSqlAdminClient(config.UserAgent).BackupRuns.Insert(project, bootstrapInstance.Name, backupRun).Do() - return operr - }, - Timeout: 20 * time.Minute, - ErrorRetryPredicates: []transport_tpg.RetryErrorPredicateFunc{transport_tpg.IsSqlOperationInProgressError}, - }) - if err != nil { - t.Fatalf("Error, failed to create instance backup: %s", err) - } - err = sql.SqlAdminOperationWaitTime(config, op, project, "Backup Instance", config.UserAgent, 20*time.Minute) - if err != nil { - t.Fatalf("Error, failed to create instance backup: %s", err) - } - } - - return bootstrapInstance.Name + return acctest.BootstrapSharedSQLInstanceBackupRun(t) } func BootstrapSharedCaPoolInLocation(t *testing.T, location string) string { - project := envvar.GetTestProjectFromEnv() - poolName := "static-ca-pool" - - config := BootstrapConfig(t) - if config == nil { - return "" - } - - log.Printf("[DEBUG] Getting shared CA pool %q", poolName) - url := fmt.Sprintf("%sprojects/%s/locations/%s/caPools/%s", config.PrivatecaBasePath, project, location, poolName) - _, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "GET", - Project: project, - RawURL: url, - UserAgent: config.UserAgent, - }) - if err != nil { - log.Printf("[DEBUG] CA pool %q not found, bootstrapping", poolName) - poolObj := map[string]interface{}{ - "tier": "ENTERPRISE", - } - createUrl := fmt.Sprintf("%sprojects/%s/locations/%s/caPools?caPoolId=%s", config.PrivatecaBasePath, project, location, poolName) - res, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "POST", - Project: project, - RawURL: createUrl, - UserAgent: config.UserAgent, - Body: poolObj, - Timeout: 4 * time.Minute, - }) - if err != nil { - t.Fatalf("Error bootstrapping shared CA pool %q: %s", poolName, err) - } - - log.Printf("[DEBUG] Waiting for CA pool creation to finish") - var opRes map[string]interface{} - err = privateca.PrivatecaOperationWaitTimeWithResponse( - config, res, &opRes, project, "Creating CA pool", config.UserAgent, - 4*time.Minute) - if err != nil { - t.Errorf("Error getting shared CA pool %q: %s", poolName, err) - } - _, err = transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "GET", - Project: project, - RawURL: url, - UserAgent: config.UserAgent, - }) - if err != nil { - t.Errorf("Error getting shared CA pool %q: %s", poolName, err) - } - } - return poolName + return acctest.BootstrapSharedCaPoolInLocation(t, location) } func BootstrapSubnet(t *testing.T, subnetName string, networkName string) string { - projectID := envvar.GetTestProjectFromEnv() - region := envvar.GetTestRegionFromEnv() - - config := BootstrapConfig(t) - if config == nil { - t.Fatal("Could not bootstrap config.") - } - - computeService := config.NewComputeClient(config.UserAgent) - if computeService == nil { - t.Fatal("Could not create compute client.") - } - - // In order to create a networkAttachment we need to bootstrap a subnet. - _, err := computeService.Subnetworks.Get(projectID, region, subnetName).Do() - if err != nil && transport_tpg.IsGoogleApiErrorWithCode(err, 404) { - log.Printf("[DEBUG] Subnet %q not found, bootstrapping", subnetName) - - networkUrl := fmt.Sprintf("%sprojects/%s/global/networks/%s", config.ComputeBasePath, projectID, networkName) - url := fmt.Sprintf("%sprojects/%s/regions/%s/subnetworks", config.ComputeBasePath, projectID, region) - - subnetObj := map[string]interface{}{ - "name": subnetName, - "region ": region, - "network": networkUrl, - "ipCidrRange": "10.77.1.0/28", - } - - res, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "POST", - Project: projectID, - RawURL: url, - UserAgent: config.UserAgent, - Body: subnetObj, - Timeout: 4 * time.Minute, - }) - - log.Printf("Response is, %s", res) - if err != nil { - t.Fatalf("Error bootstrapping test subnet %s: %s", subnetName, err) - } - - log.Printf("[DEBUG] Waiting for network creation to finish") - err = tpgcompute.ComputeOperationWaitTime(config, res, projectID, "Error bootstrapping test subnet", config.UserAgent, 4*time.Minute) - if err != nil { - t.Fatalf("Error bootstrapping test subnet %s: %s", subnetName, err) - } - } - - subnet, err := computeService.Subnetworks.Get(projectID, region, subnetName).Do() - - if subnet == nil { - t.Fatalf("Error getting test subnet %s: is nil", subnetName) - } - - if err != nil { - t.Fatalf("Error getting test subnet %s: %s", subnetName, err) - } - return subnet.Name + return acctest.BootstrapSubnet(t, subnetName, networkName) } func BootstrapNetworkAttachment(t *testing.T, networkAttachmentName string, subnetName string) string { - projectID := envvar.GetTestProjectFromEnv() - region := envvar.GetTestRegionFromEnv() - - config := BootstrapConfig(t) - if config == nil { - return "" - } - - computeService := config.NewComputeClient(config.UserAgent) - if computeService == nil { - return "" - } - - networkAttachment, err := computeService.NetworkAttachments.Get(projectID, region, networkAttachmentName).Do() - if err != nil && transport_tpg.IsGoogleApiErrorWithCode(err, 404) { - // Create Network Attachment Here. - log.Printf("[DEBUG] Network Attachment %s not found, bootstrapping", networkAttachmentName) - url := fmt.Sprintf("%sprojects/%s/regions/%s/networkAttachments", config.ComputeBasePath, projectID, region) - - subnetURL := fmt.Sprintf("%sprojects/%s/regions/%s/subnetworks/%s", config.ComputeBasePath, projectID, region, subnetName) - networkAttachmentObj := map[string]interface{}{ - "name": networkAttachmentName, - "region": region, - "subnetworks": []string{subnetURL}, - "connectionPreference": "ACCEPT_AUTOMATIC", - } - - res, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "POST", - Project: projectID, - RawURL: url, - UserAgent: config.UserAgent, - Body: networkAttachmentObj, - Timeout: 4 * time.Minute, - }) - if err != nil { - t.Fatalf("Error bootstrapping test Network Attachment %s: %s", networkAttachmentName, err) - } - - log.Printf("[DEBUG] Waiting for network creation to finish") - err = tpgcompute.ComputeOperationWaitTime(config, res, projectID, "Error bootstrapping shared test subnet", config.UserAgent, 4*time.Minute) - if err != nil { - t.Fatalf("Error bootstrapping test Network Attachment %s: %s", networkAttachmentName, err) - } - } - - networkAttachment, err = computeService.NetworkAttachments.Get(projectID, region, networkAttachmentName).Do() - - if networkAttachment == nil { - t.Fatalf("Error getting test network attachment %s: is nil", networkAttachmentName) - } - - if err != nil { - t.Fatalf("Error getting test Network Attachment %s: %s", networkAttachmentName, err) - } - - return networkAttachment.Name + return acctest.BootstrapNetworkAttachment(t, networkAttachmentName, subnetName) } func setupProjectsAndGetAccessToken(org, billing, pid, service string, config *transport_tpg.Config) (string, error) { - // Create project-1 and project-2 - rmService := config.NewResourceManagerClient(config.UserAgent) - - project := &cloudresourcemanager.Project{ - ProjectId: pid, - Name: pid, - Parent: &cloudresourcemanager.ResourceId{ - Id: org, - Type: "organization", - }, - } - - var op *cloudresourcemanager.Operation - err := transport_tpg.Retry(transport_tpg.RetryOptions{ - RetryFunc: func() (reqErr error) { - op, reqErr = rmService.Projects.Create(project).Do() - return reqErr - }, - Timeout: 5 * time.Minute, - }) - if err != nil { - return "", err - } - - // Wait for the operation to complete - opAsMap, err := tpgresource.ConvertToMap(op) - if err != nil { - return "", err - } - - waitErr := resourcemanager.ResourceManagerOperationWaitTime(config, opAsMap, "creating project", config.UserAgent, 5*time.Minute) - if waitErr != nil { - return "", waitErr - } - - ba := &cloudbilling.ProjectBillingInfo{ - BillingAccountName: fmt.Sprintf("billingAccounts/%s", billing), - } - _, err = config.NewBillingClient(config.UserAgent).Projects.UpdateBillingInfo(resourcemanager.PrefixedProject(pid), ba).Do() - if err != nil { - return "", err - } - - p2 := fmt.Sprintf("%s-2", pid) - project.ProjectId = p2 - project.Name = fmt.Sprintf("%s-2", pid) - - err = transport_tpg.Retry(transport_tpg.RetryOptions{ - RetryFunc: func() (reqErr error) { - op, reqErr = rmService.Projects.Create(project).Do() - return reqErr - }, - Timeout: 5 * time.Minute, - }) - if err != nil { - return "", err - } - - // Wait for the operation to complete - opAsMap, err = tpgresource.ConvertToMap(op) - if err != nil { - return "", err - } - - waitErr = resourcemanager.ResourceManagerOperationWaitTime(config, opAsMap, "creating project", config.UserAgent, 5*time.Minute) - if waitErr != nil { - return "", waitErr - } - - _, err = config.NewBillingClient(config.UserAgent).Projects.UpdateBillingInfo(resourcemanager.PrefixedProject(p2), ba).Do() - if err != nil { - return "", err - } - - // Enable the appropriate service in project-2 only - suService := config.NewServiceUsageClient(config.UserAgent) - - serviceReq := &serviceusage.BatchEnableServicesRequest{ - ServiceIds: []string{fmt.Sprintf("%s.googleapis.com", service)}, - } - - _, err = suService.Services.BatchEnable(fmt.Sprintf("projects/%s", p2), serviceReq).Do() - if err != nil { - return "", err - } - - // Enable the test runner to create service accounts and get an access token on behalf of - // the project 1 service account - curEmail, err := transport_tpg.GetCurrentUserEmail(config, config.UserAgent) - if err != nil { - return "", err - } - - proj1SATokenCreator := &cloudresourcemanager.Binding{ - Members: []string{fmt.Sprintf("serviceAccount:%s", curEmail)}, - Role: "roles/iam.serviceAccountTokenCreator", - } - - proj1SACreator := &cloudresourcemanager.Binding{ - Members: []string{fmt.Sprintf("serviceAccount:%s", curEmail)}, - Role: "roles/iam.serviceAccountCreator", - } - - bindings := tpgiamresource.MergeBindings([]*cloudresourcemanager.Binding{proj1SATokenCreator, proj1SACreator}) - - p, err := rmService.Projects.GetIamPolicy(pid, - &cloudresourcemanager.GetIamPolicyRequest{ - Options: &cloudresourcemanager.GetPolicyOptions{ - RequestedPolicyVersion: tpgiamresource.IamPolicyVersion, - }, - }).Do() - if err != nil { - return "", err - } - - p.Bindings = tpgiamresource.MergeBindings(append(p.Bindings, bindings...)) - _, err = config.NewResourceManagerClient(config.UserAgent).Projects.SetIamPolicy(pid, - &cloudresourcemanager.SetIamPolicyRequest{ - Policy: p, - UpdateMask: "bindings,etag,auditConfigs", - }).Do() - if err != nil { - return "", err - } - - // Create a service account for project-1 - sa1, err := getOrCreateServiceAccount(config, pid) - if err != nil { - return "", err - } - - // Add permissions to service accounts - - // Permission needed for user_project_override - proj2ServiceUsageBinding := &cloudresourcemanager.Binding{ - Members: []string{fmt.Sprintf("serviceAccount:%s", sa1.Email)}, - Role: "roles/serviceusage.serviceUsageConsumer", - } - - // Admin permission for service - proj2ServiceAdminBinding := &cloudresourcemanager.Binding{ - Members: []string{fmt.Sprintf("serviceAccount:%s", sa1.Email)}, - Role: fmt.Sprintf("roles/%s.admin", service), - } - - bindings = tpgiamresource.MergeBindings([]*cloudresourcemanager.Binding{proj2ServiceUsageBinding, proj2ServiceAdminBinding}) - - // For KMS test only - if service == "cloudkms" { - proj2CryptoKeyBinding := &cloudresourcemanager.Binding{ - Members: []string{fmt.Sprintf("serviceAccount:%s", sa1.Email)}, - Role: "roles/cloudkms.cryptoKeyEncrypter", - } - - bindings = tpgiamresource.MergeBindings(append(bindings, proj2CryptoKeyBinding)) - } - - p, err = rmService.Projects.GetIamPolicy(p2, - &cloudresourcemanager.GetIamPolicyRequest{ - Options: &cloudresourcemanager.GetPolicyOptions{ - RequestedPolicyVersion: tpgiamresource.IamPolicyVersion, - }, - }).Do() - if err != nil { - return "", err - } - - p.Bindings = tpgiamresource.MergeBindings(append(p.Bindings, bindings...)) - _, err = config.NewResourceManagerClient(config.UserAgent).Projects.SetIamPolicy(p2, - &cloudresourcemanager.SetIamPolicyRequest{ - Policy: p, - UpdateMask: "bindings,etag,auditConfigs", - }).Do() - if err != nil { - return "", err - } - - // The token creator IAM API call returns success long before the policy is - // actually usable. Wait a solid 2 minutes to ensure we can use it. - time.Sleep(2 * time.Minute) - - iamCredsService := config.NewIamCredentialsClient(config.UserAgent) - tokenRequest := &iamcredentials.GenerateAccessTokenRequest{ - Lifetime: "300s", - Scope: []string{"https://www.googleapis.com/auth/cloud-platform"}, - } - atResp, err := iamCredsService.Projects.ServiceAccounts.GenerateAccessToken(fmt.Sprintf("projects/-/serviceAccounts/%s", sa1.Email), tokenRequest).Do() - if err != nil { - return "", err - } - - accessToken := atResp.AccessToken - - return accessToken, nil + return acctest.SetupProjectsAndGetAccessToken(org, billing, pid, service, config) } diff --git a/mmv1/third_party/terraform/utils/provider_test.go.erb b/mmv1/third_party/terraform/utils/provider_test.go.erb index 6dea116a9895..2ed6270c9a6c 100644 --- a/mmv1/third_party/terraform/utils/provider_test.go.erb +++ b/mmv1/third_party/terraform/utils/provider_test.go.erb @@ -106,8 +106,8 @@ func TestAccProviderUserProjectOverride(t *testing.T) { pid := "tf-test-" + RandString(t, 10) topicName := "tf-test-topic-" + RandString(t, 10) - config := BootstrapConfig(t) - accessToken, err := setupProjectsAndGetAccessToken(org, billing, pid, "pubsub", config) + config := acctest.BootstrapConfig(t) + accessToken, err := acctest.SetupProjectsAndGetAccessToken(org, billing, pid, "pubsub", config) if err != nil { t.Error(err) } @@ -147,7 +147,7 @@ func TestAccProviderIndirectUserProjectOverride(t *testing.T) { billing := envvar.GetTestBillingAccountFromEnv(t) pid := "tf-test-" + RandString(t, 10) - config := BootstrapConfig(t) + config := acctest.BootstrapConfig(t) accessToken, err := setupProjectsAndGetAccessToken(org, billing, pid, "cloudkms", config) if err != nil { t.Error(err) From f8d6d264f1cb94114f487343580f4935d81aee40 Mon Sep 17 00:00:00 2001 From: diogoEstevesCiT <80709292+diogoEsteves42@users.noreply.github.com> Date: Mon, 3 Jul 2023 10:20:03 +0000 Subject: [PATCH 29/55] Adding `noautomatednszone` in the resource `forwardingrule` (#8102) * adding the new fields noAutomateDnsZone, need to validate the error with test step and the plan was not empty * adding the tests scenarios, need to fix the test for global * adding more tests, but requires a test with a no_autome_dns with true value * added to the field, immutability and ignoring read from api, tests are passing * removing comments from tests --- mmv1/products/compute/ForwardingRule.yaml | 25 ++++++ .../compute/GlobalForwardingRule.yaml | 21 +++++ ...arding_rule_vpc_psc_no_automate_dns.tf.erb | 90 +++++++++++++++++++ ...connect_google_apis_no_automate_dns.tf.erb | 37 ++++++++ 4 files changed, 173 insertions(+) create mode 100644 mmv1/templates/terraform/examples/forwarding_rule_vpc_psc_no_automate_dns.tf.erb create mode 100644 mmv1/templates/terraform/examples/private_service_connect_google_apis_no_automate_dns.tf.erb diff --git a/mmv1/products/compute/ForwardingRule.yaml b/mmv1/products/compute/ForwardingRule.yaml index 2085ed01af4e..3eb1f39f97ef 100644 --- a/mmv1/products/compute/ForwardingRule.yaml +++ b/mmv1/products/compute/ForwardingRule.yaml @@ -178,6 +178,23 @@ examples: - 'port_range' - 'target' - 'ip_address' + - !ruby/object:Provider::Terraform::Examples + name: 'forwarding_rule_vpc_psc_no_automate_dns' + primary_resource_id: 'default' + vars: + forwarding_rule_name: 'psc-endpoint' + consumer_network_name: 'consumer-net' + ip_name: 'website-ip' + producer_network_name: 'producer-net' + producer_psc_network_name: 'producer-psc-net' + service_attachment_name: 'producer-service' + producer_forwarding_rule_name: 'producer-forwarding-rule' + producer_backend_name: 'producer-service-backend' + producer_healthcheck_name: 'producer-service-health-check' + ignore_read_extra: + - 'port_range' + - 'target' + - 'ip_address' - !ruby/object:Provider::Terraform::Examples name: 'forwarding_rule_regional_steering' primary_resource_id: 'steering' @@ -589,3 +606,11 @@ properties: This is used in PSC consumer ForwardingRule to control whether the PSC endpoint can be accessed from another region. send_empty_value: true + - !ruby/object:Api::Type::Boolean + name: noAutomateDnsZone + description: + This is used in PSC consumer ForwardingRule to control whether it should try to auto-generate a DNS zone or not. + Non-PSC forwarding rules do not use this field. + send_empty_value: true + immutable: true + ignore_read: true \ No newline at end of file diff --git a/mmv1/products/compute/GlobalForwardingRule.yaml b/mmv1/products/compute/GlobalForwardingRule.yaml index dbd3d710e5f1..927a65795c7f 100644 --- a/mmv1/products/compute/GlobalForwardingRule.yaml +++ b/mmv1/products/compute/GlobalForwardingRule.yaml @@ -169,6 +169,19 @@ examples: project: :PROJECT_NAME ignore_read_extra: - 'ip_address' + - !ruby/object:Provider::Terraform::Examples + name: 'private_service_connect_google_apis_no_automate_dns' + min_version: beta + primary_resource_id: 'default' + vars: + network_name: 'my-network' + subnetwork_name: 'my-subnetwork' + global_address_name: 'global-psconnect-ip' + forwarding_rule_name: 'globalrule' + test_env_vars: + project: :PROJECT_NAME + ignore_read_extra: + - 'ip_address' custom_code: !ruby/object:Provider::Terraform::CustomCode post_create: templates/terraform/post_create/labels.erb properties: @@ -442,3 +455,11 @@ properties: name: allowPscGlobalAccess description: This is used in PSC consumer ForwardingRule to control whether the PSC endpoint can be accessed from another region. min_version: beta + - !ruby/object:Api::Type::Boolean + name: noAutomateDnsZone + description: + This is used in PSC consumer ForwardingRule to control whether it should try to auto-generate a DNS zone or not. + Non-PSC forwarding rules do not use this field. + send_empty_value: true + immutable: true + ignore_read: true \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/forwarding_rule_vpc_psc_no_automate_dns.tf.erb b/mmv1/templates/terraform/examples/forwarding_rule_vpc_psc_no_automate_dns.tf.erb new file mode 100644 index 000000000000..820c111c3271 --- /dev/null +++ b/mmv1/templates/terraform/examples/forwarding_rule_vpc_psc_no_automate_dns.tf.erb @@ -0,0 +1,90 @@ +resource "google_compute_forwarding_rule" "<%= ctx[:primary_resource_id] %>" { + name = "<%= ctx[:vars]['forwarding_rule_name'] %>" + region = "us-central1" + load_balancing_scheme = "" + target = google_compute_service_attachment.producer_service_attachment.id + network = google_compute_network.consumer_net.name + ip_address = google_compute_address.consumer_address.id + allow_psc_global_access = true + no_automate_dns_zone = true +} + +resource "google_compute_network" "consumer_net" { + name = "<%= ctx[:vars]['consumer_network_name'] %>" + auto_create_subnetworks = false +} + +resource "google_compute_subnetwork" "consumer_subnet" { + name = "<%= ctx[:vars]['consumer_network_name'] %>" + ip_cidr_range = "10.0.0.0/16" + region = "us-central1" + network = google_compute_network.consumer_net.id +} + +resource "google_compute_address" "consumer_address" { + name = "<%= ctx[:vars]['ip_name'] %>-1" + region = "us-central1" + subnetwork = google_compute_subnetwork.consumer_subnet.id + address_type = "INTERNAL" +} + + +resource "google_compute_network" "producer_net" { + name = "<%= ctx[:vars]['producer_network_name'] %>" + auto_create_subnetworks = false +} + +resource "google_compute_subnetwork" "producer_subnet" { + name = "<%= ctx[:vars]['producer_network_name'] %>" + ip_cidr_range = "10.0.0.0/16" + region = "us-central1" + network = google_compute_network.producer_net.id +} + +resource "google_compute_subnetwork" "psc_producer_subnet" { + name = "<%= ctx[:vars]['producer_psc_network_name'] %>" + ip_cidr_range = "10.1.0.0/16" + region = "us-central1" + + purpose = "PRIVATE_SERVICE_CONNECT" + network = google_compute_network.producer_net.id +} + +resource "google_compute_service_attachment" "producer_service_attachment" { + name = "<%= ctx[:vars]['service_attachment_name'] %>" + region = "us-central1" + description = "A service attachment configured with Terraform" + + enable_proxy_protocol = true + connection_preference = "ACCEPT_AUTOMATIC" + nat_subnets = [google_compute_subnetwork.psc_producer_subnet.name] + target_service = google_compute_forwarding_rule.producer_target_service.id +} + +resource "google_compute_forwarding_rule" "producer_target_service" { + name = "<%= ctx[:vars]['producer_forwarding_rule_name'] %>" + region = "us-central1" + + load_balancing_scheme = "INTERNAL" + backend_service = google_compute_region_backend_service.producer_service_backend.id + all_ports = true + network = google_compute_network.producer_net.name + subnetwork = google_compute_subnetwork.producer_subnet.name +} + +resource "google_compute_region_backend_service" "producer_service_backend" { + name = "<%= ctx[:vars]['producer_backend_name'] %>" + region = "us-central1" + + health_checks = [google_compute_health_check.producer_service_health_check.id] +} + +resource "google_compute_health_check" "producer_service_health_check" { + name = "<%= ctx[:vars]['producer_healthcheck_name'] %>" + + check_interval_sec = 1 + timeout_sec = 1 + tcp_health_check { + port = "80" + } +} diff --git a/mmv1/templates/terraform/examples/private_service_connect_google_apis_no_automate_dns.tf.erb b/mmv1/templates/terraform/examples/private_service_connect_google_apis_no_automate_dns.tf.erb new file mode 100644 index 000000000000..4d8276eafb59 --- /dev/null +++ b/mmv1/templates/terraform/examples/private_service_connect_google_apis_no_automate_dns.tf.erb @@ -0,0 +1,37 @@ +resource "google_compute_network" "network" { + provider = google-beta + project = "<%= ctx[:test_env_vars]['project'] %>" + name = "<%= ctx[:vars]['network_name'] %>" + auto_create_subnetworks = false +} + +resource "google_compute_subnetwork" "vpc_subnetwork" { + provider = google-beta + project = google_compute_network.network.project + name = "<%= ctx[:vars]['subnetwork_name'] %>" + ip_cidr_range = "10.2.0.0/16" + region = "us-central1" + network = google_compute_network.network.id + private_ip_google_access = true +} + +resource "google_compute_global_address" "default" { + provider = google-beta + project = google_compute_network.network.project + name = "<%= ctx[:vars]['global_address_name'] %>" + address_type = "INTERNAL" + purpose = "PRIVATE_SERVICE_CONNECT" + network = google_compute_network.network.id + address = "100.100.100.106" +} + +resource "google_compute_global_forwarding_rule" "default" { + provider = google-beta + project = google_compute_network.network.project + name = "<%= ctx[:vars]['forwarding_rule_name'] %>" + target = "all-apis" + network = google_compute_network.network.id + ip_address = google_compute_global_address.default.id + load_balancing_scheme = "" + no_automate_dns_zone = false +} From 1d3a8963edbb00688eba51e2787233d98ddaea76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Taneli=20Lepp=C3=A4?= Date: Mon, 3 Jul 2023 12:46:42 +0200 Subject: [PATCH 30/55] Promote asynchronous disk replication resources to GA. (#8232) --- mmv1/products/compute/Disk.yaml | 2 -- mmv1/products/compute/RegionDisk.yaml | 2 -- mmv1/products/compute/ResourcePolicy.yaml | 2 -- .../templates/terraform/examples/disk_async.tf.erb | 4 ---- .../terraform/examples/region_disk_async.tf.erb | 4 ---- .../resource_policy_consistency_group.tf.erb | 2 -- .../third_party/terraform/provider/provider.go.erb | 2 +- .../resource_compute_disk_async_replication.go.erb | 2 -- ...urce_compute_disk_async_replication_test.go.erb | 14 +------------- .../r/compute_disk_async_replication.html.markdown | 2 +- 10 files changed, 3 insertions(+), 33 deletions(-) diff --git a/mmv1/products/compute/Disk.yaml b/mmv1/products/compute/Disk.yaml index 9fc4f38d28c5..92d50a0df5bc 100644 --- a/mmv1/products/compute/Disk.yaml +++ b/mmv1/products/compute/Disk.yaml @@ -81,7 +81,6 @@ examples: primary_resource_name: "fmt.Sprintf(\"tf-test-test-disk%s\", context[\"random_suffix\"\ ])" - min_version: beta vars: disk_name: 'async-test-disk' secondary_disk_name: 'async-secondary-test-disk' @@ -450,7 +449,6 @@ properties: update_url: 'projects/{{project}}/zones/{{zone}}/disks/{{name}}?paths=provisionedThroughput' - !ruby/object:Api::Type::NestedObject name: 'asyncPrimaryDisk' - min_version: 'beta' properties: - !ruby/object:Api::Type::String name: 'disk' diff --git a/mmv1/products/compute/RegionDisk.yaml b/mmv1/products/compute/RegionDisk.yaml index 76edb608dfa7..8d8509afad9f 100644 --- a/mmv1/products/compute/RegionDisk.yaml +++ b/mmv1/products/compute/RegionDisk.yaml @@ -81,7 +81,6 @@ examples: primary_resource_name: "fmt.Sprintf(\"tf-test-my-region-disk%s\", context[\"random_suffix\"\ ])" - min_version: beta vars: region_disk_name: 'primary-region-disk' secondary_region_disk_name: 'secondary-region-disk' @@ -327,7 +326,6 @@ properties: output: true - !ruby/object:Api::Type::NestedObject name: 'asyncPrimaryDisk' - min_version: 'beta' properties: - !ruby/object:Api::Type::String name: 'disk' diff --git a/mmv1/products/compute/ResourcePolicy.yaml b/mmv1/products/compute/ResourcePolicy.yaml index 2459057c57da..67dbada04bd3 100644 --- a/mmv1/products/compute/ResourcePolicy.yaml +++ b/mmv1/products/compute/ResourcePolicy.yaml @@ -72,7 +72,6 @@ examples: name: 'gce-policy' - !ruby/object:Provider::Terraform::Examples name: 'resource_policy_consistency_group' - min_version: 'beta' primary_resource_id: 'cgroup' vars: name: 'gce-policy' @@ -345,7 +344,6 @@ properties: The expiration time of the schedule. The timestamp is an RFC3339 string. - !ruby/object:Api::Type::NestedObject name: 'diskConsistencyGroupPolicy' - min_version: 'beta' conflicts: - 'snapshot_schedule_policy' - 'group_placement_policy' diff --git a/mmv1/templates/terraform/examples/disk_async.tf.erb b/mmv1/templates/terraform/examples/disk_async.tf.erb index da4e1048b236..854398726589 100644 --- a/mmv1/templates/terraform/examples/disk_async.tf.erb +++ b/mmv1/templates/terraform/examples/disk_async.tf.erb @@ -1,6 +1,4 @@ resource "google_compute_disk" "primary" { - provider = google-beta - name = "<%= ctx[:vars]['disk_name'] %>" type = "pd-ssd" zone = "us-central1-a" @@ -9,8 +7,6 @@ resource "google_compute_disk" "primary" { } resource "google_compute_disk" "secondary" { - provider = google-beta - name = "<%= ctx[:vars]['secondary_disk_name'] %>" type = "pd-ssd" zone = "us-east1-c" diff --git a/mmv1/templates/terraform/examples/region_disk_async.tf.erb b/mmv1/templates/terraform/examples/region_disk_async.tf.erb index e0e748047648..05a8e870d5b3 100644 --- a/mmv1/templates/terraform/examples/region_disk_async.tf.erb +++ b/mmv1/templates/terraform/examples/region_disk_async.tf.erb @@ -1,6 +1,4 @@ resource "google_compute_region_disk" "primary" { - provider = google-beta - name = "<%= ctx[:vars]['region_disk_name'] %>" type = "pd-ssd" region = "us-central1" @@ -10,8 +8,6 @@ resource "google_compute_region_disk" "primary" { } resource "google_compute_region_disk" "secondary" { - provider = google-beta - name = "<%= ctx[:vars]['secondary_region_disk_name'] %>" type = "pd-ssd" region = "us-east1" diff --git a/mmv1/templates/terraform/examples/resource_policy_consistency_group.tf.erb b/mmv1/templates/terraform/examples/resource_policy_consistency_group.tf.erb index fc8440508f13..87adb1ce9c77 100644 --- a/mmv1/templates/terraform/examples/resource_policy_consistency_group.tf.erb +++ b/mmv1/templates/terraform/examples/resource_policy_consistency_group.tf.erb @@ -1,6 +1,4 @@ resource "google_compute_resource_policy" "cgroup" { - provider = google-beta - name = "<%= ctx[:vars]['name'] %>" region = "europe-west1" disk_consistency_group_policy { diff --git a/mmv1/third_party/terraform/provider/provider.go.erb b/mmv1/third_party/terraform/provider/provider.go.erb index daee13f59af4..7aa937faf4f3 100644 --- a/mmv1/third_party/terraform/provider/provider.go.erb +++ b/mmv1/third_party/terraform/provider/provider.go.erb @@ -481,8 +481,8 @@ end # products.each do "google_composer_environment": composer.ResourceComposerEnvironment(), "google_compute_attached_disk": compute.ResourceComputeAttachedDisk(), "google_compute_instance": compute.ResourceComputeInstance(), - <% unless version == 'ga' -%> "google_compute_disk_async_replication": compute.ResourceComputeDiskAsyncReplication(), + <% unless version == 'ga' -%> "google_compute_instance_from_machine_image": compute.ResourceComputeInstanceFromMachineImage(), <% end -%> "google_compute_instance_from_template": compute.ResourceComputeInstanceFromTemplate(), diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_disk_async_replication.go.erb b/mmv1/third_party/terraform/services/compute/resource_compute_disk_async_replication.go.erb index 8f62b6cbf2a7..d769ac6c5d39 100644 --- a/mmv1/third_party/terraform/services/compute/resource_compute_disk_async_replication.go.erb +++ b/mmv1/third_party/terraform/services/compute/resource_compute_disk_async_replication.go.erb @@ -1,6 +1,5 @@ <% autogen_exception -%> package compute -<% if version != "ga" -%> import ( "fmt" @@ -303,4 +302,3 @@ func resourceDiskAsyncReplicationDelete(d *schema.ResourceData, meta interface{} } return nil } -<% end -%> diff --git a/mmv1/third_party/terraform/tests/resource_compute_disk_async_replication_test.go.erb b/mmv1/third_party/terraform/tests/resource_compute_disk_async_replication_test.go.erb index 16e06a9cb75f..9a8c97b5ac1f 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_disk_async_replication_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_compute_disk_async_replication_test.go.erb @@ -45,7 +45,7 @@ func TestAccComputeDiskAsyncReplication(t *testing.T) { VcrTest(t, resource.TestCase{ PreCheck: func() { AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderBetaFactories(t), + ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccComputeDiskAsyncReplication_basicZonal(region, secondaryRegion, primaryDisk, secondaryDisk), @@ -76,8 +76,6 @@ func TestAccComputeDiskAsyncReplication(t *testing.T) { func testAccComputeDiskAsyncReplication_basicZonal(region, secondaryRegion, primaryDisk, secondaryDisk string) string { return fmt.Sprintf(` resource "google_compute_disk" "primary" { - provider = google-beta - zone = "%s-a" name = "%s" type = "pd-ssd" @@ -86,8 +84,6 @@ resource "google_compute_disk" "primary" { } resource "google_compute_disk" "secondary" { - provider = google-beta - name = "%s" type = "pd-ssd" zone = "%s-b" @@ -100,8 +96,6 @@ resource "google_compute_disk" "secondary" { } resource "google_compute_disk_async_replication" "replication" { - provider = google-beta - primary_disk = google_compute_disk.primary.id secondary_disk { @@ -114,8 +108,6 @@ resource "google_compute_disk_async_replication" "replication" { func testAccComputeDiskAsyncReplication_basicRegional(region, secondaryRegion, primaryDisk, secondaryDisk string) string { return fmt.Sprintf(` resource "google_compute_region_disk" "primary" { - provider = google-beta - region = "%s" name = "%s" type = "pd-ssd" @@ -129,8 +121,6 @@ resource "google_compute_region_disk" "primary" { } resource "google_compute_region_disk" "secondary" { - provider = google-beta - region = "%s" name = "%s" type = "pd-ssd" @@ -148,8 +138,6 @@ resource "google_compute_region_disk" "secondary" { } resource "google_compute_disk_async_replication" "replication" { - provider = google-beta - primary_disk = google_compute_region_disk.primary.id secondary_disk { diff --git a/mmv1/third_party/terraform/website/docs/r/compute_disk_async_replication.html.markdown b/mmv1/third_party/terraform/website/docs/r/compute_disk_async_replication.html.markdown index 6f6b3121f6fa..5f825ce3ddc8 100644 --- a/mmv1/third_party/terraform/website/docs/r/compute_disk_async_replication.html.markdown +++ b/mmv1/third_party/terraform/website/docs/r/compute_disk_async_replication.html.markdown @@ -8,7 +8,7 @@ description: |- Starts and stops asynchronous persistent disk replication. For more information see [the official documentation](https://cloud.google.com/compute/docs/disks/async-pd/about) -and the [API](https://cloud.google.com/compute/docs/reference/rest/beta/disks). +and the [API](https://cloud.google.com/compute/docs/reference/rest/v1/disks). ## Example Usage From 4e855008939da95d706d7f75e7cdf0b43ebbb2a4 Mon Sep 17 00:00:00 2001 From: "Stephen Lewis (Burrows)" Date: Mon, 3 Jul 2023 06:53:13 -0700 Subject: [PATCH 31/55] add melinath to vacation list (#8260) --- .ci/containers/membership-checker/membership.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/containers/membership-checker/membership.go b/.ci/containers/membership-checker/membership.go index a1d9a50bf113..3809970cf027 100644 --- a/.ci/containers/membership-checker/membership.go +++ b/.ci/containers/membership-checker/membership.go @@ -30,7 +30,7 @@ var ( trustedContributors = []string{} // This is for reviewers who are "on vacation": will not receive new review assignments but will still receive re-requests for assigned PRs. - onVacationReviewers = []string{} + onVacationReviewers = []string{"melinath"} ) // Check if a user is team member to not request a random reviewer From 12ca26894e7e1fc83959fb67e3a4952e82a6297d Mon Sep 17 00:00:00 2001 From: Sanyam Gupta Date: Tue, 4 Jul 2023 01:17:55 +0530 Subject: [PATCH 32/55] Updated the description for User Managed replication (#8250) --- mmv1/products/secretmanager/Secret.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mmv1/products/secretmanager/Secret.yaml b/mmv1/products/secretmanager/Secret.yaml index 8ba4d23ca267..cb4dee6b7ecf 100644 --- a/mmv1/products/secretmanager/Secret.yaml +++ b/mmv1/products/secretmanager/Secret.yaml @@ -94,7 +94,7 @@ properties: - replication.0.automatic - replication.0.user_managed description: | - The Secret will automatically be replicated without any restrictions. + The Secret will be replicated to the regions specified by the user. properties: - !ruby/object:Api::Type::Array name: replicas From 44080080b07dcf19314c24977f049ae1c9f0ec27 Mon Sep 17 00:00:00 2001 From: Scott Suarez Date: Wed, 5 Jul 2023 10:03:44 -0700 Subject: [PATCH 33/55] Remove generation lines from generate downstream, fix link (#8252) --- .ci/containers/downstream-builder/generate_downstream.sh | 5 ----- docs/content/develop/breaking-changes.md | 2 +- tools/breaking-change-detector/constants/constants.go | 2 +- 3 files changed, 2 insertions(+), 7 deletions(-) diff --git a/.ci/containers/downstream-builder/generate_downstream.sh b/.ci/containers/downstream-builder/generate_downstream.sh index 832d5276f4b9..6f9c7503fe69 100755 --- a/.ci/containers/downstream-builder/generate_downstream.sh +++ b/.ci/containers/downstream-builder/generate_downstream.sh @@ -155,11 +155,6 @@ else fi pushd ../ make tpgtools OUTPUT_PATH=$LOCAL_PATH VERSION=$VERSION - pushd ./tools/breaking-change-detector - set +e - go run . -docs -providerFolder="${LOCAL_PATH}/.github/" - set -e - popd popd fi fi diff --git a/docs/content/develop/breaking-changes.md b/docs/content/develop/breaking-changes.md index a0f7d72bbda1..f0192a635f9f 100644 --- a/docs/content/develop/breaking-changes.md +++ b/docs/content/develop/breaking-changes.md @@ -1,5 +1,5 @@ --- -title: "Understanding breaking changes" +title: "Understand breaking changes" summary: "This page discusses provider versioning, handling of breaking changes, and rare exceptions within Terraform development." weight: 12 --- diff --git a/tools/breaking-change-detector/constants/constants.go b/tools/breaking-change-detector/constants/constants.go index 7bc71249c553..e41faa4a3a57 100644 --- a/tools/breaking-change-detector/constants/constants.go +++ b/tools/breaking-change-detector/constants/constants.go @@ -3,7 +3,7 @@ package constants const BreakingChangeRelativeLocation = "develop/" const BreakingChangeFileName = "breaking-changes" -var docsite = "https://googlecloudplatform.github.io/magic-modules" +var docsite = "https://googlecloudplatform.github.io/magic-modules/" func GetFileUrl(identifier string) string { return docsite + BreakingChangeRelativeLocation + BreakingChangeFileName + "#" + identifier From c763482c7973c306367365255071afdf8094b365 Mon Sep 17 00:00:00 2001 From: Zhenhua Li Date: Wed, 5 Jul 2023 11:38:48 -0700 Subject: [PATCH 34/55] Replace acctest functions (#8239) * Replace ProtoV5ProviderFactories * Replace ProtoV5ProviderBetaFactories * Replace VcrTest * Replace RandString * Replace RandInt * Replace GoogleProviderConfig * Replace AccTestPreCheck * Replace SkipIfVcr * Don't include DCL template * Fix rebasing error --- docs/content/develop/add-handwritten-test.md | 16 +- docs/content/develop/add-mmv1-test.md | 6 +- .../accesscontextmanager/AccessPolicy.yaml | 2 +- mmv1/products/dlp/JobTrigger.yaml | 2 +- mmv1/products/firebase/AndroidApp.yaml | 2 +- .../identityplatform/InboundSamlConfig.yaml | 2 +- .../identityplatform/OauthIdpConfig.yaml | 2 +- .../TenantInboundSamlConfig.yaml | 2 +- .../TenantOauthIdpConfig.yaml | 2 +- mmv1/products/tags/TagBinding.yaml | 6 +- mmv1/products/tags/TagKey.yaml | 2 +- mmv1/products/tags/TagValue.yaml | 4 +- mmv1/provider/terraform/examples.rb | 2 +- .../apigee_addons_override.go.erb | 2 +- .../consumer_quota_override.go.erb | 2 +- .../firebase_database_instance.go.erb | 2 +- .../firestore_field.go.erb | 2 +- .../iam_workforce_pool.go.erb | 2 +- .../iam_workload_identity_pool.go.erb | 2 +- ...iam_workload_identity_pool_provider.go.erb | 2 +- ...ity_platform_project_default_config.go.erb | 2 +- .../monitoring_monitored_project.go.erb | 2 +- .../privateca_certificate.go.erb | 2 +- .../privateca_certificate_authority.go.erb | 2 +- .../storage_hmac_key.go.erb | 2 +- .../base_configs/iam_test_file.go.erb | 48 +- .../examples/base_configs/test_file.go.erb | 10 +- .../terraform/iam/iam_context.go.erb | 4 +- .../framework_provider_test.go.erb | 30 +- ...ta_source_runtimeconfig_config_test.go.erb | 7 +- ..._source_runtimeconfig_variable_test.go.erb | 7 +- .../resource_runtimeconfig_config_test.go.erb | 23 +- ...esource_runtimeconfig_variable_test.go.erb | 29 +- ...ss_approval_folder_service_account_test.go | 6 +- ...roval_organization_service_account_test.go | 4 +- ...s_approval_project_service_account_test.go | 4 +- .../data_source_alloydb_locations_test.go | 6 +- ...e_alloydb_supported_database_flags_test.go | 6 +- ...ource_artifact_registry_repository_test.go | 6 +- .../data_source_certificate_authority_test.go | 6 +- ...e_cloud_identity_group_memberships_test.go | 6 +- .../data_source_cloud_identity_groups_test.go | 6 +- .../data_source_cloud_run_locations_test.go | 4 +- .../data_source_cloud_run_service_test.go | 12 +- .../data_source_compute_health_check_test.go | 6 +- .../data_source_compute_lb_ip_ranges_test.go | 4 +- ...rce_compute_network_endpoint_group_test.go | 6 +- ...ata_source_compute_network_peering_test.go | 6 +- .../data_source_container_registry_test.go | 8 +- ...rce_dataproc_metastore_service_test.go.erb | 6 +- .../tests/data_source_dns_key_test.go.erb | 12 +- .../data_source_dns_managed_zone_test.go.erb | 8 +- .../data_source_dns_record_set_test.go.erb | 10 +- .../data_source_google_active_folder_test.go | 18 +- ...app_engine_default_service_account_test.go | 4 +- ...e_google_beyondcorp_app_connection_test.go | 12 +- ...ce_google_beyondcorp_app_connector_test.go | 24 +- ...urce_google_beyondcorp_app_gateway_test.go | 24 +- ...e_bigquery_default_service_account_test.go | 4 +- ...data_source_google_billing_account_test.go | 18 +- .../data_source_google_client_config_test.go | 8 +- ...urce_google_client_openid_userinfo_test.go | 4 +- ...oud_asset_resources_search_all_test.go.erb | 4 +- ...a_source_google_cloudbuild_trigger_test.go | 6 +- ...ce_google_cloudfunctions2_function_test.go | 8 +- ...rce_google_cloudfunctions_function_test.go | 8 +- ...source_google_composer_environment_test.go | 6 +- ...rce_google_composer_image_versions_test.go | 4 +- ...data_source_google_compute_address_test.go | 8 +- ...ource_google_compute_addresses_test.go.erb | 6 +- ...urce_google_compute_backend_bucket_test.go | 8 +- ...rce_google_compute_backend_service_test.go | 8 +- ...le_compute_default_service_account_test.go | 4 +- .../data_source_google_compute_disk_test.go | 6 +- ...rce_google_compute_forwarding_rule_test.go | 8 +- ...urce_google_compute_global_address_test.go | 6 +- ...urce_google_compute_ha_vpn_gateway_test.go | 6 +- .../data_source_google_compute_image_test.go | 16 +- ...gle_compute_instance_group_manager_test.go | 14 +- ..._google_compute_instance_group_test.go.erb | 18 +- ...oogle_compute_instance_serial_port_test.go | 6 +- ...e_google_compute_instance_template_test.go | 24 +- ...ata_source_google_compute_instance_test.go | 6 +- ...data_source_google_compute_network_test.go | 6 +- ...a_source_google_compute_node_types_test.go | 4 +- ..._compute_region_instance_group_test.go.erb | 8 +- ...mpute_region_instance_template_test.go.erb | 18 +- ...pute_region_network_endpoint_group_test.go | 6 +- ...gle_compute_region_ssl_certificate_test.go | 6 +- ...data_source_google_compute_regions_test.go | 4 +- ...rce_google_compute_resource_policy_test.go | 8 +- ...a_source_google_compute_router_nat_test.go | 6 +- ...ource_google_compute_router_status_test.go | 6 +- .../data_source_google_compute_router_test.go | 6 +- ...ata_source_google_compute_snapshot_test.go | 18 +- ...rce_google_compute_ssl_certificate_test.go | 6 +- ...a_source_google_compute_ssl_policy_test.go | 6 +- ...a_source_google_compute_subnetwork_test.go | 6 +- ..._source_google_compute_vpn_gateway_test.go | 6 +- .../data_source_google_compute_zones_test.go | 8 +- ...ontainer_attached_install_manifest_test.go | 6 +- ...google_container_attached_versions_test.go | 4 +- ...ta_source_google_container_cluster_test.go | 12 +- ...e_google_container_engine_versions_test.go | 8 +- ...ource_google_datastream_static_ips_test.go | 7 +- ...le_firebase_android_app_config_test.go.erb | 6 +- ...ce_google_firebase_android_app_test.go.erb | 6 +- ...ogle_firebase_apple_app_config_test.go.erb | 6 +- ...urce_google_firebase_apple_app_test.go.erb | 6 +- ...oogle_firebase_hosting_channel_test.go.erb | 6 +- ...source_google_firebase_web_app_test.go.erb | 4 +- ..._google_folder_organization_policy_test.go | 6 +- .../tests/data_source_google_folder_test.go | 24 +- .../tests/data_source_google_folders_test.go | 6 +- ...ces_game_server_deployment_rollout_test.go | 6 +- ...gle_global_compute_forwarding_rule_test.go | 8 +- .../tests/data_source_google_iam_role_test.go | 4 +- ...ce_google_iam_testable_permissions_test.go | 4 +- .../data_source_google_kms_crypto_key_test.go | 4 +- ...urce_google_kms_crypto_key_version_test.go | 4 +- .../data_source_google_kms_key_ring_test.go | 4 +- ...e_google_kms_secret_asymmetric_test.go.erb | 16 +- ...ource_google_kms_secret_ciphertext_test.go | 6 +- .../data_source_google_kms_secret_test.go | 22 +- ...ogle_logging_project_cmek_settings_test.go | 6 +- .../data_source_google_logging_sink_test.go | 8 +- ...google_monitoring_uptime_check_ips_test.go | 4 +- ...a_source_google_netblock_ip_ranges_test.go | 4 +- .../data_source_google_organization_test.go | 14 +- ...google_project_organization_policy_test.go | 4 +- ...data_source_google_project_service_test.go | 6 +- .../tests/data_source_google_project_test.go | 6 +- .../tests/data_source_google_projects_test.go | 4 +- ...oogle_service_account_access_token_test.go | 4 +- ...ce_google_service_account_id_token_test.go | 4 +- ..._source_google_service_account_jwt_test.go | 2 +- ..._source_google_service_account_key_test.go | 6 +- ...data_source_google_service_account_test.go | 6 +- ...rvice_networking_peered_dns_domain_test.go | 8 +- .../data_source_google_sql_ca_certs_test.go | 6 +- .../data_source_google_sql_tiers_test.go | 4 +- .../data_source_google_storage_bucket_test.go | 6 +- ...le_storage_project_service_account_test.go | 4 +- ...e_transfer_project_service_account_test.go | 4 +- ...ce_google_vmwareengine_network_test.go.erb | 6 +- ...orkload_identity_pool_provider_test.go.erb | 6 +- ...am_beta_workload_identity_pool_test.go.erb | 6 +- .../tests/data_source_iap_client_test.go | 6 +- ...ce_monitoring_notification_channel_test.go | 40 +- .../data_source_monitoring_service_test.go | 4 +- .../data_source_pubsub_subscription_test.go | 12 +- .../tests/data_source_pubsub_topic_test.go | 12 +- .../tests/data_source_redis_instance_test.go | 6 +- .../data_source_secret_manager_secret_test.go | 6 +- ...cret_manager_secret_version_access_test.go | 12 +- ...urce_secret_manager_secret_version_test.go | 12 +- .../data_source_sourcerepo_repository_test.go | 6 +- .../data_source_spanner_instance_test.go | 6 +- .../tests/data_source_sql_backup_run_test.go | 10 +- .../data_source_sql_database_instance_test.go | 6 +- ...data_source_sql_database_instances_test.go | 24 +- .../tests/data_source_sql_database_test.go | 6 +- .../tests/data_source_sql_databases_test.go | 6 +- ...urce_storage_bucket_object_content_test.go | 6 +- ...a_source_storage_object_signed_url_test.go | 10 +- .../tests/data_source_tags_tag_key_test.go | 12 +- .../tests/data_source_tags_tag_value_test.go | 16 +- ...ata_source_tpu_tensorflow_versions_test.go | 4 +- .../tests/data_source_vertex_ai_index_test.go | 6 +- .../data_source_vpc_access_connector_test.go | 6 +- .../terraform/tests/iam_scc_source_test.go | 18 +- ...ce_access_approval_folder_settings_test.go | 6 +- ...ess_approval_organization_settings_test.go | 6 +- ...e_access_approval_project_settings_test.go | 6 +- ...ext_manager_access_level_condition_test.go | 10 +- ...s_context_manager_access_level_test.go.erb | 14 +- ...cess_context_manager_access_levels_test.go | 6 +- ..._context_manager_access_policy_iam_test.go | 20 +- ..._context_manager_access_policy_test.go.erb | 10 +- ...ntext_manager_authorized_orgs_desc_test.go | 6 +- ...xt_manager_gcp_user_access_binding_test.go | 8 +- ...er_service_perimeter_egress_policy_test.go | 8 +- ...r_service_perimeter_ingress_policy_test.go | 8 +- ...manager_service_perimeter_resource_test.go | 6 +- ...text_manager_service_perimeter_test.go.erb | 10 +- ...ontext_manager_services_perimeters_test.go | 6 +- ...urce_active_directory_domain_trust_test.go | 8 +- ...rce_active_directory_domain_update_test.go | 8 +- .../tests/resource_alloydb_backup_test.go | 20 +- .../tests/resource_alloydb_cluster_test.go | 62 +- .../tests/resource_alloydb_instance_test.go | 30 +- ...esource_api_gateway_api_config_test.go.erb | 12 +- .../resource_api_gateway_api_test.go.erb | 6 +- .../resource_api_gateway_gateway_test.go.erb | 6 +- ...e_apigee_env_keystore_alias_pkcs12_test.go | 8 +- ..._apigee_environment_nodeconfig_test.go.erb | 6 +- .../tests/resource_apigee_flowhook_test.go | 8 +- ...ee_keystores_aliases_key_cert_file_test.go | 8 +- ...ource_apigee_sharedflow_deployment_test.go | 8 +- .../tests/resource_apigee_sharedflow_test.go | 8 +- ...resource_apigee_sync_authorization_test.go | 6 +- .../resource_app_engine_application_test.go | 12 +- ...resource_app_engine_domain_mapping_test.go | 6 +- ...ce_app_engine_flexible_app_version_test.go | 6 +- ...pp_engine_service_network_settings_test.go | 6 +- ...ce_app_engine_standard_app_version_test.go | 6 +- ...e_artifact_registry_repository_test.go.erb | 36 +- ...resource_beyondcorp_app_connection_test.go | 6 +- .../resource_beyondcorp_app_connector_test.go | 6 +- .../tests/resource_big_query_dataset_test.go | 38 +- .../tests/resource_big_query_routine_test.go | 8 +- ...rce_bigquery_analytics_hub_listing_test.go | 6 +- .../resource_bigquery_connection_test.go | 12 +- ...urce_bigquery_data_transfer_config_test.go | 48 +- ...ce_bigquery_datapolicy_data_policy_test.go | 6 +- .../resource_bigquery_dataset_access_test.go | 70 +- ...source_bigquery_dataset_iam_member_test.go | 8 +- .../resource_bigquery_dataset_iam_test.go | 24 +- .../tests/resource_bigquery_job_test.go | 6 +- .../tests/resource_bigquery_table_test.go | 226 +++--- .../resource_bigtable_app_profile_test.go | 24 +- .../tests/resource_bigtable_gc_policy_test.go | 70 +- .../resource_bigtable_instance_iam_test.go | 30 +- .../tests/resource_bigtable_instance_test.go | 62 +- .../tests/resource_bigtable_table_iam_test.go | 30 +- .../tests/resource_bigtable_table_test.go | 70 +- .../tests/resource_billing_budget_test.go | 26 +- ..._binary_authorization_attestor_test.go.erb | 24 +- ...ce_binary_authorization_policy_test.go.erb | 38 +- ...tificate_manager_dns_authorization_test.go | 6 +- ...ificatemanager_certificate_upgrade_test.go | 8 +- ...loud_identity_group_membership_test.go.erb | 48 +- .../resource_cloud_identity_group_test.go.erb | 14 +- .../resource_cloud_iot_device_update_test.go | 8 +- .../resource_cloud_run_domain_mapping_test.go | 6 +- .../resource_cloud_run_service_test.go.erb | 38 +- .../tests/resource_cloud_run_v2_job_test.go | 6 +- .../resource_cloud_run_v2_service_test.go | 26 +- .../resource_cloud_scheduler_job_test.go | 6 +- .../resource_cloud_tasks_queue_test.go.erb | 18 +- .../tests/resource_cloudbuild_trigger_test.go | 52 +- ...esource_cloudbuild_trigger_upgrade_test.go | 4 +- ...esource_cloudbuild_worker_pool_test.go.erb | 14 +- .../resource_cloudfunction2_function_test.go | 12 +- ...source_cloudfunctions_function_test.go.erb | 118 +-- .../tests/resource_cloudids_endpoint_test.go | 8 +- ...ce_cloudiot_device_registry_update_test.go | 12 +- .../resource_composer_environment_test.go.erb | 226 +++--- .../tests/resource_compute_address_test.go | 12 +- .../resource_compute_attached_disk_test.go | 36 +- .../resource_compute_autoscaler_test.go.erb | 72 +- ...pute_backend_bucket_signed_url_key_test.go | 8 +- .../resource_compute_backend_bucket_test.go | 34 +- ...ute_backend_service_signed_url_key_test.go | 8 +- ...source_compute_backend_service_test.go.erb | 226 +++--- ...compute_disk_async_replication_test.go.erb | 15 +- ...te_disk_resource_policy_attachment_test.go | 10 +- .../tests/resource_compute_disk_test.go.erb | 100 +-- ...ompute_firewall_policy_association_test.go | 6 +- ...e_compute_firewall_policy_rule_test.go.erb | 12 +- ...source_compute_firewall_policy_test.go.erb | 8 +- .../resource_compute_firewall_test.go.erb | 84 +- ...source_compute_forwarding_rule_test.go.erb | 62 +- ...esource_compute_global_address_test.go.erb | 12 +- ...compute_global_forwarding_rule_test.go.erb | 64 +- ...ompute_global_network_endpoint_test.go.erb | 6 +- .../resource_compute_health_check_test.go.erb | 42 +- ...urce_compute_http_health_check_test.go.erb | 8 +- ...esource_compute_https_health_check_test.go | 6 +- .../tests/resource_compute_image_test.go.erb | 50 +- ...te_instance_from_machine_image_test.go.erb | 28 +- ...compute_instance_from_template_test.go.erb | 88 +- ...compute_instance_group_manager_test.go.erb | 116 +-- ...esource_compute_instance_group_test.go.erb | 46 +- .../resource_compute_instance_iam_test.go | 6 +- ...ource_compute_instance_migrate_test.go.erb | 26 +- ...urce_compute_instance_template_test.go.erb | 272 +++---- .../resource_compute_instance_test.go.erb | 552 ++++++------- ..._network_edge_security_service_test.go.erb | 11 +- ...compute_network_endpoint_group_test.go.erb | 12 +- ...ource_compute_network_endpoint_test.go.erb | 8 +- ...urce_compute_network_endpoints_test.go.erb | 8 +- .../resource_compute_network_peering_test.go | 44 +- .../resource_compute_network_test.go.erb | 48 +- .../resource_compute_node_group_test.go.erb | 8 +- ...anization_security_policy_rule_test.go.erb | 6 +- ...e_organization_security_policy_test.go.erb | 6 +- ...ce_compute_per_instance_config_test.go.erb | 44 +- ...mpute_project_default_network_tier_test.go | 12 +- ...urce_compute_project_metadata_item_test.go | 34 +- .../resource_compute_project_metadata_test.go | 20 +- ...e_compute_public_advertised_prefix_test.go | 16 +- ...urce_compute_region_autoscaler_test.go.erb | 48 +- ...compute_region_backend_service_test.go.erb | 92 +-- .../resource_compute_region_disk_test.go.erb | 44 +- ...ce_compute_region_health_check_test.go.erb | 42 +- ..._region_instance_group_manager_test.go.erb | 96 +-- ...mpute_region_instance_template_test.go.erb | 254 +++--- ..._region_network_endpoint_group_test.go.erb | 6 +- ...ute_region_per_instance_config_test.go.erb | 42 +- ...compute_region_security_policy_test.go.erb | 6 +- ...urce_compute_region_ssl_policy_test.go.erb | 20 +- ...mpute_region_target_http_proxy_test.go.erb | 14 +- ...pute_region_target_https_proxy_test.go.erb | 6 +- ...ompute_region_target_tcp_proxy_test.go.erb | 12 +- ...esource_compute_region_url_map_test.go.erb | 48 +- .../resource_compute_reservation_test.go | 6 +- .../resource_compute_resource_policy_test.go | 6 +- .../tests/resource_compute_route_test.go | 14 +- .../resource_compute_router_bgp_peer_test.go | 54 +- .../resource_compute_router_interface_test.go | 30 +- .../resource_compute_router_nat_test.go.erb | 50 +- .../tests/resource_compute_router_test.go | 30 +- ...source_compute_security_policy_test.go.erb | 118 +-- ...esource_compute_service_attachment_test.go | 6 +- ..._compute_shared_reservation_update_test.go | 6 +- .../tests/resource_compute_shared_vpc_test.go | 12 +- .../tests/resource_compute_snapshot_test.go | 16 +- .../resource_compute_ssl_certificate_test.go | 6 +- .../resource_compute_ssl_policy_test.go.erb | 20 +- .../resource_compute_subnetwork_iam_test.go | 8 +- .../resource_compute_subnetwork_test.go.erb | 54 +- ...resource_compute_target_grpc_proxy_test.go | 14 +- ...resource_compute_target_http_proxy_test.go | 16 +- ...rce_compute_target_https_proxy_test.go.erb | 18 +- .../resource_compute_target_pool_test.go | 20 +- ...ource_compute_target_ssl_proxy_test.go.erb | 28 +- .../resource_compute_target_tcp_proxy_test.go | 12 +- .../resource_compute_url_map_test.go.erb | 82 +- .../tests/resource_compute_vpn_tunnel_test.go | 20 +- ...urce_container_analysis_occurrence_test.go | 12 +- ..._container_attached_cluster_update_test.go | 6 +- .../resource_container_cluster_test.go.erb | 750 +++++++++--------- .../resource_container_node_pool_test.go.erb | 330 ++++---- .../tests/resource_container_registry_test.go | 10 +- ...esource_containeranalysis_note_test.go.erb | 18 +- .../resource_data_catalog_entry_group_test.go | 6 +- .../tests/resource_data_catalog_entry_test.go | 6 +- ...resource_data_catalog_tag_template_test.go | 6 +- .../tests/resource_data_catalog_tag_test.go | 6 +- .../resource_data_fusion_instance_test.go | 20 +- ...oss_prevention_deidentify_template_test.go | 70 +- ...a_loss_prevention_inspect_template_test.go | 22 +- ...e_data_loss_prevention_job_trigger_test.go | 56 +- ...a_loss_prevention_stored_info_type_test.go | 16 +- ...gration_service_connection_profile_test.go | 6 +- ...rce_dataflow_flex_template_job_test.go.erb | 72 +- .../tests/resource_dataflow_job_test.go.erb | 88 +- .../resource_dataform_repository_test.go.erb | 6 +- .../resource_dataproc_cluster_iam_test.go | 24 +- .../resource_dataproc_cluster_test.go.erb | 196 ++--- .../tests/resource_dataproc_job_iam_test.go | 30 +- .../tests/resource_dataproc_job_test.go.erb | 58 +- ...rce_dataproc_metastore_service_test.go.erb | 12 +- ...rce_dataproc_workflow_template_test.go.erb | 14 +- ...urce_datastream_connection_profile_test.go | 6 +- .../tests/resource_datastream_stream_test.go | 6 +- ...urce_deployment_manager_deployment_test.go | 38 +- .../resource_dialogflow_agent_test.go.erb | 6 +- ...esource_dialogflow_entity_type_test.go.erb | 6 +- ...esource_dialogflow_fulfillment_test.go.erb | 6 +- .../resource_dialogflow_intent_test.go.erb | 12 +- .../resource_dialogflowcx_agent_test.go.erb | 6 +- .../resource_dialogflowcx_entity_type_test.go | 6 +- .../resource_dialogflowcx_environment_test.go | 20 +- .../tests/resource_dialogflowcx_flow_test.go | 6 +- .../resource_dialogflowcx_intent_test.go | 6 +- .../tests/resource_dialogflowcx_page_test.go | 6 +- .../resource_dialogflowcx_version_test.go.erb | 14 +- .../resource_dialogflowcx_webhook_test.go | 6 +- .../resource_dns_managed_zone_test.go.erb | 56 +- .../tests/resource_dns_policy_test.go.erb | 6 +- .../tests/resource_dns_record_set_test.go.erb | 76 +- ...ource_dns_response_policy_rule_test.go.erb | 12 +- .../resource_dns_response_policy_test.go.erb | 6 +- .../tests/resource_endpoints_service_test.go | 16 +- ...esource_essential_contacts_contact_test.go | 6 +- .../resource_eventarc_channel_test.go.erb | 14 +- ...eventarc_google_channel_config_test.go.erb | 14 +- .../resource_eventarc_trigger_test.go.erb | 8 +- .../tests/resource_filestore_backup_test.go | 8 +- .../tests/resource_filestore_instance_test.go | 12 +- ...ce_firebase_android_app_update_test.go.erb | 8 +- ...urce_firebase_apple_app_update_test.go.erb | 6 +- ...rce_firebase_database_instance_test.go.erb | 6 +- ...e_firebase_extensions_instance_test.go.erb | 6 +- ...ource_firebase_hosting_channel_test.go.erb | 6 +- ...resource_firebase_hosting_site_test.go.erb | 6 +- .../resource_firebase_project_test.go.erb | 6 +- .../resource_firebase_web_app_test.go.erb | 16 +- ...urce_firestore_database_update_test.go.erb | 6 +- .../tests/resource_firestore_document_test.go | 6 +- .../tests/resource_firestore_field_test.go | 10 +- ...esource_gke_backup_backup_plan_test.go.erb | 6 +- .../resource_gke_hub_feature_iam_test.go.erb | 24 +- ...rce_gke_hub_feature_membership_test.go.erb | 28 +- .../resource_gke_hub_feature_test.go.erb | 20 +- ...e_gkeonprem_bare_metal_cluster_test.go.erb | 18 +- ...gkeonprem_bare_metal_node_pool_test.go.erb | 6 +- ...ource_gkeonprem_vmware_cluster_test.go.erb | 12 +- ...rce_gkeonprem_vmware_node_pool_test.go.erb | 6 +- ...esource_google_billing_account_iam_test.go | 10 +- ...resource_google_billing_subaccount_test.go | 8 +- ...rce_google_folder_iam_audit_config_test.go | 48 +- ...resource_google_folder_iam_binding_test.go | 32 +- .../resource_google_folder_iam_member_test.go | 18 +- .../resource_google_folder_iam_policy_test.go | 16 +- ..._google_folder_organization_policy_test.go | 40 +- .../tests/resource_google_folder_test.go | 20 +- ...ogle_organization_iam_audit_config_test.go | 32 +- ...oogle_organization_iam_custom_role_test.go | 24 +- .../resource_google_organization_iam_test.go | 32 +- ...esource_google_organization_policy_test.go | 32 +- ...e_project_default_service_accounts_test.go | 34 +- ...ce_google_project_iam_audit_config_test.go | 48 +- ...rce_google_project_iam_binding_test.go.erb | 48 +- ...rce_google_project_iam_custom_role_test.go | 22 +- ...urce_google_project_iam_member_test.go.erb | 30 +- ...urce_google_project_iam_policy_test.go.erb | 44 +- ...google_project_organization_policy_test.go | 32 +- .../resource_google_project_service_test.go | 26 +- .../tests/resource_google_project_test.go | 52 +- ...e_security_scanner_scan_config_test.go.erb | 8 +- ...rce_google_service_account_iam_test.go.erb | 74 +- ...esource_google_service_account_key_test.go | 20 +- .../resource_google_service_account_test.go | 12 +- ...rvice_networking_peered_dns_domain_test.go | 8 +- ..._usage_consumer_quota_override_test.go.erb | 6 +- .../resource_healthcare_dataset_iam_test.go | 26 +- .../tests/resource_healthcare_dataset_test.go | 8 +- ...esource_healthcare_dicom_store_iam_test.go | 36 +- .../resource_healthcare_dicom_store_test.go | 12 +- ...resource_healthcare_fhir_store_iam_test.go | 36 +- .../resource_healthcare_fhir_store_test.go | 12 +- ...source_healthcare_hl7_v2_store_iam_test.go | 36 +- ...source_healthcare_hl7_v2_store_test.go.erb | 20 +- ...esource_iam_access_boundary_policy_test.go | 8 +- ...orkload_identity_pool_provider_test.go.erb | 12 +- ...am_beta_workload_identity_pool_test.go.erb | 12 +- .../resource_iam_deny_policy_test.go.erb | 12 +- ...e_pool_workforce_pool_provider_test.go.erb | 14 +- ..._workforce_pool_workforce_pool_test.go.erb | 12 +- .../tests/resource_iap_brand_test.go | 6 +- ...tform_default_supported_idp_config_test.go | 8 +- ...ntity_platform_inbound_saml_config_test.go | 6 +- ...identity_platform_oauth_idp_config_test.go | 6 +- ...enant_default_supported_idp_config_test.go | 6 +- ...latform_tenant_indound_saml_config_test.go | 6 +- ...y_platform_tenant_oauth_idp_config_test.go | 6 +- .../resource_identity_platform_tenant_test.go | 6 +- .../resource_kms_crypto_key_iam_test.go.erb | 78 +- .../tests/resource_kms_crypto_key_test.go | 84 +- .../resource_kms_key_ring_iam_test.go.erb | 62 +- .../resource_kms_key_ring_import_job_test.go | 6 +- .../tests/resource_kms_key_ring_test.go | 8 +- .../resource_kms_secret_ciphertext_test.go | 8 +- ..._logging_billing_account_exclusion_test.go | 26 +- ...ource_logging_billing_account_sink_test.go | 54 +- .../resource_logging_bucket_config_test.go | 68 +- .../resource_logging_folder_exclusion_test.go | 42 +- .../resource_logging_folder_sink_test.go | 86 +- .../tests/resource_logging_log_view_test.go | 6 +- .../tests/resource_logging_metric_test.go | 24 +- ...rce_logging_organization_exclusion_test.go | 26 +- ...resource_logging_organization_sink_test.go | 54 +- ...resource_logging_project_exclusion_test.go | 26 +- .../resource_logging_project_sink_test.go | 74 +- .../tests/resource_memcache_instance_test.go | 6 +- .../resource_monitoring_alert_policy_test.go | 52 +- .../resource_monitoring_dashboard_test.go | 18 +- .../tests/resource_monitoring_group_test.go | 4 +- ...ource_monitoring_metric_descriptor_test.go | 4 +- ...ce_monitoring_notification_channel_test.go | 20 +- .../tests/resource_monitoring_service_test.go | 6 +- .../tests/resource_monitoring_slo_test.go | 44 +- ...rce_monitoring_uptime_check_config_test.go | 24 +- ...agement_connectivity_test_resource_test.go | 6 +- ...etwork_security_address_groups_test.go.erb | 6 +- ..._security_authorization_policy_test.go.erb | 9 +- ...ork_security_client_tls_policy_test.go.erb | 9 +- ...gateway_security_policies_rule_test.go.erb | 8 +- ...rity_gateway_security_policies_test.go.erb | 6 +- ...ork_security_server_tls_policy_test.go.erb | 9 +- ...security_tls_inspection_policy_test.go.erb | 13 +- ...rce_network_security_url_lists_test.go.erb | 6 +- ...network_services_edge_cache_keyset_test.go | 6 +- ...network_services_edge_cache_origin_test.go | 6 +- ...etwork_services_edge_cache_service_test.go | 10 +- ...twork_services_endpoint_policy_test.go.erb | 6 +- ...ource_network_services_gateway_test.go.erb | 92 +-- ...ce_network_services_grpc_route_test.go.erb | 9 +- ...ce_network_services_http_route_test.go.erb | 6 +- ...resource_network_services_mesh_test.go.erb | 6 +- ...twork_services_service_binding_test.go.erb | 10 +- ...rce_network_services_tcp_route_test.go.erb | 10 +- ...rce_network_services_tls_route_test.go.erb | 10 +- ...resource_notebooks_environment_test.go.erb | 7 +- ...e_notebooks_instance_container_test.go.erb | 7 +- ...esource_notebooks_instance_gpu_test.go.erb | 7 +- .../resource_notebooks_instance_test.go.erb | 12 +- .../resource_notebooks_runtime_test.go.erb | 6 +- ...e_org_policy_custom_constraint_test.go.erb | 6 +- ...os_config_os_policy_assignment_test.go.erb | 8 +- .../resource_os_login_ssh_public_key_test.go | 6 +- .../resource_privateca_ca_pool_iam_test.go | 8 +- .../tests/resource_privateca_ca_pool_test.go | 24 +- ...ce_privateca_certificate_authority_test.go | 12 +- .../resource_privateca_certificate_test.go | 6 +- ...ource_project_service_identity_test.go.erb | 4 +- .../resource_pubsub_lite_subscription_test.go | 8 +- .../tests/resource_pubsub_lite_topic_test.go | 6 +- .../tests/resource_pubsub_schema_test.go | 6 +- .../resource_pubsub_subscription_iam_test.go | 32 +- .../resource_pubsub_subscription_test.go | 44 +- .../tests/resource_pubsub_topic_iam_test.go | 34 +- .../tests/resource_pubsub_topic_test.go | 22 +- .../tests/resource_redis_instance_test.go | 36 +- .../resource_resourcemanager_lien_test.go | 10 +- .../resource_scc_notification_config_test.go | 6 +- ...resource_secret_manager_secret_test.go.erb | 12 +- ..._secret_manager_secret_version_test.go.erb | 6 +- .../resource_security_center_source_test.go | 6 +- ...rce_service_directory_endpoint_test.go.erb | 6 +- ...ce_service_directory_namespace_test.go.erb | 6 +- ...urce_service_directory_service_test.go.erb | 6 +- ...urce_service_networking_connection_test.go | 16 +- .../resource_sourcerepo_repository_test.go | 16 +- .../resource_spanner_database_iam_test.go | 30 +- .../resource_spanner_database_test.go.erb | 30 +- .../resource_spanner_instance_iam_test.go | 24 +- .../tests/resource_spanner_instance_test.go | 32 +- .../resource_sql_database_instance_test.go | 370 ++++----- .../tests/resource_sql_database_test.go | 20 +- .../tests/resource_sql_ssl_cert_test.go | 16 +- .../terraform/tests/resource_sql_user_test.go | 42 +- ...urce_storage_bucket_access_control_test.go | 4 +- .../tests/resource_storage_bucket_acl_test.go | 34 +- .../tests/resource_storage_bucket_iam_test.go | 8 +- .../resource_storage_bucket_object_test.go | 54 +- .../tests/resource_storage_bucket_test.go.erb | 168 ++-- ...rage_default_object_access_control_test.go | 4 +- ...esource_storage_default_object_acl_test.go | 26 +- .../tests/resource_storage_hmac_key_test.go | 6 +- .../resource_storage_notification_test.go | 16 +- ...urce_storage_object_access_control_test.go | 12 +- .../tests/resource_storage_object_acl_test.go | 38 +- ...source_storage_transfer_agent_pool_test.go | 12 +- .../resource_storage_transfer_job_test.go | 90 +-- .../terraform/tests/resource_tags_test.go | 114 +-- .../terraform/tests/resource_tpu_node_test.go | 6 +- .../resource_usage_export_bucket_test.go | 6 +- .../tests/resource_vertex_ai_endpoint_test.go | 10 +- .../resource_vertex_ai_index_endpoint_test.go | 6 +- .../tests/resource_vertex_ai_index_test.go | 8 +- ...ource_vertex_ai_metadata_store_test.go.erb | 8 +- .../resource_vertex_ai_tensorboard_test.go | 6 +- .../resource_vmwareengine_cluster_test.go.erb | 8 +- .../resource_vmwareengine_network_test.go.erb | 6 +- ...rce_vmwareengine_private_cloud_test.go.erb | 8 +- .../resource_vpc_access_connector_test.go | 6 +- .../tests/resource_workflows_workflow_test.go | 12 +- ...rkstations_workstation_cluster_test.go.erb | 6 +- ...orkstations_workstation_config_test.go.erb | 48 +- ...ource_workstations_workstation_test.go.erb | 6 +- .../terraform/utils/provider_test.go.erb | 32 +- .../third_party/terraform/utils/utils_test.go | 23 +- 566 files changed, 6655 insertions(+), 6647 deletions(-) diff --git a/docs/content/develop/add-handwritten-test.md b/docs/content/develop/add-handwritten-test.md index 339665d8b533..04765285c846 100644 --- a/docs/content/develop/add-handwritten-test.md +++ b/docs/content/develop/add-handwritten-test.md @@ -63,12 +63,12 @@ For example, the following test case is a good reference: func TestAccComputeFirewall_noSource(t *testing.T) { t.Parallel() - networkName := fmt.Sprintf("tf-test-firewall-%s", RandString(t, 10)) - firewallName := fmt.Sprintf("tf-test-firewall-%s", RandString(t, 10)) + networkName := fmt.Sprintf("tf-test-firewall-%s", acctest.RandString(t, 10)) + firewallName := fmt.Sprintf("tf-test-firewall-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeFirewallDestroyProducer(t), Steps: []resource.TestStep{ { @@ -127,12 +127,12 @@ For example: func TestAccComputeFirewall_disabled(t *testing.T) { t.Parallel() - networkName := fmt.Sprintf("tf-test-firewall-%s", RandString(t, 10)) - firewallName := fmt.Sprintf("tf-test-firewall-%s", RandString(t, 10)) + networkName := fmt.Sprintf("tf-test-firewall-%s", acctest.RandString(t, 10)) + firewallName := fmt.Sprintf("tf-test-firewall-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeFirewallDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/docs/content/develop/add-mmv1-test.md b/docs/content/develop/add-mmv1-test.md index d0bf2a096f4d..89710c1db8c8 100644 --- a/docs/content/develop/add-mmv1-test.md +++ b/docs/content/develop/add-mmv1-test.md @@ -109,12 +109,12 @@ func TestAccPubsubSubscription_pubsubSubscriptionDeadLetterExample(t *testing.T) t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckPubsubSubscriptionDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/products/accesscontextmanager/AccessPolicy.yaml b/mmv1/products/accesscontextmanager/AccessPolicy.yaml index 3eaf51d4dbeb..bbde50dc8d95 100644 --- a/mmv1/products/accesscontextmanager/AccessPolicy.yaml +++ b/mmv1/products/accesscontextmanager/AccessPolicy.yaml @@ -56,7 +56,7 @@ examples: primary_resource_id: 'access-policy' test_env_vars: org_id: :ORG_ID - project: '"acm-tf-test-" + RandString(t, 10)' + project: '"acm-tf-test-" + acctest.RandString(t, 10)' # Skipping the sweeper due to the non-standard base_url skip_sweeper: true custom_code: !ruby/object:Provider::Terraform::CustomCode diff --git a/mmv1/products/dlp/JobTrigger.yaml b/mmv1/products/dlp/JobTrigger.yaml index 9c2c0c160fa2..6733578bdc8e 100644 --- a/mmv1/products/dlp/JobTrigger.yaml +++ b/mmv1/products/dlp/JobTrigger.yaml @@ -78,7 +78,7 @@ examples: test_env_vars: project: :PROJECT_NAME test_vars_overrides: - name: '"tf_test_" + RandString(t, 10)' + name: '"tf_test_" + acctest.RandString(t, 10)' - !ruby/object:Provider::Terraform::Examples name: 'dlp_job_trigger_hybrid' primary_resource_id: 'hybrid_trigger' diff --git a/mmv1/products/firebase/AndroidApp.yaml b/mmv1/products/firebase/AndroidApp.yaml index fa70c47b5984..17f46aeb37f2 100644 --- a/mmv1/products/firebase/AndroidApp.yaml +++ b/mmv1/products/firebase/AndroidApp.yaml @@ -67,7 +67,7 @@ examples: org_id: :ORG_ID project_id: :PROJECT_NAME test_vars_overrides: - package_name: '"android.package.app" + RandString(t, 4)' + package_name: '"android.package.app" + acctest.RandString(t, 4)' display_name: '"tf-test Display Name Basic"' ignore_read_extra: - project diff --git a/mmv1/products/identityplatform/InboundSamlConfig.yaml b/mmv1/products/identityplatform/InboundSamlConfig.yaml index f7a7fae589a1..2a2a97fb3403 100644 --- a/mmv1/products/identityplatform/InboundSamlConfig.yaml +++ b/mmv1/products/identityplatform/InboundSamlConfig.yaml @@ -33,7 +33,7 @@ examples: idp_entity_id: tf-idp sp_entity_id: tf-sp test_vars_overrides: - name: '"saml.tf-config-" + RandString(t, 10)' + name: '"saml.tf-config-" + acctest.RandString(t, 10)' properties: - !ruby/object:Api::Type::String name: 'name' diff --git a/mmv1/products/identityplatform/OauthIdpConfig.yaml b/mmv1/products/identityplatform/OauthIdpConfig.yaml index 7925dd487993..1aa6a070ab8e 100644 --- a/mmv1/products/identityplatform/OauthIdpConfig.yaml +++ b/mmv1/products/identityplatform/OauthIdpConfig.yaml @@ -31,7 +31,7 @@ examples: vars: name: oidc.oauth-idp-config test_vars_overrides: - name: '"oidc.oauth-idp-config-" + RandString(t, 10)' + name: '"oidc.oauth-idp-config-" + acctest.RandString(t, 10)' properties: - !ruby/object:Api::Type::String name: 'name' diff --git a/mmv1/products/identityplatform/TenantInboundSamlConfig.yaml b/mmv1/products/identityplatform/TenantInboundSamlConfig.yaml index e07dc3894879..b78f545d3fb2 100644 --- a/mmv1/products/identityplatform/TenantInboundSamlConfig.yaml +++ b/mmv1/products/identityplatform/TenantInboundSamlConfig.yaml @@ -33,7 +33,7 @@ examples: idp_entity_id: tf-idp sp_entity_id: tf-sp test_vars_overrides: - name: '"saml.tf-config-" + RandString(t, 10)' + name: '"saml.tf-config-" + acctest.RandString(t, 10)' properties: - !ruby/object:Api::Type::String name: 'name' diff --git a/mmv1/products/identityplatform/TenantOauthIdpConfig.yaml b/mmv1/products/identityplatform/TenantOauthIdpConfig.yaml index b5d24be87f3b..4906dcb1742b 100644 --- a/mmv1/products/identityplatform/TenantOauthIdpConfig.yaml +++ b/mmv1/products/identityplatform/TenantOauthIdpConfig.yaml @@ -31,7 +31,7 @@ examples: vars: name: oidc.oauth-idp-config test_vars_overrides: - name: '"oidc.oauth-idp-config-" + RandString(t, 10)' + name: '"oidc.oauth-idp-config-" + acctest.RandString(t, 10)' properties: - !ruby/object:Api::Type::String name: 'name' diff --git a/mmv1/products/tags/TagBinding.yaml b/mmv1/products/tags/TagBinding.yaml index 37f1cd141ebf..7b0c0a38360b 100644 --- a/mmv1/products/tags/TagBinding.yaml +++ b/mmv1/products/tags/TagBinding.yaml @@ -43,9 +43,9 @@ examples: value_short_name: 'valuename' project_id: project_id test_vars_overrides: - key_short_name: '"tf-test-key-" + RandString(t, 10)' - value_short_name: '"tf-test-value-" + RandString(t, 10)' - project_id: '"tf-test-" + RandString(t, 10)' + key_short_name: '"tf-test-key-" + acctest.RandString(t, 10)' + value_short_name: '"tf-test-value-" + acctest.RandString(t, 10)' + project_id: '"tf-test-" + acctest.RandString(t, 10)' test_env_vars: org_id: :ORG_ID properties: diff --git a/mmv1/products/tags/TagKey.yaml b/mmv1/products/tags/TagKey.yaml index 2604c6acd375..8c6b64c87198 100644 --- a/mmv1/products/tags/TagKey.yaml +++ b/mmv1/products/tags/TagKey.yaml @@ -39,7 +39,7 @@ examples: vars: short_name: 'keyname' test_vars_overrides: - short_name: '"tf-test-key-" + RandString(t, 10)' + short_name: '"tf-test-key-" + acctest.RandString(t, 10)' test_env_vars: org_id: :ORG_ID properties: diff --git a/mmv1/products/tags/TagValue.yaml b/mmv1/products/tags/TagValue.yaml index 5dadcb76ab4d..228d8b1ddbb1 100644 --- a/mmv1/products/tags/TagValue.yaml +++ b/mmv1/products/tags/TagValue.yaml @@ -42,8 +42,8 @@ examples: key_short_name: 'keyname' value_short_name: 'valuename' test_vars_overrides: - key_short_name: '"tf-test-key-" + RandString(t, 10)' - value_short_name: '"tf-test-value-" + RandString(t, 10)' + key_short_name: '"tf-test-key-" + acctest.RandString(t, 10)' + value_short_name: '"tf-test-value-" + acctest.RandString(t, 10)' test_env_vars: org_id: :ORG_ID properties: diff --git a/mmv1/provider/terraform/examples.rb b/mmv1/provider/terraform/examples.rb index 1aa8e268e2ed..2ffe90ca0222 100644 --- a/mmv1/provider/terraform/examples.rb +++ b/mmv1/provider/terraform/examples.rb @@ -77,7 +77,7 @@ class Examples < Api::Object # - tests config will have `"network = my-vpc%{random_suffix}"` # with context # map[string]interface{}{ - # "random_suffix": RandString() + # "random_suffix": acctest.RandString() # } # # If test_vars_overrides["network"] = "nameOfVpc()" diff --git a/mmv1/templates/terraform/custom_check_destroy/apigee_addons_override.go.erb b/mmv1/templates/terraform/custom_check_destroy/apigee_addons_override.go.erb index 59c804be2d17..715193bffcca 100644 --- a/mmv1/templates/terraform/custom_check_destroy/apigee_addons_override.go.erb +++ b/mmv1/templates/terraform/custom_check_destroy/apigee_addons_override.go.erb @@ -1,4 +1,4 @@ -config := GoogleProviderConfig(t) +config := acctest.GoogleProviderConfig(t) url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{ApigeeBasePath}}organizations/{{org}}") if err != nil { diff --git a/mmv1/templates/terraform/custom_check_destroy/consumer_quota_override.go.erb b/mmv1/templates/terraform/custom_check_destroy/consumer_quota_override.go.erb index b02578798b71..9968e9246b22 100644 --- a/mmv1/templates/terraform/custom_check_destroy/consumer_quota_override.go.erb +++ b/mmv1/templates/terraform/custom_check_destroy/consumer_quota_override.go.erb @@ -1,4 +1,4 @@ -config := GoogleProviderConfig(t) +config := acctest.GoogleProviderConfig(t) url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{ServiceUsageBasePath}}projects/{{project}}/services/{{service}}/consumerQuotaMetrics/{{metric}}/limits/{{limit}}/consumerOverrides/") if err != nil { diff --git a/mmv1/templates/terraform/custom_check_destroy/firebase_database_instance.go.erb b/mmv1/templates/terraform/custom_check_destroy/firebase_database_instance.go.erb index 781441f02294..3aa3f321423d 100644 --- a/mmv1/templates/terraform/custom_check_destroy/firebase_database_instance.go.erb +++ b/mmv1/templates/terraform/custom_check_destroy/firebase_database_instance.go.erb @@ -1,4 +1,4 @@ -config := GoogleProviderConfig(t) +config := acctest.GoogleProviderConfig(t) url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{FirebaseDatabaseBasePath}}projects/{{project}}/locations/{{region}}/instances/{{instance_id}}") if err != nil { diff --git a/mmv1/templates/terraform/custom_check_destroy/firestore_field.go.erb b/mmv1/templates/terraform/custom_check_destroy/firestore_field.go.erb index 1d41cfd4f205..f3caa9775cca 100644 --- a/mmv1/templates/terraform/custom_check_destroy/firestore_field.go.erb +++ b/mmv1/templates/terraform/custom_check_destroy/firestore_field.go.erb @@ -2,7 +2,7 @@ // 1) the index configuration has no overrides and matches the ancestor configuration. // 2) the ttl configuration is unset. -config := GoogleProviderConfig(t) +config := acctest.GoogleProviderConfig(t) url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{FirestoreBasePath}}projects/{{project}}/databases/{{database}}/collectionGroups/{{collection}}/fields/{{field}}") if err != nil { diff --git a/mmv1/templates/terraform/custom_check_destroy/iam_workforce_pool.go.erb b/mmv1/templates/terraform/custom_check_destroy/iam_workforce_pool.go.erb index 992c83982a6c..78e81e0d4652 100644 --- a/mmv1/templates/terraform/custom_check_destroy/iam_workforce_pool.go.erb +++ b/mmv1/templates/terraform/custom_check_destroy/iam_workforce_pool.go.erb @@ -1,4 +1,4 @@ -config := GoogleProviderConfig(t) +config := acctest.GoogleProviderConfig(t) url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{IAMWorkforcePoolBasePath}}locations/{{location}}/workforcePools/{{workforce_pool_id}}") if err != nil { diff --git a/mmv1/templates/terraform/custom_check_destroy/iam_workload_identity_pool.go.erb b/mmv1/templates/terraform/custom_check_destroy/iam_workload_identity_pool.go.erb index 6c52db524d35..7b676eacfe20 100644 --- a/mmv1/templates/terraform/custom_check_destroy/iam_workload_identity_pool.go.erb +++ b/mmv1/templates/terraform/custom_check_destroy/iam_workload_identity_pool.go.erb @@ -1,4 +1,4 @@ -config := GoogleProviderConfig(t) +config := acctest.GoogleProviderConfig(t) url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{IAMBetaBasePath}}projects/{{project}}/locations/global/workloadIdentityPools/{{workload_identity_pool_id}}") if err != nil { diff --git a/mmv1/templates/terraform/custom_check_destroy/iam_workload_identity_pool_provider.go.erb b/mmv1/templates/terraform/custom_check_destroy/iam_workload_identity_pool_provider.go.erb index b741ee943bac..3b99f3954e5a 100644 --- a/mmv1/templates/terraform/custom_check_destroy/iam_workload_identity_pool_provider.go.erb +++ b/mmv1/templates/terraform/custom_check_destroy/iam_workload_identity_pool_provider.go.erb @@ -1,4 +1,4 @@ -config := GoogleProviderConfig(t) +config := acctest.GoogleProviderConfig(t) url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{IAMBetaBasePath}}projects/{{project}}/locations/global/workloadIdentityPools/{{workload_identity_pool_id}}/providers/{{workload_identity_pool_provider_id}}") if err != nil { diff --git a/mmv1/templates/terraform/custom_check_destroy/identity_platform_project_default_config.go.erb b/mmv1/templates/terraform/custom_check_destroy/identity_platform_project_default_config.go.erb index cacb43fefacd..f2da2289d922 100644 --- a/mmv1/templates/terraform/custom_check_destroy/identity_platform_project_default_config.go.erb +++ b/mmv1/templates/terraform/custom_check_destroy/identity_platform_project_default_config.go.erb @@ -1,4 +1,4 @@ -config := GoogleProviderConfig(t) +config := acctest.GoogleProviderConfig(t) url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{IdentityPlatformBasePath}}projects/{{project}}/config") if err != nil { diff --git a/mmv1/templates/terraform/custom_check_destroy/monitoring_monitored_project.go.erb b/mmv1/templates/terraform/custom_check_destroy/monitoring_monitored_project.go.erb index 58b3cd3ab656..1e0f3f0937f1 100644 --- a/mmv1/templates/terraform/custom_check_destroy/monitoring_monitored_project.go.erb +++ b/mmv1/templates/terraform/custom_check_destroy/monitoring_monitored_project.go.erb @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -%> -config := GoogleProviderConfig(t) +config := acctest.GoogleProviderConfig(t) url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{MonitoringBasePath}}v1/locations/global/metricsScopes/{{metrics_scope}}") if err != nil { diff --git a/mmv1/templates/terraform/custom_check_destroy/privateca_certificate.go.erb b/mmv1/templates/terraform/custom_check_destroy/privateca_certificate.go.erb index d1a6fb40fc20..0cf655724fa7 100644 --- a/mmv1/templates/terraform/custom_check_destroy/privateca_certificate.go.erb +++ b/mmv1/templates/terraform/custom_check_destroy/privateca_certificate.go.erb @@ -1,4 +1,4 @@ -config := GoogleProviderConfig(t) +config := acctest.GoogleProviderConfig(t) url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{PrivatecaBasePath}}projects/{{project}}/locations/{{location}}/caPools/{{pool}}/certificates/{{name}}") diff --git a/mmv1/templates/terraform/custom_check_destroy/privateca_certificate_authority.go.erb b/mmv1/templates/terraform/custom_check_destroy/privateca_certificate_authority.go.erb index a342036b78e8..697663141610 100644 --- a/mmv1/templates/terraform/custom_check_destroy/privateca_certificate_authority.go.erb +++ b/mmv1/templates/terraform/custom_check_destroy/privateca_certificate_authority.go.erb @@ -1,4 +1,4 @@ -config := GoogleProviderConfig(t) +config := acctest.GoogleProviderConfig(t) url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{PrivatecaBasePath}}projects/{{project}}/locations/{{location}}/caPools/{{pool}}/certificateAuthorities/{{certificate_authority_id}}") if err != nil { diff --git a/mmv1/templates/terraform/custom_check_destroy/storage_hmac_key.go.erb b/mmv1/templates/terraform/custom_check_destroy/storage_hmac_key.go.erb index f992c4389fb0..9205dbd909c1 100644 --- a/mmv1/templates/terraform/custom_check_destroy/storage_hmac_key.go.erb +++ b/mmv1/templates/terraform/custom_check_destroy/storage_hmac_key.go.erb @@ -1,4 +1,4 @@ -config := GoogleProviderConfig(t) +config := acctest.GoogleProviderConfig(t) url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{StorageBasePath}}projects/{{project}}/hmacKeys/{{access_id}}") if err != nil { diff --git a/mmv1/templates/terraform/examples/base_configs/iam_test_file.go.erb b/mmv1/templates/terraform/examples/base_configs/iam_test_file.go.erb index 6d4889f192b4..505f71de50a8 100644 --- a/mmv1/templates/terraform/examples/base_configs/iam_test_file.go.erb +++ b/mmv1/templates/terraform/examples/base_configs/iam_test_file.go.erb @@ -64,12 +64,12 @@ func TestAcc<%= resource_name -%>IamBindingGenerated(t *testing.T) { <%= lines(compile(pwd + '/templates/terraform/iam/iam_context.go.erb')) -%> - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, <% unless object.min_version.name == "ga" -%> - ProtoV5ProviderFactories: ProtoV5ProviderBetaFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), <% else -%> - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), <% if example.pull_external -%> ExternalProviders: map[string]resource.ExternalProvider{ "random": {}, @@ -110,12 +110,12 @@ func TestAcc<%= resource_name -%>IamMemberGenerated(t *testing.T) { <%= lines(compile(pwd + '/templates/terraform/iam/iam_context.go.erb')) -%> - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, <% unless object.min_version.name == "ga" -%> - ProtoV5ProviderFactories: ProtoV5ProviderBetaFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), <% else -%> - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), <% end -%> <% if example.pull_external -%> ExternalProviders: map[string]resource.ExternalProvider{ @@ -152,12 +152,12 @@ func TestAcc<%= resource_name -%>IamPolicyGenerated(t *testing.T) { context["service_account"] = sa <% end -%> - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, <% unless object.min_version.name == "ga" -%> - ProtoV5ProviderFactories: ProtoV5ProviderBetaFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), <% else -%> - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), <% end -%> <% if example.pull_external -%> ExternalProviders: map[string]resource.ExternalProvider{ @@ -199,12 +199,12 @@ func TestAcc<%= resource_name -%>IamBindingGenerated_withCondition(t *testing.T) <%= lines(compile(pwd + '/templates/terraform/iam/iam_context.go.erb')) -%> - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, <% unless object.min_version.name == "ga" -%> - ProtoV5ProviderFactories: ProtoV5ProviderBetaFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), <% else -%> - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), <% end -%> <% if example.pull_external -%> ExternalProviders: map[string]resource.ExternalProvider{ @@ -235,12 +235,12 @@ func TestAcc<%= resource_name -%>IamBindingGenerated_withAndWithoutCondition(t * <%= lines(compile(pwd + '/templates/terraform/iam/iam_context.go.erb')) -%> - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, <% unless object.min_version.name == "ga" -%> - ProtoV5ProviderFactories: ProtoV5ProviderBetaFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), <% else -%> - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), <% end -%> <% if example.pull_external -%> ExternalProviders: map[string]resource.ExternalProvider{ @@ -281,12 +281,12 @@ func TestAcc<%= resource_name -%>IamMemberGenerated_withCondition(t *testing.T) <%= lines(compile(pwd + '/templates/terraform/iam/iam_context.go.erb')) -%> - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, <% unless object.min_version.name == "ga" -%> - ProtoV5ProviderFactories: ProtoV5ProviderBetaFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), <% else -%> - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), <% end -%> <% if example.pull_external -%> ExternalProviders: map[string]resource.ExternalProvider{ @@ -317,12 +317,12 @@ func TestAcc<%= resource_name -%>IamMemberGenerated_withAndWithoutCondition(t *t <%= lines(compile(pwd + '/templates/terraform/iam/iam_context.go.erb')) -%> - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, <% unless object.min_version.name == "ga" -%> - ProtoV5ProviderFactories: ProtoV5ProviderBetaFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), <% else -%> - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), <% end -%> <% if example.pull_external -%> ExternalProviders: map[string]resource.ExternalProvider{ @@ -379,12 +379,12 @@ func TestAcc<%= resource_name -%>IamPolicyGenerated_withCondition(t *testing.T) <% end -%> expectedPolicyData = strings.Replace(expectedPolicyData, "<", "\\u003c", -1) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, <% unless object.min_version.name == "ga" -%> - ProtoV5ProviderFactories: ProtoV5ProviderBetaFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), <% else -%> - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), <% end -%> <% if example.pull_external -%> ExternalProviders: map[string]resource.ExternalProvider{ diff --git a/mmv1/templates/terraform/examples/base_configs/test_file.go.erb b/mmv1/templates/terraform/examples/base_configs/test_file.go.erb index 53a9b8b6a229..967d78cb63c7 100644 --- a/mmv1/templates/terraform/examples/base_configs/test_file.go.erb +++ b/mmv1/templates/terraform/examples/base_configs/test_file.go.erb @@ -69,16 +69,16 @@ func TestAcc<%= test_slug -%>(t *testing.T) { "<%= var_name %>": <%= override %>, <% end -%> <% end -%> - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } <% versioned_provider = !example_version.nil? && example_version != 'ga' -%> - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, <% unless versioned_provider -%> - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), <% else -%> - ProtoV5ProviderFactories: ProtoV5ProviderBetaFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), <% end -%> <% if example.pull_external -%> ExternalProviders: map[string]resource.ExternalProvider{ @@ -126,7 +126,7 @@ func testAccCheck<%= resource_name -%>DestroyProducer(t *testing.T) func(s *terr <% if object.custom_code.test_check_destroy -%> <%= lines(compile(pwd + '/' + object.custom_code.test_check_destroy)) -%> <% else -%> - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) url, err := tpgresource.ReplaceVarsForTest(config, rs, "<%= "{{#{object.__product.name}BasePath}}#{object.self_link_uri}" -%>") if err != nil { diff --git a/mmv1/templates/terraform/iam/iam_context.go.erb b/mmv1/templates/terraform/iam/iam_context.go.erb index f5f61fed56d2..a05331f10099 100644 --- a/mmv1/templates/terraform/iam/iam_context.go.erb +++ b/mmv1/templates/terraform/iam/iam_context.go.erb @@ -1,11 +1,11 @@ context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), "role": "<%= object.iam_policy.allowed_iam_role -%>", <% unless object.iam_policy.admin_iam_role.nil? -%> "admin_role": "<%= object.iam_policy.admin_iam_role-%>", <% end -%> <% unless object.iam_policy.test_project_name.nil? -%> - "project_id" : fmt.Sprintf("<%= object.iam_policy.test_project_name -%>%s", RandString(t, 10)), + "project_id" : fmt.Sprintf("<%= object.iam_policy.test_project_name -%>%s", acctest.RandString(t, 10)), <% end -%> <%= lines(compile(pwd + '/templates/terraform/env_var_context.go.erb')) -%> <% unless example.test_vars_overrides.nil? -%> diff --git a/mmv1/third_party/terraform/framework_utils/framework_provider_test.go.erb b/mmv1/third_party/terraform/framework_utils/framework_provider_test.go.erb index 3463c636d08d..76f6c4d0e2be 100644 --- a/mmv1/third_party/terraform/framework_utils/framework_provider_test.go.erb +++ b/mmv1/third_party/terraform/framework_utils/framework_provider_test.go.erb @@ -16,15 +16,15 @@ func TestAccFrameworkProviderMeta_setModuleName(t *testing.T) { t.Parallel() moduleName := "my-module" - managedZoneName := fmt.Sprintf("tf-test-zone-%s", RandString(t, 10)) + managedZoneName := fmt.Sprintf("tf-test-zone-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDNSManagedZoneDestroyProducerFramework(t), Steps: []resource.TestStep{ { - Config: testAccFrameworkProviderMeta_setModuleName(moduleName, managedZoneName, RandString(t, 10)), + Config: testAccFrameworkProviderMeta_setModuleName(moduleName, managedZoneName, acctest.RandString(t, 10)), }, }, }) @@ -33,7 +33,7 @@ func TestAccFrameworkProviderMeta_setModuleName(t *testing.T) { func TestAccFrameworkProviderBasePath_setInvalidBasePath(t *testing.T) { t.Parallel() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, CheckDestroy: testAccCheckComputeAddressDestroyProducer(t), Steps: []resource.TestStep{ @@ -44,12 +44,12 @@ func TestAccFrameworkProviderBasePath_setInvalidBasePath(t *testing.T) { Source: "hashicorp/google<%= "-" + version unless version == 'ga' -%>", }, }, - Config: testAccProviderBasePath_setBasePath("https://www.example.com/compute/beta/", RandString(t, 10)), + Config: testAccProviderBasePath_setBasePath("https://www.example.com/compute/beta/", acctest.RandString(t, 10)), ExpectError: regexp.MustCompile("got HTTP response code 404 with body"), }, { - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), - Config: testAccProviderBasePath_setBasePath("https://www.example.com/compute/beta/", RandString(t, 10)), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), + Config: testAccProviderBasePath_setBasePath("https://www.example.com/compute/beta/", acctest.RandString(t, 10)), ExpectError: regexp.MustCompile("got HTTP response code 404 with body"), }, }, @@ -61,7 +61,7 @@ func TestAccFrameworkProviderBasePath_setBasePath(t *testing.T) { acctest.SkipIfVcr(t) t.Parallel() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, CheckDestroy: testAccCheckDNSManagedZoneDestroyProducerFramework(t), Steps: []resource.TestStep{ @@ -72,7 +72,7 @@ func TestAccFrameworkProviderBasePath_setBasePath(t *testing.T) { Source: "hashicorp/google<%= "-" + version unless version == 'ga' -%>", }, }, - Config: testAccFrameworkProviderBasePath_setBasePath("https://www.googleapis.com/dns/v1beta2/", RandString(t, 10)), + Config: testAccFrameworkProviderBasePath_setBasePath("https://www.googleapis.com/dns/v1beta2/", acctest.RandString(t, 10)), }, { ExternalProviders: map[string]resource.ExternalProvider{ @@ -86,18 +86,18 @@ func TestAccFrameworkProviderBasePath_setBasePath(t *testing.T) { ImportStateVerify: true, }, { - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), - Config: testAccFrameworkProviderBasePath_setBasePath("https://www.googleapis.com/dns/v1beta2/", RandString(t, 10)), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), + Config: testAccFrameworkProviderBasePath_setBasePath("https://www.googleapis.com/dns/v1beta2/", acctest.RandString(t, 10)), }, { - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), ResourceName: "google_dns_managed_zone.foo", ImportState: true, ImportStateVerify: true, }, { - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), - Config: testAccFrameworkProviderBasePath_setBasePathstep3("https://www.googleapis.com/dns/v1beta2/", RandString(t, 10)), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), + Config: testAccFrameworkProviderBasePath_setBasePathstep3("https://www.googleapis.com/dns/v1beta2/", acctest.RandString(t, 10)), }, }, }) diff --git a/mmv1/third_party/terraform/services/runtimeconfig/data_source_runtimeconfig_config_test.go.erb b/mmv1/third_party/terraform/services/runtimeconfig/data_source_runtimeconfig_config_test.go.erb index cdedeb58502f..c5e0218ec9db 100644 --- a/mmv1/third_party/terraform/services/runtimeconfig/data_source_runtimeconfig_config_test.go.erb +++ b/mmv1/third_party/terraform/services/runtimeconfig/data_source_runtimeconfig_config_test.go.erb @@ -8,19 +8,18 @@ import ( "testing" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-provider-google/google" "github.com/hashicorp/terraform-provider-google/google/acctest" ) func TestAccRuntimeconfigConfigDatasource_basic(t *testing.T) { t.Parallel() - google.VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: google.ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { - Config: testAccRuntimeconfigDatasourceConfig(google.RandString(t, 10)), + Config: testAccRuntimeconfigDatasourceConfig(acctest.RandString(t, 10)), Check: resource.ComposeTestCheckFunc( acctest.CheckDataSourceStateMatchesResourceState("data.google_runtimeconfig_config.default", "google_runtimeconfig_config.default"), ), diff --git a/mmv1/third_party/terraform/services/runtimeconfig/data_source_runtimeconfig_variable_test.go.erb b/mmv1/third_party/terraform/services/runtimeconfig/data_source_runtimeconfig_variable_test.go.erb index 9b811399af98..0b875d883af2 100644 --- a/mmv1/third_party/terraform/services/runtimeconfig/data_source_runtimeconfig_variable_test.go.erb +++ b/mmv1/third_party/terraform/services/runtimeconfig/data_source_runtimeconfig_variable_test.go.erb @@ -8,19 +8,18 @@ import ( "testing" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-provider-google/google" "github.com/hashicorp/terraform-provider-google/google/acctest" ) func TestAccRuntimeconfigVariableDatasource_basic(t *testing.T) { t.Parallel() - google.VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: google.ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { - Config: testAccRuntimeconfigDatasourceVariable(google.RandString(t, 10), google.RandString(t, 10), google.RandString(t, 10)), + Config: testAccRuntimeconfigDatasourceVariable(acctest.RandString(t, 10), acctest.RandString(t, 10), acctest.RandString(t, 10)), Check: resource.ComposeTestCheckFunc( acctest.CheckDataSourceStateMatchesResourceState("data.google_runtimeconfig_variable.default", "google_runtimeconfig_variable.default"), ), diff --git a/mmv1/third_party/terraform/services/runtimeconfig/resource_runtimeconfig_config_test.go.erb b/mmv1/third_party/terraform/services/runtimeconfig/resource_runtimeconfig_config_test.go.erb index 8562da8da19c..7d7c99749754 100644 --- a/mmv1/third_party/terraform/services/runtimeconfig/resource_runtimeconfig_config_test.go.erb +++ b/mmv1/third_party/terraform/services/runtimeconfig/resource_runtimeconfig_config_test.go.erb @@ -7,7 +7,6 @@ import ( "fmt" "testing" - "github.com/hashicorp/terraform-provider-google/google" "github.com/hashicorp/terraform-provider-google/google/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" @@ -19,12 +18,12 @@ func TestAccRuntimeconfigConfig_basic(t *testing.T) { t.Parallel() var runtimeConfig runtimeconfig.RuntimeConfig - configName := fmt.Sprintf("runtimeconfig-test-%s", google.RandString(t, 10)) + configName := fmt.Sprintf("runtimeconfig-test-%s", acctest.RandString(t, 10)) description := "my test description" - google.VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: google.ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckRuntimeconfigConfigDestroyProducer(t), Steps: []resource.TestStep{ { @@ -48,13 +47,13 @@ func TestAccRuntimeconfig_update(t *testing.T) { t.Parallel() var runtimeConfig runtimeconfig.RuntimeConfig - configName := fmt.Sprintf("runtimeconfig-test-%s", google.RandString(t, 10)) + configName := fmt.Sprintf("runtimeconfig-test-%s", acctest.RandString(t, 10)) firstDescription := "my test description" secondDescription := "my updated test description" - google.VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: google.ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckRuntimeconfigConfigDestroyProducer(t), Steps: []resource.TestStep{ { @@ -80,12 +79,12 @@ func TestAccRuntimeconfig_updateEmptyDescription(t *testing.T) { t.Parallel() var runtimeConfig runtimeconfig.RuntimeConfig - configName := fmt.Sprintf("runtimeconfig-test-%s", google.RandString(t, 10)) + configName := fmt.Sprintf("runtimeconfig-test-%s", acctest.RandString(t, 10)) description := "my test description" - google.VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: google.ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckRuntimeconfigConfigDestroyProducer(t), Steps: []resource.TestStep{ { @@ -128,7 +127,7 @@ func testAccCheckRuntimeConfigExists(t *testing.T, resourceName string, runtimeC return fmt.Errorf("No ID is set") } - config := google.GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) found, err := config.NewRuntimeconfigClient(config.UserAgent).Projects.Configs.Get(rs.Primary.ID).Do() if err != nil { @@ -143,7 +142,7 @@ func testAccCheckRuntimeConfigExists(t *testing.T, resourceName string, runtimeC func testAccCheckRuntimeconfigConfigDestroyProducer(t *testing.T) func(s *terraform.State) error { return func(s *terraform.State) error { - config := google.GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) for _, rs := range s.RootModule().Resources { if rs.Type != "google_runtimeconfig_config" { diff --git a/mmv1/third_party/terraform/services/runtimeconfig/resource_runtimeconfig_variable_test.go.erb b/mmv1/third_party/terraform/services/runtimeconfig/resource_runtimeconfig_variable_test.go.erb index 32bb8d5c716b..273ba0fc3ded 100644 --- a/mmv1/third_party/terraform/services/runtimeconfig/resource_runtimeconfig_variable_test.go.erb +++ b/mmv1/third_party/terraform/services/runtimeconfig/resource_runtimeconfig_variable_test.go.erb @@ -8,7 +8,6 @@ import ( "testing" "time" - "github.com/hashicorp/terraform-provider-google/google" "github.com/hashicorp/terraform-provider-google/google/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" @@ -21,16 +20,16 @@ func TestAccRuntimeconfigVariable_basic(t *testing.T) { var variable runtimeconfig.Variable - varName := fmt.Sprintf("variable-test-%s", google.RandString(t, 10)) + varName := fmt.Sprintf("variable-test-%s", acctest.RandString(t, 10)) varText := "this is my test value" - google.VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: google.ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckRuntimeconfigVariableDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccRuntimeconfigVariable_basicText(google.RandString(t, 10), varName, varText), + Config: testAccRuntimeconfigVariable_basicText(acctest.RandString(t, 10), varName, varText), Check: resource.ComposeTestCheckFunc( testAccCheckRuntimeconfigVariableExists( t, "google_runtimeconfig_variable.foobar", &variable), @@ -52,14 +51,14 @@ func TestAccRuntimeconfigVariable_basicUpdate(t *testing.T) { var variable runtimeconfig.Variable - configName := fmt.Sprintf("some-name-%s", google.RandString(t, 10)) - varName := fmt.Sprintf("variable-test-%s", google.RandString(t, 10)) + configName := fmt.Sprintf("some-name-%s", acctest.RandString(t, 10)) + varName := fmt.Sprintf("variable-test-%s", acctest.RandString(t, 10)) varText := "this is my test value" varText2 := "this is my updated value" - google.VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: google.ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckRuntimeconfigVariableDestroyProducer(t), Steps: []resource.TestStep{ { @@ -86,16 +85,16 @@ func TestAccRuntimeconfigVariable_basicValue(t *testing.T) { var variable runtimeconfig.Variable - varName := fmt.Sprintf("variable-test-%s", google.RandString(t, 10)) + varName := fmt.Sprintf("variable-test-%s", acctest.RandString(t, 10)) varValue := "Zm9vYmFyCg==" - google.VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: google.ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckRuntimeconfigVariableDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccRuntimeconfigVariable_basicValue(google.RandString(t, 10), varName, varValue), + Config: testAccRuntimeconfigVariable_basicValue(acctest.RandString(t, 10), varName, varValue), Check: resource.ComposeTestCheckFunc( testAccCheckRuntimeconfigVariableExists( t, "google_runtimeconfig_variable.foobar", &variable), @@ -123,7 +122,7 @@ func testAccCheckRuntimeconfigVariableExists(t *testing.T, resourceName string, return fmt.Errorf("No ID is set") } - config := google.GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) found, err := config.NewRuntimeconfigClient(config.UserAgent).Projects.Configs.Variables.Get(rs.Primary.ID).Do() if err != nil { @@ -182,7 +181,7 @@ func testAccCheckRuntimeconfigVariableValue(variable *runtimeconfig.Variable, va func testAccCheckRuntimeconfigVariableDestroyProducer(t *testing.T) func(s *terraform.State) error { return func(s *terraform.State) error { - config := google.GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) for _, rs := range s.RootModule().Resources { if rs.Type != "google_runtimeconfig_variable" { diff --git a/mmv1/third_party/terraform/tests/data_source_access_approval_folder_service_account_test.go b/mmv1/third_party/terraform/tests/data_source_access_approval_folder_service_account_test.go index a9fddc5ba9cd..ed6468ebe5e3 100644 --- a/mmv1/third_party/terraform/tests/data_source_access_approval_folder_service_account_test.go +++ b/mmv1/third_party/terraform/tests/data_source_access_approval_folder_service_account_test.go @@ -13,14 +13,14 @@ func TestAccDataSourceAccessApprovalFolderServiceAccount_basic(t *testing.T) { context := map[string]interface{}{ "org_id": envvar.GetTestOrgFromEnv(t), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } resourceName := "data.google_access_approval_folder_service_account.aa_account" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), ExternalProviders: map[string]resource.ExternalProvider{ "time": {}, }, diff --git a/mmv1/third_party/terraform/tests/data_source_access_approval_organization_service_account_test.go b/mmv1/third_party/terraform/tests/data_source_access_approval_organization_service_account_test.go index a8e6cdcbfca0..d62628346e71 100644 --- a/mmv1/third_party/terraform/tests/data_source_access_approval_organization_service_account_test.go +++ b/mmv1/third_party/terraform/tests/data_source_access_approval_organization_service_account_test.go @@ -17,9 +17,9 @@ func TestAccDataSourceAccessApprovalOrganizationServiceAccount_basic(t *testing. resourceName := "data.google_access_approval_organization_service_account.aa_account" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccDataSourceAccessApprovalOrganizationServiceAccount_basic(context), diff --git a/mmv1/third_party/terraform/tests/data_source_access_approval_project_service_account_test.go b/mmv1/third_party/terraform/tests/data_source_access_approval_project_service_account_test.go index 04b8efb51b8d..8705b34b3e2f 100644 --- a/mmv1/third_party/terraform/tests/data_source_access_approval_project_service_account_test.go +++ b/mmv1/third_party/terraform/tests/data_source_access_approval_project_service_account_test.go @@ -17,9 +17,9 @@ func TestAccDataSourceAccessApprovalProjectServiceAccount_basic(t *testing.T) { resourceName := "data.google_access_approval_project_service_account.aa_account" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccDataSourceAccessApprovalProjectServiceAccount_basic(context), diff --git a/mmv1/third_party/terraform/tests/data_source_alloydb_locations_test.go b/mmv1/third_party/terraform/tests/data_source_alloydb_locations_test.go index 0dd756ee76e4..f4a72c3f37e1 100644 --- a/mmv1/third_party/terraform/tests/data_source_alloydb_locations_test.go +++ b/mmv1/third_party/terraform/tests/data_source_alloydb_locations_test.go @@ -15,12 +15,12 @@ func TestAccDataSourceAlloydbLocations_basic(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccSqlDatabaseDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/data_source_alloydb_supported_database_flags_test.go b/mmv1/third_party/terraform/tests/data_source_alloydb_supported_database_flags_test.go index c7daab87477c..468bd0718373 100644 --- a/mmv1/third_party/terraform/tests/data_source_alloydb_supported_database_flags_test.go +++ b/mmv1/third_party/terraform/tests/data_source_alloydb_supported_database_flags_test.go @@ -15,12 +15,12 @@ func TestAccDataSourceAlloydbSupportedDatabaseFlags_basic(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccDataSourceAlloydbSupportedDatabaseFlags_basic(context), diff --git a/mmv1/third_party/terraform/tests/data_source_artifact_registry_repository_test.go b/mmv1/third_party/terraform/tests/data_source_artifact_registry_repository_test.go index 6598369b8542..5f28f3f34749 100644 --- a/mmv1/third_party/terraform/tests/data_source_artifact_registry_repository_test.go +++ b/mmv1/third_party/terraform/tests/data_source_artifact_registry_repository_test.go @@ -11,13 +11,13 @@ func TestAccDataSourceGoogleArtifactRegistryRepositoryConfig(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } funcDataName := "data.google_artifact_registry_repository.my-repo" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckArtifactRegistryRepositoryDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/data_source_certificate_authority_test.go b/mmv1/third_party/terraform/tests/data_source_certificate_authority_test.go index 9bcac979412c..002ec557b845 100644 --- a/mmv1/third_party/terraform/tests/data_source_certificate_authority_test.go +++ b/mmv1/third_party/terraform/tests/data_source_certificate_authority_test.go @@ -13,12 +13,12 @@ func TestAccDataSourcePrivatecaCertificateAuthority_privatecaCertificateAuthorit context := map[string]interface{}{ "pool_name": acctest.BootstrapSharedCaPoolInLocation(t, "us-central1"), "pool_location": "us-central1", - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckPrivatecaCertificateAuthorityDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/data_source_cloud_identity_group_memberships_test.go b/mmv1/third_party/terraform/tests/data_source_cloud_identity_group_memberships_test.go index 4ad910b3902c..ac03c9d83b7f 100644 --- a/mmv1/third_party/terraform/tests/data_source_cloud_identity_group_memberships_test.go +++ b/mmv1/third_party/terraform/tests/data_source_cloud_identity_group_memberships_test.go @@ -14,14 +14,14 @@ func testAccDataSourceCloudIdentityGroupMemberships_basicTest(t *testing.T) { "org_domain": envvar.GetTestOrgDomainFromEnv(t), "cust_id": envvar.GetTestCustIdFromEnv(t), "identity_user": envvar.GetTestIdentityUserFromEnv(t), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } memberId := acctest.Nprintf("%{identity_user}@%{org_domain}", context) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccCloudIdentityGroupMembershipConfig(context), diff --git a/mmv1/third_party/terraform/tests/data_source_cloud_identity_groups_test.go b/mmv1/third_party/terraform/tests/data_source_cloud_identity_groups_test.go index af4632061cea..d7e809367aef 100644 --- a/mmv1/third_party/terraform/tests/data_source_cloud_identity_groups_test.go +++ b/mmv1/third_party/terraform/tests/data_source_cloud_identity_groups_test.go @@ -14,12 +14,12 @@ func testAccDataSourceCloudIdentityGroups_basicTest(t *testing.T) { context := map[string]interface{}{ "org_domain": envvar.GetTestOrgDomainFromEnv(t), "cust_id": envvar.GetTestCustIdFromEnv(t), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccCloudIdentityGroupConfig(context), diff --git a/mmv1/third_party/terraform/tests/data_source_cloud_run_locations_test.go b/mmv1/third_party/terraform/tests/data_source_cloud_run_locations_test.go index b2751d9108c9..89410b935d7b 100644 --- a/mmv1/third_party/terraform/tests/data_source_cloud_run_locations_test.go +++ b/mmv1/third_party/terraform/tests/data_source_cloud_run_locations_test.go @@ -15,9 +15,9 @@ import ( func TestAccDataSourceGoogleCloudRunLocations_basic(t *testing.T) { t.Parallel() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccDataSourceGoogleCloudRunLocationsBasic, diff --git a/mmv1/third_party/terraform/tests/data_source_cloud_run_service_test.go b/mmv1/third_party/terraform/tests/data_source_cloud_run_service_test.go index 29b5bf9df8ac..754b85e92b75 100644 --- a/mmv1/third_party/terraform/tests/data_source_cloud_run_service_test.go +++ b/mmv1/third_party/terraform/tests/data_source_cloud_run_service_test.go @@ -11,12 +11,12 @@ func TestAccDataSourceGoogleCloudRunService_basic(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckCloudRunServiceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -33,12 +33,12 @@ func TestAccDataSourceGoogleCloudRunService_optionalProject(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckCloudRunServiceDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/data_source_compute_health_check_test.go b/mmv1/third_party/terraform/tests/data_source_compute_health_check_test.go index d8ed1054ae2b..2e8fca587d17 100644 --- a/mmv1/third_party/terraform/tests/data_source_compute_health_check_test.go +++ b/mmv1/third_party/terraform/tests/data_source_compute_health_check_test.go @@ -11,12 +11,12 @@ import ( func TestAccComputeHealthCheckDatasource_basic(t *testing.T) { t.Parallel() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { - Config: testAccComputeHealthCheckDatasourceConfig(RandString(t, 10)), + Config: testAccComputeHealthCheckDatasourceConfig(acctest.RandString(t, 10)), Check: resource.ComposeTestCheckFunc( acctest.CheckDataSourceStateMatchesResourceState("data.google_compute_health_check.hc", "google_compute_health_check.hc"), ), diff --git a/mmv1/third_party/terraform/tests/data_source_compute_lb_ip_ranges_test.go b/mmv1/third_party/terraform/tests/data_source_compute_lb_ip_ranges_test.go index 09e1084112d1..00fb02f1c7a7 100644 --- a/mmv1/third_party/terraform/tests/data_source_compute_lb_ip_ranges_test.go +++ b/mmv1/third_party/terraform/tests/data_source_compute_lb_ip_ranges_test.go @@ -9,9 +9,9 @@ import ( ) func TestAccDataSourceComputeLbIpRanges_basic(t *testing.T) { - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccComputeLbIpRangesConfig, diff --git a/mmv1/third_party/terraform/tests/data_source_compute_network_endpoint_group_test.go b/mmv1/third_party/terraform/tests/data_source_compute_network_endpoint_group_test.go index 178c2038c1ca..b3e0f85bc982 100644 --- a/mmv1/third_party/terraform/tests/data_source_compute_network_endpoint_group_test.go +++ b/mmv1/third_party/terraform/tests/data_source_compute_network_endpoint_group_test.go @@ -13,12 +13,12 @@ func TestAccDataSourceComputeNetworkEndpointGroup(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccDataSourceComputeNetworkEndpointGroupConfig(context), diff --git a/mmv1/third_party/terraform/tests/data_source_compute_network_peering_test.go b/mmv1/third_party/terraform/tests/data_source_compute_network_peering_test.go index 459b3c870920..6c75ad995b6c 100644 --- a/mmv1/third_party/terraform/tests/data_source_compute_network_peering_test.go +++ b/mmv1/third_party/terraform/tests/data_source_compute_network_peering_test.go @@ -11,12 +11,12 @@ func TestAccDataSourceComputeNetworkPeering_basic(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccComputeNetworkPeeringDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/data_source_container_registry_test.go b/mmv1/third_party/terraform/tests/data_source_container_registry_test.go index 7cde0141b10a..3fc3f7e337fc 100644 --- a/mmv1/third_party/terraform/tests/data_source_container_registry_test.go +++ b/mmv1/third_party/terraform/tests/data_source_container_registry_test.go @@ -12,9 +12,9 @@ func TestDataSourceGoogleContainerRegistryRepository(t *testing.T) { resourceName := "data.google_container_registry_repository.test" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccCheckGoogleContainerRegistryRepo_basic, @@ -46,9 +46,9 @@ func TestDataSourceGoogleContainerRegistryImage(t *testing.T) { resourceName := "data.google_container_registry_image.test" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccCheckGoogleContainerRegistryImage_basic, diff --git a/mmv1/third_party/terraform/tests/data_source_dataproc_metastore_service_test.go.erb b/mmv1/third_party/terraform/tests/data_source_dataproc_metastore_service_test.go.erb index a3564a668c5c..aecedcf75e4e 100644 --- a/mmv1/third_party/terraform/tests/data_source_dataproc_metastore_service_test.go.erb +++ b/mmv1/third_party/terraform/tests/data_source_dataproc_metastore_service_test.go.erb @@ -12,11 +12,11 @@ import ( func TestAccDataprocMetastoreServiceDatasource_basic(t *testing.T) { t.Parallel() - name := "tf-test-" + RandString(t, 10) + name := "tf-test-" + acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccDataprocMetastoreServiceDatasource_basic(name, "DEVELOPER"), diff --git a/mmv1/third_party/terraform/tests/data_source_dns_key_test.go.erb b/mmv1/third_party/terraform/tests/data_source_dns_key_test.go.erb index 5bf0ff5ac791..d6755940f3fd 100644 --- a/mmv1/third_party/terraform/tests/data_source_dns_key_test.go.erb +++ b/mmv1/third_party/terraform/tests/data_source_dns_key_test.go.erb @@ -15,11 +15,11 @@ func TestAccDataSourceDNSKeys_basic(t *testing.T) { acctest.SkipIfVcr(t) t.Parallel() - dnsZoneName := fmt.Sprintf("tf-test-dnskey-test-%s", RandString(t, 10)) + dnsZoneName := fmt.Sprintf("tf-test-dnskey-test-%s", acctest.RandString(t, 10)) var kskDigest1, kskDigest2, zskPubKey1, zskPubKey2, kskAlg1, kskAlg2 string - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, CheckDestroy: testAccCheckDNSManagedZoneDestroyProducerFramework(t), Steps: []resource.TestStep{ @@ -43,7 +43,7 @@ func TestAccDataSourceDNSKeys_basic(t *testing.T) { ), }, { - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Config: testAccDataSourceDNSKeysConfigWithOutputs(dnsZoneName, "on"), Check: resource.ComposeTestCheckFunc( testAccDataSourceDNSKeysDSRecordCheck("data.google_dns_keys.foo_dns_key"), @@ -66,9 +66,9 @@ func TestAccDataSourceDNSKeys_noDnsSec(t *testing.T) { acctest.SkipIfVcr(t) t.Parallel() - dnsZoneName := fmt.Sprintf("tf-test-dnskey-test-%s", RandString(t, 10)) + dnsZoneName := fmt.Sprintf("tf-test-dnskey-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, CheckDestroy: testAccCheckDNSManagedZoneDestroyProducerFramework(t), Steps: []resource.TestStep{ @@ -86,7 +86,7 @@ func TestAccDataSourceDNSKeys_noDnsSec(t *testing.T) { ), }, { - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Config: testAccDataSourceDNSKeysConfig(dnsZoneName, "off"), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr("data.google_dns_keys.foo_dns_key", "key_signing_keys.#", "0"), diff --git a/mmv1/third_party/terraform/tests/data_source_dns_managed_zone_test.go.erb b/mmv1/third_party/terraform/tests/data_source_dns_managed_zone_test.go.erb index 9358d2e87840..3358eaee2731 100644 --- a/mmv1/third_party/terraform/tests/data_source_dns_managed_zone_test.go.erb +++ b/mmv1/third_party/terraform/tests/data_source_dns_managed_zone_test.go.erb @@ -17,7 +17,7 @@ func TestAccDataSourceDnsManagedZone_basic(t *testing.T) { acctest.SkipIfVcr(t) t.Parallel() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, CheckDestroy: testAccCheckDNSManagedZoneDestroyProducerFramework(t), Steps: []resource.TestStep{ @@ -28,7 +28,7 @@ func TestAccDataSourceDnsManagedZone_basic(t *testing.T) { Source: "hashicorp/google<%= "-" + version unless version == 'ga' -%>", }, }, - Config: testAccDataSourceDnsManagedZone_basic(RandString(t, 10)), + Config: testAccDataSourceDnsManagedZone_basic(acctest.RandString(t, 10)), Check: acctest.CheckDataSourceStateMatchesResourceStateWithIgnores( "data.google_dns_managed_zone.qa", "google_dns_managed_zone.foo", @@ -50,8 +50,8 @@ func TestAccDataSourceDnsManagedZone_basic(t *testing.T) { ), }, { - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), - Config: testAccDataSourceDnsManagedZone_basic(RandString(t, 10)), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), + Config: testAccDataSourceDnsManagedZone_basic(acctest.RandString(t, 10)), Check: acctest.CheckDataSourceStateMatchesResourceStateWithIgnores( "data.google_dns_managed_zone.qa", "google_dns_managed_zone.foo", diff --git a/mmv1/third_party/terraform/tests/data_source_dns_record_set_test.go.erb b/mmv1/third_party/terraform/tests/data_source_dns_record_set_test.go.erb index 3799ff757311..d65d09b919e7 100644 --- a/mmv1/third_party/terraform/tests/data_source_dns_record_set_test.go.erb +++ b/mmv1/third_party/terraform/tests/data_source_dns_record_set_test.go.erb @@ -19,9 +19,9 @@ func TestAccDataSourceDnsRecordSet_basic(t *testing.T) { var ttl1, ttl2 string // ttl is a computed string-type attribute that is easy to compare in the test - managedZoneName := fmt.Sprintf("tf-test-zone-%s", RandString(t, 10)) + managedZoneName := fmt.Sprintf("tf-test-zone-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, CheckDestroy: testAccCheckDnsRecordSetDestroyProducerFramework(t), Steps: []resource.TestStep{ @@ -32,15 +32,15 @@ func TestAccDataSourceDnsRecordSet_basic(t *testing.T) { Source: "hashicorp/google<%= "-" + version unless version == 'ga' -%>", }, }, - Config: testAccDataSourceDnsRecordSet_basic(managedZoneName, RandString(t, 10)), + Config: testAccDataSourceDnsRecordSet_basic(managedZoneName, acctest.RandString(t, 10)), Check: resource.ComposeTestCheckFunc( acctest.CheckDataSourceStateMatchesResourceState("data.google_dns_record_set.rs", "google_dns_record_set.rs"), acctest.TestExtractResourceAttr("data.google_dns_record_set.rs", "ttl", &ttl1), ), }, { - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), - Config: testAccDataSourceDnsRecordSet_basic(managedZoneName, RandString(t, 10)), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), + Config: testAccDataSourceDnsRecordSet_basic(managedZoneName, acctest.RandString(t, 10)), Check: resource.ComposeTestCheckFunc( acctest.CheckDataSourceStateMatchesResourceState("data.google_dns_record_set.rs", "google_dns_record_set.rs"), acctest.TestExtractResourceAttr("data.google_dns_record_set.rs", "ttl", &ttl2), diff --git a/mmv1/third_party/terraform/tests/data_source_google_active_folder_test.go b/mmv1/third_party/terraform/tests/data_source_google_active_folder_test.go index cf4697a4f0b9..5336eedd4809 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_active_folder_test.go +++ b/mmv1/third_party/terraform/tests/data_source_google_active_folder_test.go @@ -14,11 +14,11 @@ func TestAccDataSourceGoogleActiveFolder_default(t *testing.T) { org := envvar.GetTestOrgFromEnv(t) parent := fmt.Sprintf("organizations/%s", org) - displayName := "tf-test-" + RandString(t, 10) + displayName := "tf-test-" + acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccDataSourceGoogleActiveFolderConfig(parent, displayName), @@ -34,11 +34,11 @@ func TestAccDataSourceGoogleActiveFolder_space(t *testing.T) { org := envvar.GetTestOrgFromEnv(t) parent := fmt.Sprintf("organizations/%s", org) - displayName := "terraform test " + RandString(t, 10) + displayName := "terraform test " + acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccDataSourceGoogleActiveFolderConfig(parent, displayName), @@ -54,11 +54,11 @@ func TestAccDataSourceGoogleActiveFolder_dash(t *testing.T) { org := envvar.GetTestOrgFromEnv(t) parent := fmt.Sprintf("organizations/%s", org) - displayName := "terraform - test " + RandString(t, 10) + displayName := "terraform - test " + acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccDataSourceGoogleActiveFolderConfig(parent, displayName), diff --git a/mmv1/third_party/terraform/tests/data_source_google_app_engine_default_service_account_test.go b/mmv1/third_party/terraform/tests/data_source_google_app_engine_default_service_account_test.go index aada61e5a1b2..70b0886246fc 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_app_engine_default_service_account_test.go +++ b/mmv1/third_party/terraform/tests/data_source_google_app_engine_default_service_account_test.go @@ -12,9 +12,9 @@ func TestAccDataSourceGoogleAppEngineDefaultServiceAccount_basic(t *testing.T) { resourceName := "data.google_app_engine_default_service_account.default" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccCheckGoogleAppEngineDefaultServiceAccount_basic, diff --git a/mmv1/third_party/terraform/tests/data_source_google_beyondcorp_app_connection_test.go b/mmv1/third_party/terraform/tests/data_source_google_beyondcorp_app_connection_test.go index b4a9f2f553eb..ee4baec6b61c 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_beyondcorp_app_connection_test.go +++ b/mmv1/third_party/terraform/tests/data_source_google_beyondcorp_app_connection_test.go @@ -12,12 +12,12 @@ func TestAccDataSourceGoogleBeyondcorpAppConnection_basic(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckBeyondcorpAppConnectionDestroyProducer(t), Steps: []resource.TestStep{ { @@ -34,12 +34,12 @@ func TestAccDataSourceGoogleBeyondcorpAppConnection_full(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckBeyondcorpAppConnectionDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/data_source_google_beyondcorp_app_connector_test.go b/mmv1/third_party/terraform/tests/data_source_google_beyondcorp_app_connector_test.go index ec5f164a6eee..9fe7f7e52149 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_beyondcorp_app_connector_test.go +++ b/mmv1/third_party/terraform/tests/data_source_google_beyondcorp_app_connector_test.go @@ -11,12 +11,12 @@ func TestAccDataSourceGoogleBeyondcorpAppConnector_basic(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckBeyondcorpAppConnectorDestroyProducer(t), Steps: []resource.TestStep{ { @@ -33,12 +33,12 @@ func TestAccDataSourceGoogleBeyondcorpAppConnector_optionalProject(t *testing.T) t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckBeyondcorpAppConnectorDestroyProducer(t), Steps: []resource.TestStep{ { @@ -55,12 +55,12 @@ func TestAccDataSourceGoogleBeyondcorpAppConnector_optionalRegion(t *testing.T) t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckBeyondcorpAppConnectorDestroyProducer(t), Steps: []resource.TestStep{ { @@ -77,12 +77,12 @@ func TestAccDataSourceGoogleBeyondcorpAppConnector_optionalProjectRegion(t *test t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckBeyondcorpAppConnectorDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/data_source_google_beyondcorp_app_gateway_test.go b/mmv1/third_party/terraform/tests/data_source_google_beyondcorp_app_gateway_test.go index 2ada03644414..caff3ead738b 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_beyondcorp_app_gateway_test.go +++ b/mmv1/third_party/terraform/tests/data_source_google_beyondcorp_app_gateway_test.go @@ -11,12 +11,12 @@ func TestAccDataSourceGoogleBeyondcorpAppGateway_basic(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckBeyondcorpAppGatewayDestroyProducer(t), Steps: []resource.TestStep{ { @@ -33,12 +33,12 @@ func TestAccDataSourceGoogleBeyondcorpAppGateway_optionalProject(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckBeyondcorpAppGatewayDestroyProducer(t), Steps: []resource.TestStep{ { @@ -55,12 +55,12 @@ func TestAccDataSourceGoogleBeyondcorpAppGateway_optionalRegion(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckBeyondcorpAppGatewayDestroyProducer(t), Steps: []resource.TestStep{ { @@ -77,12 +77,12 @@ func TestAccDataSourceGoogleBeyondcorpAppGateway_optionalProjectRegion(t *testin t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckBeyondcorpAppGatewayDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/data_source_google_bigquery_default_service_account_test.go b/mmv1/third_party/terraform/tests/data_source_google_bigquery_default_service_account_test.go index f1e2c644ffe8..aedbb0fdd2c9 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_bigquery_default_service_account_test.go +++ b/mmv1/third_party/terraform/tests/data_source_google_bigquery_default_service_account_test.go @@ -12,9 +12,9 @@ func TestAccDataSourceGoogleBigqueryDefaultServiceAccount_basic(t *testing.T) { resourceName := "data.google_bigquery_default_service_account.bq_account" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccCheckGoogleBigqueryDefaultServiceAccount_basic, diff --git a/mmv1/third_party/terraform/tests/data_source_google_billing_account_test.go b/mmv1/third_party/terraform/tests/data_source_google_billing_account_test.go index 09d7e15632d9..d0265d58470b 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_billing_account_test.go +++ b/mmv1/third_party/terraform/tests/data_source_google_billing_account_test.go @@ -14,9 +14,9 @@ func TestAccDataSourceGoogleBillingAccount_byFullName(t *testing.T) { billingId := envvar.GetTestMasterBillingAccountFromEnv(t) name := "billingAccounts/" + billingId - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccCheckGoogleBillingAccount_byName(name), @@ -34,9 +34,9 @@ func TestAccDataSourceGoogleBillingAccount_byShortName(t *testing.T) { billingId := envvar.GetTestMasterBillingAccountFromEnv(t) name := "billingAccounts/" + billingId - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccCheckGoogleBillingAccount_byName(billingId), @@ -54,9 +54,9 @@ func TestAccDataSourceGoogleBillingAccount_byFullNameClosed(t *testing.T) { billingId := envvar.GetTestMasterBillingAccountFromEnv(t) name := "billingAccounts/" + billingId - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccCheckGoogleBillingAccount_byNameClosed(name), @@ -67,11 +67,11 @@ func TestAccDataSourceGoogleBillingAccount_byFullNameClosed(t *testing.T) { } func TestAccDataSourceGoogleBillingAccount_byDisplayName(t *testing.T) { - name := RandString(t, 16) + name := acctest.RandString(t, 16) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccCheckGoogleBillingAccount_byDisplayName(name), diff --git a/mmv1/third_party/terraform/tests/data_source_google_client_config_test.go b/mmv1/third_party/terraform/tests/data_source_google_client_config_test.go index ee4567a88341..9d5ff9caa306 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_client_config_test.go +++ b/mmv1/third_party/terraform/tests/data_source_google_client_config_test.go @@ -12,9 +12,9 @@ func TestAccDataSourceGoogleClientConfig_basic(t *testing.T) { resourceName := "data.google_client_config.current" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccCheckGoogleClientConfig_basic, @@ -35,8 +35,8 @@ func TestAccDataSourceGoogleClientConfig_omitLocation(t *testing.T) { resourceName := "data.google_client_config.current" - VcrTest(t, resource.TestCase{ - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + acctest.VcrTest(t, resource.TestCase{ + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccCheckGoogleClientConfig_basic, diff --git a/mmv1/third_party/terraform/tests/data_source_google_client_openid_userinfo_test.go b/mmv1/third_party/terraform/tests/data_source_google_client_openid_userinfo_test.go index 820303f68e66..7c1058ee9294 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_client_openid_userinfo_test.go +++ b/mmv1/third_party/terraform/tests/data_source_google_client_openid_userinfo_test.go @@ -10,9 +10,9 @@ import ( func TestAccDataSourceGoogleClientOpenIDUserinfo_basic(t *testing.T) { t.Parallel() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccCheckGoogleClientOpenIDUserinfo_basic, diff --git a/mmv1/third_party/terraform/tests/data_source_google_cloud_asset_resources_search_all_test.go.erb b/mmv1/third_party/terraform/tests/data_source_google_cloud_asset_resources_search_all_test.go.erb index e8531daf3c88..587bf4fd782b 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_cloud_asset_resources_search_all_test.go.erb +++ b/mmv1/third_party/terraform/tests/data_source_google_cloud_asset_resources_search_all_test.go.erb @@ -17,9 +17,9 @@ func TestAccDataSourceGoogleCloudAssetResourcesSearchAll_basic(t *testing.T) { project := envvar.GetTestProjectFromEnv() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccCheckGoogleCloudAssetProjectResources(project), diff --git a/mmv1/third_party/terraform/tests/data_source_google_cloudbuild_trigger_test.go b/mmv1/third_party/terraform/tests/data_source_google_cloudbuild_trigger_test.go index ad9541ec7982..a99ea2391829 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_cloudbuild_trigger_test.go +++ b/mmv1/third_party/terraform/tests/data_source_google_cloudbuild_trigger_test.go @@ -11,12 +11,12 @@ func TestAccDataSourceGoogleCloudBuildTrigger_basic(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckCloudBuildTriggerDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/data_source_google_cloudfunctions2_function_test.go b/mmv1/third_party/terraform/tests/data_source_google_cloudfunctions2_function_test.go index eeaed6a62f3b..00a2d720f4b2 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_cloudfunctions2_function_test.go +++ b/mmv1/third_party/terraform/tests/data_source_google_cloudfunctions2_function_test.go @@ -12,13 +12,13 @@ func TestAccDataSourceGoogleCloudFunctions2Function_basic(t *testing.T) { t.Parallel() funcDataNameHttp := "data.google_cloudfunctions2_function.function_http_v2" - functionName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - bucketName := fmt.Sprintf("tf-test-bucket-%d", RandInt(t)) + functionName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + bucketName := fmt.Sprintf("tf-test-bucket-%d", acctest.RandInt(t)) zipFilePath := "./test-fixtures/cloudfunctions2/function-source.zip" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckCloudfunctions2functionDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/data_source_google_cloudfunctions_function_test.go b/mmv1/third_party/terraform/tests/data_source_google_cloudfunctions_function_test.go index dad4b468b6e8..0e5710b4a07d 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_cloudfunctions_function_test.go +++ b/mmv1/third_party/terraform/tests/data_source_google_cloudfunctions_function_test.go @@ -14,14 +14,14 @@ func TestAccDataSourceGoogleCloudFunctionsFunction_basic(t *testing.T) { t.Parallel() funcDataNameHttp := "data.google_cloudfunctions_function.function_http" - functionName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - bucketName := fmt.Sprintf("tf-test-bucket-%d", RandInt(t)) + functionName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + bucketName := fmt.Sprintf("tf-test-bucket-%d", acctest.RandInt(t)) zipFilePath := createZIPArchiveForCloudFunctionSource(t, testHTTPTriggerPath) defer os.Remove(zipFilePath) // clean up - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckCloudFunctionsFunctionDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/data_source_google_composer_environment_test.go b/mmv1/third_party/terraform/tests/data_source_google_composer_environment_test.go index 0455ddb56b00..411cdb41c2d5 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_composer_environment_test.go +++ b/mmv1/third_party/terraform/tests/data_source_google_composer_environment_test.go @@ -15,12 +15,12 @@ func TestAccDataSourceComposerEnvironment_basic(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccDataSourceComposerEnvironment_basic(context), diff --git a/mmv1/third_party/terraform/tests/data_source_google_composer_image_versions_test.go b/mmv1/third_party/terraform/tests/data_source_google_composer_image_versions_test.go index 7d9c977a70f0..0fe8ad79c441 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_composer_image_versions_test.go +++ b/mmv1/third_party/terraform/tests/data_source_google_composer_image_versions_test.go @@ -14,9 +14,9 @@ import ( func TestAccDataSourceComposerImageVersions_basic(t *testing.T) { t.Parallel() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccCheckGoogleComposerImageVersionsConfig, diff --git a/mmv1/third_party/terraform/tests/data_source_google_compute_address_test.go b/mmv1/third_party/terraform/tests/data_source_google_compute_address_test.go index b0f7d715a420..1db42441b96f 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_compute_address_test.go +++ b/mmv1/third_party/terraform/tests/data_source_google_compute_address_test.go @@ -77,16 +77,16 @@ func TestComputeAddressIdParsing(t *testing.T) { func TestAccDataSourceComputeAddress(t *testing.T) { t.Parallel() - addressName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + addressName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) rsName := "foobar" rsFullName := fmt.Sprintf("google_compute_address.%s", rsName) dsName := "my_address" dsFullName := fmt.Sprintf("data.google_compute_address.%s", dsName) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDataSourceComputeAddressDestroy(t, rsFullName), Steps: []resource.TestStep{ { @@ -153,7 +153,7 @@ func testAccCheckDataSourceComputeAddressDestroy(t *testing.T, name string) reso continue } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) addressId, err := compute.ParseComputeAddressId(rs.Primary.ID, nil) if err != nil { diff --git a/mmv1/third_party/terraform/tests/data_source_google_compute_addresses_test.go.erb b/mmv1/third_party/terraform/tests/data_source_google_compute_addresses_test.go.erb index 3c56a40c494b..48bef7b79e61 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_compute_addresses_test.go.erb +++ b/mmv1/third_party/terraform/tests/data_source_google_compute_addresses_test.go.erb @@ -13,7 +13,7 @@ import ( func TestAccDataSourceComputeAddresses(t *testing.T) { t.Parallel() - addressName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + addressName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) region := "europe-west8" region_bis := "asia-east1" @@ -22,9 +22,9 @@ func TestAccDataSourceComputeAddresses(t *testing.T) { dsAllName := "all_addresses" dsAllFullName := fmt.Sprintf("data.google_compute_addresses.%s", dsAllName) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccDataSourceComputeAddressesConfig(addressName, region, region_bis), diff --git a/mmv1/third_party/terraform/tests/data_source_google_compute_backend_bucket_test.go b/mmv1/third_party/terraform/tests/data_source_google_compute_backend_bucket_test.go index 1d483a31c9da..ebd94e0abfdf 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_compute_backend_bucket_test.go +++ b/mmv1/third_party/terraform/tests/data_source_google_compute_backend_bucket_test.go @@ -11,12 +11,12 @@ import ( func TestAccDataSourceComputeBackendBucket_basic(t *testing.T) { t.Parallel() - backendBucketName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - bucketName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + backendBucketName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + bucketName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeBackendBucketDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/data_source_google_compute_backend_service_test.go b/mmv1/third_party/terraform/tests/data_source_google_compute_backend_service_test.go index ffb84c4709f8..ceac4256abee 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_compute_backend_service_test.go +++ b/mmv1/third_party/terraform/tests/data_source_google_compute_backend_service_test.go @@ -11,12 +11,12 @@ import ( func TestAccDataSourceComputeBackendService_basic(t *testing.T) { t.Parallel() - serviceName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - checkName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + serviceName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + checkName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeBackendServiceDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/data_source_google_compute_default_service_account_test.go b/mmv1/third_party/terraform/tests/data_source_google_compute_default_service_account_test.go index 0a7615a37a2f..54671f112f6c 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_compute_default_service_account_test.go +++ b/mmv1/third_party/terraform/tests/data_source_google_compute_default_service_account_test.go @@ -12,9 +12,9 @@ func TestAccDataSourceGoogleComputeDefaultServiceAccount_basic(t *testing.T) { resourceName := "data.google_compute_default_service_account.default" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccCheckGoogleComputeDefaultServiceAccount_basic, diff --git a/mmv1/third_party/terraform/tests/data_source_google_compute_disk_test.go b/mmv1/third_party/terraform/tests/data_source_google_compute_disk_test.go index eaf2e3f8fd3d..81fcb8094ba1 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_compute_disk_test.go +++ b/mmv1/third_party/terraform/tests/data_source_google_compute_disk_test.go @@ -11,12 +11,12 @@ func TestAccDataSourceGoogleComputeDisk_basic(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeDiskDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/data_source_google_compute_forwarding_rule_test.go b/mmv1/third_party/terraform/tests/data_source_google_compute_forwarding_rule_test.go index c79e9a9ea0e7..63ecfe67fc18 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_compute_forwarding_rule_test.go +++ b/mmv1/third_party/terraform/tests/data_source_google_compute_forwarding_rule_test.go @@ -11,12 +11,12 @@ import ( func TestAccDataSourceGoogleForwardingRule(t *testing.T) { t.Parallel() - poolName := fmt.Sprintf("tf-%s", RandString(t, 10)) - ruleName := fmt.Sprintf("tf-%s", RandString(t, 10)) + poolName := fmt.Sprintf("tf-%s", acctest.RandString(t, 10)) + ruleName := fmt.Sprintf("tf-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccDataSourceGoogleForwardingRuleConfig(poolName, ruleName), diff --git a/mmv1/third_party/terraform/tests/data_source_google_compute_global_address_test.go b/mmv1/third_party/terraform/tests/data_source_google_compute_global_address_test.go index 869799b640eb..b006ccbba94c 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_compute_global_address_test.go +++ b/mmv1/third_party/terraform/tests/data_source_google_compute_global_address_test.go @@ -17,11 +17,11 @@ func TestAccDataSourceComputeGlobalAddress(t *testing.T) { rsFullName := fmt.Sprintf("google_compute_global_address.%s", rsName) dsName := "my_address" dsFullName := fmt.Sprintf("data.google_compute_global_address.%s", dsName) - addressName := fmt.Sprintf("tf-test-address-%s", RandString(t, 10)) + addressName := fmt.Sprintf("tf-test-address-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeGlobalAddressDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/data_source_google_compute_ha_vpn_gateway_test.go b/mmv1/third_party/terraform/tests/data_source_google_compute_ha_vpn_gateway_test.go index 68f290188e36..c6c12755bc89 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_compute_ha_vpn_gateway_test.go +++ b/mmv1/third_party/terraform/tests/data_source_google_compute_ha_vpn_gateway_test.go @@ -11,11 +11,11 @@ import ( func TestAccDataSourceComputeHaVpnGateway(t *testing.T) { t.Parallel() - gwName := fmt.Sprintf("tf-%s", RandString(t, 10)) + gwName := fmt.Sprintf("tf-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccDataSourceComputeHaVpnGatewayConfig(gwName), diff --git a/mmv1/third_party/terraform/tests/data_source_google_compute_image_test.go b/mmv1/third_party/terraform/tests/data_source_google_compute_image_test.go index 21b11eb53aa5..166a823ca51b 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_compute_image_test.go +++ b/mmv1/third_party/terraform/tests/data_source_google_compute_image_test.go @@ -13,12 +13,12 @@ import ( func TestAccDataSourceComputeImage(t *testing.T) { t.Parallel() - family := fmt.Sprintf("tf-test-%d", RandInt(t)) - name := fmt.Sprintf("tf-test-%d", RandInt(t)) + family := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) + name := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeImageDestroyProducer(t), Steps: []resource.TestStep{ { @@ -45,12 +45,12 @@ func TestAccDataSourceComputeImage(t *testing.T) { func TestAccDataSourceComputeImageFilter(t *testing.T) { t.Parallel() - family := fmt.Sprintf("tf-test-%d", RandInt(t)) - name := fmt.Sprintf("tf-test-%d", RandInt(t)) + family := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) + name := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeImageDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/data_source_google_compute_instance_group_manager_test.go b/mmv1/third_party/terraform/tests/data_source_google_compute_instance_group_manager_test.go index 2982edcf8fbc..cd3d37b830b5 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_compute_instance_group_manager_test.go +++ b/mmv1/third_party/terraform/tests/data_source_google_compute_instance_group_manager_test.go @@ -12,20 +12,20 @@ func TestAccDataSourceGoogleComputeInstanceGroupManager(t *testing.T) { t.Parallel() zoneName := "us-central1-a" - igmName := "tf-test-igm" + RandString(t, 6) + igmName := "tf-test-igm" + acctest.RandString(t, 6) context := map[string]interface{}{ "zoneName": zoneName, "igmName": igmName, - "baseName": "tf-test-igm-base" + RandString(t, 6), - "poolName": "tf-test-pool" + RandString(t, 6), - "templateName": "tf-test-templt" + RandString(t, 6), - "autoHealName": "tf-test-ah-name" + RandString(t, 6), + "baseName": "tf-test-igm-base" + acctest.RandString(t, 6), + "poolName": "tf-test-pool" + acctest.RandString(t, 6), + "templateName": "tf-test-templt" + acctest.RandString(t, 6), + "autoHealName": "tf-test-ah-name" + acctest.RandString(t, 6), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccDataSourceGoogleComputeInstanceGroupManager_basic1(context), diff --git a/mmv1/third_party/terraform/tests/data_source_google_compute_instance_group_test.go.erb b/mmv1/third_party/terraform/tests/data_source_google_compute_instance_group_test.go.erb index c09e239100d2..d535292c6e57 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_compute_instance_group_test.go.erb +++ b/mmv1/third_party/terraform/tests/data_source_google_compute_instance_group_test.go.erb @@ -18,12 +18,12 @@ import ( func TestAccDataSourceGoogleComputeInstanceGroup_basic(t *testing.T) { t.Parallel() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { - Config: testAccCheckDataSourceGoogleComputeInstanceGroupConfig(RandString(t, 10), RandString(t, 10)), + Config: testAccCheckDataSourceGoogleComputeInstanceGroupConfig(acctest.RandString(t, 10), acctest.RandString(t, 10)), Check: resource.ComposeTestCheckFunc( testAccCheckDataSourceGoogleComputeInstanceGroup("data.google_compute_instance_group.test"), ), @@ -35,12 +35,12 @@ func TestAccDataSourceGoogleComputeInstanceGroup_basic(t *testing.T) { func TestAccDataSourceGoogleComputeInstanceGroup_withNamedPort(t *testing.T) { t.Parallel() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { - Config: testAccCheckDataSourceGoogleComputeInstanceGroupConfigWithNamedPort(RandString(t, 10), RandString(t, 10)), + Config: testAccCheckDataSourceGoogleComputeInstanceGroupConfigWithNamedPort(acctest.RandString(t, 10), acctest.RandString(t, 10)), Check: resource.ComposeTestCheckFunc( testAccCheckDataSourceGoogleComputeInstanceGroup("data.google_compute_instance_group.test"), ), @@ -52,12 +52,12 @@ func TestAccDataSourceGoogleComputeInstanceGroup_withNamedPort(t *testing.T) { func TestAccDataSourceGoogleComputeInstanceGroup_fromIGM(t *testing.T) { t.Parallel() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { - Config: testAccCheckDataSourceGoogleComputeInstanceGroup_fromIGM(fmt.Sprintf("tf-test-igm-%d", RandInt(t)), fmt.Sprintf("tf-test-igm-%d", RandInt(t))), + Config: testAccCheckDataSourceGoogleComputeInstanceGroup_fromIGM(fmt.Sprintf("tf-test-igm-%d", acctest.RandInt(t)), fmt.Sprintf("tf-test-igm-%d", acctest.RandInt(t))), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr("data.google_compute_instance_group.test", "instances.#", "10"), ), diff --git a/mmv1/third_party/terraform/tests/data_source_google_compute_instance_serial_port_test.go b/mmv1/third_party/terraform/tests/data_source_google_compute_instance_serial_port_test.go index a9e6d920b011..0bc8fd492efb 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_compute_instance_serial_port_test.go +++ b/mmv1/third_party/terraform/tests/data_source_google_compute_instance_serial_port_test.go @@ -11,10 +11,10 @@ import ( ) func TestAccDataSourceComputeInstanceSerialPort_basic(t *testing.T) { - instanceName := fmt.Sprintf("tf-test-serial-data-%s", RandString(t, 10)) - VcrTest(t, resource.TestCase{ + instanceName := fmt.Sprintf("tf-test-serial-data-%s", acctest.RandString(t, 10)) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccComputeInstanceSerialPort(instanceName), diff --git a/mmv1/third_party/terraform/tests/data_source_google_compute_instance_template_test.go b/mmv1/third_party/terraform/tests/data_source_google_compute_instance_template_test.go index da60fa3f860c..3e728ec09c9a 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_compute_instance_template_test.go +++ b/mmv1/third_party/terraform/tests/data_source_google_compute_instance_template_test.go @@ -11,12 +11,12 @@ import ( func TestAccInstanceTemplateDatasource_name(t *testing.T) { t.Parallel() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { - Config: testAccInstanceTemplate_name(envvar.GetTestProjectFromEnv(), RandString(t, 10)), + Config: testAccInstanceTemplate_name(envvar.GetTestProjectFromEnv(), acctest.RandString(t, 10)), Check: resource.ComposeTestCheckFunc( acctest.CheckDataSourceStateMatchesResourceStateWithIgnores( "data.google_compute_instance_template.default", @@ -32,12 +32,12 @@ func TestAccInstanceTemplateDatasource_name(t *testing.T) { func TestAccInstanceTemplateDatasource_filter(t *testing.T) { t.Parallel() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { - Config: testAccInstanceTemplate_filter(envvar.GetTestProjectFromEnv(), RandString(t, 10)), + Config: testAccInstanceTemplate_filter(envvar.GetTestProjectFromEnv(), acctest.RandString(t, 10)), Check: resource.ComposeTestCheckFunc( acctest.CheckDataSourceStateMatchesResourceStateWithIgnores( "data.google_compute_instance_template.default", @@ -53,12 +53,12 @@ func TestAccInstanceTemplateDatasource_filter(t *testing.T) { func TestAccInstanceTemplateDatasource_filter_mostRecent(t *testing.T) { t.Parallel() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { - Config: testAccInstanceTemplate_filter_mostRecent(envvar.GetTestProjectFromEnv(), RandString(t, 10)), + Config: testAccInstanceTemplate_filter_mostRecent(envvar.GetTestProjectFromEnv(), acctest.RandString(t, 10)), Check: resource.ComposeTestCheckFunc( acctest.CheckDataSourceStateMatchesResourceStateWithIgnores( "data.google_compute_instance_template.default", @@ -74,12 +74,12 @@ func TestAccInstanceTemplateDatasource_filter_mostRecent(t *testing.T) { func TestAccInstanceTemplateDatasource_self_link_unique(t *testing.T) { t.Parallel() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { - Config: testAccInstanceTemplate_self_link_unique(envvar.GetTestProjectFromEnv(), RandString(t, 10)), + Config: testAccInstanceTemplate_self_link_unique(envvar.GetTestProjectFromEnv(), acctest.RandString(t, 10)), Check: resource.ComposeTestCheckFunc( acctest.CheckDataSourceStateMatchesResourceStateWithIgnores( "data.google_compute_instance_template.default", diff --git a/mmv1/third_party/terraform/tests/data_source_google_compute_instance_test.go b/mmv1/third_party/terraform/tests/data_source_google_compute_instance_test.go index bc632cab2b51..9ac37f778fd8 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_compute_instance_test.go +++ b/mmv1/third_party/terraform/tests/data_source_google_compute_instance_test.go @@ -12,11 +12,11 @@ import ( func TestAccDataSourceComputeInstance_basic(t *testing.T) { t.Parallel() - instanceName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + instanceName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/data_source_google_compute_network_test.go b/mmv1/third_party/terraform/tests/data_source_google_compute_network_test.go index 2919708e46e0..fb5ec6630a9b 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_compute_network_test.go +++ b/mmv1/third_party/terraform/tests/data_source_google_compute_network_test.go @@ -13,10 +13,10 @@ import ( func TestAccDataSourceGoogleNetwork(t *testing.T) { t.Parallel() - networkName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - VcrTest(t, resource.TestCase{ + networkName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccDataSourceGoogleNetworkConfig(networkName), diff --git a/mmv1/third_party/terraform/tests/data_source_google_compute_node_types_test.go b/mmv1/third_party/terraform/tests/data_source_google_compute_node_types_test.go index 9d4cd4098604..ca977cfe97ae 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_compute_node_types_test.go +++ b/mmv1/third_party/terraform/tests/data_source_google_compute_node_types_test.go @@ -16,9 +16,9 @@ import ( func TestAccDataSourceComputeNodeTypes_basic(t *testing.T) { t.Parallel() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccDataSourceComputeNodeTypes_basic, diff --git a/mmv1/third_party/terraform/tests/data_source_google_compute_region_instance_group_test.go.erb b/mmv1/third_party/terraform/tests/data_source_google_compute_region_instance_group_test.go.erb index 89069f6acb41..b8740c8a2938 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_compute_region_instance_group_test.go.erb +++ b/mmv1/third_party/terraform/tests/data_source_google_compute_region_instance_group_test.go.erb @@ -13,13 +13,13 @@ func TestAccDataSourceRegionInstanceGroup(t *testing.T) { // Randomness in instance template acctest.SkipIfVcr(t) t.Parallel() - name := "tf-test-" + RandString(t, 6) - VcrTest(t, resource.TestCase{ + name := "tf-test-" + acctest.RandString(t, 6) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { - Config: testAccDataSourceRegionInstanceGroup_basic(fmt.Sprintf("tf-test-rigm--%d", RandInt(t)), name), + Config: testAccDataSourceRegionInstanceGroup_basic(fmt.Sprintf("tf-test-rigm--%d", acctest.RandInt(t)), name), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr("data.google_compute_region_instance_group.data_source", "name", name), resource.TestCheckResourceAttr("data.google_compute_region_instance_group.data_source", "project", envvar.GetTestProjectFromEnv()), diff --git a/mmv1/third_party/terraform/tests/data_source_google_compute_region_instance_template_test.go.erb b/mmv1/third_party/terraform/tests/data_source_google_compute_region_instance_template_test.go.erb index df7f08b11acd..79521de6a391 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_compute_region_instance_template_test.go.erb +++ b/mmv1/third_party/terraform/tests/data_source_google_compute_region_instance_template_test.go.erb @@ -15,12 +15,12 @@ import ( func TestAccRegionInstanceTemplateDatasource_name(t *testing.T) { t.Parallel() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { - Config: testAccRegionInstanceTemplate_name(envvar.GetTestProjectFromEnv(), RandString(t, 10)), + Config: testAccRegionInstanceTemplate_name(envvar.GetTestProjectFromEnv(), acctest.RandString(t, 10)), Check: resource.ComposeTestCheckFunc( acctest.CheckDataSourceStateMatchesResourceStateWithIgnores( "data.google_compute_region_instance_template.default", @@ -36,12 +36,12 @@ func TestAccRegionInstanceTemplateDatasource_name(t *testing.T) { func TestAccRegionInstanceTemplateDatasource_filter(t *testing.T) { t.Parallel() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { - Config: testAccRegionInstanceTemplate_filter(envvar.GetTestProjectFromEnv(), RandString(t, 10)), + Config: testAccRegionInstanceTemplate_filter(envvar.GetTestProjectFromEnv(), acctest.RandString(t, 10)), Check: resource.ComposeTestCheckFunc( acctest.CheckDataSourceStateMatchesResourceStateWithIgnores( "data.google_compute_region_instance_template.default", @@ -57,12 +57,12 @@ func TestAccRegionInstanceTemplateDatasource_filter(t *testing.T) { func TestAccRegionInstanceTemplateDatasource_filter_mostRecent(t *testing.T) { t.Parallel() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { - Config: testAccRegionInstanceTemplate_filter_mostRecent(envvar.GetTestProjectFromEnv(), RandString(t, 10)), + Config: testAccRegionInstanceTemplate_filter_mostRecent(envvar.GetTestProjectFromEnv(), acctest.RandString(t, 10)), Check: resource.ComposeTestCheckFunc( acctest.CheckDataSourceStateMatchesResourceStateWithIgnores( "data.google_compute_region_instance_template.default", diff --git a/mmv1/third_party/terraform/tests/data_source_google_compute_region_network_endpoint_group_test.go b/mmv1/third_party/terraform/tests/data_source_google_compute_region_network_endpoint_group_test.go index b1b715cf96a0..ab4854349f6f 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_compute_region_network_endpoint_group_test.go +++ b/mmv1/third_party/terraform/tests/data_source_google_compute_region_network_endpoint_group_test.go @@ -13,12 +13,12 @@ func TestAccDataSourceRegionNetworkEndpointGroup_basic(t *testing.T) { context := map[string]interface{}{ "project": envvar.GetTestProjectFromEnv(), "region": "us-central1", - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccDataSourceRegionNetworkEndpointGroup_basic(context), diff --git a/mmv1/third_party/terraform/tests/data_source_google_compute_region_ssl_certificate_test.go b/mmv1/third_party/terraform/tests/data_source_google_compute_region_ssl_certificate_test.go index c7066ea38b0a..c4a65931e09c 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_compute_region_ssl_certificate_test.go +++ b/mmv1/third_party/terraform/tests/data_source_google_compute_region_ssl_certificate_test.go @@ -11,12 +11,12 @@ import ( func TestAccDataSourceComputeRegionSslCertificate(t *testing.T) { t.Parallel() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { - Config: testAccDataSourceComputeRegionSslCertificateConfig(RandString(t, 10)), + Config: testAccDataSourceComputeRegionSslCertificateConfig(acctest.RandString(t, 10)), Check: resource.ComposeTestCheckFunc( acctest.CheckDataSourceStateMatchesResourceStateWithIgnores( "data.google_compute_region_ssl_certificate.cert", diff --git a/mmv1/third_party/terraform/tests/data_source_google_compute_regions_test.go b/mmv1/third_party/terraform/tests/data_source_google_compute_regions_test.go index 03a33a430690..421db78043b8 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_compute_regions_test.go +++ b/mmv1/third_party/terraform/tests/data_source_google_compute_regions_test.go @@ -14,9 +14,9 @@ import ( func TestAccComputeRegions_basic(t *testing.T) { t.Parallel() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccCheckGoogleComputeRegionsConfig, diff --git a/mmv1/third_party/terraform/tests/data_source_google_compute_resource_policy_test.go b/mmv1/third_party/terraform/tests/data_source_google_compute_resource_policy_test.go index 52968d6404e9..0aaab391adb4 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_compute_resource_policy_test.go +++ b/mmv1/third_party/terraform/tests/data_source_google_compute_resource_policy_test.go @@ -14,16 +14,16 @@ import ( func TestAccDataSourceComputeResourcePolicy(t *testing.T) { t.Parallel() - randomSuffix := RandString(t, 10) + randomSuffix := acctest.RandString(t, 10) rsName := "foo_" + randomSuffix rsFullName := fmt.Sprintf("google_compute_resource_policy.%s", rsName) dsName := "my_policy_" + randomSuffix dsFullName := fmt.Sprintf("data.google_compute_resource_policy.%s", dsName) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDataSourceComputeResourcePolicyDestroy(t, rsFullName), Steps: []resource.TestStep{ { @@ -45,7 +45,7 @@ func testAccCheckDataSourceComputeResourcePolicyDestroy(t *testing.T, name strin continue } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) policyAttrs := rs.Primary.Attributes diff --git a/mmv1/third_party/terraform/tests/data_source_google_compute_router_nat_test.go b/mmv1/third_party/terraform/tests/data_source_google_compute_router_nat_test.go index fa8d25a6358a..31aa46bbc8af 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_compute_router_nat_test.go +++ b/mmv1/third_party/terraform/tests/data_source_google_compute_router_nat_test.go @@ -11,12 +11,12 @@ func TestAccDataSourceGoogleComputeRouterNat_basic(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeRouterNatDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/data_source_google_compute_router_status_test.go b/mmv1/third_party/terraform/tests/data_source_google_compute_router_status_test.go index dd62230fbfe5..94a2365f8b1b 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_compute_router_status_test.go +++ b/mmv1/third_party/terraform/tests/data_source_google_compute_router_status_test.go @@ -11,13 +11,13 @@ func TestAccDataSourceComputeRouterStatus(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "suffix": RandString(t, 10), + "suffix": acctest.RandString(t, 10), "region": "us-central1", } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), ExternalProviders: map[string]resource.ExternalProvider{ "time": {}, }, diff --git a/mmv1/third_party/terraform/tests/data_source_google_compute_router_test.go b/mmv1/third_party/terraform/tests/data_source_google_compute_router_test.go index e4961e27c43a..42c2fd8cdccd 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_compute_router_test.go +++ b/mmv1/third_party/terraform/tests/data_source_google_compute_router_test.go @@ -11,11 +11,11 @@ import ( func TestAccDataSourceComputeRouter(t *testing.T) { t.Parallel() - name := fmt.Sprintf("tf-test-router-%d", RandInt(t)) + name := fmt.Sprintf("tf-test-router-%d", acctest.RandInt(t)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccDataSourceComputeRouterConfig(name), diff --git a/mmv1/third_party/terraform/tests/data_source_google_compute_snapshot_test.go b/mmv1/third_party/terraform/tests/data_source_google_compute_snapshot_test.go index 85fd99e921bb..87fa3c711035 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_compute_snapshot_test.go +++ b/mmv1/third_party/terraform/tests/data_source_google_compute_snapshot_test.go @@ -11,12 +11,12 @@ import ( func TestAccSnapshotDatasource_name(t *testing.T) { t.Parallel() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { - Config: testAccSnapshot_name(envvar.GetTestProjectFromEnv(), RandString(t, 10)), + Config: testAccSnapshot_name(envvar.GetTestProjectFromEnv(), acctest.RandString(t, 10)), Check: resource.ComposeTestCheckFunc( acctest.CheckDataSourceStateMatchesResourceStateWithIgnores( "data.google_compute_snapshot.default", @@ -32,12 +32,12 @@ func TestAccSnapshotDatasource_name(t *testing.T) { func TestAccSnapshotDatasource_filter(t *testing.T) { t.Parallel() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { - Config: testAccSnapshot_filter(envvar.GetTestProjectFromEnv(), RandString(t, 10)), + Config: testAccSnapshot_filter(envvar.GetTestProjectFromEnv(), acctest.RandString(t, 10)), Check: resource.ComposeTestCheckFunc( acctest.CheckDataSourceStateMatchesResourceStateWithIgnores( "data.google_compute_snapshot.default", @@ -53,12 +53,12 @@ func TestAccSnapshotDatasource_filter(t *testing.T) { func TestAccSnapshotDatasource_filterMostRecent(t *testing.T) { t.Parallel() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { - Config: testAccSnapshot_filter_mostRecent(envvar.GetTestProjectFromEnv(), RandString(t, 10)), + Config: testAccSnapshot_filter_mostRecent(envvar.GetTestProjectFromEnv(), acctest.RandString(t, 10)), Check: resource.ComposeTestCheckFunc( acctest.CheckDataSourceStateMatchesResourceStateWithIgnores( "data.google_compute_snapshot.default", diff --git a/mmv1/third_party/terraform/tests/data_source_google_compute_ssl_certificate_test.go b/mmv1/third_party/terraform/tests/data_source_google_compute_ssl_certificate_test.go index 6cde219f7114..a6120910b08e 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_compute_ssl_certificate_test.go +++ b/mmv1/third_party/terraform/tests/data_source_google_compute_ssl_certificate_test.go @@ -11,12 +11,12 @@ import ( func TestAccDataSourceComputeSslCertificate(t *testing.T) { t.Parallel() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { - Config: testAccDataSourceComputeSslCertificateConfig(RandString(t, 10)), + Config: testAccDataSourceComputeSslCertificateConfig(acctest.RandString(t, 10)), Check: resource.ComposeTestCheckFunc( acctest.CheckDataSourceStateMatchesResourceStateWithIgnores( "data.google_compute_ssl_certificate.cert", diff --git a/mmv1/third_party/terraform/tests/data_source_google_compute_ssl_policy_test.go b/mmv1/third_party/terraform/tests/data_source_google_compute_ssl_policy_test.go index 191fa63ece8c..29b12529c051 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_compute_ssl_policy_test.go +++ b/mmv1/third_party/terraform/tests/data_source_google_compute_ssl_policy_test.go @@ -12,12 +12,12 @@ import ( func TestAccDataSourceGoogleSslPolicy(t *testing.T) { t.Parallel() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { - Config: testAccDataSourceGoogleSslPolicy(fmt.Sprintf("test-ssl-policy-%d", RandInt(t))), + Config: testAccDataSourceGoogleSslPolicy(fmt.Sprintf("test-ssl-policy-%d", acctest.RandInt(t))), Check: resource.ComposeTestCheckFunc( testAccDataSourceGoogleSslPolicyCheck("data.google_compute_ssl_policy.ssl_policy", "google_compute_ssl_policy.foobar"), ), diff --git a/mmv1/third_party/terraform/tests/data_source_google_compute_subnetwork_test.go b/mmv1/third_party/terraform/tests/data_source_google_compute_subnetwork_test.go index c23c3d65ef33..03ec1659d940 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_compute_subnetwork_test.go +++ b/mmv1/third_party/terraform/tests/data_source_google_compute_subnetwork_test.go @@ -13,12 +13,12 @@ import ( func TestAccDataSourceGoogleSubnetwork(t *testing.T) { t.Parallel() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { - Config: testAccDataSourceGoogleSubnetwork(fmt.Sprintf("tf-test-subnetwork-ds-%d", RandInt(t)), fmt.Sprintf("tf-test-subnetwork-ds-%d", RandInt(t))), + Config: testAccDataSourceGoogleSubnetwork(fmt.Sprintf("tf-test-subnetwork-ds-%d", acctest.RandInt(t)), fmt.Sprintf("tf-test-subnetwork-ds-%d", acctest.RandInt(t))), Check: resource.ComposeTestCheckFunc( testAccDataSourceGoogleSubnetworkCheck("data.google_compute_subnetwork.my_subnetwork", "google_compute_subnetwork.foobar"), testAccDataSourceGoogleSubnetworkCheck("data.google_compute_subnetwork.my_subnetwork_self_link", "google_compute_subnetwork.foobar"), diff --git a/mmv1/third_party/terraform/tests/data_source_google_compute_vpn_gateway_test.go b/mmv1/third_party/terraform/tests/data_source_google_compute_vpn_gateway_test.go index 8547d1ea2864..d22b5297a90a 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_compute_vpn_gateway_test.go +++ b/mmv1/third_party/terraform/tests/data_source_google_compute_vpn_gateway_test.go @@ -13,10 +13,10 @@ import ( func TestAccDataSourceGoogleVpnGateway(t *testing.T) { t.Parallel() - vpnGatewayName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - VcrTest(t, resource.TestCase{ + vpnGatewayName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccDataSourceGoogleVpnGatewayConfig(vpnGatewayName), diff --git a/mmv1/third_party/terraform/tests/data_source_google_compute_zones_test.go b/mmv1/third_party/terraform/tests/data_source_google_compute_zones_test.go index 06714261f0d6..042ff2e25438 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_compute_zones_test.go +++ b/mmv1/third_party/terraform/tests/data_source_google_compute_zones_test.go @@ -15,9 +15,9 @@ import ( func TestAccComputeZones_basic(t *testing.T) { t.Parallel() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccComputeZones_basic, @@ -33,9 +33,9 @@ func TestAccComputeZones_filter(t *testing.T) { t.Parallel() region := "us-central1" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccComputeZones_filter(region), diff --git a/mmv1/third_party/terraform/tests/data_source_google_container_attached_install_manifest_test.go b/mmv1/third_party/terraform/tests/data_source_google_container_attached_install_manifest_test.go index c75fd2e877e4..49cab5efb501 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_container_attached_install_manifest_test.go +++ b/mmv1/third_party/terraform/tests/data_source_google_container_attached_install_manifest_test.go @@ -12,12 +12,12 @@ import ( func TestAccDataSourceGoogleContainerAttachedInstallManifest(t *testing.T) { t.Parallel() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { - Config: testAccDataSourceGoogleContainerAttachedInstallManifestConfig(RandString(t, 10)), + Config: testAccDataSourceGoogleContainerAttachedInstallManifestConfig(acctest.RandString(t, 10)), Check: resource.ComposeTestCheckFunc( testAccDataSourceGoogleContainerAttachedInstallManifestCheck("data.google_container_attached_install_manifest.manifest"), ), diff --git a/mmv1/third_party/terraform/tests/data_source_google_container_attached_versions_test.go b/mmv1/third_party/terraform/tests/data_source_google_container_attached_versions_test.go index f35c031baf41..a1ae762bb8fb 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_container_attached_versions_test.go +++ b/mmv1/third_party/terraform/tests/data_source_google_container_attached_versions_test.go @@ -14,9 +14,9 @@ import ( func TestAccDataSourceGoogleContainerAttachedVersions(t *testing.T) { t.Parallel() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccDataSourceGoogleContainerAttachedVersionsConfig(), diff --git a/mmv1/third_party/terraform/tests/data_source_google_container_cluster_test.go b/mmv1/third_party/terraform/tests/data_source_google_container_cluster_test.go index de974eeb5a42..c98f959ce4bd 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_container_cluster_test.go +++ b/mmv1/third_party/terraform/tests/data_source_google_container_cluster_test.go @@ -11,12 +11,12 @@ import ( func TestAccContainerClusterDatasource_zonal(t *testing.T) { t.Parallel() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { - Config: testAccContainerClusterDatasource_zonal(RandString(t, 10)), + Config: testAccContainerClusterDatasource_zonal(acctest.RandString(t, 10)), Check: resource.ComposeTestCheckFunc( acctest.CheckDataSourceStateMatchesResourceStateWithIgnores( "data.google_container_cluster.kubes", @@ -37,12 +37,12 @@ func TestAccContainerClusterDatasource_zonal(t *testing.T) { func TestAccContainerClusterDatasource_regional(t *testing.T) { t.Parallel() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { - Config: testAccContainerClusterDatasource_regional(RandString(t, 10)), + Config: testAccContainerClusterDatasource_regional(acctest.RandString(t, 10)), Check: resource.ComposeTestCheckFunc( acctest.CheckDataSourceStateMatchesResourceStateWithIgnores( "data.google_container_cluster.kubes", diff --git a/mmv1/third_party/terraform/tests/data_source_google_container_engine_versions_test.go b/mmv1/third_party/terraform/tests/data_source_google_container_engine_versions_test.go index 28d9a314b390..4ea2bd0a1a91 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_container_engine_versions_test.go +++ b/mmv1/third_party/terraform/tests/data_source_google_container_engine_versions_test.go @@ -14,9 +14,9 @@ import ( func TestAccContainerEngineVersions_basic(t *testing.T) { t.Parallel() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccCheckGoogleContainerEngineVersionsConfig, @@ -31,9 +31,9 @@ func TestAccContainerEngineVersions_basic(t *testing.T) { func TestAccContainerEngineVersions_filtered(t *testing.T) { t.Parallel() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccCheckGoogleContainerEngineVersions_filtered, diff --git a/mmv1/third_party/terraform/tests/data_source_google_datastream_static_ips_test.go b/mmv1/third_party/terraform/tests/data_source_google_datastream_static_ips_test.go index efb7810dcedf..4ecb636fda1a 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_datastream_static_ips_test.go +++ b/mmv1/third_party/terraform/tests/data_source_google_datastream_static_ips_test.go @@ -5,12 +5,13 @@ import ( "testing" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-provider-google/google/acctest" ) func TestAccDataSourceGoogleDatastreamStaticIps_basic(t *testing.T) { - VcrTest(t, resource.TestCase{ - PreCheck: func() { AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + acctest.VcrTest(t, resource.TestCase{ + PreCheck: func() { acctest.AccTestPreCheck(t) }, + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccDataSourceGoogleDatastreamStaticIps_basic, diff --git a/mmv1/third_party/terraform/tests/data_source_google_firebase_android_app_config_test.go.erb b/mmv1/third_party/terraform/tests/data_source_google_firebase_android_app_config_test.go.erb index 5028af72da67..5567e106cae8 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_firebase_android_app_config_test.go.erb +++ b/mmv1/third_party/terraform/tests/data_source_google_firebase_android_app_config_test.go.erb @@ -17,13 +17,13 @@ func TestAccDataSourceGoogleFirebaseAndroidAppConfig(t *testing.T) { context := map[string]interface{}{ "project_id": envvar.GetTestProjectFromEnv(), - "package_name": "android.app." + RandString(t, 5), + "package_name": "android.app." + acctest.RandString(t, 5), "display_name": "tf-test Display Name AndroidAppConfig DataSource", } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccDataSourceGoogleFirebaseAndroidAppConfig(context), diff --git a/mmv1/third_party/terraform/tests/data_source_google_firebase_android_app_test.go.erb b/mmv1/third_party/terraform/tests/data_source_google_firebase_android_app_test.go.erb index 315c16c0601f..512148856d77 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_firebase_android_app_test.go.erb +++ b/mmv1/third_party/terraform/tests/data_source_google_firebase_android_app_test.go.erb @@ -14,15 +14,15 @@ func TestAccDataSourceGoogleFirebaseAndroidApp(t *testing.T) { context := map[string]interface{}{ "project_id": envvar.GetTestProjectFromEnv(), - "package_name": "android.package.app" + RandString(t, 4), + "package_name": "android.package.app" + acctest.RandString(t, 4), "display_name": "tf-test Display Name AndroidApp DataSource", } resourceName := "data.google_firebase_android_app.my_app" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccDataSourceGoogleFirebaseAndroidApp(context), diff --git a/mmv1/third_party/terraform/tests/data_source_google_firebase_apple_app_config_test.go.erb b/mmv1/third_party/terraform/tests/data_source_google_firebase_apple_app_config_test.go.erb index d7143641cd76..8c510844ecf5 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_firebase_apple_app_config_test.go.erb +++ b/mmv1/third_party/terraform/tests/data_source_google_firebase_apple_app_config_test.go.erb @@ -17,13 +17,13 @@ func TestAccDataSourceGoogleFirebaseAppleAppConfig(t *testing.T) { context := map[string]interface{}{ "project_id": envvar.GetTestProjectFromEnv(), - "bundle_id": "apple.app." + RandString(t, 5), + "bundle_id": "apple.app." + acctest.RandString(t, 5), "display_name": "tf-test Display Name AppleAppConfig DataSource", "app_store_id": 12345, "team_id": 1234567890, } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, Steps: []resource.TestStep{ { @@ -39,7 +39,7 @@ func TestAccDataSourceGoogleFirebaseAppleAppConfig(t *testing.T) { ), }, { - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Config: testAccDataSourceGoogleFirebaseAppleAppConfig(context), Check: resource.ComposeTestCheckFunc( testAccDataSourceFirebaseAppleAppConfigCheck("data.google_firebase_apple_app_config.my_app_config"), diff --git a/mmv1/third_party/terraform/tests/data_source_google_firebase_apple_app_test.go.erb b/mmv1/third_party/terraform/tests/data_source_google_firebase_apple_app_test.go.erb index a7b5934426fc..d644b02464b0 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_firebase_apple_app_test.go.erb +++ b/mmv1/third_party/terraform/tests/data_source_google_firebase_apple_app_test.go.erb @@ -14,7 +14,7 @@ func TestAccDataSourceGoogleFirebaseAppleApp(t *testing.T) { context := map[string]interface{}{ "project_id": envvar.GetTestProjectFromEnv(), - "bundle_id": "apple.app." + RandString(t, 5), + "bundle_id": "apple.app." + acctest.RandString(t, 5), "display_name": "tf-test Display Name AppleApp DataSource", "app_store_id": 12345, "team_id": 1234567890, @@ -22,9 +22,9 @@ func TestAccDataSourceGoogleFirebaseAppleApp(t *testing.T) { resourceName := "data.google_firebase_apple_app.my_app" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccDataSourceGoogleFirebaseAppleApp(context), diff --git a/mmv1/third_party/terraform/tests/data_source_google_firebase_hosting_channel_test.go.erb b/mmv1/third_party/terraform/tests/data_source_google_firebase_hosting_channel_test.go.erb index 1408f1b15a75..32079d73a162 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_firebase_hosting_channel_test.go.erb +++ b/mmv1/third_party/terraform/tests/data_source_google_firebase_hosting_channel_test.go.erb @@ -14,12 +14,12 @@ func TestAccDataSourceGoogleFirebaseHostingChannel(t *testing.T) { context := map[string]interface{}{ "project_id": envvar.GetTestProjectFromEnv(), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccDataSourceGoogleFirebaseHostingChannel(context), diff --git a/mmv1/third_party/terraform/tests/data_source_google_firebase_web_app_test.go.erb b/mmv1/third_party/terraform/tests/data_source_google_firebase_web_app_test.go.erb index 96f4f3fe64d9..55a476684a91 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_firebase_web_app_test.go.erb +++ b/mmv1/third_party/terraform/tests/data_source_google_firebase_web_app_test.go.erb @@ -19,9 +19,9 @@ func TestAccDataSourceGoogleFirebaseWebApp(t *testing.T) { resourceName := "data.google_firebase_web_app.my_app" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccDataSourceGoogleFirebaseWebApp(context), diff --git a/mmv1/third_party/terraform/tests/data_source_google_folder_organization_policy_test.go b/mmv1/third_party/terraform/tests/data_source_google_folder_organization_policy_test.go index 8d5e0469fed1..d7c3d2cc80f3 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_folder_organization_policy_test.go +++ b/mmv1/third_party/terraform/tests/data_source_google_folder_organization_policy_test.go @@ -10,12 +10,12 @@ import ( ) func TestAccDataSourceGoogleFolderOrganizationPolicy_basic(t *testing.T) { - folder := fmt.Sprintf("tf-test-%d", RandInt(t)) + folder := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) org := envvar.GetTestOrgFromEnv(t) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccDataSourceGoogleFolderOrganizationPolicy_basic(org, folder), diff --git a/mmv1/third_party/terraform/tests/data_source_google_folder_test.go b/mmv1/third_party/terraform/tests/data_source_google_folder_test.go index d029e30bcc48..476d94755215 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_folder_test.go +++ b/mmv1/third_party/terraform/tests/data_source_google_folder_test.go @@ -16,11 +16,11 @@ func TestAccDataSourceGoogleFolder_byFullName(t *testing.T) { org := envvar.GetTestOrgFromEnv(t) parent := fmt.Sprintf("organizations/%s", org) - displayName := "tf-test-" + RandString(t, 10) + displayName := "tf-test-" + acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccCheckGoogleFolder_byFullNameConfig(parent, displayName), @@ -36,11 +36,11 @@ func TestAccDataSourceGoogleFolder_byShortName(t *testing.T) { org := envvar.GetTestOrgFromEnv(t) parent := fmt.Sprintf("organizations/%s", org) - displayName := "tf-test-" + RandString(t, 10) + displayName := "tf-test-" + acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccCheckGoogleFolder_byShortNameConfig(parent, displayName), @@ -56,11 +56,11 @@ func TestAccDataSourceGoogleFolder_lookupOrganization(t *testing.T) { org := envvar.GetTestOrgFromEnv(t) parent := fmt.Sprintf("organizations/%s", org) - displayName := "tf-test-" + RandString(t, 10) + displayName := "tf-test-" + acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccCheckGoogleFolder_lookupOrganizationConfig(parent, displayName), @@ -74,11 +74,11 @@ func TestAccDataSourceGoogleFolder_lookupOrganization(t *testing.T) { } func TestAccDataSourceGoogleFolder_byFullNameNotFound(t *testing.T) { - name := "folders/" + RandString(t, 16) + name := "folders/" + acctest.RandString(t, 16) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccCheckGoogleFolder_byFullNameNotFoundConfig(name), diff --git a/mmv1/third_party/terraform/tests/data_source_google_folders_test.go b/mmv1/third_party/terraform/tests/data_source_google_folders_test.go index 1abfc2a2e853..7d8010e2dfe7 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_folders_test.go +++ b/mmv1/third_party/terraform/tests/data_source_google_folders_test.go @@ -14,11 +14,11 @@ func TestAccDataSourceGoogleFolders_basic(t *testing.T) { org := envvar.GetTestOrgFromEnv(t) parent := fmt.Sprintf("organizations/%s", org) - displayName := "tf-test-" + RandString(t, 10) + displayName := "tf-test-" + acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccCheckGoogleFoldersConfig(parent, displayName), diff --git a/mmv1/third_party/terraform/tests/data_source_google_game_services_game_server_deployment_rollout_test.go b/mmv1/third_party/terraform/tests/data_source_google_game_services_game_server_deployment_rollout_test.go index 18585968ebd8..2ecfa5afa3cd 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_game_services_game_server_deployment_rollout_test.go +++ b/mmv1/third_party/terraform/tests/data_source_google_game_services_game_server_deployment_rollout_test.go @@ -11,12 +11,12 @@ func TestAccDataSourceGameServicesGameServerDeploymentRollout_basic(t *testing.T t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckGameServicesGameServerDeploymentRolloutDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/data_source_google_global_compute_forwarding_rule_test.go b/mmv1/third_party/terraform/tests/data_source_google_global_compute_forwarding_rule_test.go index bc01a69722dd..c6f43e9c2128 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_global_compute_forwarding_rule_test.go +++ b/mmv1/third_party/terraform/tests/data_source_google_global_compute_forwarding_rule_test.go @@ -11,12 +11,12 @@ import ( func TestAccDataSourceGoogleGlobalForwardingRule(t *testing.T) { t.Parallel() - poolName := fmt.Sprintf("tf-%s", RandString(t, 10)) - ruleName := fmt.Sprintf("tf-%s", RandString(t, 10)) + poolName := fmt.Sprintf("tf-%s", acctest.RandString(t, 10)) + ruleName := fmt.Sprintf("tf-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccDataSourceGoogleGlobalForwardingRuleConfig(poolName, ruleName), diff --git a/mmv1/third_party/terraform/tests/data_source_google_iam_role_test.go b/mmv1/third_party/terraform/tests/data_source_google_iam_role_test.go index 079e5c21e066..9a47b26a329e 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_iam_role_test.go +++ b/mmv1/third_party/terraform/tests/data_source_google_iam_role_test.go @@ -14,9 +14,9 @@ import ( func TestAccDataSourceIAMRole(t *testing.T) { name := "roles/viewer" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccCheckGoogleIamRoleConfig(name), diff --git a/mmv1/third_party/terraform/tests/data_source_google_iam_testable_permissions_test.go b/mmv1/third_party/terraform/tests/data_source_google_iam_testable_permissions_test.go index 73701e4d4118..8e3e25540c5e 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_iam_testable_permissions_test.go +++ b/mmv1/third_party/terraform/tests/data_source_google_iam_testable_permissions_test.go @@ -17,9 +17,9 @@ func TestAccDataSourceGoogleIamTestablePermissions_basic(t *testing.T) { t.Parallel() project := envvar.GetTestProjectFromEnv() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: fmt.Sprintf(` diff --git a/mmv1/third_party/terraform/tests/data_source_google_kms_crypto_key_test.go b/mmv1/third_party/terraform/tests/data_source_google_kms_crypto_key_test.go index 871678eb7d99..4760cf9f07fa 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_kms_crypto_key_test.go +++ b/mmv1/third_party/terraform/tests/data_source_google_kms_crypto_key_test.go @@ -17,9 +17,9 @@ func TestAccDataSourceGoogleKmsCryptoKey_basic(t *testing.T) { keyParts := strings.Split(kms.CryptoKey.Name, "/") cryptoKeyId := keyParts[len(keyParts)-1] - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccDataSourceGoogleKmsCryptoKey_basic(kms.KeyRing.Name, cryptoKeyId), diff --git a/mmv1/third_party/terraform/tests/data_source_google_kms_crypto_key_version_test.go b/mmv1/third_party/terraform/tests/data_source_google_kms_crypto_key_version_test.go index ef35ba9a6c16..02400c767d74 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_kms_crypto_key_version_test.go +++ b/mmv1/third_party/terraform/tests/data_source_google_kms_crypto_key_version_test.go @@ -13,9 +13,9 @@ func TestAccDataSourceGoogleKmsCryptoKeyVersion_basic(t *testing.T) { asymDecrKey := acctest.BootstrapKMSKeyWithPurpose(t, "ASYMMETRIC_DECRYPT") symKey := acctest.BootstrapKMSKey(t) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccDataSourceGoogleKmsCryptoKeyVersion_basic(asymSignKey.CryptoKey.Name), diff --git a/mmv1/third_party/terraform/tests/data_source_google_kms_key_ring_test.go b/mmv1/third_party/terraform/tests/data_source_google_kms_key_ring_test.go index eb750215fdb9..d314fa5c770f 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_kms_key_ring_test.go +++ b/mmv1/third_party/terraform/tests/data_source_google_kms_key_ring_test.go @@ -16,9 +16,9 @@ func TestAccDataSourceGoogleKmsKeyRing_basic(t *testing.T) { keyParts := strings.Split(kms.KeyRing.Name, "/") keyRingId := keyParts[len(keyParts)-1] - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccDataSourceGoogleKmsKeyRing_basic(keyRingId), diff --git a/mmv1/third_party/terraform/tests/data_source_google_kms_secret_asymmetric_test.go.erb b/mmv1/third_party/terraform/tests/data_source_google_kms_secret_asymmetric_test.go.erb index f129db7ae253..a96132e20b0c 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_kms_secret_asymmetric_test.go.erb +++ b/mmv1/third_party/terraform/tests/data_source_google_kms_secret_asymmetric_test.go.erb @@ -29,16 +29,16 @@ func TestAccKmsSecretAsymmetricBasic(t *testing.T) { projectOrg := envvar.GetTestOrgFromEnv(t) projectBillingAccount := envvar.GetTestBillingAccountFromEnv(t) - projectID := "tf-test-" + RandString(t, 10) - keyRingName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - cryptoKeyName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + projectID := "tf-test-" + acctest.RandString(t, 10) + keyRingName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + cryptoKeyName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - plaintext := fmt.Sprintf("secret-%s", RandString(t, 10)) + plaintext := fmt.Sprintf("secret-%s", acctest.RandString(t, 10)) // The first test creates resources needed to encrypt plaintext and produce ciphertext - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: kmsCryptoKeyAsymmetricDecryptBasic(projectID, projectOrg, projectBillingAccount, keyRingName, cryptoKeyName), @@ -49,9 +49,9 @@ func TestAccKmsSecretAsymmetricBasic(t *testing.T) { } // The second test asserts that the data source has the correct plaintext, given the created ciphertext - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: googleKmsSecretAsymmetricDatasource(cryptoKeyVersionID, ciphertext), diff --git a/mmv1/third_party/terraform/tests/data_source_google_kms_secret_ciphertext_test.go b/mmv1/third_party/terraform/tests/data_source_google_kms_secret_ciphertext_test.go index c94ddac2d7ff..18af17233f3a 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_kms_secret_ciphertext_test.go +++ b/mmv1/third_party/terraform/tests/data_source_google_kms_secret_ciphertext_test.go @@ -14,11 +14,11 @@ func TestAccDataKmsSecretCiphertext_basic(t *testing.T) { kms := acctest.BootstrapKMSKey(t) - plaintext := fmt.Sprintf("secret-%s", RandString(t, 10)) + plaintext := fmt.Sprintf("secret-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testGoogleKmsSecretCiphertext_datasource(kms.CryptoKey.Name, plaintext), diff --git a/mmv1/third_party/terraform/tests/data_source_google_kms_secret_test.go b/mmv1/third_party/terraform/tests/data_source_google_kms_secret_test.go index f444467d851c..cdc500f84739 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_kms_secret_test.go +++ b/mmv1/third_party/terraform/tests/data_source_google_kms_secret_test.go @@ -22,17 +22,17 @@ func TestAccKmsSecret_basic(t *testing.T) { projectOrg := envvar.GetTestOrgFromEnv(t) projectBillingAccount := envvar.GetTestBillingAccountFromEnv(t) - projectId := "tf-test-" + RandString(t, 10) - keyRingName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - cryptoKeyName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + projectId := "tf-test-" + acctest.RandString(t, 10) + keyRingName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + cryptoKeyName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - plaintext := fmt.Sprintf("secret-%s", RandString(t, 10)) + plaintext := fmt.Sprintf("secret-%s", acctest.RandString(t, 10)) aad := "plainaad" // The first test creates resources needed to encrypt plaintext and produce ciphertext - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testGoogleKmsCryptoKey_basic(projectId, projectOrg, projectBillingAccount, keyRingName, cryptoKeyName), @@ -44,9 +44,9 @@ func TestAccKmsSecret_basic(t *testing.T) { } // The second test asserts that the data source has the correct plaintext, given the created ciphertext - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testGoogleKmsSecret_datasource(cryptoKeyId.TerraformId(), ciphertext), @@ -69,9 +69,9 @@ func TestAccKmsSecret_basic(t *testing.T) { } // The second test asserts that the data source has the correct plaintext, given the created ciphertext - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testGoogleKmsSecret_aadDatasource(cryptoKeyId.TerraformId(), ciphertext, base64.StdEncoding.EncodeToString([]byte(aad))), @@ -88,7 +88,7 @@ func TestAccKmsSecret_basic(t *testing.T) { } func testAccEncryptSecretDataWithCryptoKey(t *testing.T, s *terraform.State, cryptoKeyResourceName, plaintext, aad string) (string, *kms.KmsCryptoKeyId, error) { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) rs, ok := s.RootModule().Resources[cryptoKeyResourceName] if !ok { diff --git a/mmv1/third_party/terraform/tests/data_source_google_logging_project_cmek_settings_test.go b/mmv1/third_party/terraform/tests/data_source_google_logging_project_cmek_settings_test.go index 299cdf1947b4..635f82e914f9 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_logging_project_cmek_settings_test.go +++ b/mmv1/third_party/terraform/tests/data_source_google_logging_project_cmek_settings_test.go @@ -13,15 +13,15 @@ func TestAccLoggingProjectCmekSettings_basic(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "project_name": "tf-test-" + RandString(t, 10), + "project_name": "tf-test-" + acctest.RandString(t, 10), "org_id": envvar.GetTestOrgFromEnv(t), "billing_account": envvar.GetTestBillingAccountFromEnv(t), } resourceName := "data.google_logging_project_cmek_settings.cmek_settings" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccLoggingProjectCmekSettings_basic(context), diff --git a/mmv1/third_party/terraform/tests/data_source_google_logging_sink_test.go b/mmv1/third_party/terraform/tests/data_source_google_logging_sink_test.go index 56ffcd6c58e2..ad7b47d0e165 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_logging_sink_test.go +++ b/mmv1/third_party/terraform/tests/data_source_google_logging_sink_test.go @@ -13,13 +13,13 @@ func TestAccDataSourceGoogleLoggingSink_basic(t *testing.T) { context := map[string]interface{}{ "project_name": envvar.GetTestProjectFromEnv(), - "sink_name": "tf-test-sink-ds-" + RandString(t, 10), - "bucket_name": "tf-test-sink-ds-bucket-" + RandString(t, 10), + "sink_name": "tf-test-sink-ds-" + acctest.RandString(t, 10), + "bucket_name": "tf-test-sink-ds-bucket-" + acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccDataSourceGoogleLoggingSink_basic(context), diff --git a/mmv1/third_party/terraform/tests/data_source_google_monitoring_uptime_check_ips_test.go b/mmv1/third_party/terraform/tests/data_source_google_monitoring_uptime_check_ips_test.go index bf64deeb089a..b788e96ea118 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_monitoring_uptime_check_ips_test.go +++ b/mmv1/third_party/terraform/tests/data_source_google_monitoring_uptime_check_ips_test.go @@ -9,9 +9,9 @@ import ( ) func TestAccDataSourceGoogleMonitoringUptimeCheckIps_basic(t *testing.T) { - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccDataSourceGoogleMonitoringUptimeCheckIps_basic, diff --git a/mmv1/third_party/terraform/tests/data_source_google_netblock_ip_ranges_test.go b/mmv1/third_party/terraform/tests/data_source_google_netblock_ip_ranges_test.go index 90dcbd4fdf04..08ea7c1f3f91 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_netblock_ip_ranges_test.go +++ b/mmv1/third_party/terraform/tests/data_source_google_netblock_ip_ranges_test.go @@ -9,9 +9,9 @@ import ( ) func TestAccDataSourceGoogleNetblockIpRanges_basic(t *testing.T) { - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccNetblockIpRangesConfig, diff --git a/mmv1/third_party/terraform/tests/data_source_google_organization_test.go b/mmv1/third_party/terraform/tests/data_source_google_organization_test.go index dafacd9236bf..ab5a111d5a63 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_organization_test.go +++ b/mmv1/third_party/terraform/tests/data_source_google_organization_test.go @@ -15,9 +15,9 @@ func TestAccDataSourceGoogleOrganization_byFullName(t *testing.T) { orgId := envvar.GetTestOrgFromEnv(t) name := "organizations/" + orgId - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccCheckGoogleOrganization_byName(name), @@ -34,9 +34,9 @@ func TestAccDataSourceGoogleOrganization_byShortName(t *testing.T) { orgId := envvar.GetTestOrgFromEnv(t) name := "organizations/" + orgId - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccCheckGoogleOrganization_byName(orgId), @@ -50,11 +50,11 @@ func TestAccDataSourceGoogleOrganization_byShortName(t *testing.T) { } func TestAccDataSourceGoogleOrganization_byDomain(t *testing.T) { - name := RandString(t, 16) + ".com" + name := acctest.RandString(t, 16) + ".com" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccCheckGoogleOrganization_byDomain(name), diff --git a/mmv1/third_party/terraform/tests/data_source_google_project_organization_policy_test.go b/mmv1/third_party/terraform/tests/data_source_google_project_organization_policy_test.go index 1c680863afcd..cde58b800afe 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_project_organization_policy_test.go +++ b/mmv1/third_party/terraform/tests/data_source_google_project_organization_policy_test.go @@ -12,9 +12,9 @@ import ( func TestAccDataSourceGoogleProjectOrganizationPolicy_basic(t *testing.T) { project := envvar.GetTestProjectFromEnv() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccDataSourceGoogleProjectOrganizationPolicy_basic(project), diff --git a/mmv1/third_party/terraform/tests/data_source_google_project_service_test.go b/mmv1/third_party/terraform/tests/data_source_google_project_service_test.go index 1e5a338b0ba2..9ab00e0e8a45 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_project_service_test.go +++ b/mmv1/third_party/terraform/tests/data_source_google_project_service_test.go @@ -14,11 +14,11 @@ func TestAccDataSourceGoogleProjectService_basic(t *testing.T) { t.Parallel() org := envvar.GetTestOrgFromEnv(t) - pid := fmt.Sprintf("tf-test-%d", RandInt(t)) + pid := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) services := []string{"iam.googleapis.com", "cloudresourcemanager.googleapis.com"} - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccDataSourceGoogleProjectService_basic(services, pid, org), diff --git a/mmv1/third_party/terraform/tests/data_source_google_project_test.go b/mmv1/third_party/terraform/tests/data_source_google_project_test.go index 7a442c88f3d6..0cc26e09e099 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_project_test.go +++ b/mmv1/third_party/terraform/tests/data_source_google_project_test.go @@ -12,11 +12,11 @@ import ( func TestAccDataSourceGoogleProject_basic(t *testing.T) { t.Parallel() org := envvar.GetTestOrgFromEnv(t) - project := fmt.Sprintf("tf-test-%d", RandInt(t)) + project := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccCheckGoogleProjectConfig(project, org), diff --git a/mmv1/third_party/terraform/tests/data_source_google_projects_test.go b/mmv1/third_party/terraform/tests/data_source_google_projects_test.go index f5273f6212c4..3d88f13c62ce 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_projects_test.go +++ b/mmv1/third_party/terraform/tests/data_source_google_projects_test.go @@ -14,9 +14,9 @@ func TestAccDataSourceGoogleProjects_basic(t *testing.T) { project := envvar.GetTestProjectFromEnv() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccCheckGoogleProjectsConfig(project), diff --git a/mmv1/third_party/terraform/tests/data_source_google_service_account_access_token_test.go b/mmv1/third_party/terraform/tests/data_source_google_service_account_access_token_test.go index d009a9cf6964..5055c530a142 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_service_account_access_token_test.go +++ b/mmv1/third_party/terraform/tests/data_source_google_service_account_access_token_test.go @@ -36,9 +36,9 @@ func TestAccDataSourceGoogleServiceAccountAccessToken_basic(t *testing.T) { serviceAccount := envvar.GetTestServiceAccountFromEnv(t) targetServiceAccountEmail := acctest.BootstrapServiceAccount(t, envvar.GetTestProjectFromEnv(), serviceAccount) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccCheckGoogleServiceAccountAccessToken_datasource(targetServiceAccountEmail), diff --git a/mmv1/third_party/terraform/tests/data_source_google_service_account_id_token_test.go b/mmv1/third_party/terraform/tests/data_source_google_service_account_id_token_test.go index e064684e9fd8..4f78617058d3 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_service_account_id_token_test.go +++ b/mmv1/third_party/terraform/tests/data_source_google_service_account_id_token_test.go @@ -46,7 +46,7 @@ func TestAccDataSourceGoogleServiceAccountIdToken_basic(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccCheckGoogleServiceAccountIdToken_basic(targetAudience), @@ -77,7 +77,7 @@ func TestAccDataSourceGoogleServiceAccountIdToken_impersonation(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccCheckGoogleServiceAccountIdToken_impersonation_datasource(targetAudience, targetServiceAccountEmail), diff --git a/mmv1/third_party/terraform/tests/data_source_google_service_account_jwt_test.go b/mmv1/third_party/terraform/tests/data_source_google_service_account_jwt_test.go index bfdbc21d265d..ae51dd55c89d 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_service_account_jwt_test.go +++ b/mmv1/third_party/terraform/tests/data_source_google_service_account_jwt_test.go @@ -111,7 +111,7 @@ func TestAccDataSourceGoogleServiceAccountJwt(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccCheckGoogleServiceAccountJwt(targetServiceAccountEmail), diff --git a/mmv1/third_party/terraform/tests/data_source_google_service_account_key_test.go b/mmv1/third_party/terraform/tests/data_source_google_service_account_key_test.go index 9b590e295164..fe0257d3fbbe 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_service_account_key_test.go +++ b/mmv1/third_party/terraform/tests/data_source_google_service_account_key_test.go @@ -15,7 +15,7 @@ func TestAccDatasourceGoogleServiceAccountKey_basic(t *testing.T) { t.Parallel() resourceName := "data.google_service_account_key.acceptance" - account := fmt.Sprintf("tf-test-%d", RandInt(t)) + account := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) serviceAccountName := fmt.Sprintf( "projects/%s/serviceAccounts/%s@%s.iam.gserviceaccount.com", envvar.GetTestProjectFromEnv(), @@ -23,9 +23,9 @@ func TestAccDatasourceGoogleServiceAccountKey_basic(t *testing.T) { envvar.GetTestProjectFromEnv(), ) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccDatasourceGoogleServiceAccountKey(account), diff --git a/mmv1/third_party/terraform/tests/data_source_google_service_account_test.go b/mmv1/third_party/terraform/tests/data_source_google_service_account_test.go index 2ad07eda2488..628f69b5d4ab 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_service_account_test.go +++ b/mmv1/third_party/terraform/tests/data_source_google_service_account_test.go @@ -13,11 +13,11 @@ func TestAccDatasourceGoogleServiceAccount_basic(t *testing.T) { t.Parallel() resourceName := "data.google_service_account.acceptance" - account := fmt.Sprintf("tf-test-%d", RandInt(t)) + account := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccCheckGoogleServiceAccount_basic(account), diff --git a/mmv1/third_party/terraform/tests/data_source_google_service_networking_peered_dns_domain_test.go b/mmv1/third_party/terraform/tests/data_source_google_service_networking_peered_dns_domain_test.go index 2ae45332a765..18ce120a8fa2 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_service_networking_peered_dns_domain_test.go +++ b/mmv1/third_party/terraform/tests/data_source_google_service_networking_peered_dns_domain_test.go @@ -14,16 +14,16 @@ func TestAccDatasourceGoogleServiceNetworkingPeeredDnsDomain_basic(t *testing.T) org := envvar.GetTestOrgFromEnv(t) billingId := envvar.GetTestBillingAccountFromEnv(t) - project := fmt.Sprintf("tf-test-%d", RandInt(t)) + project := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) resourceName := "data.google_service_networking_peered_dns_domain.acceptance" - name := fmt.Sprintf("test-name-%d", RandInt(t)) + name := fmt.Sprintf("test-name-%d", acctest.RandInt(t)) network := "test-network" service := "servicenetworking.googleapis.com" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccCheckGoogleServiceNetworkingPeeredDnsDomain_basic(project, org, billingId, name, network, service), diff --git a/mmv1/third_party/terraform/tests/data_source_google_sql_ca_certs_test.go b/mmv1/third_party/terraform/tests/data_source_google_sql_ca_certs_test.go index f83f7c790c5b..c2a5097bf456 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_sql_ca_certs_test.go +++ b/mmv1/third_party/terraform/tests/data_source_google_sql_ca_certs_test.go @@ -12,11 +12,11 @@ import ( func TestAccDataSourceGoogleSQLCaCerts_basic(t *testing.T) { t.Parallel() - instanceName := fmt.Sprintf("data-ssl-ca-cert-test-%s", RandString(t, 10)) + instanceName := fmt.Sprintf("data-ssl-ca-cert-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/data_source_google_sql_tiers_test.go b/mmv1/third_party/terraform/tests/data_source_google_sql_tiers_test.go index 542a7b2cae7f..3824d901e630 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_sql_tiers_test.go +++ b/mmv1/third_party/terraform/tests/data_source_google_sql_tiers_test.go @@ -12,9 +12,9 @@ func TestAccDataSourceGoogleSqlTiers_basic(t *testing.T) { resourceName := "data.google_sql_tiers.default" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccCheckGoogleSqlTiers_basic, diff --git a/mmv1/third_party/terraform/tests/data_source_google_storage_bucket_test.go b/mmv1/third_party/terraform/tests/data_source_google_storage_bucket_test.go index e3c5593b81a9..f25f9a454f25 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_storage_bucket_test.go +++ b/mmv1/third_party/terraform/tests/data_source_google_storage_bucket_test.go @@ -11,11 +11,11 @@ import ( func TestAccDataSourceGoogleStorageBucket_basic(t *testing.T) { t.Parallel() - bucket := "tf-bucket-" + RandString(t, 10) + bucket := "tf-bucket-" + acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccStorageBucketDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/data_source_google_storage_project_service_account_test.go b/mmv1/third_party/terraform/tests/data_source_google_storage_project_service_account_test.go index 93232fbb8cb4..aa0900af11a5 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_storage_project_service_account_test.go +++ b/mmv1/third_party/terraform/tests/data_source_google_storage_project_service_account_test.go @@ -12,9 +12,9 @@ func TestAccDataSourceGoogleStorageProjectServiceAccount_basic(t *testing.T) { resourceName := "data.google_storage_project_service_account.gcs_account" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccCheckGoogleStorageProjectServiceAccount_basic, diff --git a/mmv1/third_party/terraform/tests/data_source_google_storage_transfer_project_service_account_test.go b/mmv1/third_party/terraform/tests/data_source_google_storage_transfer_project_service_account_test.go index 16df2f4742a7..f71775cd6653 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_storage_transfer_project_service_account_test.go +++ b/mmv1/third_party/terraform/tests/data_source_google_storage_transfer_project_service_account_test.go @@ -12,9 +12,9 @@ func TestAccDataSourceGoogleStorageTransferProjectServiceAccount_basic(t *testin resourceName := "data.google_storage_transfer_project_service_account.default" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccCheckGoogleStorageTransferProjectServiceAccount_basic, diff --git a/mmv1/third_party/terraform/tests/data_source_google_vmwareengine_network_test.go.erb b/mmv1/third_party/terraform/tests/data_source_google_vmwareengine_network_test.go.erb index 2f102929b4fd..3f30b4c1409f 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_vmwareengine_network_test.go.erb +++ b/mmv1/third_party/terraform/tests/data_source_google_vmwareengine_network_test.go.erb @@ -15,14 +15,14 @@ func TestAccDataSourceVmwareEngineNetwork_basic(t *testing.T) { context := map[string]interface{}{ "region": envvar.GetTestRegionFromEnv(), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), "organization": envvar.GetTestOrgFromEnv(t), "billing_account": envvar.GetTestBillingAccountFromEnv(t), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderBetaFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), CheckDestroy: testAccCheckVmwareengineNetworkDestroyProducer(t), ExternalProviders: map[string]resource.ExternalProvider{ "time": {}, diff --git a/mmv1/third_party/terraform/tests/data_source_iam_beta_workload_identity_pool_provider_test.go.erb b/mmv1/third_party/terraform/tests/data_source_iam_beta_workload_identity_pool_provider_test.go.erb index 8a373b00564a..d13a88a2f863 100644 --- a/mmv1/third_party/terraform/tests/data_source_iam_beta_workload_identity_pool_provider_test.go.erb +++ b/mmv1/third_party/terraform/tests/data_source_iam_beta_workload_identity_pool_provider_test.go.erb @@ -13,12 +13,12 @@ func TestAccDataSourceIAMBetaWorkloadIdentityPoolProvider_basic(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckIAMBetaWorkloadIdentityPoolProviderDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/data_source_iam_beta_workload_identity_pool_test.go.erb b/mmv1/third_party/terraform/tests/data_source_iam_beta_workload_identity_pool_test.go.erb index 5145f8cba795..d8629640d1fa 100644 --- a/mmv1/third_party/terraform/tests/data_source_iam_beta_workload_identity_pool_test.go.erb +++ b/mmv1/third_party/terraform/tests/data_source_iam_beta_workload_identity_pool_test.go.erb @@ -13,12 +13,12 @@ func TestAccDataSourceIAMBetaWorkloadIdentityPool_basic(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckIAMBetaWorkloadIdentityPoolDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/data_source_iap_client_test.go b/mmv1/third_party/terraform/tests/data_source_iap_client_test.go index b0c92f107605..f157757628f5 100644 --- a/mmv1/third_party/terraform/tests/data_source_iap_client_test.go +++ b/mmv1/third_party/terraform/tests/data_source_iap_client_test.go @@ -14,12 +14,12 @@ func TestAccIapClient_Datasource_basic(t *testing.T) { context := map[string]interface{}{ "org_id": envvar.GetTestOrgFromEnv(t), "org_domain": envvar.GetTestOrgDomainFromEnv(t), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccIapClientDatasourceConfig(context), diff --git a/mmv1/third_party/terraform/tests/data_source_monitoring_notification_channel_test.go b/mmv1/third_party/terraform/tests/data_source_monitoring_notification_channel_test.go index 036830711a29..559257895ba9 100644 --- a/mmv1/third_party/terraform/tests/data_source_monitoring_notification_channel_test.go +++ b/mmv1/third_party/terraform/tests/data_source_monitoring_notification_channel_test.go @@ -11,12 +11,12 @@ import ( ) func TestAccDataSourceGoogleMonitoringNotificationChannel_byDisplayName(t *testing.T) { - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { - Config: testAccDataSourceGoogleMonitoringNotificationChannel_byDisplayName(fmt.Sprintf("tf-test-%d", RandInt(t))), + Config: testAccDataSourceGoogleMonitoringNotificationChannel_byDisplayName(fmt.Sprintf("tf-test-%d", acctest.RandInt(t))), Check: resource.ComposeTestCheckFunc( acctest.CheckDataSourceStateMatchesResourceState( "data.google_monitoring_notification_channel.default", @@ -28,12 +28,12 @@ func TestAccDataSourceGoogleMonitoringNotificationChannel_byDisplayName(t *testi } func TestAccDataSourceGoogleMonitoringNotificationChannel_byTypeAndLabel(t *testing.T) { - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { - Config: testAccDataSourceGoogleMonitoringNotificationChannel_byTypeAndLabel(fmt.Sprintf("tf-test-%d", RandInt(t))), + Config: testAccDataSourceGoogleMonitoringNotificationChannel_byTypeAndLabel(fmt.Sprintf("tf-test-%d", acctest.RandInt(t))), Check: resource.ComposeTestCheckFunc( acctest.CheckDataSourceStateMatchesResourceState( "data.google_monitoring_notification_channel.default", @@ -45,12 +45,12 @@ func TestAccDataSourceGoogleMonitoringNotificationChannel_byTypeAndLabel(t *test } func TestAccDataSourceGoogleMonitoringNotificationChannel_UserLabel(t *testing.T) { - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { - Config: testAccDataSourceGoogleMonitoringNotificationChannel_byTypeAndUserLabel(fmt.Sprintf("tf-test-%d", RandInt(t))), + Config: testAccDataSourceGoogleMonitoringNotificationChannel_byTypeAndUserLabel(fmt.Sprintf("tf-test-%d", acctest.RandInt(t))), Check: resource.ComposeTestCheckFunc( acctest.CheckDataSourceStateMatchesResourceState( "data.google_monitoring_notification_channel.default", @@ -62,12 +62,12 @@ func TestAccDataSourceGoogleMonitoringNotificationChannel_UserLabel(t *testing.T } func TestAccDataSourceGoogleMonitoringNotificationChannel_byDisplayNameAndType(t *testing.T) { - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { - Config: testAccDataSourceGoogleMonitoringNotificationChannel_byDisplayNameAndType(fmt.Sprintf("tf-test-%d", RandInt(t))), + Config: testAccDataSourceGoogleMonitoringNotificationChannel_byDisplayNameAndType(fmt.Sprintf("tf-test-%d", acctest.RandInt(t))), Check: resource.ComposeTestCheckFunc( acctest.CheckDataSourceStateMatchesResourceState( "data.google_monitoring_notification_channel.email", @@ -79,9 +79,9 @@ func TestAccDataSourceGoogleMonitoringNotificationChannel_byDisplayNameAndType(t } func TestAccDataSourceGoogleMonitoringNotificationChannel_ErrorNoDisplayNameOrType(t *testing.T) { - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccDataSourceGoogleMonitoringNotificationChannel_NoDisplayNameOrType(), @@ -92,11 +92,11 @@ func TestAccDataSourceGoogleMonitoringNotificationChannel_ErrorNoDisplayNameOrTy } func TestAccDataSourceGoogleMonitoringNotificationChannel_ErrorNotFound(t *testing.T) { - displayName := fmt.Sprintf("tf-test-%d", RandInt(t)) + displayName := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccDataSourceGoogleMonitoringNotificationChannel_NotFound(displayName), @@ -107,10 +107,10 @@ func TestAccDataSourceGoogleMonitoringNotificationChannel_ErrorNotFound(t *testi } func TestAccDataSourceGoogleMonitoringNotificationChannel_ErrorNotUnique(t *testing.T) { - displayName := fmt.Sprintf("tf-test-%d", RandInt(t)) - VcrTest(t, resource.TestCase{ + displayName := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccDataSourceGoogleMonitoringNotificationChannel_NotUnique(displayName), diff --git a/mmv1/third_party/terraform/tests/data_source_monitoring_service_test.go b/mmv1/third_party/terraform/tests/data_source_monitoring_service_test.go index 98633fa98621..726710b5cdeb 100644 --- a/mmv1/third_party/terraform/tests/data_source_monitoring_service_test.go +++ b/mmv1/third_party/terraform/tests/data_source_monitoring_service_test.go @@ -10,9 +10,9 @@ import ( ) func TestAccDataSourceMonitoringService_AppEngine(t *testing.T) { - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccDataSourceMonitoringService_AppEngine(), diff --git a/mmv1/third_party/terraform/tests/data_source_pubsub_subscription_test.go b/mmv1/third_party/terraform/tests/data_source_pubsub_subscription_test.go index acd0f49a22ca..7ef8b9fb26a9 100644 --- a/mmv1/third_party/terraform/tests/data_source_pubsub_subscription_test.go +++ b/mmv1/third_party/terraform/tests/data_source_pubsub_subscription_test.go @@ -11,12 +11,12 @@ func TestAccDataSourceGooglePubsubSubscription_basic(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckPubsubSubscriptionDestroyProducer(t), Steps: []resource.TestStep{ { @@ -33,12 +33,12 @@ func TestAccDataSourceGooglePubsubSubscription_optionalProject(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckPubsubSubscriptionDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/data_source_pubsub_topic_test.go b/mmv1/third_party/terraform/tests/data_source_pubsub_topic_test.go index 9be54c5af87e..381123f073e1 100644 --- a/mmv1/third_party/terraform/tests/data_source_pubsub_topic_test.go +++ b/mmv1/third_party/terraform/tests/data_source_pubsub_topic_test.go @@ -11,12 +11,12 @@ func TestAccDataSourceGooglePubsubTopic_basic(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckPubsubTopicDestroyProducer(t), Steps: []resource.TestStep{ { @@ -33,12 +33,12 @@ func TestAccDataSourceGooglePubsubTopic_optionalProject(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckPubsubTopicDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/data_source_redis_instance_test.go b/mmv1/third_party/terraform/tests/data_source_redis_instance_test.go index 2deab3a25882..1e499a3200fd 100644 --- a/mmv1/third_party/terraform/tests/data_source_redis_instance_test.go +++ b/mmv1/third_party/terraform/tests/data_source_redis_instance_test.go @@ -11,12 +11,12 @@ import ( func TestAccRedisInstanceDatasource_basic(t *testing.T) { t.Parallel() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { - Config: testAccRedisInstanceDatasourceConfig(RandString(t, 10)), + Config: testAccRedisInstanceDatasourceConfig(acctest.RandString(t, 10)), Check: resource.ComposeTestCheckFunc( acctest.CheckDataSourceStateMatchesResourceState("data.google_redis_instance.redis", "google_redis_instance.redis"), ), diff --git a/mmv1/third_party/terraform/tests/data_source_secret_manager_secret_test.go b/mmv1/third_party/terraform/tests/data_source_secret_manager_secret_test.go index 0732ca54f09b..331eded024b5 100644 --- a/mmv1/third_party/terraform/tests/data_source_secret_manager_secret_test.go +++ b/mmv1/third_party/terraform/tests/data_source_secret_manager_secret_test.go @@ -11,12 +11,12 @@ func TestAccDataSourceSecretManagerSecret_basic(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckSecretManagerSecretDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/data_source_secret_manager_secret_version_access_test.go b/mmv1/third_party/terraform/tests/data_source_secret_manager_secret_version_access_test.go index f30493697ef6..f72b01ec4bc3 100644 --- a/mmv1/third_party/terraform/tests/data_source_secret_manager_secret_version_access_test.go +++ b/mmv1/third_party/terraform/tests/data_source_secret_manager_secret_version_access_test.go @@ -14,11 +14,11 @@ import ( func TestAccDatasourceSecretManagerSecretVersionAccess_basic(t *testing.T) { t.Parallel() - randomString := RandString(t, 10) + randomString := acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckSecretManagerSecretVersionDestroyProducer(t), Steps: []resource.TestStep{ { @@ -34,11 +34,11 @@ func TestAccDatasourceSecretManagerSecretVersionAccess_basic(t *testing.T) { func TestAccDatasourceSecretManagerSecretVersionAccess_latest(t *testing.T) { t.Parallel() - randomString := RandString(t, 10) + randomString := acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckSecretManagerSecretVersionDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/data_source_secret_manager_secret_version_test.go b/mmv1/third_party/terraform/tests/data_source_secret_manager_secret_version_test.go index 9cd5e0bcb540..a2aefb68a47f 100644 --- a/mmv1/third_party/terraform/tests/data_source_secret_manager_secret_version_test.go +++ b/mmv1/third_party/terraform/tests/data_source_secret_manager_secret_version_test.go @@ -14,11 +14,11 @@ import ( func TestAccDatasourceSecretManagerSecretVersion_basic(t *testing.T) { t.Parallel() - randomString := RandString(t, 10) + randomString := acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckSecretManagerSecretVersionDestroyProducer(t), Steps: []resource.TestStep{ { @@ -34,11 +34,11 @@ func TestAccDatasourceSecretManagerSecretVersion_basic(t *testing.T) { func TestAccDatasourceSecretManagerSecretVersion_latest(t *testing.T) { t.Parallel() - randomString := RandString(t, 10) + randomString := acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckSecretManagerSecretVersionDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/data_source_sourcerepo_repository_test.go b/mmv1/third_party/terraform/tests/data_source_sourcerepo_repository_test.go index b5d924542666..db17b1d6f500 100644 --- a/mmv1/third_party/terraform/tests/data_source_sourcerepo_repository_test.go +++ b/mmv1/third_party/terraform/tests/data_source_sourcerepo_repository_test.go @@ -11,11 +11,11 @@ import ( func TestAccDataSourceGoogleSourceRepoRepository_basic(t *testing.T) { t.Parallel() - name := "tf-repository-" + RandString(t, 10) + name := "tf-repository-" + acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckSourceRepoRepositoryDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/data_source_spanner_instance_test.go b/mmv1/third_party/terraform/tests/data_source_spanner_instance_test.go index 1c23be5f8f35..3ddacba62bca 100644 --- a/mmv1/third_party/terraform/tests/data_source_spanner_instance_test.go +++ b/mmv1/third_party/terraform/tests/data_source_spanner_instance_test.go @@ -13,12 +13,12 @@ func TestAccDataSourceSpannerInstance_basic(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckSpannerInstanceDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/data_source_sql_backup_run_test.go b/mmv1/third_party/terraform/tests/data_source_sql_backup_run_test.go index 1bb79c20e5ab..88b68ba22481 100644 --- a/mmv1/third_party/terraform/tests/data_source_sql_backup_run_test.go +++ b/mmv1/third_party/terraform/tests/data_source_sql_backup_run_test.go @@ -17,9 +17,9 @@ func TestAccDataSourceSqlBackupRun_basic(t *testing.T) { instance := acctest.BootstrapSharedSQLInstanceBackupRun(t) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccSqlDatabaseInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -36,12 +36,12 @@ func TestAccDataSourceSqlBackupRun_notFound(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccSqlDatabaseInstanceDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/data_source_sql_database_instance_test.go b/mmv1/third_party/terraform/tests/data_source_sql_database_instance_test.go index d4fc1c0f8984..3ea6ab0dfe2e 100644 --- a/mmv1/third_party/terraform/tests/data_source_sql_database_instance_test.go +++ b/mmv1/third_party/terraform/tests/data_source_sql_database_instance_test.go @@ -11,12 +11,12 @@ func TestAccDataSourceSqlDatabaseInstance_basic(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccSqlDatabaseInstanceDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/data_source_sql_database_instances_test.go b/mmv1/third_party/terraform/tests/data_source_sql_database_instances_test.go index d5d97ae2dcd5..ab02f83ec1fb 100644 --- a/mmv1/third_party/terraform/tests/data_source_sql_database_instances_test.go +++ b/mmv1/third_party/terraform/tests/data_source_sql_database_instances_test.go @@ -15,12 +15,12 @@ func TestAccDataSourceSqlDatabaseInstances_basic(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccSqlDatabaseInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -45,12 +45,12 @@ func TestAccDataSourceSqlDatabaseInstances_databaseVersionFilter(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccSqlDatabaseInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -75,12 +75,12 @@ func TestAccDataSourceSqlDatabaseInstances_regionFilter(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccSqlDatabaseInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -105,12 +105,12 @@ func TestAccDataSourceSqlDatabaseInstances_tierFilter(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccSqlDatabaseInstanceDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/data_source_sql_database_test.go b/mmv1/third_party/terraform/tests/data_source_sql_database_test.go index b06b6874b395..109a7c75fed8 100644 --- a/mmv1/third_party/terraform/tests/data_source_sql_database_test.go +++ b/mmv1/third_party/terraform/tests/data_source_sql_database_test.go @@ -11,12 +11,12 @@ func TestAccDataSourceSqlDatabase_basic(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccSqlDatabaseDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/data_source_sql_databases_test.go b/mmv1/third_party/terraform/tests/data_source_sql_databases_test.go index 4be7a1bc580f..49732707f157 100644 --- a/mmv1/third_party/terraform/tests/data_source_sql_databases_test.go +++ b/mmv1/third_party/terraform/tests/data_source_sql_databases_test.go @@ -15,12 +15,12 @@ func TestAccDataSourceSqlDatabases_basic(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccSqlDatabaseDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/data_source_storage_bucket_object_content_test.go b/mmv1/third_party/terraform/tests/data_source_storage_bucket_object_content_test.go index 60f9f68884f4..0e31d8fced46 100644 --- a/mmv1/third_party/terraform/tests/data_source_storage_bucket_object_content_test.go +++ b/mmv1/third_party/terraform/tests/data_source_storage_bucket_object_content_test.go @@ -10,12 +10,12 @@ import ( func TestAccDataSourceStorageBucketObjectContent_Basic(t *testing.T) { - bucket := "tf-bucket-object-content-" + RandString(t, 10) + bucket := "tf-bucket-object-content-" + acctest.RandString(t, 10) content := "qwertyuioasdfghjk1234567!!@#$*" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccDataSourceStorageBucketObjectContent_Basic(content, bucket), diff --git a/mmv1/third_party/terraform/tests/data_source_storage_object_signed_url_test.go b/mmv1/third_party/terraform/tests/data_source_storage_object_signed_url_test.go index 17c05b943096..0904310bef8d 100644 --- a/mmv1/third_party/terraform/tests/data_source_storage_object_signed_url_test.go +++ b/mmv1/third_party/terraform/tests/data_source_storage_object_signed_url_test.go @@ -16,9 +16,9 @@ import ( func TestAccStorageSignedUrl_basic(t *testing.T) { t.Parallel() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testGoogleSignedUrlConfig, @@ -35,16 +35,16 @@ func TestAccStorageSignedUrl_accTest(t *testing.T) { acctest.SkipIfVcr(t) t.Parallel() - bucketName := fmt.Sprintf("tf-test-bucket-%d", RandInt(t)) + bucketName := fmt.Sprintf("tf-test-bucket-%d", acctest.RandInt(t)) headers := map[string]string{ "x-goog-test": "foo", "x-goog-if-metageneration-match": "1", } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccTestGoogleStorageObjectSignedURL(bucketName), diff --git a/mmv1/third_party/terraform/tests/data_source_tags_tag_key_test.go b/mmv1/third_party/terraform/tests/data_source_tags_tag_key_test.go index 94f677dc8ee2..f1fb59ead109 100644 --- a/mmv1/third_party/terraform/tests/data_source_tags_tag_key_test.go +++ b/mmv1/third_party/terraform/tests/data_source_tags_tag_key_test.go @@ -14,11 +14,11 @@ func TestAccDataSourceGoogleTagsTagKey_default(t *testing.T) { org := envvar.GetTestOrgFromEnv(t) parent := fmt.Sprintf("organizations/%s", org) - shortName := "tf-test-" + RandString(t, 10) + shortName := "tf-test-" + acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccDataSourceGoogleTagsTagKeyConfig(parent, shortName), @@ -34,11 +34,11 @@ func TestAccDataSourceGoogleTagsTagKey_dot(t *testing.T) { org := envvar.GetTestOrgFromEnv(t) parent := fmt.Sprintf("organizations/%s", org) - shortName := "terraform.test." + RandString(t, 10) + shortName := "terraform.test." + acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccDataSourceGoogleTagsTagKeyConfig(parent, shortName), diff --git a/mmv1/third_party/terraform/tests/data_source_tags_tag_value_test.go b/mmv1/third_party/terraform/tests/data_source_tags_tag_value_test.go index c4e2ec7f0d93..b061ceab7eb4 100644 --- a/mmv1/third_party/terraform/tests/data_source_tags_tag_value_test.go +++ b/mmv1/third_party/terraform/tests/data_source_tags_tag_value_test.go @@ -14,12 +14,12 @@ func TestAccDataSourceGoogleTagsTagValue_default(t *testing.T) { org := envvar.GetTestOrgFromEnv(t) parent := fmt.Sprintf("organizations/%s", org) - keyShortName := "tf-testkey-" + RandString(t, 10) - shortName := "tf-test-" + RandString(t, 10) + keyShortName := "tf-testkey-" + acctest.RandString(t, 10) + shortName := "tf-test-" + acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccDataSourceGoogleTagsTagValueConfig(parent, keyShortName, shortName), @@ -35,12 +35,12 @@ func TestAccDataSourceGoogleTagsTagValue_dot(t *testing.T) { org := envvar.GetTestOrgFromEnv(t) parent := fmt.Sprintf("organizations/%s", org) - keyShortName := "tf-testkey-" + RandString(t, 10) - shortName := "terraform.test." + RandString(t, 10) + keyShortName := "tf-testkey-" + acctest.RandString(t, 10) + shortName := "terraform.test." + acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccDataSourceGoogleTagsTagValueConfig(parent, keyShortName, shortName), diff --git a/mmv1/third_party/terraform/tests/data_source_tpu_tensorflow_versions_test.go b/mmv1/third_party/terraform/tests/data_source_tpu_tensorflow_versions_test.go index 675f68844d49..4137d2621c3e 100644 --- a/mmv1/third_party/terraform/tests/data_source_tpu_tensorflow_versions_test.go +++ b/mmv1/third_party/terraform/tests/data_source_tpu_tensorflow_versions_test.go @@ -14,9 +14,9 @@ import ( func TestAccTPUTensorflowVersions_basic(t *testing.T) { t.Parallel() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccTpuTensorFlowVersionsConfig, diff --git a/mmv1/third_party/terraform/tests/data_source_vertex_ai_index_test.go b/mmv1/third_party/terraform/tests/data_source_vertex_ai_index_test.go index fecdf2d1d006..a7adf39be607 100644 --- a/mmv1/third_party/terraform/tests/data_source_vertex_ai_index_test.go +++ b/mmv1/third_party/terraform/tests/data_source_vertex_ai_index_test.go @@ -13,12 +13,12 @@ func TestAccDataSourceVertexAIIndex_basic(t *testing.T) { context := map[string]interface{}{ "project": envvar.GetTestProjectFromEnv(), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckVertexAIIndexDestroyProducer_basic(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/data_source_vpc_access_connector_test.go b/mmv1/third_party/terraform/tests/data_source_vpc_access_connector_test.go index 55c79cb17320..2d6884dbc3bb 100644 --- a/mmv1/third_party/terraform/tests/data_source_vpc_access_connector_test.go +++ b/mmv1/third_party/terraform/tests/data_source_vpc_access_connector_test.go @@ -11,12 +11,12 @@ import ( func TestAccVPCAccessConnectorDatasource_basic(t *testing.T) { t.Parallel() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { - Config: testAccVPCAccessConnectorDatasourceConfig(RandString(t, 10)), + Config: testAccVPCAccessConnectorDatasourceConfig(acctest.RandString(t, 10)), Check: resource.ComposeTestCheckFunc( acctest.CheckDataSourceStateMatchesResourceStateWithIgnores( "data.google_vpc_access_connector.connector", diff --git a/mmv1/third_party/terraform/tests/iam_scc_source_test.go b/mmv1/third_party/terraform/tests/iam_scc_source_test.go index 54a983d55888..5ce94e261dfe 100644 --- a/mmv1/third_party/terraform/tests/iam_scc_source_test.go +++ b/mmv1/third_party/terraform/tests/iam_scc_source_test.go @@ -14,14 +14,14 @@ func TestAccSecurityCenterSourceIamBinding(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), "role": "roles/securitycenter.sourcesViewer", "org_id": envvar.GetTestOrgFromEnv(t), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccSecurityCenterSourceIamBinding_basic(context), @@ -64,14 +64,14 @@ func TestAccSecurityCenterSourceIamMember(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), "role": "roles/securitycenter.sourcesViewer", "org_id": envvar.GetTestOrgFromEnv(t), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { // Test Iam Member creation (no update for member, no need to test) @@ -98,14 +98,14 @@ func TestAccSecurityCenterSourceIamPolicy(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), "role": "roles/securitycenter.sourcesViewer", "org_id": envvar.GetTestOrgFromEnv(t), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccSecurityCenterSourceIamPolicy_basic(context), diff --git a/mmv1/third_party/terraform/tests/resource_access_approval_folder_settings_test.go b/mmv1/third_party/terraform/tests/resource_access_approval_folder_settings_test.go index f95e3f68f1ca..97c211cfe28e 100644 --- a/mmv1/third_party/terraform/tests/resource_access_approval_folder_settings_test.go +++ b/mmv1/third_party/terraform/tests/resource_access_approval_folder_settings_test.go @@ -20,12 +20,12 @@ func testAccAccessApprovalFolderSettings(t *testing.T) { "project": envvar.GetTestProjectFromEnv(), "org_id": envvar.GetTestOrgFromEnv(t), "location": envvar.GetTestRegionFromEnv(), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), ExternalProviders: map[string]resource.ExternalProvider{ "time": {}, }, diff --git a/mmv1/third_party/terraform/tests/resource_access_approval_organization_settings_test.go b/mmv1/third_party/terraform/tests/resource_access_approval_organization_settings_test.go index bb2285403f4c..f2cfb51e2861 100644 --- a/mmv1/third_party/terraform/tests/resource_access_approval_organization_settings_test.go +++ b/mmv1/third_party/terraform/tests/resource_access_approval_organization_settings_test.go @@ -38,12 +38,12 @@ func testAccAccessApprovalOrganizationSettings(t *testing.T) { "project": envvar.GetTestProjectFromEnv(), "org_id": envvar.GetTestOrgFromEnv(t), "location": envvar.GetTestRegionFromEnv(), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckAccessApprovalOrganizationSettingsDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_access_approval_project_settings_test.go b/mmv1/third_party/terraform/tests/resource_access_approval_project_settings_test.go index dd172c7f082c..2d0381b8bac7 100644 --- a/mmv1/third_party/terraform/tests/resource_access_approval_project_settings_test.go +++ b/mmv1/third_party/terraform/tests/resource_access_approval_project_settings_test.go @@ -20,12 +20,12 @@ func testAccAccessApprovalProjectSettings(t *testing.T) { "project": envvar.GetTestProjectFromEnv(), "org_id": envvar.GetTestOrgFromEnv(t), "location": envvar.GetTestRegionFromEnv(), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckAccessApprovalProjectSettingsDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_access_context_manager_access_level_condition_test.go b/mmv1/third_party/terraform/tests/resource_access_context_manager_access_level_condition_test.go index dfdb6cb416ab..7b501e95458e 100644 --- a/mmv1/third_party/terraform/tests/resource_access_context_manager_access_level_condition_test.go +++ b/mmv1/third_party/terraform/tests/resource_access_context_manager_access_level_condition_test.go @@ -21,7 +21,7 @@ func testAccAccessContextManagerAccessLevelCondition_basicTest(t *testing.T) { org := envvar.GetTestOrgFromEnv(t) project := envvar.GetTestProjectFromEnv() - serviceAccountName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + serviceAccountName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) expected := map[string]interface{}{ "ipSubnetworks": []interface{}{"192.0.4.0/24"}, @@ -37,9 +37,9 @@ func testAccAccessContextManagerAccessLevelCondition_basicTest(t *testing.T) { "regions": []interface{}{"IT", "US"}, } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckAccessContextManagerAccessLevelConditionDestroyProducer(t), Steps: []resource.TestStep{ { @@ -57,7 +57,7 @@ func testAccCheckAccessContextManagerAccessLevelConditionPresent(t *testing.T, n return fmt.Errorf("Not found: %s", n) } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{AccessContextManagerBasePath}}{{access_level}}") if err != nil { return err @@ -89,7 +89,7 @@ func testAccCheckAccessContextManagerAccessLevelConditionDestroyProducer(t *test continue } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{AccessContextManagerBasePath}}{{access_level}}") if err != nil { diff --git a/mmv1/third_party/terraform/tests/resource_access_context_manager_access_level_test.go.erb b/mmv1/third_party/terraform/tests/resource_access_context_manager_access_level_test.go.erb index 3a26850a75a1..10eaec23cc86 100644 --- a/mmv1/third_party/terraform/tests/resource_access_context_manager_access_level_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_access_context_manager_access_level_test.go.erb @@ -20,9 +20,9 @@ import ( func testAccAccessContextManagerAccessLevel_basicTest(t *testing.T) { org := envvar.GetTestOrgFromEnv(t) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckAccessContextManagerAccessLevelDestroyProducer(t), Steps: []resource.TestStep{ { @@ -48,9 +48,9 @@ func testAccAccessContextManagerAccessLevel_basicTest(t *testing.T) { func testAccAccessContextManagerAccessLevel_fullTest(t *testing.T) { org := envvar.GetTestOrgFromEnv(t) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckAccessContextManagerAccessLevelDestroyProducer(t), Steps: []resource.TestStep{ { @@ -72,7 +72,7 @@ func testAccCheckAccessContextManagerAccessLevelDestroyProducer(t *testing.T) fu continue } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{AccessContextManagerBasePath}}{{name}}") if err != nil { @@ -97,9 +97,9 @@ func testAccCheckAccessContextManagerAccessLevelDestroyProducer(t *testing.T) fu func testAccAccessContextManagerAccessLevel_customTest(t *testing.T) { org := envvar.GetTestOrgFromEnv(t) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckAccessContextManagerAccessLevelDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_access_context_manager_access_levels_test.go b/mmv1/third_party/terraform/tests/resource_access_context_manager_access_levels_test.go index ecaded478d2b..daa7ea19fc5d 100644 --- a/mmv1/third_party/terraform/tests/resource_access_context_manager_access_levels_test.go +++ b/mmv1/third_party/terraform/tests/resource_access_context_manager_access_levels_test.go @@ -18,9 +18,9 @@ import ( func testAccAccessContextManagerAccessLevels_basicTest(t *testing.T) { org := envvar.GetTestOrgFromEnv(t) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckAccessContextManagerAccessLevelsDestroyProducer(t), Steps: []resource.TestStep{ { @@ -58,7 +58,7 @@ func testAccCheckAccessContextManagerAccessLevelsDestroyProducer(t *testing.T) f continue } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{AccessContextManagerBasePath}}{{parent}}/accessLevels") if err != nil { diff --git a/mmv1/third_party/terraform/tests/resource_access_context_manager_access_policy_iam_test.go b/mmv1/third_party/terraform/tests/resource_access_context_manager_access_policy_iam_test.go index 3ba117dd4284..6a8de7767237 100644 --- a/mmv1/third_party/terraform/tests/resource_access_context_manager_access_policy_iam_test.go +++ b/mmv1/third_party/terraform/tests/resource_access_context_manager_access_policy_iam_test.go @@ -13,12 +13,12 @@ func TestAccAccessContextManagerAccessPolicyIamBinding(t *testing.T) { acctest.SkipIfVcr(t) org := envvar.GetTestOrgFromEnv(t) - account := "tf-test-" + RandString(t, 10) + account := "tf-test-" + acctest.RandString(t, 10) role := "roles/accesscontextmanager.policyAdmin" policy := createScopedPolicy(t, org) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { // Test IAM Binding creation @@ -36,12 +36,12 @@ func TestAccAccessContextManagerAccessPolicyIamMember(t *testing.T) { acctest.SkipIfVcr(t) org := envvar.GetTestOrgFromEnv(t) - account := "tf-test-" + RandString(t, 10) + account := "tf-test-" + acctest.RandString(t, 10) role := "roles/accesscontextmanager.policyAdmin" policy := createScopedPolicy(t, org) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { // Test IAM Binding creation @@ -61,12 +61,12 @@ func TestAccAccessContextManagerAccessPolicyIamPolicy(t *testing.T) { acctest.SkipIfVcr(t) org := envvar.GetTestOrgFromEnv(t) - account := "tf-test-" + RandString(t, 10) + account := "tf-test-" + acctest.RandString(t, 10) role := "roles/accesscontextmanager.policyAdmin" policy := createScopedPolicy(t, org) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { // Test IAM Binding creation @@ -132,7 +132,7 @@ resource google_access_context_manager_access_policy_iam_policy policy { } func createScopedPolicy(t *testing.T, org string) string { - rand := RandString(t, 10) + rand := acctest.RandString(t, 10) return fmt.Sprintf(` resource "google_project" "project" { project_id = "acm-tf-test-%s" diff --git a/mmv1/third_party/terraform/tests/resource_access_context_manager_access_policy_test.go.erb b/mmv1/third_party/terraform/tests/resource_access_context_manager_access_policy_test.go.erb index d85ab931be01..02fd035131d5 100644 --- a/mmv1/third_party/terraform/tests/resource_access_context_manager_access_policy_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_access_context_manager_access_policy_test.go.erb @@ -49,9 +49,9 @@ func TestAccAccessContextManager(t *testing.T) { func testAccAccessContextManagerAccessPolicy_basicTest(t *testing.T) { org := envvar.GetTestOrgFromEnv(t) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckAccessContextManagerAccessPolicyDestroyProducer(t), Steps: []resource.TestStep{ { @@ -81,7 +81,7 @@ func testAccCheckAccessContextManagerAccessPolicyDestroyProducer(t *testing.T) f continue } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{AccessContextManagerBasePath}}accessPolicies/{{name}}") if err != nil { @@ -115,9 +115,9 @@ resource "google_access_context_manager_access_policy" "test-access" { func testAccAccessContextManagerAccessPolicy_scopedTest(t *testing.T) { org := envvar.GetTestOrgFromEnv(t) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckAccessContextManagerAccessPolicyDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_access_context_manager_authorized_orgs_desc_test.go b/mmv1/third_party/terraform/tests/resource_access_context_manager_authorized_orgs_desc_test.go index 4ff922eeece0..46c607bce6eb 100644 --- a/mmv1/third_party/terraform/tests/resource_access_context_manager_authorized_orgs_desc_test.go +++ b/mmv1/third_party/terraform/tests/resource_access_context_manager_authorized_orgs_desc_test.go @@ -19,9 +19,9 @@ func testAccAccessContextManagerAuthorizedOrgsDesc_basicTest(t *testing.T) { "org_id": envvar.GetTestOrgFromEnv(t), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckAccessContextManagerAuthorizedOrgsDescDestroyProducer(t), Steps: []resource.TestStep{ { @@ -65,7 +65,7 @@ func testAccCheckAccessContextManagerAuthorizedOrgsDescDestroyProducer(t *testin continue } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{AccessContextManagerBasePath}}{{name}}") if err != nil { diff --git a/mmv1/third_party/terraform/tests/resource_access_context_manager_gcp_user_access_binding_test.go b/mmv1/third_party/terraform/tests/resource_access_context_manager_gcp_user_access_binding_test.go index e1b4e8429867..3602178a56b7 100644 --- a/mmv1/third_party/terraform/tests/resource_access_context_manager_gcp_user_access_binding_test.go +++ b/mmv1/third_party/terraform/tests/resource_access_context_manager_gcp_user_access_binding_test.go @@ -24,12 +24,12 @@ func testAccAccessContextManagerGcpUserAccessBinding_basicTest(t *testing.T) { "org_id": envvar.GetTestOrgFromEnv(t), "org_domain": envvar.GetTestOrgDomainFromEnv(t), "cust_id": envvar.GetTestCustIdFromEnv(t), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckAccessContextManagerGcpUserAccessBindingDestroyProducer(t), Steps: []resource.TestStep{ { @@ -107,7 +107,7 @@ func testAccCheckAccessContextManagerGcpUserAccessBindingDestroyProducer(t *test continue } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{AccessContextManagerBasePath}}organizations/{{organization_id}}/gcpUserAccessBindings/{{name}}") if err != nil { diff --git a/mmv1/third_party/terraform/tests/resource_access_context_manager_service_perimeter_egress_policy_test.go b/mmv1/third_party/terraform/tests/resource_access_context_manager_service_perimeter_egress_policy_test.go index be42275dbafb..75cefb79ab6d 100644 --- a/mmv1/third_party/terraform/tests/resource_access_context_manager_service_perimeter_egress_policy_test.go +++ b/mmv1/third_party/terraform/tests/resource_access_context_manager_service_perimeter_egress_policy_test.go @@ -20,12 +20,12 @@ func testAccAccessContextManagerServicePerimeterEgressPolicy_basicTest(t *testin acctest.SkipIfVcr(t) org := envvar.GetTestOrgFromEnv(t) //projects := acctest.BootstrapServicePerimeterProjects(t, 1) - policyTitle := RandString(t, 10) + policyTitle := acctest.RandString(t, 10) perimeterTitle := "perimeter" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccAccessContextManagerServicePerimeterEgressPolicy_basic(org, policyTitle, perimeterTitle), @@ -50,7 +50,7 @@ func testAccCheckAccessContextManagerServicePerimeterEgressPolicyDestroyProducer continue } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{AccessContextManagerBasePath}}{{perimeter}}") if err != nil { diff --git a/mmv1/third_party/terraform/tests/resource_access_context_manager_service_perimeter_ingress_policy_test.go b/mmv1/third_party/terraform/tests/resource_access_context_manager_service_perimeter_ingress_policy_test.go index bb468ed0e11c..e218ddca7310 100644 --- a/mmv1/third_party/terraform/tests/resource_access_context_manager_service_perimeter_ingress_policy_test.go +++ b/mmv1/third_party/terraform/tests/resource_access_context_manager_service_perimeter_ingress_policy_test.go @@ -20,12 +20,12 @@ func testAccAccessContextManagerServicePerimeterIngressPolicy_basicTest(t *testi acctest.SkipIfVcr(t) org := envvar.GetTestOrgFromEnv(t) //projects := acctest.BootstrapServicePerimeterProjects(t, 1) - policyTitle := RandString(t, 10) + policyTitle := acctest.RandString(t, 10) perimeterTitle := "perimeter" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccAccessContextManagerServicePerimeterIngressPolicy_basic(org, policyTitle, perimeterTitle), @@ -50,7 +50,7 @@ func testAccCheckAccessContextManagerServicePerimeterIngressPolicyDestroyProduce continue } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{AccessContextManagerBasePath}}{{perimeter}}") if err != nil { diff --git a/mmv1/third_party/terraform/tests/resource_access_context_manager_service_perimeter_resource_test.go b/mmv1/third_party/terraform/tests/resource_access_context_manager_service_perimeter_resource_test.go index 98b981c6674e..10665715db56 100644 --- a/mmv1/third_party/terraform/tests/resource_access_context_manager_service_perimeter_resource_test.go +++ b/mmv1/third_party/terraform/tests/resource_access_context_manager_service_perimeter_resource_test.go @@ -23,9 +23,9 @@ func testAccAccessContextManagerServicePerimeterResource_basicTest(t *testing.T) policyTitle := "my policy" perimeterTitle := "perimeter" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccAccessContextManagerServicePerimeterResource_basic(org, policyTitle, perimeterTitle, projects[0].ProjectNumber, projects[1].ProjectNumber), @@ -56,7 +56,7 @@ func testAccCheckAccessContextManagerServicePerimeterResourceDestroyProducer(t * continue } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{AccessContextManagerBasePath}}{{perimeter_name}}") if err != nil { diff --git a/mmv1/third_party/terraform/tests/resource_access_context_manager_service_perimeter_test.go.erb b/mmv1/third_party/terraform/tests/resource_access_context_manager_service_perimeter_test.go.erb index 04bc2a2faf2d..2be630137d0e 100644 --- a/mmv1/third_party/terraform/tests/resource_access_context_manager_service_perimeter_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_access_context_manager_service_perimeter_test.go.erb @@ -19,9 +19,9 @@ import ( func testAccAccessContextManagerServicePerimeter_basicTest(t *testing.T) { org := envvar.GetTestOrgFromEnv(t) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckAccessContextManagerServicePerimeterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -39,9 +39,9 @@ func testAccAccessContextManagerServicePerimeter_basicTest(t *testing.T) { func testAccAccessContextManagerServicePerimeter_updateTest(t *testing.T) { org := envvar.GetTestOrgFromEnv(t) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckAccessContextManagerServicePerimeterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -95,7 +95,7 @@ func testAccCheckAccessContextManagerServicePerimeterDestroyProducer(t *testing. continue } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{AccessContextManagerBasePath}}{{name}}") if err != nil { diff --git a/mmv1/third_party/terraform/tests/resource_access_context_manager_services_perimeters_test.go b/mmv1/third_party/terraform/tests/resource_access_context_manager_services_perimeters_test.go index 49e6fda8af41..972b6ab8b68d 100644 --- a/mmv1/third_party/terraform/tests/resource_access_context_manager_services_perimeters_test.go +++ b/mmv1/third_party/terraform/tests/resource_access_context_manager_services_perimeters_test.go @@ -17,9 +17,9 @@ import ( func testAccAccessContextManagerServicePerimeters_basicTest(t *testing.T) { org := envvar.GetTestOrgFromEnv(t) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckAccessContextManagerServicePerimetersDestroyProducer(t), Steps: []resource.TestStep{ { @@ -57,7 +57,7 @@ func testAccCheckAccessContextManagerServicePerimetersDestroyProducer(t *testing continue } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{AccessContextManagerBasePath}}{{parent}}/servicePerimeters") if err != nil { diff --git a/mmv1/third_party/terraform/tests/resource_active_directory_domain_trust_test.go b/mmv1/third_party/terraform/tests/resource_active_directory_domain_trust_test.go index 82bd0f7ec37c..d8834d24e77c 100644 --- a/mmv1/third_party/terraform/tests/resource_active_directory_domain_trust_test.go +++ b/mmv1/third_party/terraform/tests/resource_active_directory_domain_trust_test.go @@ -23,12 +23,12 @@ func TestAccActiveDirectoryDomainTrust_activeDirectoryDomainTrustBasicExample(t t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckActiveDirectoryDomainTrustDestroyProducer(t), Steps: []resource.TestStep{ { @@ -89,7 +89,7 @@ func testAccCheckActiveDirectoryDomainTrustDestroyProducer(t *testing.T) func(s continue } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{ActiveDirectoryBasePath}}projects/{{project}}/locations/global/domains/{{domain}}") if err != nil { diff --git a/mmv1/third_party/terraform/tests/resource_active_directory_domain_update_test.go b/mmv1/third_party/terraform/tests/resource_active_directory_domain_update_test.go index 09fdf9bad5c7..0c54b37e0e98 100644 --- a/mmv1/third_party/terraform/tests/resource_active_directory_domain_update_test.go +++ b/mmv1/third_party/terraform/tests/resource_active_directory_domain_update_test.go @@ -19,7 +19,7 @@ func TestAccActiveDirectoryDomain_update(t *testing.T) { t.Parallel() - domain := fmt.Sprintf("tf-test%s.org1.com", RandString(t, 5)) + domain := fmt.Sprintf("tf-test%s.org1.com", acctest.RandString(t, 5)) context := map[string]interface{}{ "domain": domain, "resource_name": "ad-domain", @@ -27,9 +27,9 @@ func TestAccActiveDirectoryDomain_update(t *testing.T) { resourceName := acctest.Nprintf("google_active_directory_domain.%{resource_name}", context) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckActiveDirectoryDomainDestroyProducer(t), Steps: []resource.TestStep{ { @@ -98,7 +98,7 @@ func testAccCheckActiveDirectoryDomainDestroyProducer(t *testing.T) func(s *terr continue } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{ActiveDirectoryBasePath}}{{name}}") if err != nil { diff --git a/mmv1/third_party/terraform/tests/resource_alloydb_backup_test.go b/mmv1/third_party/terraform/tests/resource_alloydb_backup_test.go index 1a5df7757286..66cbdc95d612 100644 --- a/mmv1/third_party/terraform/tests/resource_alloydb_backup_test.go +++ b/mmv1/third_party/terraform/tests/resource_alloydb_backup_test.go @@ -12,12 +12,12 @@ func TestAccAlloydbBackup_update(t *testing.T) { context := map[string]interface{}{ "network_name": acctest.BootstrapSharedTestNetwork(t, "alloydb-update"), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckAlloydbBackupDestroyProducer(t), Steps: []resource.TestStep{ { @@ -97,12 +97,12 @@ func TestAccAlloydbBackup_createBackupWithMandatoryFields(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckAlloydbBackupDestroyProducer(t), Steps: []resource.TestStep{ { @@ -172,13 +172,13 @@ func TestAccAlloydbBackup_usingCMEK(t *testing.T) { context := map[string]interface{}{ "network_name": acctest.BootstrapSharedTestNetwork(t, "alloydb-cmek"), - "random_suffix": RandString(t, 10), - "key_name": "tf-test-key-" + RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), + "key_name": "tf-test-key-" + acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckAlloydbBackupDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_alloydb_cluster_test.go b/mmv1/third_party/terraform/tests/resource_alloydb_cluster_test.go index a1d171240988..b25d19f7e3d0 100644 --- a/mmv1/third_party/terraform/tests/resource_alloydb_cluster_test.go +++ b/mmv1/third_party/terraform/tests/resource_alloydb_cluster_test.go @@ -11,12 +11,12 @@ func TestAccAlloydbCluster_update(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckAlloydbClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -76,12 +76,12 @@ func TestAccAlloydbCluster_addAutomatedBackupPolicyAndInitialUser(t *testing.T) t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckAlloydbClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -116,12 +116,12 @@ func TestAccAlloydbCluster_deleteAutomatedBackupPolicyAndInitialUser(t *testing. t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckAlloydbClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -224,12 +224,12 @@ func TestAccAlloydbCluster_missingWeeklySchedule(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckAlloydbClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -274,12 +274,12 @@ func TestAccAlloydbCluster_mandatoryFields(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckAlloydbClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -294,12 +294,12 @@ func TestAccAlloydbCluster_maximumFields(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckAlloydbClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -314,12 +314,12 @@ func TestAccAlloydbCluster_deleteTimeBasedRetentionPolicy(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckAlloydbClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -427,13 +427,13 @@ func TestAccAlloydbCluster_usingCMEK(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), - "key_name": "tf-test-key-" + RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), + "key_name": "tf-test-key-" + acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ - PreCheck: func() { AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + acctest.VcrTest(t, resource.TestCase{ + PreCheck: func() { acctest.AccTestPreCheck(t) }, + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckAlloydbClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -486,13 +486,13 @@ func TestAccAlloydbCluster_CMEKInAutomatedBackupIsUpdatable(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), - "key_name": "tf-test-key-" + RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), + "key_name": "tf-test-key-" + acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ - PreCheck: func() { AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + acctest.VcrTest(t, resource.TestCase{ + PreCheck: func() { acctest.AccTestPreCheck(t) }, + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckAlloydbClusterDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_alloydb_instance_test.go b/mmv1/third_party/terraform/tests/resource_alloydb_instance_test.go index ad799c635a8c..09766d64193a 100644 --- a/mmv1/third_party/terraform/tests/resource_alloydb_instance_test.go +++ b/mmv1/third_party/terraform/tests/resource_alloydb_instance_test.go @@ -11,12 +11,12 @@ func TestAccAlloydbInstance_update(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckAlloydbInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -97,12 +97,12 @@ func TestAccAlloydbInstance_createInstanceWithMandatoryFields(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckAlloydbInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -155,12 +155,12 @@ func TestAccAlloydbInstance_createInstanceWithMaximumFields(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckAlloydbInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -232,12 +232,12 @@ func TestAccAlloydbInstance_createPrimaryAndReadPoolInstance(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckAlloydbInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -299,12 +299,12 @@ func TestAccAlloydbInstance_updateDatabaseFlagInPrimaryInstance(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckAlloydbInstanceDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_api_gateway_api_config_test.go.erb b/mmv1/third_party/terraform/tests/resource_api_gateway_api_config_test.go.erb index 328d95ebb375..dbb6b1397d64 100644 --- a/mmv1/third_party/terraform/tests/resource_api_gateway_api_config_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_api_gateway_api_config_test.go.erb @@ -13,12 +13,12 @@ func TestAccApiGatewayApiConfig_apigatewayApiConfigBasicExampleUpdated(t *testin t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderBetaFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), CheckDestroy: testAccCheckApiGatewayApiConfigDestroyProducer(t), Steps: []resource.TestStep{ { @@ -37,12 +37,12 @@ func TestAccApiGatewayApiConfig_generatedPrefix(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderBetaFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), CheckDestroy: testAccCheckApiGatewayApiConfigDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_api_gateway_api_test.go.erb b/mmv1/third_party/terraform/tests/resource_api_gateway_api_test.go.erb index e3d8958ddafa..cc065b4e54c5 100644 --- a/mmv1/third_party/terraform/tests/resource_api_gateway_api_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_api_gateway_api_test.go.erb @@ -13,12 +13,12 @@ func TestAccApiGatewayApi_apigatewayApiBasicExampleUpdated(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderBetaFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), CheckDestroy: testAccCheckApiGatewayApiDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_api_gateway_gateway_test.go.erb b/mmv1/third_party/terraform/tests/resource_api_gateway_gateway_test.go.erb index e3bbbed5fb95..fab1c261fa6f 100644 --- a/mmv1/third_party/terraform/tests/resource_api_gateway_gateway_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_api_gateway_gateway_test.go.erb @@ -13,12 +13,12 @@ func TestAccApiGatewayGateway_apigatewayGatewayBasicExampleUpdated(t *testing.T) t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderBetaFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), CheckDestroy: testAccCheckApiGatewayGatewayDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_apigee_env_keystore_alias_pkcs12_test.go b/mmv1/third_party/terraform/tests/resource_apigee_env_keystore_alias_pkcs12_test.go index 4e10b5d1d95b..c40d1ca6b824 100644 --- a/mmv1/third_party/terraform/tests/resource_apigee_env_keystore_alias_pkcs12_test.go +++ b/mmv1/third_party/terraform/tests/resource_apigee_env_keystore_alias_pkcs12_test.go @@ -22,12 +22,12 @@ func TestAccApigeeKeystoresAliasesPkcs12_ApigeeKeystoresAliasesPkcs12Example(t * context := map[string]interface{}{ "org_id": envvar.GetTestOrgFromEnv(t), "billing_account": envvar.GetTestBillingAccountFromEnv(t), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckApigeeKeystoresAliasesPkcs12DestroyProducer(t), Steps: []resource.TestStep{ { @@ -135,7 +135,7 @@ func testAccCheckApigeeKeystoresAliasesPkcs12DestroyProducer(t *testing.T) func( continue } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{ApigeeBasePath}}{{keystore_id}}/aliases/{{alias}}") if err != nil { diff --git a/mmv1/third_party/terraform/tests/resource_apigee_environment_nodeconfig_test.go.erb b/mmv1/third_party/terraform/tests/resource_apigee_environment_nodeconfig_test.go.erb index cfdbb155cd98..91ae9ca68489 100644 --- a/mmv1/third_party/terraform/tests/resource_apigee_environment_nodeconfig_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_apigee_environment_nodeconfig_test.go.erb @@ -17,12 +17,12 @@ func TestAccApigeeEnvironment_apigeeEnvironmentNodeconfigTestExampleUpdate(t *te context := map[string]interface{}{ "org_id": envvar.GetTestOrgFromEnv(t), "billing_account": envvar.GetTestBillingAccountFromEnv(t), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderBetaFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), CheckDestroy: testAccCheckApigeeEnvironmentDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_apigee_flowhook_test.go b/mmv1/third_party/terraform/tests/resource_apigee_flowhook_test.go index 5d8357f5068d..7c0d40591f4f 100644 --- a/mmv1/third_party/terraform/tests/resource_apigee_flowhook_test.go +++ b/mmv1/third_party/terraform/tests/resource_apigee_flowhook_test.go @@ -21,12 +21,12 @@ func TestAccApigeeFlowhook_apigeeFlowhookTestExample(t *testing.T) { context := map[string]interface{}{ "org_id": envvar.GetTestOrgFromEnv(t), "billing_account": envvar.GetTestBillingAccountFromEnv(t), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckApigeeFlowhookDestroyProducer(t), Steps: []resource.TestStep{ { @@ -142,7 +142,7 @@ func testAccCheckApigeeFlowhookDestroyProducer(t *testing.T) func(s *terraform.S continue } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{ApigeeBasePath}}organizations/{{org_id}}/environments/{{environment}}/flowhooks/{{flow_hook_point}}") if err != nil { diff --git a/mmv1/third_party/terraform/tests/resource_apigee_keystores_aliases_key_cert_file_test.go b/mmv1/third_party/terraform/tests/resource_apigee_keystores_aliases_key_cert_file_test.go index cb789432adec..5e73d98a269c 100644 --- a/mmv1/third_party/terraform/tests/resource_apigee_keystores_aliases_key_cert_file_test.go +++ b/mmv1/third_party/terraform/tests/resource_apigee_keystores_aliases_key_cert_file_test.go @@ -22,12 +22,12 @@ func TestAccApigeeKeystoresAliasesKeyCertFile_apigeeKeystoresAliasesKeyCertFileT context := map[string]interface{}{ "org_id": envvar.GetTestOrgFromEnv(t), "billing_account": envvar.GetTestBillingAccountFromEnv(t), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckApigeeKeystoresAliasesKeyCertFileDestroyProducer(t), Steps: []resource.TestStep{ { @@ -144,7 +144,7 @@ func testAccCheckApigeeKeystoresAliasesKeyCertFileDestroyProducer(t *testing.T) continue } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{ApigeeBasePath}}organizations/{{org_id}}/environments/{{environment}}/keystores/{{keystore}}/aliases/{{alias}}") if err != nil { diff --git a/mmv1/third_party/terraform/tests/resource_apigee_sharedflow_deployment_test.go b/mmv1/third_party/terraform/tests/resource_apigee_sharedflow_deployment_test.go index 8ffc8252d319..0ad76f502924 100644 --- a/mmv1/third_party/terraform/tests/resource_apigee_sharedflow_deployment_test.go +++ b/mmv1/third_party/terraform/tests/resource_apigee_sharedflow_deployment_test.go @@ -21,12 +21,12 @@ func TestAccApigeeSharedflowDeployment_apigeeSharedflowDeploymentTestExample(t * context := map[string]interface{}{ "org_id": envvar.GetTestOrgFromEnv(t), "billing_account": envvar.GetTestBillingAccountFromEnv(t), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckApigeeSharedflowDeploymentDestroyProducer(t), Steps: []resource.TestStep{ { @@ -144,7 +144,7 @@ func testAccCheckApigeeSharedflowDeploymentDestroyProducer(t *testing.T) func(s continue } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{ApigeeBasePath}}organizations/{{org_id}}/environments/{{environment}}/sharedflows/{{sharedflow_id}}/revisions/{{revision}}/deployments") if err != nil { diff --git a/mmv1/third_party/terraform/tests/resource_apigee_sharedflow_test.go b/mmv1/third_party/terraform/tests/resource_apigee_sharedflow_test.go index c76afce12073..0161044fe51c 100644 --- a/mmv1/third_party/terraform/tests/resource_apigee_sharedflow_test.go +++ b/mmv1/third_party/terraform/tests/resource_apigee_sharedflow_test.go @@ -23,12 +23,12 @@ func TestAccApigeeSharedFlow_apigeeSharedflowTestExample(t *testing.T) { context := map[string]interface{}{ "org_id": envvar.GetTestOrgFromEnv(t), "billing_account": envvar.GetTestBillingAccountFromEnv(t), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckApigeeSharedFlowDestroyProducer(t), Steps: []resource.TestStep{ { @@ -130,7 +130,7 @@ func testAccCheckApigeeSharedFlowDestroyProducer(t *testing.T) func(s *terraform continue } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{ApigeeBasePath}}organizations/{{org_id}}/sharedflows/{{name}}") if err != nil { diff --git a/mmv1/third_party/terraform/tests/resource_apigee_sync_authorization_test.go b/mmv1/third_party/terraform/tests/resource_apigee_sync_authorization_test.go index 3a7673299004..3954cb2b9875 100644 --- a/mmv1/third_party/terraform/tests/resource_apigee_sync_authorization_test.go +++ b/mmv1/third_party/terraform/tests/resource_apigee_sync_authorization_test.go @@ -14,12 +14,12 @@ func TestAccApigeeSyncAuthorization_update(t *testing.T) { context := map[string]interface{}{ "org_id": envvar.GetTestOrgFromEnv(t), "billing_account": envvar.GetTestBillingAccountFromEnv(t), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccApigeeSyncAuthorization_basic(context), diff --git a/mmv1/third_party/terraform/tests/resource_app_engine_application_test.go b/mmv1/third_party/terraform/tests/resource_app_engine_application_test.go index 77a36e31881c..1b5e577d1d57 100644 --- a/mmv1/third_party/terraform/tests/resource_app_engine_application_test.go +++ b/mmv1/third_party/terraform/tests/resource_app_engine_application_test.go @@ -13,10 +13,10 @@ func TestAccAppEngineApplication_basic(t *testing.T) { t.Parallel() org := envvar.GetTestOrgFromEnv(t) - pid := fmt.Sprintf("tf-test-%d", RandInt(t)) - VcrTest(t, resource.TestCase{ + pid := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccAppEngineApplication_basic(pid, org), @@ -49,11 +49,11 @@ func TestAccAppEngineApplication_withIAP(t *testing.T) { t.Parallel() org := envvar.GetTestOrgFromEnv(t) - pid := fmt.Sprintf("tf-test-%d", RandInt(t)) + pid := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccAppEngineApplication_withIAP(pid, org), diff --git a/mmv1/third_party/terraform/tests/resource_app_engine_domain_mapping_test.go b/mmv1/third_party/terraform/tests/resource_app_engine_domain_mapping_test.go index 21be39d73219..f99af62a00d2 100644 --- a/mmv1/third_party/terraform/tests/resource_app_engine_domain_mapping_test.go +++ b/mmv1/third_party/terraform/tests/resource_app_engine_domain_mapping_test.go @@ -11,11 +11,11 @@ import ( func TestAccAppEngineDomainMapping_update(t *testing.T) { t.Parallel() - domainName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + domainName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckAppEngineDomainMappingDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_app_engine_flexible_app_version_test.go b/mmv1/third_party/terraform/tests/resource_app_engine_flexible_app_version_test.go index c051cf742eb7..7917035e897f 100644 --- a/mmv1/third_party/terraform/tests/resource_app_engine_flexible_app_version_test.go +++ b/mmv1/third_party/terraform/tests/resource_app_engine_flexible_app_version_test.go @@ -14,12 +14,12 @@ func TestAccAppEngineFlexibleAppVersion_update(t *testing.T) { context := map[string]interface{}{ "org_id": envvar.GetTestOrgFromEnv(t), "billing_account": envvar.GetTestBillingAccountFromEnv(t), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckAppEngineFlexibleAppVersionDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_app_engine_service_network_settings_test.go b/mmv1/third_party/terraform/tests/resource_app_engine_service_network_settings_test.go index 08e389b44de6..fb22ff85cd56 100644 --- a/mmv1/third_party/terraform/tests/resource_app_engine_service_network_settings_test.go +++ b/mmv1/third_party/terraform/tests/resource_app_engine_service_network_settings_test.go @@ -11,12 +11,12 @@ func TestAccAppEngineServiceNetworkSettings_update(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccAppEngineServiceNetworkSettings_basic(context), diff --git a/mmv1/third_party/terraform/tests/resource_app_engine_standard_app_version_test.go b/mmv1/third_party/terraform/tests/resource_app_engine_standard_app_version_test.go index a032d3ac5b7f..cbd3afaa1e90 100644 --- a/mmv1/third_party/terraform/tests/resource_app_engine_standard_app_version_test.go +++ b/mmv1/third_party/terraform/tests/resource_app_engine_standard_app_version_test.go @@ -14,12 +14,12 @@ func TestAccAppEngineStandardAppVersion_update(t *testing.T) { context := map[string]interface{}{ "org_id": envvar.GetTestOrgFromEnv(t), "billing_account": envvar.GetTestBillingAccountFromEnv(t), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckAppEngineStandardAppVersionDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_artifact_registry_repository_test.go.erb b/mmv1/third_party/terraform/tests/resource_artifact_registry_repository_test.go.erb index 95c1c5a387ab..67c16f52174a 100644 --- a/mmv1/third_party/terraform/tests/resource_artifact_registry_repository_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_artifact_registry_repository_test.go.erb @@ -12,11 +12,11 @@ import ( func TestAccArtifactRegistryRepository_update(t *testing.T) { t.Parallel() - repositoryID := fmt.Sprintf("tf-test-%d", RandInt(t)) + repositoryID := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckArtifactRegistryRepositoryDestroyProducer(t), Steps: []resource.TestStep{ { @@ -42,11 +42,11 @@ func TestAccArtifactRegistryRepository_update(t *testing.T) { func TestAccArtifactRegistryRepository_createMvnSnapshot(t *testing.T) { t.Parallel() - repositoryID := fmt.Sprintf("tf-test-%d", RandInt(t)) + repositoryID := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckArtifactRegistryRepositoryDestroyProducer(t), Steps: []resource.TestStep{ { @@ -64,11 +64,11 @@ func TestAccArtifactRegistryRepository_createMvnSnapshot(t *testing.T) { func TestAccArtifactRegistryRepository_createMvnRelease(t *testing.T) { t.Parallel() - repositoryID := fmt.Sprintf("tf-test-%d", RandInt(t)) + repositoryID := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckArtifactRegistryRepositoryDestroyProducer(t), Steps: []resource.TestStep{ { @@ -86,11 +86,11 @@ func TestAccArtifactRegistryRepository_createMvnRelease(t *testing.T) { func TestAccArtifactRegistryRepository_kfp(t *testing.T) { t.Parallel() - repositoryID := fmt.Sprintf("tf-test-%d", RandInt(t)) + repositoryID := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckArtifactRegistryRepositoryDestroyProducer(t), Steps: []resource.TestStep{ { @@ -167,12 +167,12 @@ resource "google_artifact_registry_repository" "test" { func TestAccArtifactRegistryRepository_virtual(t *testing.T) { t.Parallel() - upstreamRepositoryID := fmt.Sprintf("tf-test-%d", RandInt(t)) + upstreamRepositoryID := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) repositoryID := fmt.Sprintf("%s-virtual", upstreamRepositoryID) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckArtifactRegistryRepositoryDestroyProducer(t), Steps: []resource.TestStep{ { @@ -198,11 +198,11 @@ func TestAccArtifactRegistryRepository_virtual(t *testing.T) { func TestAccArtifactRegistryRepository_remote(t *testing.T) { t.Parallel() - repositoryID := fmt.Sprintf("tf-test-%d", RandInt(t)) + repositoryID := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckArtifactRegistryRepositoryDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_beyondcorp_app_connection_test.go b/mmv1/third_party/terraform/tests/resource_beyondcorp_app_connection_test.go index dbb64100a50f..cb636e140e2c 100644 --- a/mmv1/third_party/terraform/tests/resource_beyondcorp_app_connection_test.go +++ b/mmv1/third_party/terraform/tests/resource_beyondcorp_app_connection_test.go @@ -11,12 +11,12 @@ func TestAccBeyondcorpAppConnection_beyondcorpAppConnectionUpdateExample(t *test t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckBeyondcorpAppConnectionDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_beyondcorp_app_connector_test.go b/mmv1/third_party/terraform/tests/resource_beyondcorp_app_connector_test.go index 3016f6bdd374..d59336d5357a 100644 --- a/mmv1/third_party/terraform/tests/resource_beyondcorp_app_connector_test.go +++ b/mmv1/third_party/terraform/tests/resource_beyondcorp_app_connector_test.go @@ -11,12 +11,12 @@ func TestAccBeyondcorpAppConnector_beyondcorpAppConnectorUpdateExample(t *testin t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckBeyondcorpAppConnectorDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_big_query_dataset_test.go b/mmv1/third_party/terraform/tests/resource_big_query_dataset_test.go index ac4e75bc2109..466e5e6de6c4 100644 --- a/mmv1/third_party/terraform/tests/resource_big_query_dataset_test.go +++ b/mmv1/third_party/terraform/tests/resource_big_query_dataset_test.go @@ -14,11 +14,11 @@ import ( func TestAccBigQueryDataset_basic(t *testing.T) { t.Parallel() - datasetID := fmt.Sprintf("tf_test_%s", RandString(t, 10)) + datasetID := fmt.Sprintf("tf_test_%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckBigQueryDatasetDestroyProducer(t), Steps: []resource.TestStep{ { @@ -52,12 +52,12 @@ func TestAccBigQueryDataset_basic(t *testing.T) { func TestAccBigQueryDataset_datasetWithContents(t *testing.T) { t.Parallel() - datasetID := fmt.Sprintf("tf_test_%s", RandString(t, 10)) - tableID := fmt.Sprintf("tf_test_%s", RandString(t, 10)) + datasetID := fmt.Sprintf("tf_test_%s", acctest.RandString(t, 10)) + tableID := fmt.Sprintf("tf_test_%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckBigQueryDatasetDestroyProducer(t), Steps: []resource.TestStep{ { @@ -77,13 +77,13 @@ func TestAccBigQueryDataset_datasetWithContents(t *testing.T) { func TestAccBigQueryDataset_access(t *testing.T) { t.Parallel() - datasetID := fmt.Sprintf("tf_test_access_%s", RandString(t, 10)) - otherDatasetID := fmt.Sprintf("tf_test_other_%s", RandString(t, 10)) - otherTableID := fmt.Sprintf("tf_test_other_%s", RandString(t, 10)) + datasetID := fmt.Sprintf("tf_test_access_%s", acctest.RandString(t, 10)) + otherDatasetID := fmt.Sprintf("tf_test_other_%s", acctest.RandString(t, 10)) + otherTableID := fmt.Sprintf("tf_test_other_%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckBigQueryDatasetDestroyProducer(t), Steps: []resource.TestStep{ { @@ -125,11 +125,11 @@ func TestAccBigQueryDataset_access(t *testing.T) { func TestAccBigQueryDataset_regionalLocation(t *testing.T) { t.Parallel() - datasetID1 := fmt.Sprintf("tf_test_%s", RandString(t, 10)) + datasetID1 := fmt.Sprintf("tf_test_%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckBigQueryDatasetDestroyProducer(t), Steps: []resource.TestStep{ { @@ -149,11 +149,11 @@ func TestAccBigQueryDataset_cmek(t *testing.T) { kms := acctest.BootstrapKMSKeyInLocation(t, "us") pid := envvar.GetTestProjectFromEnv() - datasetID1 := fmt.Sprintf("tf_test_%s", RandString(t, 10)) + datasetID1 := fmt.Sprintf("tf_test_%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccBigQueryDataset_cmek(pid, datasetID1, kms.CryptoKey.Name), @@ -170,7 +170,7 @@ func TestAccBigQueryDataset_cmek(t *testing.T) { func testAccAddTable(t *testing.T, datasetID string, tableID string) resource.TestCheckFunc { // Not actually a check, but adds a table independently of terraform return func(s *terraform.State) error { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) table := &bigquery.Table{ TableReference: &bigquery.TableReference{ DatasetId: datasetID, diff --git a/mmv1/third_party/terraform/tests/resource_big_query_routine_test.go b/mmv1/third_party/terraform/tests/resource_big_query_routine_test.go index c013c875e380..a127b983e0ef 100644 --- a/mmv1/third_party/terraform/tests/resource_big_query_routine_test.go +++ b/mmv1/third_party/terraform/tests/resource_big_query_routine_test.go @@ -11,12 +11,12 @@ import ( func TestAccBigQueryRoutine_bigQueryRoutine_Update(t *testing.T) { t.Parallel() - dataset := fmt.Sprintf("tfmanualdataset%s", RandString(t, 10)) - routine := fmt.Sprintf("tfmanualroutine%s", RandString(t, 10)) + dataset := fmt.Sprintf("tfmanualdataset%s", acctest.RandString(t, 10)) + routine := fmt.Sprintf("tfmanualroutine%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckBigQueryRoutineDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_bigquery_analytics_hub_listing_test.go b/mmv1/third_party/terraform/tests/resource_bigquery_analytics_hub_listing_test.go index f6c2fc40f17e..37b8197d520f 100644 --- a/mmv1/third_party/terraform/tests/resource_bigquery_analytics_hub_listing_test.go +++ b/mmv1/third_party/terraform/tests/resource_bigquery_analytics_hub_listing_test.go @@ -11,12 +11,12 @@ func TestAccBigqueryAnalyticsHubListing_bigqueryAnalyticshubListingUpdate(t *tes t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckBigqueryAnalyticsHubListingDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_bigquery_connection_test.go b/mmv1/third_party/terraform/tests/resource_bigquery_connection_test.go index 87036ae2b3ca..641272f52ac2 100644 --- a/mmv1/third_party/terraform/tests/resource_bigquery_connection_test.go +++ b/mmv1/third_party/terraform/tests/resource_bigquery_connection_test.go @@ -13,12 +13,12 @@ func TestAccBigqueryConnectionConnection_bigqueryConnectionBasic(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckBigqueryConnectionConnectionDestroyProducer(t), ExternalProviders: map[string]resource.ExternalProvider{ "random": {}, @@ -144,12 +144,12 @@ func TestAccBigqueryConnectionConnection_bigqueryConnectionAwsUpdate(t *testing. t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), ExternalProviders: map[string]resource.ExternalProvider{ "random": {}, "time": {}, diff --git a/mmv1/third_party/terraform/tests/resource_bigquery_data_transfer_config_test.go b/mmv1/third_party/terraform/tests/resource_bigquery_data_transfer_config_test.go index 19d64be289ea..1bba14b45317 100644 --- a/mmv1/third_party/terraform/tests/resource_bigquery_data_transfer_config_test.go +++ b/mmv1/third_party/terraform/tests/resource_bigquery_data_transfer_config_test.go @@ -180,14 +180,14 @@ func TestAccBigqueryDataTransferConfig(t *testing.T) { func testAccBigqueryDataTransferConfig_scheduledQuery_basic(t *testing.T) { // Uses time.Now acctest.SkipIfVcr(t) - random_suffix := RandString(t, 10) + random_suffix := acctest.RandString(t, 10) now := time.Now().UTC() start_time := now.Add(1 * time.Hour).Format(time.RFC3339) end_time := now.AddDate(0, 1, 0).Format(time.RFC3339) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckBigqueryDataTransferConfigDestroyProducer(t), Steps: []resource.TestStep{ { @@ -206,17 +206,17 @@ func testAccBigqueryDataTransferConfig_scheduledQuery_basic(t *testing.T) { func testAccBigqueryDataTransferConfig_scheduledQuery_update(t *testing.T) { // Uses time.Now acctest.SkipIfVcr(t) - random_suffix := RandString(t, 10) + random_suffix := acctest.RandString(t, 10) now := time.Now().UTC() first_start_time := now.Add(1 * time.Hour).Format(time.RFC3339) first_end_time := now.AddDate(0, 1, 0).Format(time.RFC3339) second_start_time := now.Add(2 * time.Hour).Format(time.RFC3339) second_end_time := now.AddDate(0, 2, 0).Format(time.RFC3339) - random_suffix2 := RandString(t, 10) + random_suffix2 := acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckBigqueryDataTransferConfigDestroyProducer(t), Steps: []resource.TestStep{ { @@ -247,14 +247,14 @@ func testAccBigqueryDataTransferConfig_scheduledQuery_update(t *testing.T) { func testAccBigqueryDataTransferConfig_scheduledQuery_no_destination(t *testing.T) { // Uses time.Now acctest.SkipIfVcr(t) - random_suffix := RandString(t, 10) + random_suffix := acctest.RandString(t, 10) now := time.Now().UTC() start_time := now.Add(1 * time.Hour).Format(time.RFC3339) end_time := now.AddDate(0, 1, 0).Format(time.RFC3339) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckBigqueryDataTransferConfigDestroyProducer(t), Steps: []resource.TestStep{ { @@ -271,11 +271,11 @@ func testAccBigqueryDataTransferConfig_scheduledQuery_no_destination(t *testing. } func testAccBigqueryDataTransferConfig_scheduledQuery_with_service_account(t *testing.T) { - random_suffix := RandString(t, 10) + random_suffix := acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckBigqueryDataTransferConfigDestroyProducer(t), Steps: []resource.TestStep{ { @@ -292,11 +292,11 @@ func testAccBigqueryDataTransferConfig_scheduledQuery_with_service_account(t *te } func testAccBigqueryDataTransferConfig_copy_booleanParam(t *testing.T) { - random_suffix := RandString(t, 10) + random_suffix := acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckBigqueryDataTransferConfigDestroyProducer(t), Steps: []resource.TestStep{ { @@ -313,11 +313,11 @@ func testAccBigqueryDataTransferConfig_copy_booleanParam(t *testing.T) { } func testAccBigqueryDataTransferConfig_force_new_update_params(t *testing.T) { - random_suffix := RandString(t, 10) + random_suffix := acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckBigqueryDataTransferConfigDestroyProducer(t), Steps: []resource.TestStep{ { @@ -361,7 +361,7 @@ func testAccCheckBigqueryDataTransferConfigDestroyProducer(t *testing.T) func(s continue } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{BigqueryDataTransferBasePath}}{{name}}") if err != nil { @@ -384,13 +384,13 @@ func testAccCheckBigqueryDataTransferConfigDestroyProducer(t *testing.T) func(s } func testAccBigqueryDataTransferConfig_scheduledQuery_update_service_account(t *testing.T) { - random_suffix1 := RandString(t, 10) - random_suffix2 := RandString(t, 10) + random_suffix1 := acctest.RandString(t, 10) + random_suffix2 := acctest.RandString(t, 10) transferConfigID := "" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckBigqueryDataTransferConfigDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_bigquery_datapolicy_data_policy_test.go b/mmv1/third_party/terraform/tests/resource_bigquery_datapolicy_data_policy_test.go index 41d59001aa64..8265ffb9fc81 100644 --- a/mmv1/third_party/terraform/tests/resource_bigquery_datapolicy_data_policy_test.go +++ b/mmv1/third_party/terraform/tests/resource_bigquery_datapolicy_data_policy_test.go @@ -11,12 +11,12 @@ func TestAccBigqueryDatapolicyDataPolicy_bigqueryDatapolicyDataPolicyUpdate(t *t t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckBigqueryDatapolicyDataPolicyDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_bigquery_dataset_access_test.go b/mmv1/third_party/terraform/tests/resource_bigquery_dataset_access_test.go index 72cdb6cd9956..c3061efa6838 100644 --- a/mmv1/third_party/terraform/tests/resource_bigquery_dataset_access_test.go +++ b/mmv1/third_party/terraform/tests/resource_bigquery_dataset_access_test.go @@ -17,17 +17,17 @@ import ( func TestAccBigQueryDatasetAccess_basic(t *testing.T) { t.Parallel() - datasetID := fmt.Sprintf("tf_test_%s", RandString(t, 10)) - saID := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + datasetID := fmt.Sprintf("tf_test_%s", acctest.RandString(t, 10)) + saID := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) expected := map[string]interface{}{ "role": "OWNER", "userByEmail": fmt.Sprintf("%s@%s.iam.gserviceaccount.com", saID, envvar.GetTestProjectFromEnv()), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccBigQueryDatasetAccess_basic(datasetID, saID), @@ -45,9 +45,9 @@ func TestAccBigQueryDatasetAccess_basic(t *testing.T) { func TestAccBigQueryDatasetAccess_view(t *testing.T) { t.Parallel() - datasetID := fmt.Sprintf("tf_test_%s", RandString(t, 10)) - datasetID2 := fmt.Sprintf("tf_test_%s", RandString(t, 10)) - tableID := fmt.Sprintf("tf_test_%s", RandString(t, 10)) + datasetID := fmt.Sprintf("tf_test_%s", acctest.RandString(t, 10)) + datasetID2 := fmt.Sprintf("tf_test_%s", acctest.RandString(t, 10)) + tableID := fmt.Sprintf("tf_test_%s", acctest.RandString(t, 10)) expected := map[string]interface{}{ "view": map[string]interface{}{ @@ -57,9 +57,9 @@ func TestAccBigQueryDatasetAccess_view(t *testing.T) { }, } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccBigQueryDatasetAccess_view(datasetID, datasetID2, tableID), @@ -76,8 +76,8 @@ func TestAccBigQueryDatasetAccess_view(t *testing.T) { func TestAccBigQueryDatasetAccess_authorizedDataset(t *testing.T) { t.Parallel() - datasetID := fmt.Sprintf("tf_test_%s", RandString(t, 10)) - datasetID2 := fmt.Sprintf("tf_test_%s", RandString(t, 10)) + datasetID := fmt.Sprintf("tf_test_%s", acctest.RandString(t, 10)) + datasetID2 := fmt.Sprintf("tf_test_%s", acctest.RandString(t, 10)) expected := map[string]interface{}{ "dataset": map[string]interface{}{ @@ -89,9 +89,9 @@ func TestAccBigQueryDatasetAccess_authorizedDataset(t *testing.T) { }, } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccBigQueryDatasetAccess_authorizedDataset(datasetID, datasetID2), @@ -111,9 +111,9 @@ func TestAccBigQueryDatasetAccess_authorizedRoutine(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "public_dataset": fmt.Sprintf("tf_test_public_dataset_%s", RandString(t, 10)), - "public_routine": fmt.Sprintf("tf_test_public_routine_%s", RandString(t, 10)), - "private_dataset": fmt.Sprintf("tf_test_private_dataset_%s", RandString(t, 10)), + "public_dataset": fmt.Sprintf("tf_test_public_dataset_%s", acctest.RandString(t, 10)), + "public_routine": fmt.Sprintf("tf_test_public_routine_%s", acctest.RandString(t, 10)), + "private_dataset": fmt.Sprintf("tf_test_private_dataset_%s", acctest.RandString(t, 10)), } expected := map[string]interface{}{ @@ -124,9 +124,9 @@ func TestAccBigQueryDatasetAccess_authorizedRoutine(t *testing.T) { }, } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccBigQueryDatasetAccess_authorizedRoutine(context), @@ -146,7 +146,7 @@ func TestAccBigQueryDatasetAccess_multiple(t *testing.T) { acctest.SkipIfVcr(t) t.Parallel() - datasetID := fmt.Sprintf("tf_test_%s", RandString(t, 10)) + datasetID := fmt.Sprintf("tf_test_%s", acctest.RandString(t, 10)) expected1 := map[string]interface{}{ "role": "WRITER", @@ -158,9 +158,9 @@ func TestAccBigQueryDatasetAccess_multiple(t *testing.T) { "specialGroup": "projectWriters", } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccBigQueryDatasetAccess_multiple(datasetID), @@ -184,7 +184,7 @@ func TestAccBigQueryDatasetAccess_multiple(t *testing.T) { func TestAccBigQueryDatasetAccess_predefinedRole(t *testing.T) { t.Parallel() - datasetID := fmt.Sprintf("tf_test_%s", RandString(t, 10)) + datasetID := fmt.Sprintf("tf_test_%s", acctest.RandString(t, 10)) expected1 := map[string]interface{}{ "role": "WRITER", @@ -196,9 +196,9 @@ func TestAccBigQueryDatasetAccess_predefinedRole(t *testing.T) { "domain": "google.com", } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccBigQueryDatasetAccess_predefinedRole("roles/bigquery.dataEditor", datasetID), @@ -227,12 +227,12 @@ func TestAccBigQueryDatasetAccess_predefinedRole(t *testing.T) { func TestAccBigQueryDatasetAccess_iamMember(t *testing.T) { t.Parallel() - datasetID := fmt.Sprintf("tf_test_%s", RandString(t, 10)) - sinkName := fmt.Sprintf("tf_test_%s", RandString(t, 10)) + datasetID := fmt.Sprintf("tf_test_%s", acctest.RandString(t, 10)) + sinkName := fmt.Sprintf("tf_test_%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccBigQueryDatasetAccess_iamMember(datasetID, sinkName), @@ -244,11 +244,11 @@ func TestAccBigQueryDatasetAccess_iamMember(t *testing.T) { func TestAccBigQueryDatasetAccess_allUsers(t *testing.T) { t.Parallel() - datasetID := fmt.Sprintf("tf_test_%s", RandString(t, 10)) + datasetID := fmt.Sprintf("tf_test_%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccBigQueryDatasetAccess_allUsers(datasetID), @@ -263,11 +263,11 @@ func TestAccBigQueryDatasetAccess_allUsers(t *testing.T) { func TestAccBigQueryDatasetAccess_allAuthenticatedUsers(t *testing.T) { t.Parallel() - datasetID := fmt.Sprintf("tf_test_%s", RandString(t, 10)) + datasetID := fmt.Sprintf("tf_test_%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccBigQueryDatasetAccess_allAuthenticatedUsers(datasetID), @@ -291,7 +291,7 @@ func testAccCheckBigQueryDatasetAccess(t *testing.T, n string, expected map[stri return fmt.Errorf("Not found: %s", n) } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{BigQueryBasePath}}projects/{{project}}/datasets/{{dataset_id}}") if err != nil { return err diff --git a/mmv1/third_party/terraform/tests/resource_bigquery_dataset_iam_member_test.go b/mmv1/third_party/terraform/tests/resource_bigquery_dataset_iam_member_test.go index e7f95e4c3b41..c539c71cd19e 100644 --- a/mmv1/third_party/terraform/tests/resource_bigquery_dataset_iam_member_test.go +++ b/mmv1/third_party/terraform/tests/resource_bigquery_dataset_iam_member_test.go @@ -12,17 +12,17 @@ import ( func TestAccBigqueryDatasetIamMember_basic(t *testing.T) { t.Parallel() - datasetID := fmt.Sprintf("tf_test_%s", RandString(t, 10)) - saID := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + datasetID := fmt.Sprintf("tf_test_%s", acctest.RandString(t, 10)) + saID := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) expected := map[string]interface{}{ "role": "roles/viewer", "userByEmail": fmt.Sprintf("%s@%s.iam.gserviceaccount.com", saID, envvar.GetTestProjectFromEnv()), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccBigqueryDatasetIamMember_basic(datasetID, saID), diff --git a/mmv1/third_party/terraform/tests/resource_bigquery_dataset_iam_test.go b/mmv1/third_party/terraform/tests/resource_bigquery_dataset_iam_test.go index 4478b98c05b3..732949478958 100644 --- a/mmv1/third_party/terraform/tests/resource_bigquery_dataset_iam_test.go +++ b/mmv1/third_party/terraform/tests/resource_bigquery_dataset_iam_test.go @@ -12,16 +12,16 @@ import ( func TestAccBigqueryDatasetIamBinding(t *testing.T) { t.Parallel() - dataset := "tf_test_dataset_iam_" + RandString(t, 10) - account := "tf-test-bq-iam-" + RandString(t, 10) + dataset := "tf_test_dataset_iam_" + acctest.RandString(t, 10) + account := "tf-test-bq-iam-" + acctest.RandString(t, 10) role := "roles/bigquery.dataViewer" importId := fmt.Sprintf("projects/%s/datasets/%s %s", envvar.GetTestProjectFromEnv(), dataset, role) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { // Test IAM Binding creation @@ -54,8 +54,8 @@ func TestAccBigqueryDatasetIamBinding(t *testing.T) { func TestAccBigqueryDatasetIamMember(t *testing.T) { t.Parallel() - dataset := "tf_test_dataset_iam_" + RandString(t, 10) - account := "tf-test-bq-iam-" + RandString(t, 10) + dataset := "tf_test_dataset_iam_" + acctest.RandString(t, 10) + account := "tf-test-bq-iam-" + acctest.RandString(t, 10) role := "roles/editor" importId := fmt.Sprintf("projects/%s/datasets/%s %s serviceAccount:%s", @@ -64,9 +64,9 @@ func TestAccBigqueryDatasetIamMember(t *testing.T) { role, serviceAccountCanonicalEmail(account)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { // Test IAM Binding creation @@ -91,16 +91,16 @@ func TestAccBigqueryDatasetIamMember(t *testing.T) { func TestAccBigqueryDatasetIamPolicy(t *testing.T) { t.Parallel() - dataset := "tf_test_dataset_iam_" + RandString(t, 10) - account := "tf-test-bq-iam-" + RandString(t, 10) + dataset := "tf_test_dataset_iam_" + acctest.RandString(t, 10) + account := "tf-test-bq-iam-" + acctest.RandString(t, 10) role := "roles/bigquery.dataOwner" importId := fmt.Sprintf("projects/%s/datasets/%s", envvar.GetTestProjectFromEnv(), dataset) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { // Test IAM Binding creation diff --git a/mmv1/third_party/terraform/tests/resource_bigquery_job_test.go b/mmv1/third_party/terraform/tests/resource_bigquery_job_test.go index a111c0d66496..a4732e8c075d 100644 --- a/mmv1/third_party/terraform/tests/resource_bigquery_job_test.go +++ b/mmv1/third_party/terraform/tests/resource_bigquery_job_test.go @@ -13,16 +13,16 @@ func TestAccBigQueryJob_withLocation(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), "location": "asia-northeast1", } // Need to construct the import ID manually since the state ID will not contain the location importID := fmt.Sprintf("projects/%s/jobs/tf_test_job_query%s/location/%s", envvar.GetTestProjectFromEnv(), context["random_suffix"], context["location"]) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccBigQueryJob_withLocation(context), diff --git a/mmv1/third_party/terraform/tests/resource_bigquery_table_test.go b/mmv1/third_party/terraform/tests/resource_bigquery_table_test.go index caa0c2497a8e..798e8cc253c6 100644 --- a/mmv1/third_party/terraform/tests/resource_bigquery_table_test.go +++ b/mmv1/third_party/terraform/tests/resource_bigquery_table_test.go @@ -15,12 +15,12 @@ import ( func TestAccBigQueryTable_Basic(t *testing.T) { t.Parallel() - datasetID := fmt.Sprintf("tf_test_%s", RandString(t, 10)) - tableID := fmt.Sprintf("tf_test_%s", RandString(t, 10)) + datasetID := fmt.Sprintf("tf_test_%s", acctest.RandString(t, 10)) + tableID := fmt.Sprintf("tf_test_%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckBigQueryTableDestroyProducer(t), Steps: []resource.TestStep{ { @@ -48,14 +48,14 @@ func TestAccBigQueryTable_Basic(t *testing.T) { func TestAccBigQueryTable_Kms(t *testing.T) { t.Parallel() resourceName := "google_bigquery_table.test" - datasetID := fmt.Sprintf("tf_test_%s", RandString(t, 10)) - tableID := fmt.Sprintf("tf_test_%s", RandString(t, 10)) + datasetID := fmt.Sprintf("tf_test_%s", acctest.RandString(t, 10)) + tableID := fmt.Sprintf("tf_test_%s", acctest.RandString(t, 10)) kms := acctest.BootstrapKMSKey(t) cryptoKeyName := kms.CryptoKey.Name - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckBigQueryTableDestroyProducer(t), Steps: []resource.TestStep{ { @@ -74,12 +74,12 @@ func TestAccBigQueryTable_Kms(t *testing.T) { func TestAccBigQueryTable_HourlyTimePartitioning(t *testing.T) { t.Parallel() - datasetID := fmt.Sprintf("tf_test_%s", RandString(t, 10)) - tableID := fmt.Sprintf("tf_test_%s", RandString(t, 10)) + datasetID := fmt.Sprintf("tf_test_%s", acctest.RandString(t, 10)) + tableID := fmt.Sprintf("tf_test_%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckBigQueryTableDestroyProducer(t), Steps: []resource.TestStep{ { @@ -107,12 +107,12 @@ func TestAccBigQueryTable_HourlyTimePartitioning(t *testing.T) { func TestAccBigQueryTable_MonthlyTimePartitioning(t *testing.T) { t.Parallel() - datasetID := fmt.Sprintf("tf_test_%s", RandString(t, 10)) - tableID := fmt.Sprintf("tf_test_%s", RandString(t, 10)) + datasetID := fmt.Sprintf("tf_test_%s", acctest.RandString(t, 10)) + tableID := fmt.Sprintf("tf_test_%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckBigQueryTableDestroyProducer(t), Steps: []resource.TestStep{ { @@ -140,12 +140,12 @@ func TestAccBigQueryTable_MonthlyTimePartitioning(t *testing.T) { func TestAccBigQueryTable_YearlyTimePartitioning(t *testing.T) { t.Parallel() - datasetID := fmt.Sprintf("tf_test_%s", RandString(t, 10)) - tableID := fmt.Sprintf("tf_test_%s", RandString(t, 10)) + datasetID := fmt.Sprintf("tf_test_%s", acctest.RandString(t, 10)) + tableID := fmt.Sprintf("tf_test_%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckBigQueryTableDestroyProducer(t), Steps: []resource.TestStep{ { @@ -174,12 +174,12 @@ func TestAccBigQueryTable_HivePartitioning(t *testing.T) { t.Parallel() bucketName := testBucketName(t) resourceName := "google_bigquery_table.test" - datasetID := fmt.Sprintf("tf_test_%s", RandString(t, 10)) - tableID := fmt.Sprintf("tf_test_%s", RandString(t, 10)) + datasetID := fmt.Sprintf("tf_test_%s", acctest.RandString(t, 10)) + tableID := fmt.Sprintf("tf_test_%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckBigQueryTableDestroyProducer(t), Steps: []resource.TestStep{ { @@ -199,12 +199,12 @@ func TestAccBigQueryTable_HivePartitioningCustomSchema(t *testing.T) { t.Parallel() bucketName := testBucketName(t) resourceName := "google_bigquery_table.test" - datasetID := fmt.Sprintf("tf_test_%s", RandString(t, 10)) - tableID := fmt.Sprintf("tf_test_%s", RandString(t, 10)) + datasetID := fmt.Sprintf("tf_test_%s", acctest.RandString(t, 10)) + tableID := fmt.Sprintf("tf_test_%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckBigQueryTableDestroyProducer(t), Steps: []resource.TestStep{ { @@ -224,13 +224,13 @@ func TestAccBigQueryTable_AvroPartitioning(t *testing.T) { t.Parallel() bucketName := testBucketName(t) resourceName := "google_bigquery_table.test" - datasetID := fmt.Sprintf("tf_test_%s", RandString(t, 10)) - tableID := fmt.Sprintf("tf_test_%s", RandString(t, 10)) + datasetID := fmt.Sprintf("tf_test_%s", acctest.RandString(t, 10)) + tableID := fmt.Sprintf("tf_test_%s", acctest.RandString(t, 10)) avroFilePath := "./test-fixtures/bigquerytable/avro-generated.avro" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckBigQueryTableDestroyProducer(t), Steps: []resource.TestStep{ { @@ -249,12 +249,12 @@ func TestAccBigQueryTable_AvroPartitioning(t *testing.T) { func TestAccBigQueryTable_RangePartitioning(t *testing.T) { t.Parallel() resourceName := "google_bigquery_table.test" - datasetID := fmt.Sprintf("tf_test_%s", RandString(t, 10)) - tableID := fmt.Sprintf("tf_test_%s", RandString(t, 10)) + datasetID := fmt.Sprintf("tf_test_%s", acctest.RandString(t, 10)) + tableID := fmt.Sprintf("tf_test_%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckBigQueryTableDestroyProducer(t), Steps: []resource.TestStep{ { @@ -273,12 +273,12 @@ func TestAccBigQueryTable_RangePartitioning(t *testing.T) { func TestAccBigQueryTable_View(t *testing.T) { t.Parallel() - datasetID := fmt.Sprintf("tf_test_%s", RandString(t, 10)) - tableID := fmt.Sprintf("tf_test_%s", RandString(t, 10)) + datasetID := fmt.Sprintf("tf_test_%s", acctest.RandString(t, 10)) + tableID := fmt.Sprintf("tf_test_%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckBigQueryTableDestroyProducer(t), Steps: []resource.TestStep{ { @@ -297,12 +297,12 @@ func TestAccBigQueryTable_View(t *testing.T) { func TestAccBigQueryTable_updateView(t *testing.T) { t.Parallel() - datasetID := fmt.Sprintf("tf_test_%s", RandString(t, 10)) - tableID := fmt.Sprintf("tf_test_%s", RandString(t, 10)) + datasetID := fmt.Sprintf("tf_test_%s", acctest.RandString(t, 10)) + tableID := fmt.Sprintf("tf_test_%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckBigQueryTableDestroyProducer(t), Steps: []resource.TestStep{ { @@ -330,12 +330,12 @@ func TestAccBigQueryTable_updateView(t *testing.T) { func TestAccBigQueryTable_WithViewAndSchema(t *testing.T) { t.Parallel() - datasetID := fmt.Sprintf("tf_test_%s", RandString(t, 10)) - tableID := fmt.Sprintf("tf_test_%s", RandString(t, 10)) + datasetID := fmt.Sprintf("tf_test_%s", acctest.RandString(t, 10)) + tableID := fmt.Sprintf("tf_test_%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckBigQueryTableDestroyProducer(t), Steps: []resource.TestStep{ { @@ -363,15 +363,15 @@ func TestAccBigQueryTable_WithViewAndSchema(t *testing.T) { func TestAccBigQueryTable_MaterializedView_DailyTimePartioning_Basic(t *testing.T) { t.Parallel() - datasetID := fmt.Sprintf("tf_test_%s", RandString(t, 10)) - tableID := fmt.Sprintf("tf_test_%s", RandString(t, 10)) - materialized_viewID := fmt.Sprintf("tf_test_%s", RandString(t, 10)) + datasetID := fmt.Sprintf("tf_test_%s", acctest.RandString(t, 10)) + tableID := fmt.Sprintf("tf_test_%s", acctest.RandString(t, 10)) + materialized_viewID := fmt.Sprintf("tf_test_%s", acctest.RandString(t, 10)) query := fmt.Sprintf("SELECT count(some_string) as count, some_int, ts FROM `%s.%s` WHERE DATE(ts) = '2019-01-01' GROUP BY some_int, ts", datasetID, tableID) queryNew := strings.ReplaceAll(query, "2019", "2020") - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckBigQueryTableDestroyProducer(t), Steps: []resource.TestStep{ { @@ -411,18 +411,18 @@ func TestAccBigQueryTable_MaterializedView_DailyTimePartioning_Basic(t *testing. func TestAccBigQueryTable_MaterializedView_DailyTimePartioning_Update(t *testing.T) { t.Parallel() - datasetID := fmt.Sprintf("tf_test_%s", RandString(t, 10)) - tableID := fmt.Sprintf("tf_test_%s", RandString(t, 10)) - materialized_viewID := fmt.Sprintf("tf_test_%s", RandString(t, 10)) + datasetID := fmt.Sprintf("tf_test_%s", acctest.RandString(t, 10)) + tableID := fmt.Sprintf("tf_test_%s", acctest.RandString(t, 10)) + materialized_viewID := fmt.Sprintf("tf_test_%s", acctest.RandString(t, 10)) query := fmt.Sprintf("SELECT count(some_string) as count, some_int, ts FROM `%s.%s` WHERE DATE(ts) = '2019-01-01' GROUP BY some_int, ts", datasetID, tableID) enable_refresh := "false" refresh_interval_ms := "3600000" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckBigQueryTableDestroyProducer(t), Steps: []resource.TestStep{ { @@ -463,14 +463,14 @@ func TestAccBigQueryExternalDataTable_parquet(t *testing.T) { t.Parallel() bucketName := testBucketName(t) - objectName := fmt.Sprintf("tf_test_%s.gz.parquet", RandString(t, 10)) + objectName := fmt.Sprintf("tf_test_%s.gz.parquet", acctest.RandString(t, 10)) - datasetID := fmt.Sprintf("tf_test_%s", RandString(t, 10)) - tableID := fmt.Sprintf("tf_test_%s", RandString(t, 10)) + datasetID := fmt.Sprintf("tf_test_%s", acctest.RandString(t, 10)) + tableID := fmt.Sprintf("tf_test_%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckBigQueryTableDestroyProducer(t), Steps: []resource.TestStep{ { @@ -484,14 +484,14 @@ func TestAccBigQueryExternalDataTable_CSV(t *testing.T) { t.Parallel() bucketName := testBucketName(t) - objectName := fmt.Sprintf("tf_test_%s.csv", RandString(t, 10)) + objectName := fmt.Sprintf("tf_test_%s.csv", acctest.RandString(t, 10)) - datasetID := fmt.Sprintf("tf_test_%s", RandString(t, 10)) - tableID := fmt.Sprintf("tf_test_%s", RandString(t, 10)) + datasetID := fmt.Sprintf("tf_test_%s", acctest.RandString(t, 10)) + tableID := fmt.Sprintf("tf_test_%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckBigQueryTableDestroyProducer(t), Steps: []resource.TestStep{ { @@ -510,17 +510,17 @@ func TestAccBigQueryExternalDataTable_CSV_WithSchemaAndConnectionID_UpdateNoConn t.Parallel() bucketName := testBucketName(t) - objectName := fmt.Sprintf("tf_test_%s.csv", RandString(t, 10)) + objectName := fmt.Sprintf("tf_test_%s.csv", acctest.RandString(t, 10)) - datasetID := fmt.Sprintf("tf_test_%s", RandString(t, 10)) - tableID := fmt.Sprintf("tf_test_%s", RandString(t, 10)) - connectionID := fmt.Sprintf("tf_test_%s", RandString(t, 10)) + datasetID := fmt.Sprintf("tf_test_%s", acctest.RandString(t, 10)) + tableID := fmt.Sprintf("tf_test_%s", acctest.RandString(t, 10)) + connectionID := fmt.Sprintf("tf_test_%s", acctest.RandString(t, 10)) projectID := envvar.GetTestProjectFromEnv() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckBigQueryTableDestroyProducer(t), Steps: []resource.TestStep{ { @@ -549,17 +549,17 @@ func TestAccBigQueryExternalDataTable_CSV_WithSchema_UpdateToConnectionID(t *tes t.Parallel() bucketName := testBucketName(t) - objectName := fmt.Sprintf("tf_test_%s.csv", RandString(t, 10)) + objectName := fmt.Sprintf("tf_test_%s.csv", acctest.RandString(t, 10)) - datasetID := fmt.Sprintf("tf_test_%s", RandString(t, 10)) - tableID := fmt.Sprintf("tf_test_%s", RandString(t, 10)) - connectionID := fmt.Sprintf("tf_test_%s", RandString(t, 10)) + datasetID := fmt.Sprintf("tf_test_%s", acctest.RandString(t, 10)) + tableID := fmt.Sprintf("tf_test_%s", acctest.RandString(t, 10)) + connectionID := fmt.Sprintf("tf_test_%s", acctest.RandString(t, 10)) projectID := envvar.GetTestProjectFromEnv() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckBigQueryTableDestroyProducer(t), Steps: []resource.TestStep{ { @@ -597,14 +597,14 @@ func TestAccBigQueryExternalDataTable_CSV_WithSchema_UpdateAllowQuotedNewlines(t t.Parallel() bucketName := testBucketName(t) - objectName := fmt.Sprintf("tf_test_%s.csv", RandString(t, 10)) + objectName := fmt.Sprintf("tf_test_%s.csv", acctest.RandString(t, 10)) - datasetID := fmt.Sprintf("tf_test_%s", RandString(t, 10)) - tableID := fmt.Sprintf("tf_test_%s", RandString(t, 10)) + datasetID := fmt.Sprintf("tf_test_%s", acctest.RandString(t, 10)) + tableID := fmt.Sprintf("tf_test_%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckBigQueryTableDestroyProducer(t), Steps: []resource.TestStep{ { @@ -633,13 +633,13 @@ func TestAccBigQueryDataTable_bigtable(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 8), + "random_suffix": acctest.RandString(t, 8), "project": envvar.GetTestProjectFromEnv(), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckBigQueryTableDestroyProducer(t), Steps: []resource.TestStep{ { @@ -659,12 +659,12 @@ func TestAccBigQueryDataTable_sheet(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckBigQueryTableDestroyProducer(t), Steps: []resource.TestStep{ { @@ -683,12 +683,12 @@ func TestAccBigQueryDataTable_sheet(t *testing.T) { func TestAccBigQueryDataTable_jsonEquivalency(t *testing.T) { t.Parallel() - datasetID := fmt.Sprintf("tf_test_%s", RandString(t, 10)) - tableID := fmt.Sprintf("tf_test_%s", RandString(t, 10)) + datasetID := fmt.Sprintf("tf_test_%s", acctest.RandString(t, 10)) + tableID := fmt.Sprintf("tf_test_%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckBigQueryTableDestroyProducer(t), Steps: []resource.TestStep{ { @@ -716,12 +716,12 @@ func TestAccBigQueryDataTable_jsonEquivalency(t *testing.T) { func TestAccBigQueryDataTable_canReorderParameters(t *testing.T) { t.Parallel() - datasetID := fmt.Sprintf("tf_test_%s", RandString(t, 10)) - tableID := fmt.Sprintf("tf_test_%s", RandString(t, 10)) + datasetID := fmt.Sprintf("tf_test_%s", acctest.RandString(t, 10)) + tableID := fmt.Sprintf("tf_test_%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckBigQueryTableDestroyProducer(t), Steps: []resource.TestStep{ { @@ -742,12 +742,12 @@ func TestAccBigQueryDataTable_canReorderParameters(t *testing.T) { func TestAccBigQueryDataTable_expandArray(t *testing.T) { t.Parallel() - datasetID := fmt.Sprintf("tf_test_%s", RandString(t, 10)) - tableID := fmt.Sprintf("tf_test_%s", RandString(t, 10)) + datasetID := fmt.Sprintf("tf_test_%s", acctest.RandString(t, 10)) + tableID := fmt.Sprintf("tf_test_%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckBigQueryTableDestroyProducer(t), Steps: []resource.TestStep{ { @@ -775,12 +775,12 @@ func TestAccBigQueryDataTable_expandArray(t *testing.T) { func TestAccBigQueryTable_allowDestroy(t *testing.T) { t.Parallel() - datasetID := fmt.Sprintf("tf_test_%s", RandString(t, 10)) - tableID := fmt.Sprintf("tf_test_%s", RandString(t, 10)) + datasetID := fmt.Sprintf("tf_test_%s", acctest.RandString(t, 10)) + tableID := fmt.Sprintf("tf_test_%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckBigQueryTableDestroyProducer(t), Steps: []resource.TestStep{ { @@ -807,12 +807,12 @@ func TestAccBigQueryTable_allowDestroy(t *testing.T) { func TestAccBigQueryTable_emptySchema(t *testing.T) { t.Parallel() - datasetID := fmt.Sprintf("tf_test_%s", RandString(t, 10)) - tableID := fmt.Sprintf("tf_test_%s", RandString(t, 10)) + datasetID := fmt.Sprintf("tf_test_%s", acctest.RandString(t, 10)) + tableID := fmt.Sprintf("tf_test_%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckBigQueryTableDestroyProducer(t), Steps: []resource.TestStep{ { @@ -844,7 +844,7 @@ func testAccCheckBigQueryExtData(t *testing.T, expectedQuoteChar string) resourc continue } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) dataset := rs.Primary.Attributes["dataset_id"] table := rs.Primary.Attributes["table_id"] res, err := config.NewBigQueryClient(config.UserAgent).Tables.Get(config.Project, dataset, table).Do() @@ -872,7 +872,7 @@ func testAccCheckBigQueryTableDestroyProducer(t *testing.T) func(s *terraform.St continue } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) _, err := config.NewBigQueryClient(config.UserAgent).Tables.Get(config.Project, rs.Primary.Attributes["dataset_id"], rs.Primary.Attributes["table_id"]).Do() if err == nil { return fmt.Errorf("Table still present") diff --git a/mmv1/third_party/terraform/tests/resource_bigtable_app_profile_test.go b/mmv1/third_party/terraform/tests/resource_bigtable_app_profile_test.go index 0dc95e6d780d..88a30224e760 100644 --- a/mmv1/third_party/terraform/tests/resource_bigtable_app_profile_test.go +++ b/mmv1/third_party/terraform/tests/resource_bigtable_app_profile_test.go @@ -13,11 +13,11 @@ func TestAccBigtableAppProfile_update(t *testing.T) { acctest.SkipIfVcr(t) t.Parallel() - instanceName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + instanceName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckBigtableAppProfileDestroyProducer(t), Steps: []resource.TestStep{ { @@ -47,11 +47,11 @@ func TestAccBigtableAppProfile_ignoreWarnings(t *testing.T) { acctest.SkipIfVcr(t) t.Parallel() - instanceName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + instanceName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckBigtableAppProfileDestroyProducer(t), Steps: []resource.TestStep{ { @@ -72,11 +72,11 @@ func TestAccBigtableAppProfile_multiClusterIds(t *testing.T) { acctest.SkipIfVcr(t) t.Parallel() - instanceName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + instanceName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckBigtableAppProfileDestroyProducer(t), Steps: []resource.TestStep{ { @@ -106,11 +106,11 @@ func TestAccBigtableAppProfile_updateSingleToMulti(t *testing.T) { acctest.SkipIfVcr(t) t.Parallel() - instanceName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + instanceName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckBigtableAppProfileDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_bigtable_gc_policy_test.go b/mmv1/third_party/terraform/tests/resource_bigtable_gc_policy_test.go index b086b4d67fc3..c3cf1b363f4a 100644 --- a/mmv1/third_party/terraform/tests/resource_bigtable_gc_policy_test.go +++ b/mmv1/third_party/terraform/tests/resource_bigtable_gc_policy_test.go @@ -19,13 +19,13 @@ func TestAccBigtableGCPolicy_basic(t *testing.T) { acctest.SkipIfVcr(t) t.Parallel() - instanceName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - tableName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - familyName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + instanceName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + tableName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + familyName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckBigtableGCPolicyDestroyProducer(t), Steps: []resource.TestStep{ { @@ -44,13 +44,13 @@ func TestAccBigtableGCPolicy_abandoned(t *testing.T) { acctest.SkipIfVcr(t) t.Parallel() - instanceName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - tableName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - familyName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + instanceName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + tableName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + familyName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckBigtableGCPolicyDestroyProducer(t), Steps: []resource.TestStep{ { @@ -77,13 +77,13 @@ func TestAccBigtableGCPolicy_swapOffDeprecated(t *testing.T) { acctest.SkipIfVcr(t) t.Parallel() - instanceName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - tableName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - familyName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + instanceName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + tableName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + familyName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckBigtableGCPolicyDestroyProducer(t), Steps: []resource.TestStep{ { @@ -115,13 +115,13 @@ func TestAccBigtableGCPolicy_union(t *testing.T) { acctest.SkipIfVcr(t) t.Parallel() - instanceName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - tableName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - familyName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + instanceName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + tableName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + familyName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckBigtableGCPolicyDestroyProducer(t), Steps: []resource.TestStep{ { @@ -141,13 +141,13 @@ func TestAccBigtableGCPolicy_multiplePolicies(t *testing.T) { acctest.SkipIfVcr(t) t.Parallel() - instanceName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - tableName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - familyName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + instanceName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + tableName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + familyName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckBigtableGCPolicyDestroyProducer(t), Steps: []resource.TestStep{ { @@ -169,16 +169,16 @@ func TestAccBigtableGCPolicy_gcRulesPolicy(t *testing.T) { acctest.SkipIfVcr(t) t.Parallel() - instanceName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - tableName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - familyName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + instanceName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + tableName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + familyName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) gcRulesOriginal := "{\"mode\":\"intersection\",\"rules\":[{\"max_age\":\"10h\"},{\"max_version\":2}]}" gcRulesUpdate := "{\"mode\":\"intersection\",\"rules\":[{\"max_age\":\"16h\"},{\"max_version\":1}]}" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckBigtableGCPolicyDestroyProducer(t), Steps: []resource.TestStep{ { @@ -299,7 +299,7 @@ func testAccCheckBigtableGCPolicyDestroyProducer(t *testing.T) func(s *terraform continue } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) c, err := config.BigTableClientFactory(config.UserAgent).NewAdminClient(config.Project, rs.Primary.Attributes["instance_name"]) if err != nil { // The instance is already gone @@ -338,7 +338,7 @@ func testAccBigtableGCPolicyExists(t *testing.T, n string, compareGcRules bool) if rs.Primary.ID == "" { return fmt.Errorf("No ID is set") } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) c, err := config.BigTableClientFactory(config.UserAgent).NewAdminClient(config.Project, rs.Primary.Attributes["instance_name"]) if err != nil { return fmt.Errorf("Error starting admin client. %s", err) @@ -384,7 +384,7 @@ func testAccBigtableRemoteGCPolicyExists(t *testing.T, table_name_space string) return fmt.Errorf("Table not found: %s", table_name_space) } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) c, err := config.BigTableClientFactory(config.UserAgent).NewAdminClient(config.Project, rs.Primary.Attributes["instance_name"]) if err != nil { return fmt.Errorf("Error starting admin client. %s", err) @@ -427,7 +427,7 @@ func testAccBigtableCanWriteData(t *testing.T, n string, numberOfRows int) resou if rs.Primary.ID == "" { return fmt.Errorf("No ID is set") } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) c, err := config.BigTableClientFactory(config.UserAgent).NewClient(config.Project, rs.Primary.Attributes["instance_name"]) if err != nil { return fmt.Errorf("Error starting client. %s", err) @@ -467,7 +467,7 @@ func testAccBigtableCanReadData(t *testing.T, n string, numberOfRows int) resour if rs.Primary.ID == "" { return fmt.Errorf("No ID is set") } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) c, err := config.BigTableClientFactory(config.UserAgent).NewClient(config.Project, rs.Primary.Attributes["instance_name"]) if err != nil { return fmt.Errorf("Error starting client. %s", err) diff --git a/mmv1/third_party/terraform/tests/resource_bigtable_instance_iam_test.go b/mmv1/third_party/terraform/tests/resource_bigtable_instance_iam_test.go index 0a868a3eea1a..1ed1c524c66f 100644 --- a/mmv1/third_party/terraform/tests/resource_bigtable_instance_iam_test.go +++ b/mmv1/third_party/terraform/tests/resource_bigtable_instance_iam_test.go @@ -14,17 +14,17 @@ func TestAccBigtableInstanceIamBinding(t *testing.T) { acctest.SkipIfVcr(t) t.Parallel() - instance := "tf-bigtable-iam-" + RandString(t, 10) - cluster := "c-" + RandString(t, 10) - account := "tf-bigtable-iam-" + RandString(t, 10) + instance := "tf-bigtable-iam-" + acctest.RandString(t, 10) + cluster := "c-" + acctest.RandString(t, 10) + account := "tf-bigtable-iam-" + acctest.RandString(t, 10) role := "roles/bigtable.user" importId := fmt.Sprintf("projects/%s/instances/%s %s", envvar.GetTestProjectFromEnv(), instance, role) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { // Test IAM Binding creation @@ -59,9 +59,9 @@ func TestAccBigtableInstanceIamMember(t *testing.T) { acctest.SkipIfVcr(t) t.Parallel() - instance := "tf-bigtable-iam-" + RandString(t, 10) - cluster := "c-" + RandString(t, 10) - account := "tf-bigtable-iam-" + RandString(t, 10) + instance := "tf-bigtable-iam-" + acctest.RandString(t, 10) + cluster := "c-" + acctest.RandString(t, 10) + account := "tf-bigtable-iam-" + acctest.RandString(t, 10) role := "roles/bigtable.user" importId := fmt.Sprintf("projects/%s/instances/%s %s serviceAccount:%s", @@ -70,9 +70,9 @@ func TestAccBigtableInstanceIamMember(t *testing.T) { role, serviceAccountCanonicalEmail(account)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { // Test IAM Binding creation @@ -99,17 +99,17 @@ func TestAccBigtableInstanceIamPolicy(t *testing.T) { acctest.SkipIfVcr(t) t.Parallel() - instance := "tf-bigtable-iam-" + RandString(t, 10) - cluster := "c-" + RandString(t, 10) - account := "tf-bigtable-iam-" + RandString(t, 10) + instance := "tf-bigtable-iam-" + acctest.RandString(t, 10) + cluster := "c-" + acctest.RandString(t, 10) + account := "tf-bigtable-iam-" + acctest.RandString(t, 10) role := "roles/bigtable.user" importId := fmt.Sprintf("projects/%s/instances/%s", envvar.GetTestProjectFromEnv(), instance) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { // Test IAM Binding creation diff --git a/mmv1/third_party/terraform/tests/resource_bigtable_instance_test.go b/mmv1/third_party/terraform/tests/resource_bigtable_instance_test.go index e12b870e3a8a..39bcb1391d60 100644 --- a/mmv1/third_party/terraform/tests/resource_bigtable_instance_test.go +++ b/mmv1/third_party/terraform/tests/resource_bigtable_instance_test.go @@ -18,11 +18,11 @@ func TestAccBigtableInstance_basic(t *testing.T) { acctest.SkipIfVcr(t) t.Parallel() - instanceName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + instanceName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckBigtableInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -56,11 +56,11 @@ func TestAccBigtableInstance_cluster(t *testing.T) { acctest.SkipIfVcr(t) t.Parallel() - instanceName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + instanceName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckBigtableInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -119,11 +119,11 @@ func TestAccBigtableInstance_development(t *testing.T) { acctest.SkipIfVcr(t) t.Parallel() - instanceName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + instanceName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckBigtableInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -144,11 +144,11 @@ func TestAccBigtableInstance_allowDestroy(t *testing.T) { acctest.SkipIfVcr(t) t.Parallel() - instanceName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + instanceName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckBigtableInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -180,11 +180,11 @@ func TestAccBigtableInstance_kms(t *testing.T) { kms1 := acctest.BootstrapKMSKeyInLocation(t, "us-central1") kms2 := acctest.BootstrapKMSKeyInLocation(t, "us-east1") pid := envvar.GetTestProjectFromEnv() - instanceName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + instanceName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckBigtableInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -211,11 +211,11 @@ func TestAccBigtableInstance_createWithAutoscalingAndUpdate(t *testing.T) { acctest.SkipIfVcr(t) t.Parallel() - instanceName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + instanceName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckBigtableInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -254,11 +254,11 @@ func TestAccBigtableInstance_createWithAutoscalingAndUpdateWithStorageTarget(t * acctest.SkipIfVcr(t) t.Parallel() - instanceName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + instanceName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckBigtableInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -297,11 +297,11 @@ func TestAccBigtableInstance_enableAndDisableAutoscaling(t *testing.T) { acctest.SkipIfVcr(t) t.Parallel() - instanceName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + instanceName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckBigtableInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -344,11 +344,11 @@ func TestAccBigtableInstance_enableAndDisableAutoscalingWithoutNumNodes(t *testi acctest.SkipIfVcr(t) t.Parallel() - instanceName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + instanceName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckBigtableInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -387,7 +387,7 @@ func testAccCheckBigtableInstanceDestroyProducer(t *testing.T) func(s *terraform continue } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) c, err := config.BigTableClientFactory(config.UserAgent).NewInstanceAdminClient(config.Project) if err != nil { return fmt.Errorf("Error starting instance admin client. %s", err) @@ -410,11 +410,11 @@ func TestAccBigtableInstance_MultipleClustersSameID(t *testing.T) { acctest.SkipIfVcr(t) t.Parallel() - instanceName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + instanceName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckBigtableInstanceDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_bigtable_table_iam_test.go b/mmv1/third_party/terraform/tests/resource_bigtable_table_iam_test.go index 94c583e85afb..ebd52a4c9105 100644 --- a/mmv1/third_party/terraform/tests/resource_bigtable_table_iam_test.go +++ b/mmv1/third_party/terraform/tests/resource_bigtable_table_iam_test.go @@ -14,17 +14,17 @@ func TestAccBigtableTableIamBinding(t *testing.T) { acctest.SkipIfVcr(t) t.Parallel() - instance := "tf-bigtable-iam-" + RandString(t, 10) - cluster := "c-" + RandString(t, 10) - account := "tf-bigtable-iam-" + RandString(t, 10) + instance := "tf-bigtable-iam-" + acctest.RandString(t, 10) + cluster := "c-" + acctest.RandString(t, 10) + account := "tf-bigtable-iam-" + acctest.RandString(t, 10) role := "roles/bigtable.user" importId := fmt.Sprintf("projects/%s/instances/%s/tables/%s %s", envvar.GetTestProjectFromEnv(), instance, cluster, role) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { // Test IAM Binding creation @@ -59,9 +59,9 @@ func TestAccBigtableTableIamMember(t *testing.T) { acctest.SkipIfVcr(t) t.Parallel() - instance := "tf-bigtable-iam-" + RandString(t, 10) - cluster := "c-" + RandString(t, 10) - account := "tf-bigtable-iam-" + RandString(t, 10) + instance := "tf-bigtable-iam-" + acctest.RandString(t, 10) + cluster := "c-" + acctest.RandString(t, 10) + account := "tf-bigtable-iam-" + acctest.RandString(t, 10) role := "roles/bigtable.user" importId := fmt.Sprintf("projects/%s/instances/%s/tables/%s %s serviceAccount:%s", @@ -71,9 +71,9 @@ func TestAccBigtableTableIamMember(t *testing.T) { role, serviceAccountCanonicalEmail(account)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { // Test IAM Binding creation @@ -100,17 +100,17 @@ func TestAccBigtableTableIamPolicy(t *testing.T) { acctest.SkipIfVcr(t) t.Parallel() - instance := "tf-bigtable-iam-" + RandString(t, 10) - cluster := "c-" + RandString(t, 10) - account := "tf-bigtable-iam-" + RandString(t, 10) + instance := "tf-bigtable-iam-" + acctest.RandString(t, 10) + cluster := "c-" + acctest.RandString(t, 10) + account := "tf-bigtable-iam-" + acctest.RandString(t, 10) role := "roles/bigtable.user" importId := fmt.Sprintf("projects/%s/instances/%s/tables/%s", envvar.GetTestProjectFromEnv(), instance, cluster) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { // Test IAM Binding creation diff --git a/mmv1/third_party/terraform/tests/resource_bigtable_table_test.go b/mmv1/third_party/terraform/tests/resource_bigtable_table_test.go index 11e7cefd486f..869479efd9e2 100644 --- a/mmv1/third_party/terraform/tests/resource_bigtable_table_test.go +++ b/mmv1/third_party/terraform/tests/resource_bigtable_table_test.go @@ -18,12 +18,12 @@ func TestAccBigtableTable_basic(t *testing.T) { acctest.SkipIfVcr(t) t.Parallel() - instanceName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - tableName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + instanceName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + tableName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckBigtableTableDestroyProducer(t), Steps: []resource.TestStep{ { @@ -43,12 +43,12 @@ func TestAccBigtableTable_splitKeys(t *testing.T) { acctest.SkipIfVcr(t) t.Parallel() - instanceName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - tableName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + instanceName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + tableName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckBigtableTableDestroyProducer(t), Steps: []resource.TestStep{ { @@ -69,13 +69,13 @@ func TestAccBigtableTable_family(t *testing.T) { acctest.SkipIfVcr(t) t.Parallel() - instanceName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - tableName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - family := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + instanceName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + tableName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + family := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckBigtableTableDestroyProducer(t), Steps: []resource.TestStep{ { @@ -95,13 +95,13 @@ func TestAccBigtableTable_deletion_protection_protected(t *testing.T) { acctest.SkipIfVcr(t) t.Parallel() - instanceName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - tableName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - family := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + instanceName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + tableName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + family := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckBigtableTableDestroyProducer(t), Steps: []resource.TestStep{ // creating a table with a column family and deletion protection equals to protected @@ -155,13 +155,13 @@ func TestAccBigtableTable_deletion_protection_unprotected(t *testing.T) { acctest.SkipIfVcr(t) t.Parallel() - instanceName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - tableName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - family := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + instanceName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + tableName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + family := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckBigtableTableDestroyProducer(t), Steps: []resource.TestStep{ // creating a table with a column family and deletion protection equals to unprotected @@ -214,13 +214,13 @@ func TestAccBigtableTable_familyMany(t *testing.T) { acctest.SkipIfVcr(t) t.Parallel() - instanceName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - tableName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - family := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + instanceName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + tableName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + family := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckBigtableTableDestroyProducer(t), Steps: []resource.TestStep{ { @@ -240,13 +240,13 @@ func TestAccBigtableTable_familyUpdate(t *testing.T) { acctest.SkipIfVcr(t) t.Parallel() - instanceName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - tableName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - family := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + instanceName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + tableName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + family := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckBigtableTableDestroyProducer(t), Steps: []resource.TestStep{ { @@ -277,7 +277,7 @@ func testAccCheckBigtableTableDestroyProducer(t *testing.T) func(s *terraform.St continue } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) c, err := config.BigTableClientFactory(config.UserAgent).NewAdminClient(config.Project, rs.Primary.Attributes["instance_name"]) if err != nil { // The instance is already gone @@ -304,7 +304,7 @@ func testAccBigtableColumnFamilyExists(t *testing.T, table_name_space, family st return fmt.Errorf("Table not found: %s", table_name_space) } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) c, err := config.BigTableClientFactory(config.UserAgent).NewAdminClient(config.Project, rs.Primary.Attributes["instance_name"]) if err != nil { return fmt.Errorf("Error starting admin client. %s", err) diff --git a/mmv1/third_party/terraform/tests/resource_billing_budget_test.go b/mmv1/third_party/terraform/tests/resource_billing_budget_test.go index 60b1c0e2dd92..448d9d92127d 100644 --- a/mmv1/third_party/terraform/tests/resource_billing_budget_test.go +++ b/mmv1/third_party/terraform/tests/resource_billing_budget_test.go @@ -16,12 +16,12 @@ func TestAccBillingBudget_billingBudgetCurrencycode(t *testing.T) { context := map[string]interface{}{ "billing_acct": envvar.GetTestMasterBillingAccountFromEnv(t), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckBillingBudgetDestroyProducer(t), Steps: []resource.TestStep{ { @@ -74,12 +74,12 @@ func TestAccBillingBudget_billingBudgetUpdate(t *testing.T) { context := map[string]interface{}{ "billing_acct": envvar.GetTestMasterBillingAccountFromEnv(t), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckBillingBudgetDestroyProducer(t), Steps: []resource.TestStep{ { @@ -131,12 +131,12 @@ func TestAccBillingBudget_billingFilterSubaccounts(t *testing.T) { context := map[string]interface{}{ "master_billing_acct": envvar.GetTestMasterBillingAccountFromEnv(t), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckBillingBudgetDestroyProducer(t), Steps: []resource.TestStep{ { @@ -548,13 +548,13 @@ func TestAccBillingBudget_budgetFilterProjectsOrdering(t *testing.T) { "org": envvar.GetTestOrgFromEnv(t), "billing_acct": envvar.GetTestMasterBillingAccountFromEnv(t), "project_billing_acct": envvar.GetTestBillingAccountFromEnv(t), - "random_suffix_1": RandString(t, 10), - "random_suffix_2": RandString(t, 10), + "random_suffix_1": acctest.RandString(t, 10), + "random_suffix_2": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckBillingBudgetDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_binary_authorization_attestor_test.go.erb b/mmv1/third_party/terraform/tests/resource_binary_authorization_attestor_test.go.erb index 1aab40db6977..67961125745e 100644 --- a/mmv1/third_party/terraform/tests/resource_binary_authorization_attestor_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_binary_authorization_attestor_test.go.erb @@ -56,10 +56,10 @@ func TestSignatureAlgorithmDiffSuppress(t *testing.T) { func TestAccBinaryAuthorizationAttestor_basic(t *testing.T) { t.Parallel() - name := RandString(t, 10) - VcrTest(t, resource.TestCase{ + name := acctest.RandString(t, 10) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckBinaryAuthorizationAttestorDestroyProducer(t), Steps: []resource.TestStep{ { @@ -77,10 +77,10 @@ func TestAccBinaryAuthorizationAttestor_basic(t *testing.T) { func TestAccBinaryAuthorizationAttestor_full(t *testing.T) { t.Parallel() - name := RandString(t, 10) - VcrTest(t, resource.TestCase{ + name := acctest.RandString(t, 10) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckBinaryAuthorizationAttestorDestroyProducer(t), Steps: []resource.TestStep{ { @@ -99,11 +99,11 @@ func TestAccBinaryAuthorizationAttestor_kms(t *testing.T) { t.Parallel() kms := acctest.BootstrapKMSKeyWithPurpose(t, "ASYMMETRIC_SIGN") - attestorName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + attestorName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckBinaryAuthorizationAttestorDestroyProducer(t), Steps: []resource.TestStep{ { @@ -121,10 +121,10 @@ func TestAccBinaryAuthorizationAttestor_kms(t *testing.T) { func TestAccBinaryAuthorizationAttestor_update(t *testing.T) { t.Parallel() - name := RandString(t, 10) - VcrTest(t, resource.TestCase{ + name := acctest.RandString(t, 10) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckBinaryAuthorizationAttestorDestroyProducer(t), Steps: []resource.TestStep{ resource.TestStep{ diff --git a/mmv1/third_party/terraform/tests/resource_binary_authorization_policy_test.go.erb b/mmv1/third_party/terraform/tests/resource_binary_authorization_policy_test.go.erb index 2955cb174021..aa33b384f58e 100644 --- a/mmv1/third_party/terraform/tests/resource_binary_authorization_policy_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_binary_authorization_policy_test.go.erb @@ -19,11 +19,11 @@ func TestAccBinaryAuthorizationPolicy_basic(t *testing.T) { t.Parallel() org := envvar.GetTestOrgFromEnv(t) - pid := "tf-test-" + RandString(t, 10) + pid := "tf-test-" + acctest.RandString(t, 10) billingId := envvar.GetTestBillingAccountFromEnv(t) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccBinaryAuthorizationPolicyBasic(pid, org, billingId), @@ -47,14 +47,14 @@ func TestAccBinaryAuthorizationPolicy_full(t *testing.T) { t.Parallel() org := envvar.GetTestOrgFromEnv(t) - pid := "tf-test-" + RandString(t, 10) + pid := "tf-test-" + acctest.RandString(t, 10) billingId := envvar.GetTestBillingAccountFromEnv(t) - note := RandString(t, 10) - attestor := RandString(t, 10) + note := acctest.RandString(t, 10) + attestor := acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccBinaryAuthorizationPolicyFull(pid, org, billingId, note, attestor, "ENABLE"), @@ -79,14 +79,14 @@ func TestAccBinaryAuthorizationPolicy_separateProject(t *testing.T) { t.Parallel() org := envvar.GetTestOrgFromEnv(t) - pid := "tf-test-" + RandString(t, 10) + pid := "tf-test-" + acctest.RandString(t, 10) billingId := envvar.GetTestBillingAccountFromEnv(t) - note := RandString(t, 10) - attestor := RandString(t, 10) + note := acctest.RandString(t, 10) + attestor := acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccBinaryAuthorizationPolicy_separateProject(pid, org, billingId, note, attestor), @@ -110,14 +110,14 @@ func TestAccBinaryAuthorizationPolicy_update(t *testing.T) { t.Parallel() org := envvar.GetTestOrgFromEnv(t) - pid := "tf-test-" + RandString(t, 10) + pid := "tf-test-" + acctest.RandString(t, 10) billingId := envvar.GetTestBillingAccountFromEnv(t) - note := RandString(t, 10) - attestor := RandString(t, 10) + note := acctest.RandString(t, 10) + attestor := acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccBinaryAuthorizationPolicyBasic(pid, org, billingId), @@ -163,7 +163,7 @@ func TestAccBinaryAuthorizationPolicy_update(t *testing.T) { func testAccCheckBinaryAuthorizationPolicyDefault(t *testing.T, pid string) resource.TestCheckFunc { return func(s *terraform.State) error { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) url := fmt.Sprintf("https://binaryauthorization.googleapis.com/v1/projects/%s/policy", pid) pol, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ Config: config, diff --git a/mmv1/third_party/terraform/tests/resource_certificate_manager_dns_authorization_test.go b/mmv1/third_party/terraform/tests/resource_certificate_manager_dns_authorization_test.go index 1274066d1043..f6b0465598da 100644 --- a/mmv1/third_party/terraform/tests/resource_certificate_manager_dns_authorization_test.go +++ b/mmv1/third_party/terraform/tests/resource_certificate_manager_dns_authorization_test.go @@ -11,12 +11,12 @@ func TestAccCertificateManagerDnsAuthorization_update(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckCertificateManagerDnsAuthorizationDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_certificatemanager_certificate_upgrade_test.go b/mmv1/third_party/terraform/tests/resource_certificatemanager_certificate_upgrade_test.go index 4010f3e0eb0a..fb647e8dd90e 100644 --- a/mmv1/third_party/terraform/tests/resource_certificatemanager_certificate_upgrade_test.go +++ b/mmv1/third_party/terraform/tests/resource_certificatemanager_certificate_upgrade_test.go @@ -12,9 +12,9 @@ import ( // Tests schema version migration by creating a certificate with an old version of the provider (4.59.0) // and then updating it with the current version the provider. func TestAccCertificateManagerCertificate_migration(t *testing.T) { - SkipIfVcr(t) + acctest.SkipIfVcr(t) t.Parallel() - name := fmt.Sprintf("tf-test-%d", RandInt(t)) + name := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) oldVersion := map[string]resource.ExternalProvider{ "google": { @@ -26,8 +26,8 @@ func TestAccCertificateManagerCertificate_migration(t *testing.T) { "mynewprovider": func() (*schema.Provider, error) { return acctest.TestAccProviders["google"], nil }, } - VcrTest(t, resource.TestCase{ - PreCheck: func() { AccTestPreCheck(t) }, + acctest.VcrTest(t, resource.TestCase{ + PreCheck: func() { acctest.AccTestPreCheck(t) }, CheckDestroy: testAccCheckCertificateManagerCertificateDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_cloud_identity_group_membership_test.go.erb b/mmv1/third_party/terraform/tests/resource_cloud_identity_group_membership_test.go.erb index bb7b94fe6f47..043c092cf726 100644 --- a/mmv1/third_party/terraform/tests/resource_cloud_identity_group_membership_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_cloud_identity_group_membership_test.go.erb @@ -20,12 +20,12 @@ func testAccCloudIdentityGroupMembership_updateTest(t *testing.T) { "org_domain": envvar.GetTestOrgDomainFromEnv(t), "cust_id": envvar.GetTestCustIdFromEnv(t), "identity_user": envvar.GetTestIdentityUserFromEnv(t), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckCloudIdentityGroupMembershipDestroyProducer(t), Steps: []resource.TestStep{ { @@ -126,12 +126,12 @@ func testAccCloudIdentityGroupMembership_importTest(t *testing.T) { "org_domain": envvar.GetTestOrgDomainFromEnv(t), "cust_id": envvar.GetTestCustIdFromEnv(t), "identity_user": envvar.GetTestIdentityUserFromEnv(t), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckCloudIdentityGroupMembershipDestroyProducer(t), Steps: []resource.TestStep{ { @@ -188,10 +188,10 @@ func testAccCloudIdentityGroupMembership_membershipDoesNotExistTest(t *testing.T context := map[string]interface{}{ "org_domain": envvar.GetTestOrgDomainFromEnv(t), "cust_id": envvar.GetTestCustIdFromEnv(t), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - saId := "tf-test-sa-" + RandString(t, 10) + saId := "tf-test-sa-" + acctest.RandString(t, 10) project := envvar.GetTestProjectFromEnv() config := acctest.BootstrapConfig(t) @@ -207,9 +207,9 @@ func testAccCloudIdentityGroupMembership_membershipDoesNotExistTest(t *testing.T context["member_id"] = sa.Email - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckCloudIdentityGroupMembershipDestroyProducer(t), Steps: []resource.TestStep{ { @@ -217,7 +217,7 @@ func testAccCloudIdentityGroupMembership_membershipDoesNotExistTest(t *testing.T }, { PreConfig: func() { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) _, err := config.NewIamClient(config.UserAgent).Projects.ServiceAccounts.Delete(sa.Name).Do() if err != nil { @@ -268,12 +268,12 @@ func testAccCloudIdentityGroupMembership_cloudIdentityGroupMembershipWithMemberK context := map[string]interface{}{ "org_domain": envvar.GetTestOrgDomainFromEnv(t), "cust_id": envvar.GetTestCustIdFromEnv(t), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckCloudIdentityGroupMembershipDestroyProducer(t), Steps: []resource.TestStep{ { @@ -337,12 +337,12 @@ func testAccCloudIdentityGroupMembership_cloudIdentityGroupMembershipUserWithMem "org_domain": envvar.GetTestOrgDomainFromEnv(t), "cust_id": envvar.GetTestCustIdFromEnv(t), "identity_user": envvar.GetTestIdentityUserFromEnv(t), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckCloudIdentityGroupMembershipDestroyProducer(t), Steps: []resource.TestStep{ { @@ -396,12 +396,12 @@ func testAccCloudIdentityGroupMembership_cloudIdentityGroupMembershipExampleTest context := map[string]interface{}{ "org_domain": envvar.GetTestOrgDomainFromEnv(t), "cust_id": envvar.GetTestCustIdFromEnv(t), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckCloudIdentityGroupMembershipDestroyProducer(t), Steps: []resource.TestStep{ { @@ -466,12 +466,12 @@ func testAccCloudIdentityGroupMembership_cloudIdentityGroupMembershipUserExample "org_domain": envvar.GetTestOrgDomainFromEnv(t), "cust_id": envvar.GetTestCustIdFromEnv(t), "identity_user": envvar.GetTestIdentityUserFromEnv(t), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckCloudIdentityGroupMembershipDestroyProducer(t), Steps: []resource.TestStep{ { @@ -531,7 +531,7 @@ func testAccCheckCloudIdentityGroupMembershipDestroyProducer(t *testing.T) func( continue } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{CloudIdentityBasePath}}{{name}}") if err != nil { diff --git a/mmv1/third_party/terraform/tests/resource_cloud_identity_group_test.go.erb b/mmv1/third_party/terraform/tests/resource_cloud_identity_group_test.go.erb index c77cebbf8912..312c56fe8bfb 100644 --- a/mmv1/third_party/terraform/tests/resource_cloud_identity_group_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_cloud_identity_group_test.go.erb @@ -52,12 +52,12 @@ func testAccCloudIdentityGroup_updateTest(t *testing.T) { context := map[string]interface{}{ "org_domain": envvar.GetTestOrgDomainFromEnv(t), "cust_id": envvar.GetTestCustIdFromEnv(t), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckCloudIdentityGroupDestroyProducer(t), Steps: []resource.TestStep{ { @@ -94,12 +94,12 @@ func testAccCloudIdentityGroup_cloudIdentityGroupsBasicExampleTest(t *testing.T) context := map[string]interface{}{ "org_domain": envvar.GetTestOrgDomainFromEnv(t), "cust_id": envvar.GetTestCustIdFromEnv(t), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckCloudIdentityGroupDestroyProducer(t), Steps: []resource.TestStep{ { @@ -144,7 +144,7 @@ func testAccCheckCloudIdentityGroupDestroyProducer(t *testing.T) func(s *terrafo continue } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{CloudIdentityBasePath}}{{name}}") if err != nil { diff --git a/mmv1/third_party/terraform/tests/resource_cloud_iot_device_update_test.go b/mmv1/third_party/terraform/tests/resource_cloud_iot_device_update_test.go index e16705d1396e..42aa4c94aa47 100644 --- a/mmv1/third_party/terraform/tests/resource_cloud_iot_device_update_test.go +++ b/mmv1/third_party/terraform/tests/resource_cloud_iot_device_update_test.go @@ -11,13 +11,13 @@ import ( func TestAccCloudIoTDevice_update(t *testing.T) { t.Parallel() - registryName := fmt.Sprintf("psregistry-test-%s", RandString(t, 10)) - deviceName := fmt.Sprintf("psdevice-test-%s", RandString(t, 10)) + registryName := fmt.Sprintf("psregistry-test-%s", acctest.RandString(t, 10)) + deviceName := fmt.Sprintf("psdevice-test-%s", acctest.RandString(t, 10)) resourceName := fmt.Sprintf("google_cloudiot_device.%s", deviceName) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckCloudIotDeviceDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_cloud_run_domain_mapping_test.go b/mmv1/third_party/terraform/tests/resource_cloud_run_domain_mapping_test.go index 0f833dffea2d..ee70e0043ccd 100644 --- a/mmv1/third_party/terraform/tests/resource_cloud_run_domain_mapping_test.go +++ b/mmv1/third_party/terraform/tests/resource_cloud_run_domain_mapping_test.go @@ -14,12 +14,12 @@ func TestAccCloudRunDomainMapping_foregroundDeletion(t *testing.T) { context := map[string]interface{}{ "namespace": envvar.GetTestProjectFromEnv(), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckCloudRunDomainMappingDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_cloud_run_service_test.go.erb b/mmv1/third_party/terraform/tests/resource_cloud_run_service_test.go.erb index 1b5630397b03..644bf281febc 100644 --- a/mmv1/third_party/terraform/tests/resource_cloud_run_service_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_cloud_run_service_test.go.erb @@ -14,11 +14,11 @@ func TestAccCloudRunService_cloudRunServiceUpdate(t *testing.T) { t.Parallel() project := envvar.GetTestProjectFromEnv() - name := "tftest-cloudrun-" + RandString(t, 6) + name := "tftest-cloudrun-" + acctest.RandString(t, 6) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccCloudRunService_cloudRunServiceUpdate(name, project, "10", "600"), @@ -47,11 +47,11 @@ func TestAccCloudRunService_foregroundDeletion(t *testing.T) { t.Parallel() project := envvar.GetTestProjectFromEnv() - name := "tftest-cloudrun-" + RandString(t, 6) + name := "tftest-cloudrun-" + acctest.RandString(t, 6) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccCloudRunService_cloudRunServiceUpdate(name, project, "10", "600"), @@ -123,14 +123,14 @@ func TestAccCloudRunService_secretVolume(t *testing.T) { t.Parallel() project := envvar.GetTestProjectFromEnv() - name := "tftest-cloudrun-" + RandString(t, 6) + name := "tftest-cloudrun-" + acctest.RandString(t, 6) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { - Config: testAccCloudRunService_cloudRunServiceUpdateWithSecretVolume(name, project, "secret-"+RandString(t, 5), "secret-"+RandString(t, 6), "google_secret_manager_secret.secret1.secret_id"), + Config: testAccCloudRunService_cloudRunServiceUpdateWithSecretVolume(name, project, "secret-"+acctest.RandString(t, 5), "secret-"+acctest.RandString(t, 6), "google_secret_manager_secret.secret1.secret_id"), }, { ResourceName: "google_cloud_run_service.default", @@ -139,7 +139,7 @@ func TestAccCloudRunService_secretVolume(t *testing.T) { ImportStateVerifyIgnore: []string{"metadata.0.resource_version", "status.0.conditions"}, }, { - Config: testAccCloudRunService_cloudRunServiceUpdateWithSecretVolume(name, project, "secret-"+RandString(t, 10), "secret-"+RandString(t, 11), "google_secret_manager_secret.secret2.secret_id"), + Config: testAccCloudRunService_cloudRunServiceUpdateWithSecretVolume(name, project, "secret-"+acctest.RandString(t, 10), "secret-"+acctest.RandString(t, 11), "google_secret_manager_secret.secret2.secret_id"), }, { ResourceName: "google_cloud_run_service.default", @@ -247,14 +247,14 @@ func TestAccCloudRunService_secretEnvironmentVariable(t *testing.T) { t.Parallel() project := envvar.GetTestProjectFromEnv() - name := "tftest-cloudrun-" + RandString(t, 6) + name := "tftest-cloudrun-" + acctest.RandString(t, 6) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { - Config: testAccCloudRunService_cloudRunServiceUpdateWithSecretEnvVar(name, project, "secret-"+RandString(t, 5), "secret-"+RandString(t, 6), "google_secret_manager_secret.secret1.secret_id"), + Config: testAccCloudRunService_cloudRunServiceUpdateWithSecretEnvVar(name, project, "secret-"+acctest.RandString(t, 5), "secret-"+acctest.RandString(t, 6), "google_secret_manager_secret.secret1.secret_id"), }, { ResourceName: "google_cloud_run_service.default", @@ -263,7 +263,7 @@ func TestAccCloudRunService_secretEnvironmentVariable(t *testing.T) { ImportStateVerifyIgnore: []string{"metadata.0.resource_version", "status.0.conditions"}, }, { - Config: testAccCloudRunService_cloudRunServiceUpdateWithSecretEnvVar(name, project, "secret-"+RandString(t, 10), "secret-"+RandString(t, 11), "google_secret_manager_secret.secret2.secret_id"), + Config: testAccCloudRunService_cloudRunServiceUpdateWithSecretEnvVar(name, project, "secret-"+acctest.RandString(t, 10), "secret-"+acctest.RandString(t, 11), "google_secret_manager_secret.secret2.secret_id"), }, { ResourceName: "google_cloud_run_service.default", @@ -368,11 +368,11 @@ func TestAccCloudRunService_probes(t *testing.T) { t.Parallel() project := envvar.GetTestProjectFromEnv() - name := "tftest-cloudrun-" + RandString(t, 6) + name := "tftest-cloudrun-" + acctest.RandString(t, 6) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccCloudRunService_cloudRunServiceWithEmptyTCPStartupProbeAndHTTPLivenessProbe(name, project), diff --git a/mmv1/third_party/terraform/tests/resource_cloud_run_v2_job_test.go b/mmv1/third_party/terraform/tests/resource_cloud_run_v2_job_test.go index 758bda1e687e..d52b795d0ae8 100644 --- a/mmv1/third_party/terraform/tests/resource_cloud_run_v2_job_test.go +++ b/mmv1/third_party/terraform/tests/resource_cloud_run_v2_job_test.go @@ -11,12 +11,12 @@ func TestAccCloudRunV2Job_cloudrunv2JobFullUpdate(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckCloudRunV2JobDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_cloud_run_v2_service_test.go b/mmv1/third_party/terraform/tests/resource_cloud_run_v2_service_test.go index 29d9abbad730..f69ae5637b3d 100644 --- a/mmv1/third_party/terraform/tests/resource_cloud_run_v2_service_test.go +++ b/mmv1/third_party/terraform/tests/resource_cloud_run_v2_service_test.go @@ -15,12 +15,12 @@ func TestAccCloudRunV2Service_cloudrunv2ServiceFullUpdate(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckCloudRunV2ServiceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -212,12 +212,12 @@ func TestAccCloudRunV2Service_cloudrunv2ServiceTCPProbesUpdate(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckCloudRunV2ServiceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -246,12 +246,12 @@ func TestAccCloudRunV2Service_cloudrunv2ServiceHTTPProbesUpdate(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckCloudRunV2ServiceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -279,14 +279,14 @@ func TestAccCloudRunV2Service_cloudrunv2ServiceHTTPProbesUpdate(t *testing.T) { func TestAccCloudRunV2Service_cloudrunv2ServiceGRPCProbesUpdate(t *testing.T) { t.Parallel() - serviceName := fmt.Sprintf("tf-test-cloudrun-service%s", RandString(t, 10)) + serviceName := fmt.Sprintf("tf-test-cloudrun-service%s", acctest.RandString(t, 10)) context := map[string]interface{}{ "service_name": serviceName, } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckCloudRunV2ServiceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -338,7 +338,7 @@ func TestAccCloudRunV2Service_cloudrunv2ServiceGRPCProbesUpdate(t *testing.T) { func testAccCheckCloudRunV2ServiceDestroyByNameProducer(t *testing.T, serviceName string) func() { return func() { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) service := config.NewCloudRunV2Client(config.UserAgent).Projects.Locations.Services qualifiedServiceName := fmt.Sprintf("projects/%s/locations/%s/services/%s", config.Project, config.Region, serviceName) op, err := service.Delete(qualifiedServiceName).Do() diff --git a/mmv1/third_party/terraform/tests/resource_cloud_scheduler_job_test.go b/mmv1/third_party/terraform/tests/resource_cloud_scheduler_job_test.go index b2af7ae9b4db..c3d4eb90310b 100644 --- a/mmv1/third_party/terraform/tests/resource_cloud_scheduler_job_test.go +++ b/mmv1/third_party/terraform/tests/resource_cloud_scheduler_job_test.go @@ -11,12 +11,12 @@ func TestAccCloudSchedulerJob_schedulerPausedExample(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckCloudSchedulerJobDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_cloud_tasks_queue_test.go.erb b/mmv1/third_party/terraform/tests/resource_cloud_tasks_queue_test.go.erb index 77902df83848..74a7cf5d866b 100644 --- a/mmv1/third_party/terraform/tests/resource_cloud_tasks_queue_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_cloud_tasks_queue_test.go.erb @@ -12,11 +12,11 @@ import ( func TestAccCloudTasksQueue_update(t *testing.T) { t.Parallel() - name := "cloudtasksqueuetest-" + RandString(t, 10) + name := "cloudtasksqueuetest-" + acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccCloudTasksQueue_full(name), @@ -43,11 +43,11 @@ func TestAccCloudTasksQueue_update(t *testing.T) { func TestAccCloudTasksQueue_update2Basic(t *testing.T) { t.Parallel() - name := "cloudtasksqueuetest-" + RandString(t, 10) + name := "cloudtasksqueuetest-" + acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccCloudTasksQueue_full(name), @@ -73,11 +73,11 @@ func TestAccCloudTasksQueue_update2Basic(t *testing.T) { func TestAccCloudTasksQueue_MaxRetryDiffSuppress0s(t *testing.T) { t.Parallel() - testID := RandString(t, 10) + testID := acctest.RandString(t, 10) cloudTaskName := fmt.Sprintf("tf-test-%s", testID) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccCloudtasksQueueMaxRetry0s(cloudTaskName), diff --git a/mmv1/third_party/terraform/tests/resource_cloudbuild_trigger_test.go b/mmv1/third_party/terraform/tests/resource_cloudbuild_trigger_test.go index 4fd433cb2ed1..4077a54dee76 100644 --- a/mmv1/third_party/terraform/tests/resource_cloudbuild_trigger_test.go +++ b/mmv1/third_party/terraform/tests/resource_cloudbuild_trigger_test.go @@ -12,11 +12,11 @@ import ( func TestAccCloudBuildTrigger_basic(t *testing.T) { t.Parallel() - name := fmt.Sprintf("tf-test-%d", RandInt(t)) + name := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckCloudBuildTriggerDestroyProducer(t), Steps: []resource.TestStep{ { @@ -41,11 +41,11 @@ func TestAccCloudBuildTrigger_basic(t *testing.T) { func TestAccCloudBuildTrigger_available_secrets_config(t *testing.T) { t.Parallel() - name := fmt.Sprintf("tf-test-%d", RandInt(t)) + name := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckCloudBuildTriggerDestroyProducer(t), Steps: []resource.TestStep{ { @@ -70,11 +70,11 @@ func TestAccCloudBuildTrigger_available_secrets_config(t *testing.T) { func TestAccCloudBuildTrigger_pubsub_config(t *testing.T) { t.Parallel() - name := fmt.Sprintf("tf-test-%d", RandInt(t)) + name := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckCloudBuildTriggerDestroyProducer(t), Steps: []resource.TestStep{ { @@ -99,11 +99,11 @@ func TestAccCloudBuildTrigger_pubsub_config(t *testing.T) { func TestAccCloudBuildTrigger_webhook_config(t *testing.T) { t.Parallel() - name := fmt.Sprintf("tf-test-%d", RandInt(t)) + name := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckCloudBuildTriggerDestroyProducer(t), Steps: []resource.TestStep{ { @@ -129,11 +129,11 @@ func TestAccCloudBuildTrigger_webhook_config(t *testing.T) { func TestAccCloudBuildTrigger_customizeDiffTimeoutSum(t *testing.T) { t.Parallel() - name := fmt.Sprintf("tf-test-%d", RandInt(t)) + name := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckCloudBuildTriggerDestroyProducer(t), Steps: []resource.TestStep{ { @@ -147,11 +147,11 @@ func TestAccCloudBuildTrigger_customizeDiffTimeoutSum(t *testing.T) { func TestAccCloudBuildTrigger_customizeDiffTimeoutFormat(t *testing.T) { t.Parallel() - name := fmt.Sprintf("tf-test-%d", RandInt(t)) + name := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckCloudBuildTriggerDestroyProducer(t), Steps: []resource.TestStep{ { @@ -164,11 +164,11 @@ func TestAccCloudBuildTrigger_customizeDiffTimeoutFormat(t *testing.T) { func TestAccCloudBuildTrigger_disable(t *testing.T) { t.Parallel() - name := fmt.Sprintf("tf-test-%d", RandInt(t)) + name := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckCloudBuildTriggerDestroyProducer(t), Steps: []resource.TestStep{ { @@ -194,9 +194,9 @@ func TestAccCloudBuildTrigger_disable(t *testing.T) { func TestAccCloudBuildTrigger_fullStep(t *testing.T) { t.Parallel() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckCloudBuildTriggerDestroyProducer(t), Steps: []resource.TestStep{ { @@ -213,11 +213,11 @@ func TestAccCloudBuildTrigger_fullStep(t *testing.T) { func TestAccCloudBuildTrigger_basic_bitbucket(t *testing.T) { t.Parallel() - name := fmt.Sprintf("tf-test-%d", RandInt(t)) + name := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckCloudBuildTriggerDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_cloudbuild_trigger_upgrade_test.go b/mmv1/third_party/terraform/tests/resource_cloudbuild_trigger_upgrade_test.go index 6a471254e696..3eeaed2d8ea2 100644 --- a/mmv1/third_party/terraform/tests/resource_cloudbuild_trigger_upgrade_test.go +++ b/mmv1/third_party/terraform/tests/resource_cloudbuild_trigger_upgrade_test.go @@ -14,7 +14,7 @@ import ( func TestAccCloudBuildTrigger_migration(t *testing.T) { acctest.SkipIfVcr(t) t.Parallel() - name := fmt.Sprintf("tf-test-%d", RandInt(t)) + name := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) oldVersion := map[string]resource.ExternalProvider{ "google": { @@ -26,7 +26,7 @@ func TestAccCloudBuildTrigger_migration(t *testing.T) { "mynewprovider": func() (*schema.Provider, error) { return acctest.TestAccProviders["google"], nil }, } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, CheckDestroy: testAccCheckCloudBuildTriggerDestroyProducer(t), Steps: []resource.TestStep{ diff --git a/mmv1/third_party/terraform/tests/resource_cloudbuild_worker_pool_test.go.erb b/mmv1/third_party/terraform/tests/resource_cloudbuild_worker_pool_test.go.erb index ee97dc32303c..53247b581b04 100644 --- a/mmv1/third_party/terraform/tests/resource_cloudbuild_worker_pool_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_cloudbuild_worker_pool_test.go.erb @@ -18,13 +18,13 @@ func TestAccCloudbuildWorkerPool_basic(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), "project": envvar.GetTestProjectFromEnv(), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: funcAccTestCloudbuildWorkerPoolCheckDestroy(t), Steps: []resource.TestStep{ { @@ -96,13 +96,13 @@ func TestAccCloudbuildWorkerPool_withNetwork(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), "project": envvar.GetTestProjectFromEnv(), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: funcAccTestCloudbuildWorkerPoolCheckDestroy(t), Steps: []resource.TestStep{ { @@ -172,7 +172,7 @@ func funcAccTestCloudbuildWorkerPoolCheckDestroy(t *testing.T) func(s *terraform continue } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{CloudBuildBasePath}}projects/{{project}}/locations/{{location}}/workerPools/{{name}}") if err != nil { diff --git a/mmv1/third_party/terraform/tests/resource_cloudfunction2_function_test.go b/mmv1/third_party/terraform/tests/resource_cloudfunction2_function_test.go index 041b5a977c25..6805c94c38f6 100644 --- a/mmv1/third_party/terraform/tests/resource_cloudfunction2_function_test.go +++ b/mmv1/third_party/terraform/tests/resource_cloudfunction2_function_test.go @@ -13,12 +13,12 @@ func TestAccCloudFunctions2Function_update(t *testing.T) { context := map[string]interface{}{ "zip_path": "./test-fixtures/cloudfunctions2/function-source.zip", - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckCloudfunctions2functionDestroyProducer(t), Steps: []resource.TestStep{ { @@ -180,16 +180,16 @@ func TestAccCloudFunctions2Function_fullUpdate(t *testing.T) { context := map[string]interface{}{ "project": envvar.GetTestProjectFromEnv(), "zip_path": "./test-fixtures/cloudfunctions2/function-source-eventarc-gcs.zip", - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } if acctest.BootstrapPSARole(t, "service-", "gcp-sa-pubsub", "roles/cloudkms.cryptoKeyEncrypterDecrypter") { t.Fatal("Stopping the test because a binding was added.") } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckCloudfunctions2functionDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_cloudfunctions_function_test.go.erb b/mmv1/third_party/terraform/tests/resource_cloudfunctions_function_test.go.erb index 33ab66f3a54c..1aa75635342f 100644 --- a/mmv1/third_party/terraform/tests/resource_cloudfunctions_function_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_cloudfunctions_function_test.go.erb @@ -36,14 +36,14 @@ func TestAccCloudFunctionsFunction_basic(t *testing.T) { var function cloudfunctions.CloudFunction funcResourceName := "google_cloudfunctions_function.function" - functionName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - bucketName := fmt.Sprintf("tf-test-bucket-%d", RandInt(t)) + functionName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + bucketName := fmt.Sprintf("tf-test-bucket-%d", acctest.RandInt(t)) zipFilePath := createZIPArchiveForCloudFunctionSource(t, testHTTPTriggerPath) defer os.Remove(zipFilePath) // clean up - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckCloudFunctionsFunctionDestroyProducer(t), Steps: []resource.TestStep{ { @@ -96,16 +96,16 @@ func TestAccCloudFunctionsFunction_update(t *testing.T) { var function cloudfunctions.CloudFunction funcResourceName := "google_cloudfunctions_function.function" - functionName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - bucketName := fmt.Sprintf("tf-test-bucket-%d", RandInt(t)) + functionName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + bucketName := fmt.Sprintf("tf-test-bucket-%d", acctest.RandInt(t)) zipFilePath := createZIPArchiveForCloudFunctionSource(t, testHTTPTriggerPath) zipFileUpdatePath := createZIPArchiveForCloudFunctionSource(t, testHTTPTriggerUpdatePath) - random_suffix := RandString(t, 10) + random_suffix := acctest.RandString(t, 10) defer os.Remove(zipFilePath) // clean up - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccCloudFunctionsFunction_basic(functionName, bucketName, zipFilePath), @@ -166,17 +166,17 @@ func TestAccCloudFunctionsFunction_buildworkerpool(t *testing.T) { var function cloudfunctions.CloudFunction funcResourceName := "google_cloudfunctions_function.function" - functionName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - bucketName := fmt.Sprintf("tf-test-bucket-%d", RandInt(t)) + functionName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + bucketName := fmt.Sprintf("tf-test-bucket-%d", acctest.RandInt(t)) location := "us-central1" zipFilePath := createZIPArchiveForCloudFunctionSource(t, testHTTPTriggerPath) proj := envvar.GetTestProjectFromEnv() defer os.Remove(zipFilePath) // clean up - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckCloudFunctionsFunctionDestroyProducer(t), Steps: []resource.TestStep{ { @@ -204,15 +204,15 @@ func TestAccCloudFunctionsFunction_pubsub(t *testing.T) { t.Parallel() funcResourceName := "google_cloudfunctions_function.function" - functionName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - bucketName := fmt.Sprintf("tf-test-bucket-%d", RandInt(t)) - topicName := fmt.Sprintf("tf-test-sub-%s", RandString(t, 10)) + functionName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + bucketName := fmt.Sprintf("tf-test-bucket-%d", acctest.RandInt(t)) + topicName := fmt.Sprintf("tf-test-sub-%s", acctest.RandString(t, 10)) zipFilePath := createZIPArchiveForCloudFunctionSource(t, testPubSubTriggerPath) defer os.Remove(zipFilePath) // clean up - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckCloudFunctionsFunctionDestroyProducer(t), Steps: []resource.TestStep{ { @@ -236,14 +236,14 @@ func TestAccCloudFunctionsFunction_pubsub(t *testing.T) { func TestAccCloudFunctionsFunction_bucket(t *testing.T) { t.Parallel() funcResourceName := "google_cloudfunctions_function.function" - functionName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - bucketName := fmt.Sprintf("tf-test-bucket-%d", RandInt(t)) + functionName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + bucketName := fmt.Sprintf("tf-test-bucket-%d", acctest.RandInt(t)) zipFilePath := createZIPArchiveForCloudFunctionSource(t, testBucketTriggerPath) defer os.Remove(zipFilePath) // clean up - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckCloudFunctionsFunctionDestroyProducer(t), Steps: []resource.TestStep{ { @@ -272,15 +272,15 @@ func TestAccCloudFunctionsFunction_bucket(t *testing.T) { func TestAccCloudFunctionsFunction_dockerRepository(t *testing.T) { t.Parallel() funcResourceName := "google_cloudfunctions_function.function" - arRepoName := fmt.Sprintf("tf-ar-test-docker-repository-%s", RandString(t, 10)) - functionName := fmt.Sprintf("tf-ar-test-%s", RandString(t, 10)) - bucketName := fmt.Sprintf("tf-ar-test-bucket-%d", RandInt(t)) + arRepoName := fmt.Sprintf("tf-ar-test-docker-repository-%s", acctest.RandString(t, 10)) + functionName := fmt.Sprintf("tf-ar-test-%s", acctest.RandString(t, 10)) + bucketName := fmt.Sprintf("tf-ar-test-bucket-%d", acctest.RandInt(t)) zipFilePath := createZIPArchiveForCloudFunctionSource(t, testHTTPTriggerPath) defer os.Remove(zipFilePath) // clean up - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckCloudFunctionsFunctionDestroyProducer(t), Steps: []resource.TestStep{ { @@ -302,15 +302,15 @@ func TestAccCloudFunctionsFunction_cmek(t *testing.T) { t.Parallel() kmsKey := acctest.BootstrapKMSKeyInLocation(t, "us-central1") funcResourceName := "google_cloudfunctions_function.function" - arRepoName := fmt.Sprintf("tf-cmek-test-docker-repository-%s", RandString(t, 10)) - functionName := fmt.Sprintf("tf-cmek-test-%s", RandString(t, 10)) - bucketName := fmt.Sprintf("tf-cmek-test-bucket-%d", RandInt(t)) + arRepoName := fmt.Sprintf("tf-cmek-test-docker-repository-%s", acctest.RandString(t, 10)) + functionName := fmt.Sprintf("tf-cmek-test-%s", acctest.RandString(t, 10)) + bucketName := fmt.Sprintf("tf-cmek-test-bucket-%d", acctest.RandInt(t)) zipFilePath := createZIPArchiveForCloudFunctionSource(t, testHTTPTriggerPath) defer os.Remove(zipFilePath) // clean up - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckCloudFunctionsFunctionDestroyProducer(t), Steps: []resource.TestStep{ { @@ -330,14 +330,14 @@ func TestAccCloudFunctionsFunction_cmek(t *testing.T) { func TestAccCloudFunctionsFunction_firestore(t *testing.T) { t.Parallel() funcResourceName := "google_cloudfunctions_function.function" - functionName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - bucketName := fmt.Sprintf("tf-test-bucket-%d", RandInt(t)) + functionName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + bucketName := fmt.Sprintf("tf-test-bucket-%d", acctest.RandInt(t)) zipFilePath := createZIPArchiveForCloudFunctionSource(t, testFirestoreTriggerPath) defer os.Remove(zipFilePath) // clean up - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckCloudFunctionsFunctionDestroyProducer(t), Steps: []resource.TestStep{ { @@ -357,12 +357,12 @@ func TestAccCloudFunctionsFunction_sourceRepo(t *testing.T) { t.Parallel() funcResourceName := "google_cloudfunctions_function.function" - functionName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + functionName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) proj := envvar.GetTestProjectFromEnv() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckCloudFunctionsFunctionDestroyProducer(t), Steps: []resource.TestStep{ { @@ -382,14 +382,14 @@ func TestAccCloudFunctionsFunction_serviceAccountEmail(t *testing.T) { t.Parallel() funcResourceName := "google_cloudfunctions_function.function" - functionName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - bucketName := fmt.Sprintf("tf-test-bucket-%d", RandInt(t)) + functionName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + bucketName := fmt.Sprintf("tf-test-bucket-%d", acctest.RandInt(t)) zipFilePath := createZIPArchiveForCloudFunctionSource(t, testHTTPTriggerPath) defer os.Remove(zipFilePath) // clean up - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckCloudFunctionsFunctionDestroyProducer(t), Steps: []resource.TestStep{ { @@ -409,17 +409,17 @@ func TestAccCloudFunctionsFunction_vpcConnector(t *testing.T) { t.Parallel() funcResourceName := "google_cloudfunctions_function.function" - functionName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - bucketName := fmt.Sprintf("tf-test-bucket-%d", RandInt(t)) - networkName := fmt.Sprintf("tf-test-net-%d", RandInt(t)) - vpcConnectorName := fmt.Sprintf("tf-test-conn-%s", RandString(t, 5)) + functionName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + bucketName := fmt.Sprintf("tf-test-bucket-%d", acctest.RandInt(t)) + networkName := fmt.Sprintf("tf-test-net-%d", acctest.RandInt(t)) + vpcConnectorName := fmt.Sprintf("tf-test-conn-%s", acctest.RandString(t, 5)) zipFilePath := createZIPArchiveForCloudFunctionSource(t, testHTTPTriggerPath) projectNumber := os.Getenv("GOOGLE_PROJECT_NUMBER") defer os.Remove(zipFilePath) // clean up - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckCloudFunctionsFunctionDestroyProducer(t), Steps: []resource.TestStep{ { @@ -447,20 +447,20 @@ func TestAccCloudFunctionsFunction_vpcConnector(t *testing.T) { func TestAccCloudFunctionsFunction_secretEnvVar(t *testing.T) { t.Parallel() - randomSecretSuffix := RandString(t, 10) + randomSecretSuffix := acctest.RandString(t, 10) accountId := fmt.Sprintf("tf-test-account-%s", randomSecretSuffix) secretName := fmt.Sprintf("tf-test-secret-%s", randomSecretSuffix) versionName1 := fmt.Sprintf("tf-test-version1-%s", randomSecretSuffix) versionName2 := fmt.Sprintf("tf-test-version2-%s", randomSecretSuffix) - bucketName := fmt.Sprintf("tf-test-bucket-%d", RandInt(t)) + bucketName := fmt.Sprintf("tf-test-bucket-%d", acctest.RandInt(t)) functionName := fmt.Sprintf("tf-test-%s", randomSecretSuffix) zipFilePath := createZIPArchiveForCloudFunctionSource(t, testSecretEnvVarFunctionPath) funcResourceName := "google_cloudfunctions_function.function" defer os.Remove(zipFilePath) // clean up - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckCloudFunctionsFunctionDestroyProducer(t), Steps: []resource.TestStep{ { @@ -489,20 +489,20 @@ func TestAccCloudFunctionsFunction_secretMount(t *testing.T) { t.Parallel() projectNumber := os.Getenv("GOOGLE_PROJECT_NUMBER") - randomSecretSuffix := RandString(t, 10) + randomSecretSuffix := acctest.RandString(t, 10) accountId := fmt.Sprintf("tf-test-account-%s", randomSecretSuffix) secretName := fmt.Sprintf("tf-test-secret-%s", randomSecretSuffix) versionName1 := fmt.Sprintf("tf-test-version1-%s", randomSecretSuffix) versionName2 := fmt.Sprintf("tf-test-version2-%s", randomSecretSuffix) - bucketName := fmt.Sprintf("tf-test-bucket-%d", RandInt(t)) + bucketName := fmt.Sprintf("tf-test-bucket-%d", acctest.RandInt(t)) functionName := fmt.Sprintf("tf-test-%s", randomSecretSuffix) zipFilePath := createZIPArchiveForCloudFunctionSource(t, testSecretVolumesMountFunctionPath) funcResourceName := "google_cloudfunctions_function.function" defer os.Remove(zipFilePath) // clean up - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckCloudFunctionsFunctionDestroyProducer(t), Steps: []resource.TestStep{ { @@ -529,7 +529,7 @@ func TestAccCloudFunctionsFunction_secretMount(t *testing.T) { func testAccCheckCloudFunctionsFunctionDestroyProducer(t *testing.T) func(s *terraform.State) error { return func(s *terraform.State) error { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) for _, rs := range s.RootModule().Resources { if rs.Type != "google_cloudfunctions_function" { @@ -565,7 +565,7 @@ func testAccCloudFunctionsFunctionExists(t *testing.T, n string, function *cloud if rs.Primary.ID == "" { return fmt.Errorf("No ID is set") } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) name := rs.Primary.Attributes["name"] project := rs.Primary.Attributes["project"] region := rs.Primary.Attributes["region"] diff --git a/mmv1/third_party/terraform/tests/resource_cloudids_endpoint_test.go b/mmv1/third_party/terraform/tests/resource_cloudids_endpoint_test.go index 85e2cb0e1181..7b9713d6c521 100644 --- a/mmv1/third_party/terraform/tests/resource_cloudids_endpoint_test.go +++ b/mmv1/third_party/terraform/tests/resource_cloudids_endpoint_test.go @@ -17,12 +17,12 @@ func TestAccCloudIdsEndpoint_basic(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckCloudIdsEndpointDestroyProducer(t), Steps: []resource.TestStep{ { @@ -113,7 +113,7 @@ func testAccCheckCloudIdsEndpointDestroyProducer(t *testing.T) func(s *terraform continue } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{CloudIdsBasePath}}projects/{{project}}/locations/{{location}}/endpoints/{{name}}") if err != nil { diff --git a/mmv1/third_party/terraform/tests/resource_cloudiot_device_registry_update_test.go b/mmv1/third_party/terraform/tests/resource_cloudiot_device_registry_update_test.go index 22c421ad2d1f..8e06232c5966 100644 --- a/mmv1/third_party/terraform/tests/resource_cloudiot_device_registry_update_test.go +++ b/mmv1/third_party/terraform/tests/resource_cloudiot_device_registry_update_test.go @@ -11,15 +11,15 @@ import ( func TestAccCloudIoTRegistry_update(t *testing.T) { t.Parallel() - registryName := fmt.Sprintf("psregistry-test-%s", RandString(t, 10)) + registryName := fmt.Sprintf("psregistry-test-%s", acctest.RandString(t, 10)) resourceName := fmt.Sprintf("google_cloudiot_registry.%s", registryName) - deviceStatus := fmt.Sprintf("psregistry-test-devicestatus-%s", RandString(t, 10)) - defaultTelemetry := fmt.Sprintf("psregistry-test-telemetry-%s", RandString(t, 10)) - additionalTelemetry := fmt.Sprintf("psregistry-additional-test-telemetry-%s", RandString(t, 10)) + deviceStatus := fmt.Sprintf("psregistry-test-devicestatus-%s", acctest.RandString(t, 10)) + defaultTelemetry := fmt.Sprintf("psregistry-test-telemetry-%s", acctest.RandString(t, 10)) + additionalTelemetry := fmt.Sprintf("psregistry-additional-test-telemetry-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckCloudIotDeviceRegistryDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_composer_environment_test.go.erb b/mmv1/third_party/terraform/tests/resource_composer_environment_test.go.erb index 9bcb553b283e..8f2d5851354d 100644 --- a/mmv1/third_party/terraform/tests/resource_composer_environment_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_composer_environment_test.go.erb @@ -35,12 +35,12 @@ func allComposerServiceAgents() []string { func TestAccComposerEnvironment_basic(t *testing.T) { t.Parallel() - envName := fmt.Sprintf("%s-%d", testComposerEnvironmentPrefix, RandInt(t)) - network := fmt.Sprintf("%s-%d", testComposerNetworkPrefix, RandInt(t)) + envName := fmt.Sprintf("%s-%d", testComposerEnvironmentPrefix, acctest.RandInt(t)) + network := fmt.Sprintf("%s-%d", testComposerNetworkPrefix, acctest.RandInt(t)) subnetwork := network + "-1" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccComposerEnvironmentDestroyProducer(t), Steps: []resource.TestStep{ { @@ -81,13 +81,13 @@ func TestAccComposerEnvironment_basic(t *testing.T) { func TestAccComposerEnvironment_update(t *testing.T) { t.Parallel() - envName := fmt.Sprintf("%s-%d", testComposerEnvironmentPrefix, RandInt(t)) - network := fmt.Sprintf("%s-%d", testComposerNetworkPrefix, RandInt(t)) + envName := fmt.Sprintf("%s-%d", testComposerEnvironmentPrefix, acctest.RandInt(t)) + network := fmt.Sprintf("%s-%d", testComposerNetworkPrefix, acctest.RandInt(t)) subnetwork := network + "-1" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccComposerEnvironmentDestroyProducer(t), Steps: []resource.TestStep{ { @@ -118,13 +118,13 @@ func TestAccComposerEnvironment_update(t *testing.T) { func TestAccComposerEnvironmentComposer1_private(t *testing.T) { t.Parallel() - envName := fmt.Sprintf("%s-%d", testComposerEnvironmentPrefix, RandInt(t)) - network := fmt.Sprintf("%s-%d", testComposerNetworkPrefix, RandInt(t)) + envName := fmt.Sprintf("%s-%d", testComposerEnvironmentPrefix, acctest.RandInt(t)) + network := fmt.Sprintf("%s-%d", testComposerNetworkPrefix, acctest.RandInt(t)) subnetwork := network + "-1" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccComposerEnvironmentDestroyProducer(t), Steps: []resource.TestStep{ { @@ -157,13 +157,13 @@ func TestAccComposerEnvironmentComposer1_private(t *testing.T) { func TestAccComposerEnvironmentComposer2_private(t *testing.T) { t.Parallel() - envName := fmt.Sprintf("%s-%d", testComposerEnvironmentPrefix, RandInt(t)) - network := fmt.Sprintf("%s-%d", testComposerNetworkPrefix, RandInt(t)) + envName := fmt.Sprintf("%s-%d", testComposerEnvironmentPrefix, acctest.RandInt(t)) + network := fmt.Sprintf("%s-%d", testComposerNetworkPrefix, acctest.RandInt(t)) subnetwork := network + "-1" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccComposerEnvironmentDestroyProducer(t), Steps: []resource.TestStep{ { @@ -197,13 +197,13 @@ func TestAccComposerEnvironmentComposer2_private(t *testing.T) { func TestAccComposerEnvironment_privateWithWebServerControl(t *testing.T) { t.Parallel() - envName := fmt.Sprintf("%s-%d", testComposerEnvironmentPrefix, RandInt(t)) - network := fmt.Sprintf("%s-%d", testComposerNetworkPrefix, RandInt(t)) + envName := fmt.Sprintf("%s-%d", testComposerEnvironmentPrefix, acctest.RandInt(t)) + network := fmt.Sprintf("%s-%d", testComposerNetworkPrefix, acctest.RandInt(t)) subnetwork := network + "-1" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccComposerEnvironmentDestroyProducer(t), Steps: []resource.TestStep{ { @@ -243,13 +243,13 @@ func TestAccComposerEnvironment_privateWithWebServerControl(t *testing.T) { func TestAccComposerEnvironment_withDatabaseConfig(t *testing.T) { t.Parallel() - envName := fmt.Sprintf("%s-%d", testComposerEnvironmentPrefix, RandInt(t)) - network := fmt.Sprintf("%s-%d", testComposerNetworkPrefix, RandInt(t)) + envName := fmt.Sprintf("%s-%d", testComposerEnvironmentPrefix, acctest.RandInt(t)) + network := fmt.Sprintf("%s-%d", testComposerNetworkPrefix, acctest.RandInt(t)) subnetwork := network + "-1" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccComposerEnvironmentDestroyProducer(t), Steps: []resource.TestStep{ { @@ -278,16 +278,16 @@ func TestAccComposerEnvironment_withDatabaseConfig(t *testing.T) { func TestAccComposerEnvironment_withWebServerConfig(t *testing.T) { t.Parallel() - envName := fmt.Sprintf("%s-%d", testComposerEnvironmentPrefix, RandInt(t)) - network := fmt.Sprintf("%s-%d", testComposerNetworkPrefix, RandInt(t)) + envName := fmt.Sprintf("%s-%d", testComposerEnvironmentPrefix, acctest.RandInt(t)) + network := fmt.Sprintf("%s-%d", testComposerNetworkPrefix, acctest.RandInt(t)) subnetwork := network + "-1" grantServiceAgentsRole(t, "service-", []string{"gcp-sa-cloudbuild"}, "roles/cloudbuild.builds.builder") - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccComposerEnvironmentDestroyProducer(t), Steps: []resource.TestStep{ { @@ -320,13 +320,13 @@ func TestAccComposerEnvironment_withEncryptionConfigComposer1(t *testing.T) { kms := acctest.BootstrapKMSKeyInLocation(t, "us-central1") pid := envvar.GetTestProjectFromEnv() grantServiceAgentsRole(t, "service-", allComposerServiceAgents(), "roles/cloudkms.cryptoKeyEncrypterDecrypter") - envName := fmt.Sprintf("%s-%d", testComposerEnvironmentPrefix, RandInt(t)) - network := fmt.Sprintf("%s-%d", testComposerNetworkPrefix, RandInt(t)) + envName := fmt.Sprintf("%s-%d", testComposerEnvironmentPrefix, acctest.RandInt(t)) + network := fmt.Sprintf("%s-%d", testComposerNetworkPrefix, acctest.RandInt(t)) subnetwork := network + "-1" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccComposerEnvironmentDestroyProducer(t), Steps: []resource.TestStep{ { @@ -356,13 +356,13 @@ func TestAccComposerEnvironment_withEncryptionConfigComposer2(t *testing.T) { kms := acctest.BootstrapKMSKeyInLocation(t, "us-central1") pid := envvar.GetTestProjectFromEnv() grantServiceAgentsRole(t, "service-", allComposerServiceAgents(), "roles/cloudkms.cryptoKeyEncrypterDecrypter") - envName := fmt.Sprintf("%s-%d", testComposerEnvironmentPrefix, RandInt(t)) - network := fmt.Sprintf("%s-%d", testComposerNetworkPrefix, RandInt(t)) + envName := fmt.Sprintf("%s-%d", testComposerEnvironmentPrefix, acctest.RandInt(t)) + network := fmt.Sprintf("%s-%d", testComposerNetworkPrefix, acctest.RandInt(t)) subnetwork := network + "-1" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccComposerEnvironmentDestroyProducer(t), Steps: []resource.TestStep{ { @@ -389,13 +389,13 @@ func TestAccComposerEnvironment_withEncryptionConfigComposer2(t *testing.T) { func TestAccComposerEnvironment_withMaintenanceWindow(t *testing.T) { t.Parallel() - envName := fmt.Sprintf("%s-%d", testComposerEnvironmentPrefix, RandInt(t)) - network := fmt.Sprintf("%s-%d", testComposerNetworkPrefix, RandInt(t)) + envName := fmt.Sprintf("%s-%d", testComposerEnvironmentPrefix, acctest.RandInt(t)) + network := fmt.Sprintf("%s-%d", testComposerNetworkPrefix, acctest.RandInt(t)) subnetwork := network + "-1" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccComposerEnvironmentDestroyProducer(t), Steps: []resource.TestStep{ { @@ -422,13 +422,13 @@ func TestAccComposerEnvironment_withMaintenanceWindow(t *testing.T) { func TestAccComposerEnvironment_maintenanceWindowUpdate(t *testing.T) { t.Parallel() - envName := fmt.Sprintf("%s-%d", testComposerEnvironmentPrefix, RandInt(t)) - network := fmt.Sprintf("%s-%d", testComposerNetworkPrefix, RandInt(t)) + envName := fmt.Sprintf("%s-%d", testComposerEnvironmentPrefix, acctest.RandInt(t)) + network := fmt.Sprintf("%s-%d", testComposerNetworkPrefix, acctest.RandInt(t)) subnetwork := network + "-1" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccComposerEnvironmentDestroyProducer(t), Steps: []resource.TestStep{ { @@ -458,13 +458,13 @@ func TestAccComposerEnvironment_maintenanceWindowUpdate(t *testing.T) { func TestAccComposerEnvironment_ComposerV2(t *testing.T) { t.Parallel() - envName := fmt.Sprintf("%s-%d", testComposerEnvironmentPrefix, RandInt(t)) - network := fmt.Sprintf("%s-%d", testComposerNetworkPrefix, RandInt(t)) + envName := fmt.Sprintf("%s-%d", testComposerEnvironmentPrefix, acctest.RandInt(t)) + network := fmt.Sprintf("%s-%d", testComposerNetworkPrefix, acctest.RandInt(t)) subnetwork := network + "-1" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccComposerEnvironmentDestroyProducer(t), Steps: []resource.TestStep{ { @@ -492,13 +492,13 @@ func TestAccComposerEnvironment_ComposerV2(t *testing.T) { func TestAccComposerEnvironment_ComposerV2HighResilience(t *testing.T) { t.Parallel() - envName := fmt.Sprintf("%s-%d", testComposerEnvironmentPrefix, RandInt(t)) - network := fmt.Sprintf("%s-%d", testComposerNetworkPrefix, RandInt(t)) + envName := fmt.Sprintf("%s-%d", testComposerEnvironmentPrefix, acctest.RandInt(t)) + network := fmt.Sprintf("%s-%d", testComposerNetworkPrefix, acctest.RandInt(t)) subnetwork := network + "-1" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccComposerEnvironmentDestroyProducer(t), Steps: []resource.TestStep{ { @@ -528,13 +528,13 @@ func TestAccComposerEnvironment_UpdateComposerV2WithTriggerer(t *testing.T) { acctest.SkipIfVcr(t) t.Parallel() - envName := fmt.Sprintf("%s-%d", testComposerEnvironmentPrefix, RandInt(t)) - network := fmt.Sprintf("%s-%d", testComposerNetworkPrefix, RandInt(t)) + envName := fmt.Sprintf("%s-%d", testComposerEnvironmentPrefix, acctest.RandInt(t)) + network := fmt.Sprintf("%s-%d", testComposerNetworkPrefix, acctest.RandInt(t)) subnetwork := network + "-1" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccComposerEnvironmentDestroyProducer(t), Steps: []resource.TestStep{ { @@ -565,13 +565,13 @@ func TestAccComposerEnvironment_UpdateComposerV2WithTriggerer(t *testing.T) { func TestAccComposerEnvironment_UpdateComposerV2(t *testing.T) { t.Parallel() - envName := fmt.Sprintf("%s-%d", testComposerEnvironmentPrefix, RandInt(t)) - network := fmt.Sprintf("%s-%d", testComposerNetworkPrefix, RandInt(t)) + envName := fmt.Sprintf("%s-%d", testComposerEnvironmentPrefix, acctest.RandInt(t)) + network := fmt.Sprintf("%s-%d", testComposerNetworkPrefix, acctest.RandInt(t)) subnetwork := network + "-1" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccComposerEnvironmentDestroyProducer(t), Steps: []resource.TestStep{ { @@ -601,12 +601,12 @@ func TestAccComposerEnvironment_UpdateComposerV2(t *testing.T) { func TestAccComposerEnvironment_composerV2PrivateServiceConnect(t *testing.T) { t.Parallel() - envName := fmt.Sprintf("%s-%d", testComposerEnvironmentPrefix, RandInt(t)) - network := fmt.Sprintf("%s-%d", testComposerNetworkPrefix, RandInt(t)) + envName := fmt.Sprintf("%s-%d", testComposerEnvironmentPrefix, acctest.RandInt(t)) + network := fmt.Sprintf("%s-%d", testComposerNetworkPrefix, acctest.RandInt(t)) subnetwork := network + "-1" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccComposerEnvironmentDestroyProducer(t), Steps: []resource.TestStep{ { @@ -633,12 +633,12 @@ func TestAccComposerEnvironment_composerV2PrivateServiceConnect(t *testing.T) { func TestAccComposerEnvironment_composerV1MasterAuthNetworks(t *testing.T) { t.Parallel() - envName := fmt.Sprintf("%s-%d", testComposerEnvironmentPrefix, RandInt(t)) - network := fmt.Sprintf("%s-%d", testComposerNetworkPrefix, RandInt(t)) + envName := fmt.Sprintf("%s-%d", testComposerEnvironmentPrefix, acctest.RandInt(t)) + network := fmt.Sprintf("%s-%d", testComposerNetworkPrefix, acctest.RandInt(t)) subnetwork := network + "-1" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccComposerEnvironmentDestroyProducer(t), Steps: []resource.TestStep{ { @@ -665,12 +665,12 @@ func TestAccComposerEnvironment_composerV1MasterAuthNetworks(t *testing.T) { func TestAccComposerEnvironment_composerV2MasterAuthNetworks(t *testing.T) { t.Parallel() - envName := fmt.Sprintf("%s-%d", testComposerEnvironmentPrefix, RandInt(t)) - network := fmt.Sprintf("%s-%d", testComposerNetworkPrefix, RandInt(t)) + envName := fmt.Sprintf("%s-%d", testComposerEnvironmentPrefix, acctest.RandInt(t)) + network := fmt.Sprintf("%s-%d", testComposerNetworkPrefix, acctest.RandInt(t)) subnetwork := network + "-1" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccComposerEnvironmentDestroyProducer(t), Steps: []resource.TestStep{ { @@ -697,12 +697,12 @@ func TestAccComposerEnvironment_composerV2MasterAuthNetworks(t *testing.T) { func TestAccComposerEnvironment_composerV1MasterAuthNetworksUpdate(t *testing.T) { t.Parallel() - envName := fmt.Sprintf("%s-%d", testComposerEnvironmentPrefix, RandInt(t)) - network := fmt.Sprintf("%s-%d", testComposerNetworkPrefix, RandInt(t)) + envName := fmt.Sprintf("%s-%d", testComposerEnvironmentPrefix, acctest.RandInt(t)) + network := fmt.Sprintf("%s-%d", testComposerNetworkPrefix, acctest.RandInt(t)) subnetwork := network + "-1" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccComposerEnvironmentDestroyProducer(t), Steps: []resource.TestStep{ { @@ -732,12 +732,12 @@ func TestAccComposerEnvironment_composerV1MasterAuthNetworksUpdate(t *testing.T) func TestAccComposerEnvironment_composerV2MasterAuthNetworksUpdate(t *testing.T) { t.Parallel() - envName := fmt.Sprintf("%s-%d", testComposerEnvironmentPrefix, RandInt(t)) - network := fmt.Sprintf("%s-%d", testComposerNetworkPrefix, RandInt(t)) + envName := fmt.Sprintf("%s-%d", testComposerEnvironmentPrefix, acctest.RandInt(t)) + network := fmt.Sprintf("%s-%d", testComposerNetworkPrefix, acctest.RandInt(t)) subnetwork := network + "-1" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccComposerEnvironmentDestroyProducer(t), Steps: []resource.TestStep{ { @@ -767,14 +767,14 @@ func TestAccComposerEnvironment_composerV2MasterAuthNetworksUpdate(t *testing.T) func TestAccComposer1Environment_withNodeConfig(t *testing.T) { t.Parallel() - envName := fmt.Sprintf("%s-%d", testComposerEnvironmentPrefix, RandInt(t)) - network := fmt.Sprintf("%s-%d", testComposerNetworkPrefix, RandInt(t)) + envName := fmt.Sprintf("%s-%d", testComposerEnvironmentPrefix, acctest.RandInt(t)) + network := fmt.Sprintf("%s-%d", testComposerNetworkPrefix, acctest.RandInt(t)) subnetwork := network + "-1" - serviceAccount := fmt.Sprintf("tf-test-%d", RandInt(t)) + serviceAccount := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccComposerEnvironmentDestroyProducer(t), Steps: []resource.TestStep{ { @@ -801,14 +801,14 @@ func TestAccComposer1Environment_withNodeConfig(t *testing.T) { func TestAccComposer2Environment_withNodeConfig(t *testing.T) { t.Parallel() - envName := fmt.Sprintf("%s-%d", testComposerEnvironmentPrefix, RandInt(t)) - network := fmt.Sprintf("%s-%d", testComposerNetworkPrefix, RandInt(t)) + envName := fmt.Sprintf("%s-%d", testComposerEnvironmentPrefix, acctest.RandInt(t)) + network := fmt.Sprintf("%s-%d", testComposerNetworkPrefix, acctest.RandInt(t)) subnetwork := network + "-1" - serviceAccount := fmt.Sprintf("tf-test-%d", RandInt(t)) + serviceAccount := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccComposerEnvironmentDestroyProducer(t), Steps: []resource.TestStep{ { @@ -834,13 +834,13 @@ func TestAccComposer2Environment_withNodeConfig(t *testing.T) { func TestAccComposerEnvironmentAirflow2_withRecoveryConfig(t *testing.T) { t.Parallel() - envName := fmt.Sprintf("%s-%d", testComposerEnvironmentPrefix, RandInt(t)) - network := fmt.Sprintf("%s-%d", testComposerNetworkPrefix, RandInt(t)) + envName := fmt.Sprintf("%s-%d", testComposerEnvironmentPrefix, acctest.RandInt(t)) + network := fmt.Sprintf("%s-%d", testComposerNetworkPrefix, acctest.RandInt(t)) subnetwork := network + "-1" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccComposerEnvironmentDestroyProducer(t), Steps: []resource.TestStep{ { @@ -874,13 +874,13 @@ func TestAccComposerEnvironmentAirflow2_withRecoveryConfig(t *testing.T) { func TestAccComposerEnvironment_withSoftwareConfig(t *testing.T) { t.Parallel() - envName := fmt.Sprintf("%s-%d", testComposerEnvironmentPrefix, RandInt(t)) - network := fmt.Sprintf("%s-%d", testComposerNetworkPrefix, RandInt(t)) + envName := fmt.Sprintf("%s-%d", testComposerEnvironmentPrefix, acctest.RandInt(t)) + network := fmt.Sprintf("%s-%d", testComposerNetworkPrefix, acctest.RandInt(t)) subnetwork := network + "-1" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccComposerEnvironmentDestroyProducer(t), Steps: []resource.TestStep{ { @@ -906,13 +906,13 @@ func TestAccComposerEnvironment_withSoftwareConfig(t *testing.T) { func TestAccComposerEnvironmentAirflow2_withSoftwareConfig(t *testing.T) { t.Parallel() - envName := fmt.Sprintf("%s-%d", testComposerEnvironmentPrefix, RandInt(t)) - network := fmt.Sprintf("%s-%d", testComposerNetworkPrefix, RandInt(t)) + envName := fmt.Sprintf("%s-%d", testComposerEnvironmentPrefix, acctest.RandInt(t)) + network := fmt.Sprintf("%s-%d", testComposerNetworkPrefix, acctest.RandInt(t)) subnetwork := network + "-1" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccComposerEnvironmentDestroyProducer(t), Steps: []resource.TestStep{ { @@ -949,13 +949,13 @@ func TestAccComposerEnvironmentAirflow2_withSoftwareConfig(t *testing.T) { func TestAccComposerEnvironment_withUpdateOnCreate(t *testing.T) { t.Parallel() - envName := fmt.Sprintf("%s-%d", testComposerEnvironmentPrefix, RandInt(t)) - network := fmt.Sprintf("%s-%d", testComposerNetworkPrefix, RandInt(t)) + envName := fmt.Sprintf("%s-%d", testComposerEnvironmentPrefix, acctest.RandInt(t)) + network := fmt.Sprintf("%s-%d", testComposerNetworkPrefix, acctest.RandInt(t)) subnetwork := network + "-1" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccComposerEnvironmentDestroyProducer(t), Steps: []resource.TestStep{ { @@ -982,14 +982,14 @@ func TestAccComposerEnvironment_withUpdateOnCreate(t *testing.T) { func TestAccComposerEnvironment_fixPyPiPackages(t *testing.T) { t.Parallel() - envName := fmt.Sprintf("%s-%d", testComposerEnvironmentPrefix, RandInt(t)) - network := fmt.Sprintf("%s-%d", testComposerNetworkPrefix, RandInt(t)) + envName := fmt.Sprintf("%s-%d", testComposerEnvironmentPrefix, acctest.RandInt(t)) + network := fmt.Sprintf("%s-%d", testComposerNetworkPrefix, acctest.RandInt(t)) subnetwork := network + "-1" - serviceAccount := fmt.Sprintf("tf-test-%d", RandInt(t)) + serviceAccount := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccComposerEnvironmentDestroyProducer(t), Steps: []resource.TestStep{ { @@ -1018,7 +1018,7 @@ func grantServiceAgentsRole(t *testing.T, prefix string, agentNames []string, ro func testAccComposerEnvironmentDestroyProducer(t *testing.T) func(s *terraform.State) error { return func(s *terraform.State) error { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) for _, rs := range s.RootModule().Resources { if rs.Type != "google_composer_environment" { @@ -2505,7 +2505,7 @@ resource "google_project_iam_member" "composer-worker" { // Destroy test step for config with a network will fail unless we clean up the firewalls before. func testAccCheckClearComposerEnvironmentFirewalls(t *testing.T, networkName string) resource.TestCheckFunc { return func(s *terraform.State) error { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) config.Project = envvar.GetTestProjectFromEnv() network, err := config.NewComputeClient(config.UserAgent).Networks.Get(envvar.GetTestProjectFromEnv(), networkName).Do() if err != nil { diff --git a/mmv1/third_party/terraform/tests/resource_compute_address_test.go b/mmv1/third_party/terraform/tests/resource_compute_address_test.go index 422261dce425..afab1990ba55 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_address_test.go +++ b/mmv1/third_party/terraform/tests/resource_compute_address_test.go @@ -11,13 +11,13 @@ import ( func TestAccComputeAddress_networkTier(t *testing.T) { t.Parallel() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeAddressDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccComputeAddress_networkTier(RandString(t, 10)), + Config: testAccComputeAddress_networkTier(acctest.RandString(t, 10)), }, { ResourceName: "google_compute_address.foobar", @@ -29,13 +29,13 @@ func TestAccComputeAddress_networkTier(t *testing.T) { } func TestAccComputeAddress_internal(t *testing.T) { - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeAddressDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccComputeAddress_internal(RandString(t, 10)), + Config: testAccComputeAddress_internal(acctest.RandString(t, 10)), }, { ResourceName: "google_compute_address.internal", diff --git a/mmv1/third_party/terraform/tests/resource_compute_attached_disk_test.go b/mmv1/third_party/terraform/tests/resource_compute_attached_disk_test.go index b478332857b1..b228ff1f658a 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_attached_disk_test.go +++ b/mmv1/third_party/terraform/tests/resource_compute_attached_disk_test.go @@ -14,13 +14,13 @@ import ( func TestAccComputeAttachedDisk_basic(t *testing.T) { t.Parallel() - diskName := fmt.Sprintf("tf-test-disk-%d", RandInt(t)) - instanceName := fmt.Sprintf("tf-test-inst-%d", RandInt(t)) + diskName := fmt.Sprintf("tf-test-disk-%d", acctest.RandInt(t)) + instanceName := fmt.Sprintf("tf-test-inst-%d", acctest.RandInt(t)) importID := fmt.Sprintf("%s/us-central1-a/%s/%s", envvar.GetTestProjectFromEnv(), instanceName, diskName) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), // Check destroy isn't a good test here, see comment on testCheckAttachedDiskIsNowDetached CheckDestroy: nil, Steps: []resource.TestStep{ @@ -46,13 +46,13 @@ func TestAccComputeAttachedDisk_basic(t *testing.T) { func TestAccComputeAttachedDisk_full(t *testing.T) { t.Parallel() - diskName := fmt.Sprintf("tf-test-%d", RandInt(t)) - instanceName := fmt.Sprintf("tf-test-%d", RandInt(t)) + diskName := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) + instanceName := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) importID := fmt.Sprintf("%s/us-central1-a/%s/%s", envvar.GetTestProjectFromEnv(), instanceName, diskName) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), // Check destroy isn't a good test here, see comment on testCheckAttachedDiskIsNowDetached CheckDestroy: nil, Steps: []resource.TestStep{ @@ -73,13 +73,13 @@ func TestAccComputeAttachedDisk_full(t *testing.T) { func TestAccComputeAttachedDisk_region(t *testing.T) { t.Parallel() - diskName := fmt.Sprintf("tf-test-%d", RandInt(t)) - instanceName := fmt.Sprintf("tf-test-%d", RandInt(t)) + diskName := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) + instanceName := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) importID := fmt.Sprintf("%s/us-central1-a/%s/%s", envvar.GetTestProjectFromEnv(), instanceName, diskName) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), // Check destroy isn't a good test here, see comment on testCheckAttachedDiskIsNowDetached CheckDestroy: nil, Steps: []resource.TestStep{ @@ -100,13 +100,13 @@ func TestAccComputeAttachedDisk_region(t *testing.T) { func TestAccComputeAttachedDisk_count(t *testing.T) { t.Parallel() - diskPrefix := fmt.Sprintf("tf-test-%d", RandInt(t)) - instanceName := fmt.Sprintf("tf-test-%d", RandInt(t)) + diskPrefix := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) + instanceName := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) count := 2 - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: nil, Steps: []resource.TestStep{ { @@ -129,7 +129,7 @@ func TestAccComputeAttachedDisk_count(t *testing.T) { // situation where the detach fails but since the instance/disk get destroyed we wouldn't notice. func testCheckAttachedDiskIsNowDetached(t *testing.T, instanceName, diskName string) resource.TestCheckFunc { return func(s *terraform.State) error { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) instance, err := config.NewComputeClient(config.UserAgent).Instances.Get(envvar.GetTestProjectFromEnv(), "us-central1-a", instanceName).Do() if err != nil { @@ -147,7 +147,7 @@ func testCheckAttachedDiskIsNowDetached(t *testing.T, instanceName, diskName str func testCheckAttachedDiskContainsManyDisks(t *testing.T, instanceName string, count int) resource.TestCheckFunc { return func(s *terraform.State) error { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) instance, err := config.NewComputeClient(config.UserAgent).Instances.Get(envvar.GetTestProjectFromEnv(), "us-central1-a", instanceName).Do() if err != nil { diff --git a/mmv1/third_party/terraform/tests/resource_compute_autoscaler_test.go.erb b/mmv1/third_party/terraform/tests/resource_compute_autoscaler_test.go.erb index 5895097f7766..1b1e163403b4 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_autoscaler_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_compute_autoscaler_test.go.erb @@ -12,14 +12,14 @@ import ( func TestAccComputeAutoscaler_update(t *testing.T) { t.Parallel() - var itName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) - var tpName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) - var igmName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) - var autoscalerName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) + var itName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + var tpName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + var igmName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + var autoscalerName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeAutoscalerDestroyProducer(t), Steps: []resource.TestStep{ resource.TestStep{ @@ -46,14 +46,14 @@ func TestAccComputeAutoscaler_update(t *testing.T) { func TestAccComputeAutoscaler_multicondition(t *testing.T) { t.Parallel() - var itName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) - var tpName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) - var igmName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) - var autoscalerName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) + var itName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + var tpName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + var igmName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + var autoscalerName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeAutoscalerDestroyProducer(t), Steps: []resource.TestStep{ resource.TestStep{ @@ -71,14 +71,14 @@ func TestAccComputeAutoscaler_multicondition(t *testing.T) { func TestAccComputeAutoscaler_scaleDownControl(t *testing.T) { t.Parallel() - var itName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) - var tpName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) - var igmName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) - var autoscalerName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) + var itName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + var tpName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + var igmName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + var autoscalerName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeAutoscalerDestroyProducer(t), Steps: []resource.TestStep{ resource.TestStep{ @@ -96,14 +96,14 @@ func TestAccComputeAutoscaler_scaleDownControl(t *testing.T) { func TestAccComputeAutoscaler_scalingSchedule(t *testing.T) { t.Parallel() - var itName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) - var tpName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) - var igmName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) - var autoscalerName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) + var itName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + var tpName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + var igmName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + var autoscalerName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeAutoscalerDestroyProducer(t), Steps: []resource.TestStep{ resource.TestStep{ @@ -121,14 +121,14 @@ func TestAccComputeAutoscaler_scalingSchedule(t *testing.T) { func TestAccComputeAutoscaler_scaleInControl(t *testing.T) { t.Parallel() - var itName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) - var tpName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) - var igmName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) - var autoscalerName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) + var itName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + var tpName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + var igmName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + var autoscalerName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeAutoscalerDestroyProducer(t), Steps: []resource.TestStep{ resource.TestStep{ @@ -146,14 +146,14 @@ func TestAccComputeAutoscaler_scaleInControl(t *testing.T) { func TestAccComputeAutoscaler_scaleInControlFixed(t *testing.T) { t.Parallel() - var itName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) - var tpName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) - var igmName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) - var autoscalerName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) + var itName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + var tpName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + var igmName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + var autoscalerName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeAutoscalerDestroyProducer(t), Steps: []resource.TestStep{ resource.TestStep{ diff --git a/mmv1/third_party/terraform/tests/resource_compute_backend_bucket_signed_url_key_test.go b/mmv1/third_party/terraform/tests/resource_compute_backend_bucket_signed_url_key_test.go index e0bc6da80ab3..92cede7b1c18 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_backend_bucket_signed_url_key_test.go +++ b/mmv1/third_party/terraform/tests/resource_compute_backend_bucket_signed_url_key_test.go @@ -17,12 +17,12 @@ func TestAccComputeBackendBucketSignedUrlKey_basic(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeBackendBucketSignedUrlKeyDestroyProducer(t), Steps: []resource.TestStep{ { @@ -90,7 +90,7 @@ func checkComputeBackendBucketSignedUrlKeyExists(t *testing.T, s *terraform.Stat continue } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) keyName := rs.Primary.Attributes["name"] url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{ComputeBasePath}}projects/{{project}}/global/backendBuckets/{{backend_bucket}}") diff --git a/mmv1/third_party/terraform/tests/resource_compute_backend_bucket_test.go b/mmv1/third_party/terraform/tests/resource_compute_backend_bucket_test.go index 480baee64c18..6b3a05bbfe3b 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_backend_bucket_test.go +++ b/mmv1/third_party/terraform/tests/resource_compute_backend_bucket_test.go @@ -11,13 +11,13 @@ import ( func TestAccComputeBackendBucket_basicModified(t *testing.T) { t.Parallel() - backendName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - storageName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - secondStorageName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + backendName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + storageName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + secondStorageName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeBackendBucketDestroyProducer(t), Steps: []resource.TestStep{ { @@ -44,12 +44,12 @@ func TestAccComputeBackendBucket_basicModified(t *testing.T) { func TestAccComputeBackendBucket_withCdnPolicy(t *testing.T) { t.Parallel() - backendName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - storageName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + backendName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + storageName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeBackendBucketDestroyProducer(t), Steps: []resource.TestStep{ { @@ -107,12 +107,12 @@ func TestAccComputeBackendBucket_withCdnPolicy(t *testing.T) { func TestAccComputeBackendBucket_withSecurityPolicy(t *testing.T) { t.Parallel() - bucketName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - polName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + bucketName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + polName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeBackendServiceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -138,12 +138,12 @@ func TestAccComputeBackendBucket_withSecurityPolicy(t *testing.T) { func TestAccComputeBackendBucket_withCompressionMode(t *testing.T) { t.Parallel() - backendName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - storageName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + backendName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + storageName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeBackendServiceDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_compute_backend_service_signed_url_key_test.go b/mmv1/third_party/terraform/tests/resource_compute_backend_service_signed_url_key_test.go index 004b4e461e14..8f8d2404d059 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_backend_service_signed_url_key_test.go +++ b/mmv1/third_party/terraform/tests/resource_compute_backend_service_signed_url_key_test.go @@ -17,12 +17,12 @@ func TestAccComputeBackendServiceSignedUrlKey_basic(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeBackendServiceSignedUrlKeyDestroyProducer(t), Steps: []resource.TestStep{ { @@ -90,7 +90,7 @@ func checkComputeBackendServiceSignedUrlKeyExists(t *testing.T, s *terraform.Sta continue } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) keyName := rs.Primary.Attributes["name"] url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{ComputeBasePath}}projects/{{project}}/global/backendServices/{{backend_service}}") diff --git a/mmv1/third_party/terraform/tests/resource_compute_backend_service_test.go.erb b/mmv1/third_party/terraform/tests/resource_compute_backend_service_test.go.erb index bc89698768c9..55e16e65e6c2 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_backend_service_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_compute_backend_service_test.go.erb @@ -12,13 +12,13 @@ import ( func TestAccComputeBackendService_basic(t *testing.T) { t.Parallel() - serviceName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - checkName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - extraCheckName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + serviceName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + checkName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + extraCheckName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeBackendServiceDestroyProducer(t), Steps: []resource.TestStep{ resource.TestStep{ @@ -45,13 +45,13 @@ func TestAccComputeBackendService_basic(t *testing.T) { func TestAccComputeBackendService_withBackend(t *testing.T) { t.Parallel() - serviceName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - igName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - itName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - checkName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - VcrTest(t, resource.TestCase{ + serviceName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + igName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + itName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + checkName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeBackendServiceDestroyProducer(t), Steps: []resource.TestStep{ resource.TestStep{ @@ -77,13 +77,13 @@ func TestAccComputeBackendService_withBackend(t *testing.T) { } func TestAccComputeBackendService_withBackendAndMaxUtilization(t *testing.T) { - serviceName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - igName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - itName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - checkName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - VcrTest(t, resource.TestCase{ + serviceName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + igName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + itName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + checkName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeBackendServiceDestroyProducer(t), Steps: []resource.TestStep{ resource.TestStep{ @@ -115,13 +115,13 @@ func TestAccComputeBackendService_withBackendAndMaxUtilization(t *testing.T) { } func TestAccComputeBackendService_withBackendAndIAP(t *testing.T) { - serviceName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - igName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - itName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - checkName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - VcrTest(t, resource.TestCase{ + serviceName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + igName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + itName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + checkName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeBackendServiceDestroyProducer(t), Steps: []resource.TestStep{ resource.TestStep{ @@ -150,12 +150,12 @@ func TestAccComputeBackendService_withBackendAndIAP(t *testing.T) { func TestAccComputeBackendService_updatePreservesOptionalParameters(t *testing.T) { t.Parallel() - serviceName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - checkName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + serviceName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + checkName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeBackendServiceDestroyProducer(t), Steps: []resource.TestStep{ resource.TestStep{ @@ -183,12 +183,12 @@ func TestAccComputeBackendService_updatePreservesOptionalParameters(t *testing.T func TestAccComputeBackendService_withConnectionDraining(t *testing.T) { t.Parallel() - serviceName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - checkName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + serviceName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + checkName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeBackendServiceDestroyProducer(t), Steps: []resource.TestStep{ resource.TestStep{ @@ -206,12 +206,12 @@ func TestAccComputeBackendService_withConnectionDraining(t *testing.T) { func TestAccComputeBackendService_withConnectionDrainingAndUpdate(t *testing.T) { t.Parallel() - serviceName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - checkName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + serviceName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + checkName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeBackendServiceDestroyProducer(t), Steps: []resource.TestStep{ resource.TestStep{ @@ -237,12 +237,12 @@ func TestAccComputeBackendService_withConnectionDrainingAndUpdate(t *testing.T) func TestAccComputeBackendService_withHttpsHealthCheck(t *testing.T) { t.Parallel() - serviceName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - checkName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + serviceName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + checkName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeBackendServiceDestroyProducer(t), Steps: []resource.TestStep{ resource.TestStep{ @@ -261,12 +261,12 @@ func TestAccComputeBackendService_withHttpsHealthCheck(t *testing.T) { func TestAccComputeBackendService_withCdnPolicy(t *testing.T) { t.Parallel() - serviceName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - checkName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + serviceName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + checkName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeBackendServiceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -309,14 +309,14 @@ func TestAccComputeBackendService_withCdnPolicy(t *testing.T) { func TestAccComputeBackendService_withSecurityPolicy(t *testing.T) { t.Parallel() - serviceName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - checkName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - polName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - edgePolName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + serviceName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + checkName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + polName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + edgePolName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeBackendServiceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -342,12 +342,12 @@ func TestAccComputeBackendService_withSecurityPolicy(t *testing.T) { func TestAccComputeBackendService_withCDNEnabled(t *testing.T) { t.Parallel() - serviceName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - checkName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + serviceName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + checkName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeBackendServiceDestroyProducer(t), Steps: []resource.TestStep{ resource.TestStep{ @@ -366,12 +366,12 @@ func TestAccComputeBackendService_withCDNEnabled(t *testing.T) { func TestAccComputeBackendService_withSessionAffinity(t *testing.T) { t.Parallel() - serviceName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - checkName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + serviceName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + checkName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeBackendServiceDestroyProducer(t), Steps: []resource.TestStep{ resource.TestStep{ @@ -399,12 +399,12 @@ func TestAccComputeBackendService_withSessionAffinity(t *testing.T) { func TestAccComputeBackendService_withAffinityCookieTtlSec(t *testing.T) { t.Parallel() - serviceName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - checkName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + serviceName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + checkName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeBackendServiceDestroyProducer(t), Steps: []resource.TestStep{ resource.TestStep{ @@ -423,14 +423,14 @@ func TestAccComputeBackendService_withAffinityCookieTtlSec(t *testing.T) { func TestAccComputeBackendService_withMaxConnections(t *testing.T) { t.Parallel() - serviceName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - igName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - itName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - checkName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + serviceName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + igName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + itName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + checkName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeBackendServiceDestroyProducer(t), Steps: []resource.TestStep{ resource.TestStep{ @@ -458,14 +458,14 @@ func TestAccComputeBackendService_withMaxConnections(t *testing.T) { func TestAccComputeBackendService_withMaxConnectionsPerInstance(t *testing.T) { t.Parallel() - serviceName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - igName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - itName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - checkName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + serviceName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + igName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + itName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + checkName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeBackendServiceDestroyProducer(t), Steps: []resource.TestStep{ resource.TestStep{ @@ -493,16 +493,16 @@ func TestAccComputeBackendService_withMaxConnectionsPerInstance(t *testing.T) { func TestAccComputeBackendService_withMaxRatePerEndpoint(t *testing.T) { t.Parallel() - randSuffix := RandString(t, 10) + randSuffix := acctest.RandString(t, 10) service := fmt.Sprintf("tf-test-%s", randSuffix) instance := fmt.Sprintf("tf-test-%s", randSuffix) neg := fmt.Sprintf("tf-test-%s", randSuffix) network := fmt.Sprintf("tf-test-%s", randSuffix) check := fmt.Sprintf("tf-test-%s", randSuffix) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeBackendServiceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -530,16 +530,16 @@ func TestAccComputeBackendService_withMaxRatePerEndpoint(t *testing.T) { func TestAccComputeBackendService_withMaxConnectionsPerEndpoint(t *testing.T) { t.Parallel() - randSuffix := RandString(t, 10) + randSuffix := acctest.RandString(t, 10) service := fmt.Sprintf("tf-test-%s", randSuffix) instance := fmt.Sprintf("tf-test-%s", randSuffix) neg := fmt.Sprintf("tf-test-%s", randSuffix) network := fmt.Sprintf("tf-test-%s", randSuffix) check := fmt.Sprintf("tf-test-%s", randSuffix) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeBackendServiceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -567,12 +567,12 @@ func TestAccComputeBackendService_withMaxConnectionsPerEndpoint(t *testing.T) { func TestAccComputeBackendService_withCustomHeaders(t *testing.T) { t.Parallel() - serviceName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - checkName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + serviceName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + checkName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeBackendServiceDestroyProducer(t), Steps: []resource.TestStep{ resource.TestStep{ @@ -600,15 +600,15 @@ func TestAccComputeBackendService_internalLoadBalancing(t *testing.T) { acctest.SkipIfVcr(t) t.Parallel() - fr := fmt.Sprintf("forwardrule-test-%s", RandString(t, 10)) - proxy := fmt.Sprintf("forwardrule-test-%s", RandString(t, 10)) - backend := fmt.Sprintf("forwardrule-test-%s", RandString(t, 10)) - hc := fmt.Sprintf("forwardrule-test-%s", RandString(t, 10)) - urlmap := fmt.Sprintf("forwardrule-test-%s", RandString(t, 10)) + fr := fmt.Sprintf("forwardrule-test-%s", acctest.RandString(t, 10)) + proxy := fmt.Sprintf("forwardrule-test-%s", acctest.RandString(t, 10)) + backend := fmt.Sprintf("forwardrule-test-%s", acctest.RandString(t, 10)) + hc := fmt.Sprintf("forwardrule-test-%s", acctest.RandString(t, 10)) + urlmap := fmt.Sprintf("forwardrule-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeBackendServiceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -626,12 +626,12 @@ func TestAccComputeBackendService_internalLoadBalancing(t *testing.T) { func TestAccComputeBackendService_withLogConfig(t *testing.T) { t.Parallel() - serviceName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - checkName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + serviceName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + checkName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeBackendServiceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -689,12 +689,12 @@ func TestAccComputeBackendService_withLogConfig(t *testing.T) { func TestAccComputeBackendService_trafficDirectorUpdateBasic(t *testing.T) { t.Parallel() - backendName := fmt.Sprintf("foo-%s", RandString(t, 10)) - checkName := fmt.Sprintf("bar-%s", RandString(t, 10)) + backendName := fmt.Sprintf("foo-%s", acctest.RandString(t, 10)) + checkName := fmt.Sprintf("bar-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeBackendServiceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -720,12 +720,12 @@ func TestAccComputeBackendService_trafficDirectorUpdateBasic(t *testing.T) { func TestAccComputeBackendService_withCompressionMode(t *testing.T) { t.Parallel() - backendName := fmt.Sprintf("foo-%s", RandString(t, 10)) - checkName := fmt.Sprintf("bar-%s", RandString(t, 10)) + backendName := fmt.Sprintf("foo-%s", acctest.RandString(t, 10)) + checkName := fmt.Sprintf("bar-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeBackendServiceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -759,12 +759,12 @@ func TestAccComputeBackendService_withCompressionMode(t *testing.T) { func TestAccComputeBackendService_trafficDirectorUpdateLbPolicies(t *testing.T) { t.Parallel() - backendName := fmt.Sprintf("foo-%s", RandString(t, 10)) - checkName := fmt.Sprintf("bar-%s", RandString(t, 10)) + backendName := fmt.Sprintf("foo-%s", acctest.RandString(t, 10)) + checkName := fmt.Sprintf("bar-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeBackendServiceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -791,12 +791,12 @@ func TestAccComputeBackendService_trafficDirectorUpdateLbPolicies(t *testing.T) func TestAccComputeBackendService_trafficDirectorUpdateFull(t *testing.T) { t.Parallel() - backendName := fmt.Sprintf("foo-%s", RandString(t, 10)) - checkName := fmt.Sprintf("bar-%s", RandString(t, 10)) + backendName := fmt.Sprintf("foo-%s", acctest.RandString(t, 10)) + checkName := fmt.Sprintf("bar-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeBackendServiceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -824,11 +824,11 @@ func TestAccComputeBackendService_trafficDirectorUpdateFull(t *testing.T) { func TestAccComputeBackendService_regionNegBackend(t *testing.T) { t.Parallel() - suffix := RandString(t, 10) + suffix := acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeBackendServiceDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_compute_disk_async_replication_test.go.erb b/mmv1/third_party/terraform/tests/resource_compute_disk_async_replication_test.go.erb index 9a8c97b5ac1f..ff87ab3e2071 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_disk_async_replication_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_compute_disk_async_replication_test.go.erb @@ -8,6 +8,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-provider-google/google/acctest" "github.com/hashicorp/terraform-provider-google/google/tpgresource" ) @@ -38,14 +39,14 @@ func TestAccComputeDiskAsyncReplication(t *testing.T) { secondaryRegion = "australia-southeast1" } - primaryDisk := fmt.Sprintf("tf-test-disk-primary-%s", RandString(t, 10)) - secondaryDisk := fmt.Sprintf("tf-test-disk-secondary-%s", RandString(t, 10)) - primaryRegionalDisk := fmt.Sprintf("tf-test-disk-rprimary-%s", RandString(t, 10)) - secondaryRegionalDisk := fmt.Sprintf("tf-test-disk-rsecondary-%s", RandString(t, 10)) + primaryDisk := fmt.Sprintf("tf-test-disk-primary-%s", acctest.RandString(t, 10)) + secondaryDisk := fmt.Sprintf("tf-test-disk-secondary-%s", acctest.RandString(t, 10)) + primaryRegionalDisk := fmt.Sprintf("tf-test-disk-rprimary-%s", acctest.RandString(t, 10)) + secondaryRegionalDisk := fmt.Sprintf("tf-test-disk-rsecondary-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ - PreCheck: func() { AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + acctest.VcrTest(t, resource.TestCase{ + PreCheck: func() { acctest.AccTestPreCheck(t) }, + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccComputeDiskAsyncReplication_basicZonal(region, secondaryRegion, primaryDisk, secondaryDisk), diff --git a/mmv1/third_party/terraform/tests/resource_compute_disk_resource_policy_attachment_test.go b/mmv1/third_party/terraform/tests/resource_compute_disk_resource_policy_attachment_test.go index 5f35d1b63085..6b2ff033f7fa 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_disk_resource_policy_attachment_test.go +++ b/mmv1/third_party/terraform/tests/resource_compute_disk_resource_policy_attachment_test.go @@ -11,13 +11,13 @@ import ( func TestAccComputeDiskResourcePolicyAttachment_update(t *testing.T) { t.Parallel() - diskName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - policyName := fmt.Sprintf("tf-test-policy-%s", RandString(t, 10)) - policyName2 := fmt.Sprintf("tf-test-policy-%s", RandString(t, 10)) + diskName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + policyName := fmt.Sprintf("tf-test-policy-%s", acctest.RandString(t, 10)) + policyName2 := fmt.Sprintf("tf-test-policy-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccComputeDiskResourcePolicyAttachment_basic(diskName, policyName), diff --git a/mmv1/third_party/terraform/tests/resource_compute_disk_test.go.erb b/mmv1/third_party/terraform/tests/resource_compute_disk_test.go.erb index dc2a99ea4256..2f8ca7047e14 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_disk_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_compute_disk_test.go.erb @@ -330,11 +330,11 @@ func TestAccComputeDisk_imageDiffSuppressPublicVendorsFamilyNames(t *testing.T) func TestAccComputeDisk_update(t *testing.T) { t.Parallel() - diskName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + diskName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccComputeDisk_basic(diskName), @@ -359,7 +359,7 @@ func TestAccComputeDisk_pdHyperDiskProvisionedIopsLifeCycle(t *testing.T) { t.Parallel() context_1 := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), "provisioned_iops": 10000, "lifecycle_bool": true, } @@ -374,9 +374,9 @@ func TestAccComputeDisk_pdHyperDiskProvisionedIopsLifeCycle(t *testing.T) { "lifecycle_bool": false, } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeDiskDestroyProducer(t), Steps: []resource.TestStep{ { @@ -411,7 +411,7 @@ func TestAccComputeDisk_pdHyperDiskProvisionedThroughputLifeCycle(t *testing.T) t.Parallel() context_1 := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), "provisioned_throughput": 180, "lifecycle_bool": true, } @@ -426,9 +426,9 @@ func TestAccComputeDisk_pdHyperDiskProvisionedThroughputLifeCycle(t *testing.T) "lifecycle_bool": false, } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeDiskDestroyProducer(t), Steps: []resource.TestStep{ { @@ -462,14 +462,14 @@ func TestAccComputeDisk_pdHyperDiskProvisionedThroughputLifeCycle(t *testing.T) func TestAccComputeDisk_fromSnapshot(t *testing.T) { t.Parallel() - diskName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - firstDiskName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - snapshotName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + diskName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + firstDiskName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + snapshotName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) projectName := envvar.GetTestProjectFromEnv() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeDiskDestroyProducer(t), Steps: []resource.TestStep{ resource.TestStep{ @@ -495,12 +495,12 @@ func TestAccComputeDisk_fromSnapshot(t *testing.T) { func TestAccComputeDisk_encryption(t *testing.T) { t.Parallel() - diskName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + diskName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) var disk compute.Disk - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeDiskDestroyProducer(t), Steps: []resource.TestStep{ resource.TestStep{ @@ -521,7 +521,7 @@ func TestAccComputeDisk_encryptionKMS(t *testing.T) { kms := acctest.BootstrapKMSKey(t) pid := envvar.GetTestProjectFromEnv() - diskName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + diskName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) importID := fmt.Sprintf("%s/%s/%s", pid, "us-central1-a", diskName) var disk compute.Disk @@ -529,9 +529,9 @@ func TestAccComputeDisk_encryptionKMS(t *testing.T) { t.Fatal("Stopping the test because a role was added to the policy.") } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeDiskDestroyProducer(t), Steps: []resource.TestStep{ { @@ -556,12 +556,12 @@ func TestAccComputeDisk_encryptionKMS(t *testing.T) { func TestAccComputeDisk_deleteDetach(t *testing.T) { t.Parallel() - diskName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - instanceName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + diskName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + instanceName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeDiskDestroyProducer(t), Steps: []resource.TestStep{ resource.TestStep{ @@ -593,13 +593,13 @@ func TestAccComputeDisk_deleteDetachIGM(t *testing.T) { acctest.SkipIfVcr(t) t.Parallel() - diskName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - diskName2 := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - mgrName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + diskName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + diskName2 := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + mgrName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeDiskDestroyProducer(t), Steps: []resource.TestStep{ resource.TestStep{ @@ -647,11 +647,11 @@ func TestAccComputeDisk_deleteDetachIGM(t *testing.T) { func TestAccComputeDisk_pdExtremeImplicitProvisionedIops(t *testing.T) { t.Parallel() - diskName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + diskName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccComputeDisk_pdExtremeImplicitProvisionedIops(diskName), @@ -669,12 +669,12 @@ func TestAccComputeDisk_pdExtremeImplicitProvisionedIops(t *testing.T) { func TestAccComputeDisk_resourcePolicies(t *testing.T) { t.Parallel() - diskName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - policyName := fmt.Sprintf("tf-test-policy-%s", RandString(t, 10)) + diskName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + policyName := fmt.Sprintf("tf-test-policy-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccComputeDisk_resourcePolicies(diskName, policyName), @@ -692,12 +692,12 @@ func TestAccComputeDisk_resourcePolicies(t *testing.T) { <% unless version == 'ga' -%> func TestAccComputeDisk_multiWriter(t *testing.T) { t.Parallel() - instanceName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - diskName := fmt.Sprintf("tf-testd-%s", RandString(t, 10)) + instanceName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + diskName := fmt.Sprintf("tf-testd-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccComputeDisk_multiWriter(instanceName, diskName, true), @@ -723,7 +723,7 @@ func testAccCheckComputeDiskExists(t *testing.T, n, p string, disk *compute.Disk return fmt.Errorf("No ID is set") } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) found, err := config.NewComputeClient(config.UserAgent).Disks.Get( p, rs.Primary.Attributes["zone"], rs.Primary.Attributes["name"]).Do() @@ -762,13 +762,13 @@ func testAccCheckEncryptionKey(t *testing.T, n string, disk *compute.Disk) resou func TestAccComputeDisk_cloneDisk(t *testing.T) { t.Parallel() pid := envvar.GetTestProjectFromEnv() - diskName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + diskName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) var disk compute.Disk - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeDiskDestroyProducer(t), Steps: []resource.TestStep{ { @@ -790,11 +790,11 @@ func TestAccComputeDisk_cloneDisk(t *testing.T) { func TestAccComputeDisk_featuresUpdated(t *testing.T) { t.Parallel() - diskName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + diskName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccComputeDisk_features(diskName), @@ -1175,12 +1175,12 @@ func testAccComputeDisk_diskClone(diskName, refSelector string) string { func TestAccComputeDisk_encryptionWithRSAEncryptedKey(t *testing.T) { t.Parallel() - diskName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + diskName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) var disk compute.Disk - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeDiskDestroyProducer(t), Steps: []resource.TestStep{ resource.TestStep{ diff --git a/mmv1/third_party/terraform/tests/resource_compute_firewall_policy_association_test.go b/mmv1/third_party/terraform/tests/resource_compute_firewall_policy_association_test.go index d79f5b2a96cb..5dde02fb4265 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_firewall_policy_association_test.go +++ b/mmv1/third_party/terraform/tests/resource_compute_firewall_policy_association_test.go @@ -13,13 +13,13 @@ func TestAccComputeFirewallPolicyAssociation_basic(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), "org_name": fmt.Sprintf("organizations/%s", envvar.GetTestOrgFromEnv(t)), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccComputeFirewallPolicyAssociation_basic(context), diff --git a/mmv1/third_party/terraform/tests/resource_compute_firewall_policy_rule_test.go.erb b/mmv1/third_party/terraform/tests/resource_compute_firewall_policy_rule_test.go.erb index d2dd80164cd5..8c2daa357d25 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_firewall_policy_rule_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_compute_firewall_policy_rule_test.go.erb @@ -14,13 +14,13 @@ func TestAccComputeFirewallPolicyRule_update(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), "org_name": fmt.Sprintf("organizations/%s", envvar.GetTestOrgFromEnv(t)), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccComputeFirewallPolicyRule_start(context), @@ -280,13 +280,13 @@ func TestAccComputeFirewallPolicyRule_multipleRules(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), "org_name": fmt.Sprintf("organizations/%s", envvar.GetTestOrgFromEnv(t)), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccComputeFirewallPolicyRule_multiple(context), diff --git a/mmv1/third_party/terraform/tests/resource_compute_firewall_policy_test.go.erb b/mmv1/third_party/terraform/tests/resource_compute_firewall_policy_test.go.erb index 8f6f5e064c53..a089314bc1ca 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_firewall_policy_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_compute_firewall_policy_test.go.erb @@ -14,12 +14,12 @@ func TestAccComputeFirewallPolicy_update(t *testing.T) { t.Parallel() org := envvar.GetTestOrgFromEnv(t) - policyName := fmt.Sprintf("tf-test-firewall-policy-%s", RandString(t, 10)) - folderName := fmt.Sprintf("tf-test-folder-%s", RandString(t, 10)) + policyName := fmt.Sprintf("tf-test-firewall-policy-%s", acctest.RandString(t, 10)) + folderName := fmt.Sprintf("tf-test-folder-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeFirewallDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_compute_firewall_test.go.erb b/mmv1/third_party/terraform/tests/resource_compute_firewall_test.go.erb index 869b86018275..127770227c8b 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_firewall_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_compute_firewall_test.go.erb @@ -13,12 +13,12 @@ import ( func TestAccComputeFirewall_update(t *testing.T) { t.Parallel() - networkName := fmt.Sprintf("tf-test-firewall-%s", RandString(t, 10)) - firewallName := fmt.Sprintf("tf-test-firewall-%s", RandString(t, 10)) + networkName := fmt.Sprintf("tf-test-firewall-%s", acctest.RandString(t, 10)) + firewallName := fmt.Sprintf("tf-test-firewall-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeFirewallDestroyProducer(t), Steps: []resource.TestStep{ { @@ -52,12 +52,12 @@ func TestAccComputeFirewall_update(t *testing.T) { func TestAccComputeFirewall_localRanges(t *testing.T) { t.Parallel() - networkName := fmt.Sprintf("tf-test-firewall-%s", RandString(t, 10)) - firewallName := fmt.Sprintf("tf-test-firewall-%s", RandString(t, 10)) + networkName := fmt.Sprintf("tf-test-firewall-%s", acctest.RandString(t, 10)) + firewallName := fmt.Sprintf("tf-test-firewall-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeFirewallDestroyProducer(t), Steps: []resource.TestStep{ { @@ -91,12 +91,12 @@ func TestAccComputeFirewall_localRanges(t *testing.T) { func TestAccComputeFirewall_priority(t *testing.T) { t.Parallel() - networkName := fmt.Sprintf("tf-test-firewall-%s", RandString(t, 10)) - firewallName := fmt.Sprintf("tf-test-firewall-%s", RandString(t, 10)) + networkName := fmt.Sprintf("tf-test-firewall-%s", acctest.RandString(t, 10)) + firewallName := fmt.Sprintf("tf-test-firewall-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeFirewallDestroyProducer(t), Steps: []resource.TestStep{ { @@ -114,12 +114,12 @@ func TestAccComputeFirewall_priority(t *testing.T) { func TestAccComputeFirewall_noSource(t *testing.T) { t.Parallel() - networkName := fmt.Sprintf("tf-test-firewall-%s", RandString(t, 10)) - firewallName := fmt.Sprintf("tf-test-firewall-%s", RandString(t, 10)) + networkName := fmt.Sprintf("tf-test-firewall-%s", acctest.RandString(t, 10)) + firewallName := fmt.Sprintf("tf-test-firewall-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeFirewallDestroyProducer(t), Steps: []resource.TestStep{ { @@ -133,12 +133,12 @@ func TestAccComputeFirewall_noSource(t *testing.T) { func TestAccComputeFirewall_denied(t *testing.T) { t.Parallel() - networkName := fmt.Sprintf("tf-test-firewall-%s", RandString(t, 10)) - firewallName := fmt.Sprintf("tf-test-firewall-%s", RandString(t, 10)) + networkName := fmt.Sprintf("tf-test-firewall-%s", acctest.RandString(t, 10)) + firewallName := fmt.Sprintf("tf-test-firewall-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeFirewallDestroyProducer(t), Steps: []resource.TestStep{ { @@ -156,12 +156,12 @@ func TestAccComputeFirewall_denied(t *testing.T) { func TestAccComputeFirewall_egress(t *testing.T) { t.Parallel() - networkName := fmt.Sprintf("tf-test-firewall-%s", RandString(t, 10)) - firewallName := fmt.Sprintf("tf-test-firewall-%s", RandString(t, 10)) + networkName := fmt.Sprintf("tf-test-firewall-%s", acctest.RandString(t, 10)) + firewallName := fmt.Sprintf("tf-test-firewall-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeFirewallDestroyProducer(t), Steps: []resource.TestStep{ { @@ -179,15 +179,15 @@ func TestAccComputeFirewall_egress(t *testing.T) { func TestAccComputeFirewall_serviceAccounts(t *testing.T) { t.Parallel() - networkName := fmt.Sprintf("tf-test-firewall-%s", RandString(t, 10)) - firewallName := fmt.Sprintf("tf-test-firewall-%s", RandString(t, 10)) + networkName := fmt.Sprintf("tf-test-firewall-%s", acctest.RandString(t, 10)) + firewallName := fmt.Sprintf("tf-test-firewall-%s", acctest.RandString(t, 10)) - sourceSa := fmt.Sprintf("tf-test-firewall-%s", RandString(t, 10)) - targetSa := fmt.Sprintf("tf-test-firewall-%s", RandString(t, 10)) + sourceSa := fmt.Sprintf("tf-test-firewall-%s", acctest.RandString(t, 10)) + targetSa := fmt.Sprintf("tf-test-firewall-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeFirewallDestroyProducer(t), Steps: []resource.TestStep{ { @@ -205,12 +205,12 @@ func TestAccComputeFirewall_serviceAccounts(t *testing.T) { func TestAccComputeFirewall_disabled(t *testing.T) { t.Parallel() - networkName := fmt.Sprintf("tf-test-firewall-%s", RandString(t, 10)) - firewallName := fmt.Sprintf("tf-test-firewall-%s", RandString(t, 10)) + networkName := fmt.Sprintf("tf-test-firewall-%s", acctest.RandString(t, 10)) + firewallName := fmt.Sprintf("tf-test-firewall-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeFirewallDestroyProducer(t), Steps: []resource.TestStep{ { @@ -236,12 +236,12 @@ func TestAccComputeFirewall_disabled(t *testing.T) { func TestAccComputeFirewall_enableLogging(t *testing.T) { t.Parallel() - networkName := fmt.Sprintf("tf-test-firewall-%s", RandString(t, 10)) - firewallName := fmt.Sprintf("tf-test-firewall-%s", RandString(t, 10)) + networkName := fmt.Sprintf("tf-test-firewall-%s", acctest.RandString(t, 10)) + firewallName := fmt.Sprintf("tf-test-firewall-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeFirewallDestroyProducer(t), Steps: []resource.TestStep{ { @@ -283,12 +283,12 @@ func TestAccComputeFirewall_enableLogging(t *testing.T) { func TestAccComputeFirewall_moduleOutput(t *testing.T) { t.Parallel() - networkName := fmt.Sprintf("tf-test-firewall-%s", RandString(t, 10)) - firewallName := fmt.Sprintf("tf-test-firewall-%s", RandString(t, 10)) + networkName := fmt.Sprintf("tf-test-firewall-%s", acctest.RandString(t, 10)) + firewallName := fmt.Sprintf("tf-test-firewall-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeFirewallDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_compute_forwarding_rule_test.go.erb b/mmv1/third_party/terraform/tests/resource_compute_forwarding_rule_test.go.erb index 3dcf3d8c3e69..73dde0ef3479 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_forwarding_rule_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_compute_forwarding_rule_test.go.erb @@ -12,12 +12,12 @@ import ( func TestAccComputeForwardingRule_update(t *testing.T) { t.Parallel() - poolName := fmt.Sprintf("tf-%s", RandString(t, 10)) - ruleName := fmt.Sprintf("tf-%s", RandString(t, 10)) + poolName := fmt.Sprintf("tf-%s", acctest.RandString(t, 10)) + ruleName := fmt.Sprintf("tf-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeForwardingRuleDestroyProducer(t), Steps: []resource.TestStep{ resource.TestStep{ @@ -43,15 +43,15 @@ func TestAccComputeForwardingRule_update(t *testing.T) { func TestAccComputeForwardingRule_ip(t *testing.T) { t.Parallel() - addrName := fmt.Sprintf("tf-%s", RandString(t, 10)) - poolName := fmt.Sprintf("tf-%s", RandString(t, 10)) - ruleName := fmt.Sprintf("tf-%s", RandString(t, 10)) + addrName := fmt.Sprintf("tf-%s", acctest.RandString(t, 10)) + poolName := fmt.Sprintf("tf-%s", acctest.RandString(t, 10)) + ruleName := fmt.Sprintf("tf-%s", acctest.RandString(t, 10)) addressRefFieldRaw := "address" addressRefFieldID := "id" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeForwardingRuleDestroyProducer(t), Steps: []resource.TestStep{ resource.TestStep{ @@ -80,12 +80,12 @@ func TestAccComputeForwardingRule_internalTcpUdpLbWithMigBackendExampleUpdate(t t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ - PreCheck: func() { AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderBetaFactories(t), + acctest.VcrTest(t, resource.TestCase{ + PreCheck: func() { acctest.AccTestPreCheck(t) }, + ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), CheckDestroy: testAccCheckComputeForwardingRuleDestroyProducer(t), Steps: []resource.TestStep{ { @@ -114,12 +114,12 @@ func TestAccComputeForwardingRule_internalTcpUdpLbWithMigBackendExampleUpdate(t func TestAccComputeForwardingRule_networkTier(t *testing.T) { t.Parallel() - poolName := fmt.Sprintf("tf-%s", RandString(t, 10)) - ruleName := fmt.Sprintf("tf-%s", RandString(t, 10)) + poolName := fmt.Sprintf("tf-%s", acctest.RandString(t, 10)) + ruleName := fmt.Sprintf("tf-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeForwardingRuleDestroyProducer(t), Steps: []resource.TestStep{ resource.TestStep{ @@ -139,14 +139,14 @@ func TestAccComputeForwardingRule_networkTier(t *testing.T) { func TestAccComputeForwardingRule_serviceDirectoryRegistrations(t *testing.T) { t.Parallel() - poolName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - ruleName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - svcDirNamespace := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - serviceName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + poolName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + ruleName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + svcDirNamespace := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + serviceName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeForwardingRuleDestroyProducer(t), Steps: []resource.TestStep{ resource.TestStep{ @@ -167,12 +167,12 @@ func TestAccComputeForwardingRule_forwardingRuleVpcPscExampleUpdate(t *testing.T t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ - PreCheck: func() { AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + acctest.VcrTest(t, resource.TestCase{ + PreCheck: func() { acctest.AccTestPreCheck(t) }, + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeForwardingRuleDestroyProducer(t), Steps: []resource.TestStep{ resource.TestStep{ @@ -199,12 +199,12 @@ func TestAccComputeForwardingRule_forwardingRuleRegionalSteeringExampleUpdate(t t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ - PreCheck: func() { AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + acctest.VcrTest(t, resource.TestCase{ + PreCheck: func() { acctest.AccTestPreCheck(t) }, + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeForwardingRuleDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_compute_global_address_test.go.erb b/mmv1/third_party/terraform/tests/resource_compute_global_address_test.go.erb index 631a43020038..2f4640524dda 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_global_address_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_compute_global_address_test.go.erb @@ -12,13 +12,13 @@ import ( func TestAccComputeGlobalAddress_ipv6(t *testing.T) { t.Parallel() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeGlobalAddressDestroyProducer(t), Steps: []resource.TestStep{ resource.TestStep{ - Config: testAccComputeGlobalAddress_ipv6(RandString(t, 10)), + Config: testAccComputeGlobalAddress_ipv6(acctest.RandString(t, 10)), }, resource.TestStep{ ResourceName: "google_compute_global_address.foobar", @@ -32,13 +32,13 @@ func TestAccComputeGlobalAddress_ipv6(t *testing.T) { func TestAccComputeGlobalAddress_internal(t *testing.T) { t.Parallel() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeGlobalAddressDestroyProducer(t), Steps: []resource.TestStep{ resource.TestStep{ - Config: testAccComputeGlobalAddress_internal(RandString(t, 10), RandString(t, 10)), + Config: testAccComputeGlobalAddress_internal(acctest.RandString(t, 10), acctest.RandString(t, 10)), }, resource.TestStep{ ResourceName: "google_compute_global_address.foobar", diff --git a/mmv1/third_party/terraform/tests/resource_compute_global_forwarding_rule_test.go.erb b/mmv1/third_party/terraform/tests/resource_compute_global_forwarding_rule_test.go.erb index c979008fe3a8..d4019090f1a2 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_global_forwarding_rule_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_compute_global_forwarding_rule_test.go.erb @@ -13,16 +13,16 @@ import ( func TestAccComputeGlobalForwardingRule_updateTarget(t *testing.T) { t.Parallel() - fr := fmt.Sprintf("forwardrule-test-%s", RandString(t, 10)) - proxy := fmt.Sprintf("forwardrule-test-%s", RandString(t, 10)) - proxyUpdated := fmt.Sprintf("forwardrule-test-%s", RandString(t, 10)) - backend := fmt.Sprintf("forwardrule-test-%s", RandString(t, 10)) - hc := fmt.Sprintf("forwardrule-test-%s", RandString(t, 10)) - urlmap := fmt.Sprintf("forwardrule-test-%s", RandString(t, 10)) - - VcrTest(t, resource.TestCase{ + fr := fmt.Sprintf("forwardrule-test-%s", acctest.RandString(t, 10)) + proxy := fmt.Sprintf("forwardrule-test-%s", acctest.RandString(t, 10)) + proxyUpdated := fmt.Sprintf("forwardrule-test-%s", acctest.RandString(t, 10)) + backend := fmt.Sprintf("forwardrule-test-%s", acctest.RandString(t, 10)) + hc := fmt.Sprintf("forwardrule-test-%s", acctest.RandString(t, 10)) + urlmap := fmt.Sprintf("forwardrule-test-%s", acctest.RandString(t, 10)) + + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeGlobalForwardingRuleDestroyProducer(t), Steps: []resource.TestStep{ { @@ -58,15 +58,15 @@ func TestAccComputeGlobalForwardingRule_updateTarget(t *testing.T) { func TestAccComputeGlobalForwardingRule_ipv6(t *testing.T) { t.Parallel() - fr := fmt.Sprintf("forwardrule-test-%s", RandString(t, 10)) - proxy := fmt.Sprintf("forwardrule-test-%s", RandString(t, 10)) - backend := fmt.Sprintf("forwardrule-test-%s", RandString(t, 10)) - hc := fmt.Sprintf("forwardrule-test-%s", RandString(t, 10)) - urlmap := fmt.Sprintf("forwardrule-test-%s", RandString(t, 10)) + fr := fmt.Sprintf("forwardrule-test-%s", acctest.RandString(t, 10)) + proxy := fmt.Sprintf("forwardrule-test-%s", acctest.RandString(t, 10)) + backend := fmt.Sprintf("forwardrule-test-%s", acctest.RandString(t, 10)) + hc := fmt.Sprintf("forwardrule-test-%s", acctest.RandString(t, 10)) + urlmap := fmt.Sprintf("forwardrule-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeGlobalForwardingRuleDestroyProducer(t), Steps: []resource.TestStep{ { @@ -90,15 +90,15 @@ func TestAccComputeGlobalForwardingRule_ipv6(t *testing.T) { func TestAccComputeGlobalForwardingRule_labels(t *testing.T) { t.Parallel() - fr := fmt.Sprintf("forwardrule-test-%s", RandString(t, 10)) - proxy := fmt.Sprintf("forwardrule-test-%s", RandString(t, 10)) - backend := fmt.Sprintf("forwardrule-test-%s", RandString(t, 10)) - hc := fmt.Sprintf("forwardrule-test-%s", RandString(t, 10)) - urlmap := fmt.Sprintf("forwardrule-test-%s", RandString(t, 10)) + fr := fmt.Sprintf("forwardrule-test-%s", acctest.RandString(t, 10)) + proxy := fmt.Sprintf("forwardrule-test-%s", acctest.RandString(t, 10)) + backend := fmt.Sprintf("forwardrule-test-%s", acctest.RandString(t, 10)) + hc := fmt.Sprintf("forwardrule-test-%s", acctest.RandString(t, 10)) + urlmap := fmt.Sprintf("forwardrule-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeGlobalForwardingRuleDestroyProducer(t), Steps: []resource.TestStep{ { @@ -128,17 +128,17 @@ func TestAccComputeGlobalForwardingRule_labels(t *testing.T) { func TestAccComputeGlobalForwardingRule_internalLoadBalancing(t *testing.T) { t.Parallel() - fr := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - proxy := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - backend := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - hc := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - urlmap := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - igm := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - it := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + fr := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + proxy := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + backend := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + hc := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + urlmap := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + igm := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + it := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeGlobalForwardingRuleDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_compute_global_network_endpoint_test.go.erb b/mmv1/third_party/terraform/tests/resource_compute_global_network_endpoint_test.go.erb index d4d98338b70d..d94893656460 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_global_network_endpoint_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_compute_global_network_endpoint_test.go.erb @@ -13,16 +13,16 @@ func TestAccComputeGlobalNetworkEndpoint_networkEndpointsBasic(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), "default_port": 90, "modified_port": 100, } negId := fmt.Sprintf("projects/%s/global/networkEndpointGroups/neg-%s", envvar.GetTestProjectFromEnv(), context["random_suffix"]) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { // Create one endpoint diff --git a/mmv1/third_party/terraform/tests/resource_compute_health_check_test.go.erb b/mmv1/third_party/terraform/tests/resource_compute_health_check_test.go.erb index a9f68554c03a..535dbaba67cd 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_health_check_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_compute_health_check_test.go.erb @@ -13,11 +13,11 @@ import ( func TestAccComputeHealthCheck_tcp_update(t *testing.T) { t.Parallel() - hckName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + hckName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeHealthCheckDestroyProducer(t), Steps: []resource.TestStep{ { @@ -43,11 +43,11 @@ func TestAccComputeHealthCheck_tcp_update(t *testing.T) { func TestAccComputeHealthCheck_ssl_port_spec(t *testing.T) { t.Parallel() - hckName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + hckName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeHealthCheckDestroyProducer(t), Steps: []resource.TestStep{ { @@ -65,11 +65,11 @@ func TestAccComputeHealthCheck_ssl_port_spec(t *testing.T) { func TestAccComputeHealthCheck_http_port_spec(t *testing.T) { t.Parallel() - hckName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + hckName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeHealthCheckDestroyProducer(t), Steps: []resource.TestStep{ { @@ -86,11 +86,11 @@ func TestAccComputeHealthCheck_http_port_spec(t *testing.T) { func TestAccComputeHealthCheck_https_serving_port(t *testing.T) { t.Parallel() - hckName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + hckName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeHealthCheckDestroyProducer(t), Steps: []resource.TestStep{ { @@ -108,11 +108,11 @@ func TestAccComputeHealthCheck_https_serving_port(t *testing.T) { func TestAccComputeHealthCheck_typeTransition(t *testing.T) { t.Parallel() - hckName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + hckName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeHealthCheckDestroyProducer(t), Steps: []resource.TestStep{ { @@ -142,11 +142,11 @@ func TestAccComputeHealthCheck_tcpAndSsl_shouldFail(t *testing.T) { acctest.SkipIfVcr(t) t.Parallel() - hckName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + hckName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeHealthCheckDestroyProducer(t), Steps: []resource.TestStep{ { @@ -161,11 +161,11 @@ func TestAccComputeHealthCheck_tcpAndSsl_shouldFail(t *testing.T) { func TestAccComputeHealthCheck_logConfigDisabled(t *testing.T) { t.Parallel() - hckName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + hckName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeHealthCheckDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_compute_http_health_check_test.go.erb b/mmv1/third_party/terraform/tests/resource_compute_http_health_check_test.go.erb index fab7e8922bac..8d429e91917f 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_http_health_check_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_compute_http_health_check_test.go.erb @@ -21,11 +21,11 @@ func TestAccComputeHttpHealthCheck_update(t *testing.T) { var healthCheck compute.HttpHealthCheck - hhckName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + hhckName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeHttpHealthCheckDestroyProducer(t), Steps: []resource.TestStep{ { @@ -65,7 +65,7 @@ func testAccCheckComputeHttpHealthCheckExists(t *testing.T, n string, healthChec return fmt.Errorf("No name is set") } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) found, err := config.NewComputeClient(config.UserAgent).HttpHealthChecks.Get( config.Project, rs.Primary.Attributes["name"]).Do() diff --git a/mmv1/third_party/terraform/tests/resource_compute_https_health_check_test.go b/mmv1/third_party/terraform/tests/resource_compute_https_health_check_test.go index 3b6c2ccdf60a..8018237772ac 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_https_health_check_test.go +++ b/mmv1/third_party/terraform/tests/resource_compute_https_health_check_test.go @@ -11,11 +11,11 @@ import ( func TestAccComputeHttpsHealthCheck_update(t *testing.T) { t.Parallel() - hhckName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + hhckName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeHttpsHealthCheckDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_compute_image_test.go.erb b/mmv1/third_party/terraform/tests/resource_compute_image_test.go.erb index a6bfb18ff0a1..9b2d020e50c9 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_image_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_compute_image_test.go.erb @@ -22,13 +22,13 @@ import ( func TestAccComputeImage_withLicense(t *testing.T) { t.Parallel() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeImageDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccComputeImage_license("image-test-" + RandString(t, 10)), + Config: testAccComputeImage_license("image-test-" + acctest.RandString(t, 10)), }, { ResourceName: "google_compute_image.foobar", @@ -44,11 +44,11 @@ func TestAccComputeImage_update(t *testing.T) { var image compute.Image - name := "image-test-" + RandString(t, 10) + name := "image-test-" + acctest.RandString(t, 10) // Only labels supports an update - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeImageDestroyProducer(t), Steps: []resource.TestStep{ { @@ -85,13 +85,13 @@ func TestAccComputeImage_basedondisk(t *testing.T) { var image compute.Image - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeImageDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccComputeImage_basedondisk(RandString(t, 10), RandString(t, 10)), + Config: testAccComputeImage_basedondisk(acctest.RandString(t, 10), acctest.RandString(t, 10)), Check: resource.ComposeTestCheckFunc( testAccCheckComputeImageExists( t, "google_compute_image.foobar", &image), @@ -111,11 +111,11 @@ func TestAccComputeImage_sourceImage(t *testing.T) { t.Parallel() var image compute.Image - imageName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + imageName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeImageDestroyProducer(t), Steps: []resource.TestStep{ { @@ -140,13 +140,13 @@ func TestAccComputeImage_sourceSnapshot(t *testing.T) { var image compute.Image - diskName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - snapshotName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - imageName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + diskName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + snapshotName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + imageName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeImageDestroyProducer(t), Steps: []resource.TestStep{ { @@ -177,7 +177,7 @@ func testAccCheckComputeImageExists(t *testing.T, n string, image *compute.Image return fmt.Errorf("No name is set") } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) found, err := config.NewComputeClient(config.UserAgent).Images.Get( config.Project, rs.Primary.Attributes["name"]).Do() @@ -199,13 +199,13 @@ func TestAccComputeImage_resolveImage(t *testing.T) { t.Parallel() var image compute.Image - rand := RandString(t, 10) + rand := acctest.RandString(t, 10) name := fmt.Sprintf("test-image-%s", rand) fam := fmt.Sprintf("test-image-family-%s", rand) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeImageDestroyProducer(t), Steps: []resource.TestStep{ { @@ -227,13 +227,13 @@ func TestAccComputeImage_imageEncryptionKey(t *testing.T) { kmsKeyName := tpgresource.GetResourceNameFromSelfLink(kmsKey.CryptoKey.Name) kmsRingName := tpgresource.GetResourceNameFromSelfLink(kmsKey.KeyRing.Name) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceTemplateDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccComputeImage_imageEncryptionKey(kmsRingName, kmsKeyName, RandString(t, 10)), + Config: testAccComputeImage_imageEncryptionKey(kmsRingName, kmsKeyName, acctest.RandString(t, 10)), }, { ResourceName: "google_compute_image.image", @@ -246,7 +246,7 @@ func TestAccComputeImage_imageEncryptionKey(t *testing.T) { func testAccCheckComputeImageResolution(t *testing.T, n string) resource.TestCheckFunc { return func(s *terraform.State) error { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) project := config.Project rs, ok := s.RootModule().Resources[n] diff --git a/mmv1/third_party/terraform/tests/resource_compute_instance_from_machine_image_test.go.erb b/mmv1/third_party/terraform/tests/resource_compute_instance_from_machine_image_test.go.erb index 4b72f29b5676..9a66b85d4bd5 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_instance_from_machine_image_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_compute_instance_from_machine_image_test.go.erb @@ -22,13 +22,13 @@ func TestAccComputeInstanceFromMachineImage_basic(t *testing.T) { t.Parallel() var instance compute.Instance - instanceName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - generatedInstanceName := fmt.Sprintf("tf-test-generated-%s", RandString(t, 10)) + instanceName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + generatedInstanceName := fmt.Sprintf("tf-test-generated-%s", acctest.RandString(t, 10)) resourceName := "google_compute_instance_from_machine_image.foobar" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderBetaFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), CheckDestroy: testAccCheckComputeInstanceFromMachineImageDestroyProducer(t), Steps: []resource.TestStep{ { @@ -50,13 +50,13 @@ func TestAccComputeInstanceFromMachineImage_overrideMetadataDotStartupScript(t * t.Parallel() var instance compute.Instance - instanceName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - generatedInstanceName := fmt.Sprintf("tf-test-generated-%s", RandString(t, 10)) + instanceName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + generatedInstanceName := fmt.Sprintf("tf-test-generated-%s", acctest.RandString(t, 10)) resourceName := "google_compute_instance_from_machine_image.foobar" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderBetaFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), CheckDestroy: testAccCheckComputeInstanceFromMachineImageDestroyProducer(t), Steps: []resource.TestStep{ { @@ -75,16 +75,16 @@ func TestAccComputeInstanceFromMachineImage_diffProject(t *testing.T) { t.Parallel() var instance compute.Instance - instanceName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - generatedInstanceName := fmt.Sprintf("tf-test-generated-%s", RandString(t, 10)) + instanceName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + generatedInstanceName := fmt.Sprintf("tf-test-generated-%s", acctest.RandString(t, 10)) resourceName := "google_compute_instance_from_machine_image.foobar" org := envvar.GetTestOrgFromEnv(t) billingId := envvar.GetTestBillingAccountFromEnv(t) - projectID := fmt.Sprintf("tf-test-%d", RandInt(t)) + projectID := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderBetaFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), CheckDestroy: testAccCheckComputeInstanceFromMachineImageDestroyProducer(t), Steps: []resource.TestStep{ { @@ -104,7 +104,7 @@ func TestAccComputeInstanceFromMachineImage_diffProject(t *testing.T) { func testAccCheckComputeInstanceFromMachineImageDestroyProducer(t *testing.T) func(s *terraform.State) error { return func(s *terraform.State) error { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) for _, rs := range s.RootModule().Resources { if rs.Type != "google_compute_instance_from_machine_image" { diff --git a/mmv1/third_party/terraform/tests/resource_compute_instance_from_template_test.go.erb b/mmv1/third_party/terraform/tests/resource_compute_instance_from_template_test.go.erb index a775d8e6dfa9..a03df465315c 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_instance_from_template_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_compute_instance_from_template_test.go.erb @@ -21,13 +21,13 @@ func TestAccComputeInstanceFromTemplate_basic(t *testing.T) { t.Parallel() var instance compute.Instance - instanceName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - templateName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + instanceName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + templateName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) resourceName := "google_compute_instance_from_template.foobar" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceFromTemplateDestroyProducer(t), Steps: []resource.TestStep{ { @@ -49,13 +49,13 @@ func TestAccComputeInstanceFromTemplate_self_link_unique(t *testing.T) { t.Parallel() var instance compute.Instance - instanceName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - templateName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + instanceName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + templateName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) resourceName := "google_compute_instance_from_template.foobar" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceFromTemplateDestroyProducer(t), Steps: []resource.TestStep{ { @@ -79,13 +79,13 @@ func TestAccComputeInstanceFromRegionTemplate_basic(t *testing.T) { t.Parallel() var instance compute.Instance - instanceName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - templateName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + instanceName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + templateName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) resourceName := "google_compute_instance_from_template.foobar" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceFromTemplateDestroyProducer(t), Steps: []resource.TestStep{ { @@ -109,15 +109,15 @@ func TestAccComputeInstanceFromTemplate_overrideBootDisk(t *testing.T) { t.Parallel() var instance compute.Instance - instanceName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - templateName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - templateDisk := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - overrideDisk := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + instanceName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + templateName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + templateDisk := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + overrideDisk := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) resourceName := "google_compute_instance_from_template.inst" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceFromTemplateDestroyProducer(t), Steps: []resource.TestStep{ { @@ -138,15 +138,15 @@ func TestAccComputeInstanceFromTemplate_overrideAttachedDisk(t *testing.T) { t.Parallel() var instance compute.Instance - instanceName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - templateName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - templateDisk := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - overrideDisk := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + instanceName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + templateName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + templateDisk := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + overrideDisk := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) resourceName := "google_compute_instance_from_template.inst" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceFromTemplateDestroyProducer(t), Steps: []resource.TestStep{ { @@ -167,15 +167,15 @@ func TestAccComputeInstanceFromTemplate_overrideScratchDisk(t *testing.T) { t.Parallel() var instance compute.Instance - instanceName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - templateName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - templateDisk := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - overrideDisk := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + instanceName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + templateName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + templateDisk := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + overrideDisk := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) resourceName := "google_compute_instance_from_template.inst" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceFromTemplateDestroyProducer(t), Steps: []resource.TestStep{ { @@ -196,14 +196,14 @@ func TestAccComputeInstanceFromTemplate_overrideScheduling(t *testing.T) { t.Parallel() var instance compute.Instance - instanceName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - templateName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - templateDisk := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + instanceName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + templateName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + templateDisk := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) resourceName := "google_compute_instance_from_template.inst" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceFromTemplateDestroyProducer(t), Steps: []resource.TestStep{ { @@ -220,8 +220,8 @@ func TestAccComputeInstanceFromTemplate_012_removableFields(t *testing.T) { t.Parallel() var instance compute.Instance - instanceName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - templateName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + instanceName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + templateName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) resourceName := "google_compute_instance_from_template.inst" // First config is a basic instance from template, second tests the empty list syntax @@ -230,9 +230,9 @@ func TestAccComputeInstanceFromTemplate_012_removableFields(t *testing.T) { config2 := testAccComputeInstanceFromTemplate_012_removableFieldsTpl(templateName) + testAccComputeInstanceFromTemplate_012_removableFields2(instanceName) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceFromTemplateDestroyProducer(t), Steps: []resource.TestStep{ { @@ -261,13 +261,13 @@ func TestAccComputeInstanceFromTemplate_012_removableFields(t *testing.T) { func TestAccComputeInstanceFromTemplate_overrideMetadataDotStartupScript(t *testing.T) { var instance compute.Instance - instanceName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - templateName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + instanceName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + templateName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) resourceName := "google_compute_instance_from_template.inst" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceFromTemplateDestroyProducer(t), Steps: []resource.TestStep{ { @@ -284,7 +284,7 @@ func TestAccComputeInstanceFromTemplate_overrideMetadataDotStartupScript(t *test func testAccCheckComputeInstanceFromTemplateDestroyProducer(t *testing.T) func(s *terraform.State) error { return func(s *terraform.State) error { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) for _, rs := range s.RootModule().Resources { if rs.Type != "google_compute_instance_from_template" { diff --git a/mmv1/third_party/terraform/tests/resource_compute_instance_group_manager_test.go.erb b/mmv1/third_party/terraform/tests/resource_compute_instance_group_manager_test.go.erb index a624a7c1a003..3642b4c57775 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_instance_group_manager_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_compute_instance_group_manager_test.go.erb @@ -13,14 +13,14 @@ import ( func TestAccInstanceGroupManager_basic(t *testing.T) { t.Parallel() - template := fmt.Sprintf("tf-test-igm-%s", RandString(t, 10)) - target := fmt.Sprintf("tf-test-igm-%s", RandString(t, 10)) - igm1 := fmt.Sprintf("tf-test-igm-%s", RandString(t, 10)) - igm2 := fmt.Sprintf("tf-test-igm-%s", RandString(t, 10)) + template := fmt.Sprintf("tf-test-igm-%s", acctest.RandString(t, 10)) + target := fmt.Sprintf("tf-test-igm-%s", acctest.RandString(t, 10)) + igm1 := fmt.Sprintf("tf-test-igm-%s", acctest.RandString(t, 10)) + igm2 := fmt.Sprintf("tf-test-igm-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckInstanceGroupManagerDestroyProducer(t), Steps: []resource.TestStep{ { @@ -45,14 +45,14 @@ func TestAccInstanceGroupManager_basic(t *testing.T) { func TestAccInstanceGroupManager_self_link_unique(t *testing.T) { t.Parallel() - template := fmt.Sprintf("tf-test-igm-%s", RandString(t, 10)) - target := fmt.Sprintf("tf-test-igm-%s", RandString(t, 10)) - igm1 := fmt.Sprintf("tf-test-igm-%s", RandString(t, 10)) - igm2 := fmt.Sprintf("tf-test-igm-%s", RandString(t, 10)) + template := fmt.Sprintf("tf-test-igm-%s", acctest.RandString(t, 10)) + target := fmt.Sprintf("tf-test-igm-%s", acctest.RandString(t, 10)) + igm1 := fmt.Sprintf("tf-test-igm-%s", acctest.RandString(t, 10)) + igm2 := fmt.Sprintf("tf-test-igm-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckInstanceGroupManagerDestroyProducer(t), Steps: []resource.TestStep{ { @@ -77,12 +77,12 @@ func TestAccInstanceGroupManager_self_link_unique(t *testing.T) { func TestAccInstanceGroupManager_targetSizeZero(t *testing.T) { t.Parallel() - templateName := fmt.Sprintf("tf-test-igm-%s", RandString(t, 10)) - igmName := fmt.Sprintf("tf-test-igm-%s", RandString(t, 10)) + templateName := fmt.Sprintf("tf-test-igm-%s", acctest.RandString(t, 10)) + igmName := fmt.Sprintf("tf-test-igm-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckInstanceGroupManagerDestroyProducer(t), Steps: []resource.TestStep{ { @@ -101,17 +101,17 @@ func TestAccInstanceGroupManager_targetSizeZero(t *testing.T) { func TestAccInstanceGroupManager_update(t *testing.T) { t.Parallel() - template1 := fmt.Sprintf("tf-test-igm-%s", RandString(t, 10)) - target1 := fmt.Sprintf("tf-test-igm-%s", RandString(t, 10)) - target2 := fmt.Sprintf("tf-test-igm-%s", RandString(t, 10)) - template2 := fmt.Sprintf("tf-test-igm-%s", RandString(t, 10)) - igm := fmt.Sprintf("tf-test-igm-%s", RandString(t, 10)) + template1 := fmt.Sprintf("tf-test-igm-%s", acctest.RandString(t, 10)) + target1 := fmt.Sprintf("tf-test-igm-%s", acctest.RandString(t, 10)) + target2 := fmt.Sprintf("tf-test-igm-%s", acctest.RandString(t, 10)) + template2 := fmt.Sprintf("tf-test-igm-%s", acctest.RandString(t, 10)) + igm := fmt.Sprintf("tf-test-igm-%s", acctest.RandString(t, 10)) description := "Manager 1" description2 := "Manager 2" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckInstanceGroupManagerDestroyProducer(t), Steps: []resource.TestStep{ { @@ -152,11 +152,11 @@ func TestAccInstanceGroupManager_updateLifecycle(t *testing.T) { tag1 := "tag1" tag2 := "tag2" - igm := fmt.Sprintf("tf-test-igm-%s", RandString(t, 10)) + igm := fmt.Sprintf("tf-test-igm-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckInstanceGroupManagerDestroyProducer(t), Steps: []resource.TestStep{ { @@ -186,11 +186,11 @@ func TestAccInstanceGroupManager_updatePolicy(t *testing.T) { acctest.SkipIfVcr(t) t.Parallel() - igm := fmt.Sprintf("tf-test-igm-%s", RandString(t, 10)) + igm := fmt.Sprintf("tf-test-igm-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckInstanceGroupManagerDestroyProducer(t), Steps: []resource.TestStep{ { @@ -248,12 +248,12 @@ func TestAccInstanceGroupManager_separateRegions(t *testing.T) { acctest.SkipIfVcr(t) t.Parallel() - igm1 := fmt.Sprintf("tf-test-igm-%s", RandString(t, 10)) - igm2 := fmt.Sprintf("tf-test-igm-%s", RandString(t, 10)) + igm1 := fmt.Sprintf("tf-test-igm-%s", acctest.RandString(t, 10)) + igm2 := fmt.Sprintf("tf-test-igm-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckInstanceGroupManagerDestroyProducer(t), Steps: []resource.TestStep{ { @@ -278,13 +278,13 @@ func TestAccInstanceGroupManager_separateRegions(t *testing.T) { func TestAccInstanceGroupManager_versions(t *testing.T) { t.Parallel() - primaryTemplate := fmt.Sprintf("tf-test-igm-%s", RandString(t, 10)) - canaryTemplate := fmt.Sprintf("tf-test-igm-%s", RandString(t, 10)) - igm := fmt.Sprintf("tf-test-igm-%s", RandString(t, 10)) + primaryTemplate := fmt.Sprintf("tf-test-igm-%s", acctest.RandString(t, 10)) + canaryTemplate := fmt.Sprintf("tf-test-igm-%s", acctest.RandString(t, 10)) + igm := fmt.Sprintf("tf-test-igm-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckInstanceGroupManagerDestroyProducer(t), Steps: []resource.TestStep{ { @@ -303,14 +303,14 @@ func TestAccInstanceGroupManager_versions(t *testing.T) { func TestAccInstanceGroupManager_autoHealingPolicies(t *testing.T) { t.Parallel() - template := fmt.Sprintf("tf-test-igm-%s", RandString(t, 10)) - target := fmt.Sprintf("tf-test-igm-%s", RandString(t, 10)) - igm := fmt.Sprintf("tf-test-igm-%s", RandString(t, 10)) - hck := fmt.Sprintf("tf-test-igm-%s", RandString(t, 10)) + template := fmt.Sprintf("tf-test-igm-%s", acctest.RandString(t, 10)) + target := fmt.Sprintf("tf-test-igm-%s", acctest.RandString(t, 10)) + igm := fmt.Sprintf("tf-test-igm-%s", acctest.RandString(t, 10)) + hck := fmt.Sprintf("tf-test-igm-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckInstanceGroupManagerDestroyProducer(t), Steps: []resource.TestStep{ { @@ -338,15 +338,15 @@ func TestAccInstanceGroupManager_autoHealingPolicies(t *testing.T) { func TestAccInstanceGroupManager_stateful(t *testing.T) { t.Parallel() - template := fmt.Sprintf("tf-test-igm-%s", RandString(t, 10)) - target := fmt.Sprintf("tf-test-igm-%s", RandString(t, 10)) - igm := fmt.Sprintf("tf-test-igm-%s", RandString(t, 10)) - hck := fmt.Sprintf("tf-test-igm-%s", RandString(t, 10)) - network := fmt.Sprintf("tf-test-igm-%s", RandString(t, 10)) + template := fmt.Sprintf("tf-test-igm-%s", acctest.RandString(t, 10)) + target := fmt.Sprintf("tf-test-igm-%s", acctest.RandString(t, 10)) + igm := fmt.Sprintf("tf-test-igm-%s", acctest.RandString(t, 10)) + hck := fmt.Sprintf("tf-test-igm-%s", acctest.RandString(t, 10)) + network := fmt.Sprintf("tf-test-igm-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckInstanceGroupManagerDestroyProducer(t), Steps: []resource.TestStep{ { @@ -383,14 +383,14 @@ func TestAccInstanceGroupManager_stateful(t *testing.T) { func TestAccInstanceGroupManager_waitForStatus(t *testing.T) { t.Parallel() - template := fmt.Sprintf("tf-test-igm-%s", RandString(t, 10)) - target := fmt.Sprintf("tf-test-igm-%s", RandString(t, 10)) - igm := fmt.Sprintf("tf-test-igm-%s", RandString(t, 10)) - perInstanceConfig := fmt.Sprintf("tf-test-config-%s", RandString(t, 10)) + template := fmt.Sprintf("tf-test-igm-%s", acctest.RandString(t, 10)) + target := fmt.Sprintf("tf-test-igm-%s", acctest.RandString(t, 10)) + igm := fmt.Sprintf("tf-test-igm-%s", acctest.RandString(t, 10)) + perInstanceConfig := fmt.Sprintf("tf-test-config-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckInstanceGroupManagerDestroyProducer(t), Steps: []resource.TestStep{ { @@ -417,7 +417,7 @@ func TestAccInstanceGroupManager_waitForStatus(t *testing.T) { func testAccCheckInstanceGroupManagerDestroyProducer(t *testing.T) func(s *terraform.State) error { return func(s *terraform.State) error { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) for _, rs := range s.RootModule().Resources { if rs.Type != "google_compute_instance_group_manager" { diff --git a/mmv1/third_party/terraform/tests/resource_compute_instance_group_test.go.erb b/mmv1/third_party/terraform/tests/resource_compute_instance_group_test.go.erb index 35c2923e55ed..56441b97456e 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_instance_group_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_compute_instance_group_test.go.erb @@ -22,12 +22,12 @@ func TestAccComputeInstanceGroup_basic(t *testing.T) { var instanceGroup compute.InstanceGroup var resourceName = "google_compute_instance_group.basic" - var instanceName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) + var instanceName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) var zone = "us-central1-c" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccComputeInstanceGroup_destroyProducer(t), Steps: []resource.TestStep{ { @@ -57,14 +57,14 @@ func TestAccComputeInstanceGroup_basic(t *testing.T) { func TestAccComputeInstanceGroup_rename(t *testing.T) { t.Parallel() - var instanceName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) - var instanceGroupName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) - var backendName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) - var healthName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) + var instanceName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + var instanceGroupName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + var backendName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + var healthName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccComputeInstanceGroup_destroyProducer(t), Steps: []resource.TestStep{ { @@ -91,11 +91,11 @@ func TestAccComputeInstanceGroup_update(t *testing.T) { t.Parallel() var instanceGroup compute.InstanceGroup - var instanceName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) + var instanceName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccComputeInstanceGroup_destroyProducer(t), Steps: []resource.TestStep{ { @@ -132,11 +132,11 @@ func TestAccComputeInstanceGroup_outOfOrderInstances(t *testing.T) { t.Parallel() var instanceGroup compute.InstanceGroup - var instanceName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) + var instanceName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccComputeInstanceGroup_destroyProducer(t), Steps: []resource.TestStep{ { @@ -154,11 +154,11 @@ func TestAccComputeInstanceGroup_network(t *testing.T) { t.Parallel() var instanceGroup compute.InstanceGroup - var instanceName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) + var instanceName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccComputeInstanceGroup_destroyProducer(t), Steps: []resource.TestStep{ { @@ -180,7 +180,7 @@ func TestAccComputeInstanceGroup_network(t *testing.T) { func testAccComputeInstanceGroup_destroyProducer(t *testing.T) func(s *terraform.State) error { return func(s *terraform.State) error { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) for _, rs := range s.RootModule().Resources { if rs.Type != "google_compute_instance_group" { @@ -208,7 +208,7 @@ func testAccComputeInstanceGroup_exists(t *testing.T, n string, instanceGroup *c return fmt.Errorf("No ID is set") } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) found, err := config.NewComputeClient(config.UserAgent).InstanceGroups.Get( config.Project, rs.Primary.Attributes["zone"], rs.Primary.Attributes["name"]).Do() @@ -233,7 +233,7 @@ func testAccComputeInstanceGroup_updated(t *testing.T, n string, size int64, ins return fmt.Errorf("No ID is set") } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) instanceGroup, err := config.NewComputeClient(config.UserAgent).InstanceGroups.Get( config.Project, rs.Primary.Attributes["zone"], rs.Primary.Attributes["name"]).Do() @@ -262,7 +262,7 @@ func testAccComputeInstanceGroup_named_ports(t *testing.T, n string, np map[stri return fmt.Errorf("No ID is set") } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) instanceGroup, err := config.NewComputeClient(config.UserAgent).InstanceGroups.Get( config.Project, rs.Primary.Attributes["zone"], rs.Primary.Attributes["name"]).Do() @@ -289,7 +289,7 @@ func testAccComputeInstanceGroup_named_ports(t *testing.T, n string, np map[stri func testAccComputeInstanceGroup_hasCorrectNetwork(t *testing.T, nInstanceGroup string, nNetwork string, instanceGroup *compute.InstanceGroup) resource.TestCheckFunc { return func(s *terraform.State) error { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) rsInstanceGroup, ok := s.RootModule().Resources[nInstanceGroup] if !ok { diff --git a/mmv1/third_party/terraform/tests/resource_compute_instance_iam_test.go b/mmv1/third_party/terraform/tests/resource_compute_instance_iam_test.go index b745e29940e8..378850467992 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_instance_iam_test.go +++ b/mmv1/third_party/terraform/tests/resource_compute_instance_iam_test.go @@ -17,11 +17,11 @@ func TestAccComputeInstanceIamPolicy(t *testing.T) { project := envvar.GetTestProjectFromEnv() role := "roles/compute.osLogin" zone := envvar.GetTestZoneFromEnv() - instanceName := fmt.Sprintf("tf-test-instance-%s", RandString(t, 10)) + instanceName := fmt.Sprintf("tf-test-instance-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccComputeInstanceIamPolicy_basic(zone, instanceName, role), diff --git a/mmv1/third_party/terraform/tests/resource_compute_instance_migrate_test.go.erb b/mmv1/third_party/terraform/tests/resource_compute_instance_migrate_test.go.erb index 3f5ec2bd6a32..2c2b3446c1c7 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_instance_migrate_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_compute_instance_migrate_test.go.erb @@ -95,7 +95,7 @@ func TestAccComputeInstanceMigrateState(t *testing.T) { config := getInitializedConfig(t) - instanceName := fmt.Sprintf("instance-test-%s", RandString(t, 10)) + instanceName := fmt.Sprintf("instance-test-%s", acctest.RandString(t, 10)) instance := &compute.Instance{ Name: instanceName, Disks: []*compute.AttachedDisk{ @@ -167,7 +167,7 @@ func TestAccComputeInstanceMigrateState_bootDisk(t *testing.T) { zone := "us-central1-f" // Seed test data - instanceName := fmt.Sprintf("instance-test-%s", RandString(t, 10)) + instanceName := fmt.Sprintf("instance-test-%s", acctest.RandString(t, 10)) instance := &compute.Instance{ Name: instanceName, Disks: []*compute.AttachedDisk{ @@ -235,7 +235,7 @@ func TestAccComputeInstanceMigrateState_v4FixBootDisk(t *testing.T) { zone := "us-central1-f" // Seed test data - instanceName := fmt.Sprintf("instance-test-%s", RandString(t, 10)) + instanceName := fmt.Sprintf("instance-test-%s", acctest.RandString(t, 10)) instance := &compute.Instance{ Name: instanceName, Disks: []*compute.AttachedDisk{ @@ -302,7 +302,7 @@ func TestAccComputeInstanceMigrateState_attachedDiskFromSource(t *testing.T) { zone := "us-central1-f" // Seed test data - diskName := fmt.Sprintf("instance-test-%s", RandString(t, 10)) + diskName := fmt.Sprintf("instance-test-%s", acctest.RandString(t, 10)) disk := &compute.Disk{ Name: diskName, SourceImage: "projects/debian-cloud/global/images/family/debian-11", @@ -318,7 +318,7 @@ func TestAccComputeInstanceMigrateState_attachedDiskFromSource(t *testing.T) { } defer cleanUpDisk(config, diskName, zone) - instanceName := fmt.Sprintf("instance-test-%s", RandString(t, 10)) + instanceName := fmt.Sprintf("instance-test-%s", acctest.RandString(t, 10)) instance := &compute.Instance{ Name: instanceName, Disks: []*compute.AttachedDisk{ @@ -383,7 +383,7 @@ func TestAccComputeInstanceMigrateState_v4FixAttachedDiskFromSource(t *testing.T zone := "us-central1-f" // Seed test data - diskName := fmt.Sprintf("instance-test-%s", RandString(t, 10)) + diskName := fmt.Sprintf("instance-test-%s", acctest.RandString(t, 10)) disk := &compute.Disk{ Name: diskName, SourceImage: "projects/debian-cloud/global/images/family/debian-11", @@ -399,7 +399,7 @@ func TestAccComputeInstanceMigrateState_v4FixAttachedDiskFromSource(t *testing.T } defer cleanUpDisk(config, diskName, zone) - instanceName := fmt.Sprintf("instance-test-%s", RandString(t, 10)) + instanceName := fmt.Sprintf("instance-test-%s", acctest.RandString(t, 10)) instance := &compute.Instance{ Name: instanceName, Disks: []*compute.AttachedDisk{ @@ -462,7 +462,7 @@ func TestAccComputeInstanceMigrateState_attachedDiskFromEncryptionKey(t *testing config := getInitializedConfig(t) zone := "us-central1-f" - instanceName := fmt.Sprintf("instance-test-%s", RandString(t, 10)) + instanceName := fmt.Sprintf("instance-test-%s", acctest.RandString(t, 10)) instance := &compute.Instance{ Name: instanceName, Disks: []*compute.AttachedDisk{ @@ -531,7 +531,7 @@ func TestAccComputeInstanceMigrateState_v4FixAttachedDiskFromEncryptionKey(t *te config := getInitializedConfig(t) zone := "us-central1-f" - instanceName := fmt.Sprintf("instance-test-%s", RandString(t, 10)) + instanceName := fmt.Sprintf("instance-test-%s", acctest.RandString(t, 10)) instance := &compute.Instance{ Name: instanceName, Disks: []*compute.AttachedDisk{ @@ -599,7 +599,7 @@ func TestAccComputeInstanceMigrateState_attachedDiskFromAutoDeleteAndImage(t *te config := getInitializedConfig(t) zone := "us-central1-f" - instanceName := fmt.Sprintf("instance-test-%s", RandString(t, 10)) + instanceName := fmt.Sprintf("instance-test-%s", acctest.RandString(t, 10)) instance := &compute.Instance{ Name: instanceName, Disks: []*compute.AttachedDisk{ @@ -672,7 +672,7 @@ func TestAccComputeInstanceMigrateState_v4FixAttachedDiskFromAutoDeleteAndImage( config := getInitializedConfig(t) zone := "us-central1-f" - instanceName := fmt.Sprintf("instance-test-%s", RandString(t, 10)) + instanceName := fmt.Sprintf("instance-test-%s", acctest.RandString(t, 10)) instance := &compute.Instance{ Name: instanceName, Disks: []*compute.AttachedDisk{ @@ -745,7 +745,7 @@ func TestAccComputeInstanceMigrateState_scratchDisk(t *testing.T) { zone := "us-central1-f" // Seed test data - instanceName := fmt.Sprintf("instance-test-%s", RandString(t, 10)) + instanceName := fmt.Sprintf("instance-test-%s", acctest.RandString(t, 10)) instance := &compute.Instance{ Name: instanceName, Disks: []*compute.AttachedDisk{ @@ -811,7 +811,7 @@ func TestAccComputeInstanceMigrateState_v4FixScratchDisk(t *testing.T) { zone := "us-central1-f" // Seed test data - instanceName := fmt.Sprintf("instance-test-%s", RandString(t, 10)) + instanceName := fmt.Sprintf("instance-test-%s", acctest.RandString(t, 10)) instance := &compute.Instance{ Name: instanceName, Disks: []*compute.AttachedDisk{ diff --git a/mmv1/third_party/terraform/tests/resource_compute_instance_template_test.go.erb b/mmv1/third_party/terraform/tests/resource_compute_instance_template_test.go.erb index 714dd04b6b84..a8ff94cb4856 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_instance_template_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_compute_instance_template_test.go.erb @@ -33,13 +33,13 @@ func TestAccComputeInstanceTemplate_basic(t *testing.T) { var instanceTemplate compute.InstanceTemplate - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceTemplateDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccComputeInstanceTemplate_basic(RandString(t, 10)), + Config: testAccComputeInstanceTemplate_basic(acctest.RandString(t, 10)), Check: resource.ComposeTestCheckFunc( testAccCheckComputeInstanceTemplateExists( t, "google_compute_instance_template.foobar", &instanceTemplate), @@ -63,13 +63,13 @@ func TestAccComputeInstanceTemplate_imageShorthand(t *testing.T) { var instanceTemplate compute.InstanceTemplate - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceTemplateDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccComputeInstanceTemplate_imageShorthand(RandString(t, 10)), + Config: testAccComputeInstanceTemplate_imageShorthand(acctest.RandString(t, 10)), Check: resource.ComposeTestCheckFunc( testAccCheckComputeInstanceTemplateExists( t, "google_compute_instance_template.foobar", &instanceTemplate), @@ -89,13 +89,13 @@ func TestAccComputeInstanceTemplate_preemptible(t *testing.T) { var instanceTemplate compute.InstanceTemplate - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceTemplateDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccComputeInstanceTemplate_preemptible(RandString(t, 10)), + Config: testAccComputeInstanceTemplate_preemptible(acctest.RandString(t, 10)), Check: resource.ComposeTestCheckFunc( testAccCheckComputeInstanceTemplateExists( t, "google_compute_instance_template.foobar", &instanceTemplate), @@ -118,13 +118,13 @@ func TestAccComputeInstanceTemplate_maintenance_interval(t *testing.T) { var instanceTemplate compute.InstanceTemplate - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceTemplateDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccComputeInstanceTemplate_maintenance_interval(RandString(t, 10)), + Config: testAccComputeInstanceTemplate_maintenance_interval(acctest.RandString(t, 10)), Check: resource.ComposeTestCheckFunc( testAccCheckComputeInstanceTemplateExists( t, "google_compute_instance_template.foobar", &instanceTemplate), @@ -137,7 +137,7 @@ func TestAccComputeInstanceTemplate_maintenance_interval(t *testing.T) { ImportStateVerify: true, }, { - Config: testAccComputeInstanceTemplate_basic(RandString(t, 10)), + Config: testAccComputeInstanceTemplate_basic(acctest.RandString(t, 10)), Check: resource.ComposeTestCheckFunc( testAccCheckComputeInstanceTemplateExists( t, "google_compute_instance_template.foobar", &instanceTemplate), @@ -154,13 +154,13 @@ func TestAccComputeInstanceTemplate_IP(t *testing.T) { var instanceTemplate compute.InstanceTemplate - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceTemplateDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccComputeInstanceTemplate_ip(RandString(t, 10)), + Config: testAccComputeInstanceTemplate_ip(acctest.RandString(t, 10)), Check: resource.ComposeTestCheckFunc( testAccCheckComputeInstanceTemplateExists( t, "google_compute_instance_template.foobar", &instanceTemplate), @@ -181,13 +181,13 @@ func TestAccComputeInstanceTemplate_IPv6(t *testing.T) { var instanceTemplate compute.InstanceTemplate - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceTemplateDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccComputeInstanceTemplate_ipv6(RandString(t, 10)), + Config: testAccComputeInstanceTemplate_ipv6(acctest.RandString(t, 10)), Check: resource.ComposeTestCheckFunc( testAccCheckComputeInstanceTemplateExists( t, "google_compute_instance_template.foobar", &instanceTemplate), @@ -205,13 +205,13 @@ func TestAccComputeInstanceTemplate_IPv6(t *testing.T) { func TestAccComputeInstanceTemplate_networkTier(t *testing.T) { t.Parallel() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceTemplateDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccComputeInstanceTemplate_networkTier(RandString(t, 10)), + Config: testAccComputeInstanceTemplate_networkTier(acctest.RandString(t, 10)), }, { ResourceName: "google_compute_instance_template.foobar", @@ -228,13 +228,13 @@ func TestAccComputeInstanceTemplate_networkIP(t *testing.T) { var instanceTemplate compute.InstanceTemplate networkIP := "10.128.0.2" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceTemplateDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccComputeInstanceTemplate_networkIP(RandString(t, 10), networkIP), + Config: testAccComputeInstanceTemplate_networkIP(acctest.RandString(t, 10), networkIP), Check: resource.ComposeTestCheckFunc( testAccCheckComputeInstanceTemplateExists( t, "google_compute_instance_template.foobar", &instanceTemplate), @@ -258,13 +258,13 @@ func TestAccComputeInstanceTemplate_networkIPAddress(t *testing.T) { var instanceTemplate compute.InstanceTemplate ipAddress := "10.128.0.2" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceTemplateDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccComputeInstanceTemplate_networkIPAddress(RandString(t, 10), ipAddress), + Config: testAccComputeInstanceTemplate_networkIPAddress(acctest.RandString(t, 10), ipAddress), Check: resource.ComposeTestCheckFunc( testAccCheckComputeInstanceTemplateExists( t, "google_compute_instance_template.foobar", &instanceTemplate), @@ -285,13 +285,13 @@ func TestAccComputeInstanceTemplate_networkIPAddress(t *testing.T) { func TestAccComputeInstanceTemplate_disks(t *testing.T) { t.Parallel() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceTemplateDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccComputeInstanceTemplate_disks(RandString(t, 10)), + Config: testAccComputeInstanceTemplate_disks(acctest.RandString(t, 10)), }, { ResourceName: "google_compute_instance_template.foobar", @@ -305,13 +305,13 @@ func TestAccComputeInstanceTemplate_disks(t *testing.T) { func TestAccComputeInstanceTemplate_disksInvalid(t *testing.T) { t.Parallel() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceTemplateDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccComputeInstanceTemplate_disksInvalid(RandString(t, 10)), + Config: testAccComputeInstanceTemplate_disksInvalid(acctest.RandString(t, 10)), ExpectError: regexp.MustCompile("Cannot use `source`.*"), }, }, @@ -321,13 +321,13 @@ func TestAccComputeInstanceTemplate_disksInvalid(t *testing.T) { func TestAccComputeInstanceTemplate_regionDisks(t *testing.T) { t.Parallel() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceTemplateDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccComputeInstanceTemplate_regionDisks(RandString(t, 10)), + Config: testAccComputeInstanceTemplate_regionDisks(acctest.RandString(t, 10)), }, { ResourceName: "google_compute_instance_template.foobar", @@ -342,15 +342,15 @@ func TestAccComputeInstanceTemplate_subnet_auto(t *testing.T) { t.Parallel() var instanceTemplate compute.InstanceTemplate - network := "tf-test-network-" + RandString(t, 10) + network := "tf-test-network-" + acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceTemplateDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccComputeInstanceTemplate_subnet_auto(network, RandString(t, 10)), + Config: testAccComputeInstanceTemplate_subnet_auto(network, acctest.RandString(t, 10)), Check: resource.ComposeTestCheckFunc( testAccCheckComputeInstanceTemplateExists( t, "google_compute_instance_template.foobar", &instanceTemplate), @@ -371,13 +371,13 @@ func TestAccComputeInstanceTemplate_subnet_custom(t *testing.T) { var instanceTemplate compute.InstanceTemplate - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceTemplateDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccComputeInstanceTemplate_subnet_custom(RandString(t, 10)), + Config: testAccComputeInstanceTemplate_subnet_custom(acctest.RandString(t, 10)), Check: resource.ComposeTestCheckFunc( testAccCheckComputeInstanceTemplateExists( t, "google_compute_instance_template.foobar", &instanceTemplate), @@ -403,13 +403,13 @@ func TestAccComputeInstanceTemplate_subnet_xpn(t *testing.T) { billingId := envvar.GetTestBillingAccountFromEnv(t) projectName := fmt.Sprintf("tf-testxpn-%d", time.Now().Unix()) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceTemplateDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccComputeInstanceTemplate_subnet_xpn(org, billingId, projectName, RandString(t, 10)), + Config: testAccComputeInstanceTemplate_subnet_xpn(org, billingId, projectName, acctest.RandString(t, 10)), Check: resource.ComposeTestCheckFunc( testAccCheckComputeInstanceTemplateExistsInProject( t, "google_compute_instance_template.foobar", fmt.Sprintf("%s-service", projectName), @@ -426,13 +426,13 @@ func TestAccComputeInstanceTemplate_metadata_startup_script(t *testing.T) { var instanceTemplate compute.InstanceTemplate - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceTemplateDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccComputeInstanceTemplate_startup_script(RandString(t, 10)), + Config: testAccComputeInstanceTemplate_startup_script(acctest.RandString(t, 10)), Check: resource.ComposeTestCheckFunc( testAccCheckComputeInstanceTemplateExists( t, "google_compute_instance_template.foobar", &instanceTemplate), @@ -448,13 +448,13 @@ func TestAccComputeInstanceTemplate_primaryAliasIpRange(t *testing.T) { var instanceTemplate compute.InstanceTemplate - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceTemplateDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccComputeInstanceTemplate_primaryAliasIpRange(RandString(t, 10)), + Config: testAccComputeInstanceTemplate_primaryAliasIpRange(acctest.RandString(t, 10)), Check: resource.ComposeTestCheckFunc( testAccCheckComputeInstanceTemplateExists(t, "google_compute_instance_template.foobar", &instanceTemplate), testAccCheckComputeInstanceTemplateHasAliasIpRange(&instanceTemplate, "", "/24"), @@ -474,13 +474,13 @@ func TestAccComputeInstanceTemplate_secondaryAliasIpRange(t *testing.T) { var instanceTemplate compute.InstanceTemplate - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceTemplateDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccComputeInstanceTemplate_secondaryAliasIpRange(RandString(t, 10)), + Config: testAccComputeInstanceTemplate_secondaryAliasIpRange(acctest.RandString(t, 10)), Check: resource.ComposeTestCheckFunc( testAccCheckComputeInstanceTemplateExists(t, "google_compute_instance_template.foobar", &instanceTemplate), testAccCheckComputeInstanceTemplateHasAliasIpRange(&instanceTemplate, "inst-test-secondary", "/24"), @@ -500,13 +500,13 @@ func TestAccComputeInstanceTemplate_guestAccelerator(t *testing.T) { var instanceTemplate compute.InstanceTemplate - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceTemplateDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccComputeInstanceTemplate_guestAccelerator(RandString(t, 10), 1), + Config: testAccComputeInstanceTemplate_guestAccelerator(acctest.RandString(t, 10), 1), Check: resource.ComposeTestCheckFunc( testAccCheckComputeInstanceTemplateExists(t, "google_compute_instance_template.foobar", &instanceTemplate), testAccCheckComputeInstanceTemplateHasGuestAccelerator(&instanceTemplate, "nvidia-tesla-k80", 1), @@ -527,13 +527,13 @@ func TestAccComputeInstanceTemplate_guestAcceleratorSkip(t *testing.T) { var instanceTemplate compute.InstanceTemplate - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceTemplateDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccComputeInstanceTemplate_guestAccelerator(RandString(t, 10), 0), + Config: testAccComputeInstanceTemplate_guestAccelerator(acctest.RandString(t, 10), 0), Check: resource.ComposeTestCheckFunc( testAccCheckComputeInstanceTemplateExists(t, "google_compute_instance_template.foobar", &instanceTemplate), testAccCheckComputeInstanceTemplateLacksGuestAccelerator(&instanceTemplate), @@ -549,13 +549,13 @@ func TestAccComputeInstanceTemplate_minCpuPlatform(t *testing.T) { var instanceTemplate compute.InstanceTemplate - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceTemplateDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccComputeInstanceTemplate_minCpuPlatform(RandString(t, 10)), + Config: testAccComputeInstanceTemplate_minCpuPlatform(acctest.RandString(t, 10)), Check: resource.ComposeTestCheckFunc( testAccCheckComputeInstanceTemplateExists(t, "google_compute_instance_template.foobar", &instanceTemplate), testAccCheckComputeInstanceTemplateHasMinCpuPlatform(&instanceTemplate, DEFAULT_MIN_CPU_TEST_VALUE), @@ -576,13 +576,13 @@ func TestAccComputeInstanceTemplate_EncryptKMS(t *testing.T) { var instanceTemplate compute.InstanceTemplate kms := acctest.BootstrapKMSKey(t) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceTemplateDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccComputeInstanceTemplate_encryptionKMS(RandString(t, 10), kms.CryptoKey.Name), + Config: testAccComputeInstanceTemplate_encryptionKMS(acctest.RandString(t, 10), kms.CryptoKey.Name), Check: resource.ComposeTestCheckFunc( testAccCheckComputeInstanceTemplateExists(t, "google_compute_instance_template.foobar", &instanceTemplate), ), @@ -599,13 +599,13 @@ func TestAccComputeInstanceTemplate_EncryptKMS(t *testing.T) { func TestAccComputeInstanceTemplate_soleTenantNodeAffinities(t *testing.T) { t.Parallel() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceTemplateDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccComputeInstanceTemplate_soleTenantInstanceTemplate(RandString(t, 10)), + Config: testAccComputeInstanceTemplate_soleTenantInstanceTemplate(acctest.RandString(t, 10)), }, { ResourceName: "google_compute_instance_template.foobar", @@ -620,15 +620,15 @@ func TestAccComputeInstanceTemplate_instanceResourcePolicies(t *testing.T) { t.Parallel() var template compute.InstanceTemplate - var policyName = "tf-test-policy-" + RandString(t, 10) + var policyName = "tf-test-policy-" + acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceTemplateDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccComputeInstanceTemplate_instanceResourcePolicyCollocated(RandString(t, 10), policyName), + Config: testAccComputeInstanceTemplate_instanceResourcePolicyCollocated(acctest.RandString(t, 10), policyName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeInstanceTemplateExists(t, "google_compute_instance_template.foobar", &template), testAccCheckComputeInstanceTemplateHasInstanceResourcePolicies(&template, policyName), @@ -647,11 +647,11 @@ func TestAccComputeInstanceTemplate_reservationAffinities(t *testing.T) { t.Parallel() var template compute.InstanceTemplate - var templateName = RandString(t, 10) + var templateName = acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceTemplateDestroyProducer(t), Steps: []resource.TestStep{ { @@ -699,13 +699,13 @@ func TestAccComputeInstanceTemplate_shieldedVmConfig1(t *testing.T) { var instanceTemplate compute.InstanceTemplate - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceTemplateDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccComputeInstanceTemplate_shieldedVmConfig(RandString(t, 10), true, true, true), + Config: testAccComputeInstanceTemplate_shieldedVmConfig(acctest.RandString(t, 10), true, true, true), Check: resource.ComposeTestCheckFunc( testAccCheckComputeInstanceTemplateExists(t, "google_compute_instance_template.foobar", &instanceTemplate), testAccCheckComputeInstanceTemplateHasShieldedVmConfig(&instanceTemplate, true, true, true), @@ -725,13 +725,13 @@ func TestAccComputeInstanceTemplate_shieldedVmConfig2(t *testing.T) { var instanceTemplate compute.InstanceTemplate - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceTemplateDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccComputeInstanceTemplate_shieldedVmConfig(RandString(t, 10), true, true, false), + Config: testAccComputeInstanceTemplate_shieldedVmConfig(acctest.RandString(t, 10), true, true, false), Check: resource.ComposeTestCheckFunc( testAccCheckComputeInstanceTemplateExists(t, "google_compute_instance_template.foobar", &instanceTemplate), testAccCheckComputeInstanceTemplateHasShieldedVmConfig(&instanceTemplate, true, true, false), @@ -751,13 +751,13 @@ func TestAccComputeInstanceTemplate_ConfidentialInstanceConfigMain(t *testing.T) var instanceTemplate compute.InstanceTemplate - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceTemplateDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccComputeInstanceTemplateConfidentialInstanceConfig(RandString(t, 10), true), + Config: testAccComputeInstanceTemplateConfidentialInstanceConfig(acctest.RandString(t, 10), true), Check: resource.ComposeTestCheckFunc( testAccCheckComputeInstanceTemplateExists(t, "google_compute_instance_template.foobar", &instanceTemplate), testAccCheckComputeInstanceTemplateHasConfidentialInstanceConfig(&instanceTemplate, true), @@ -772,13 +772,13 @@ func TestAccComputeInstanceTemplate_AdvancedMachineFeatures(t *testing.T) { var instanceTemplate compute.InstanceTemplate - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceTemplateDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccComputeInstanceTemplateAdvancedMachineFeatures(RandString(t, 10)), + Config: testAccComputeInstanceTemplateAdvancedMachineFeatures(acctest.RandString(t, 10)), Check: resource.ComposeTestCheckFunc( testAccCheckComputeInstanceTemplateExists(t, "google_compute_instance_template.foobar", &instanceTemplate), ), @@ -791,13 +791,13 @@ func TestAccComputeInstanceTemplate_AdvancedMachineFeatures(t *testing.T) { func TestAccComputeInstanceTemplate_enableDisplay(t *testing.T) { t.Parallel() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceTemplateDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccComputeInstanceTemplate_enableDisplay(RandString(t, 10)), + Config: testAccComputeInstanceTemplate_enableDisplay(acctest.RandString(t, 10)), }, { ResourceName: "google_compute_instance_template.foobar", @@ -812,12 +812,12 @@ func TestAccComputeInstanceTemplate_enableDisplay(t *testing.T) { func TestAccComputeInstanceTemplate_invalidDiskType(t *testing.T) { t.Parallel() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { - Config: testAccComputeInstanceTemplate_invalidDiskType(RandString(t, 10)), + Config: testAccComputeInstanceTemplate_invalidDiskType(acctest.RandString(t, 10)), ExpectError: regexp.MustCompile("SCRATCH disks must have a disk_type of local-ssd"), }, }, @@ -827,12 +827,12 @@ func TestAccComputeInstanceTemplate_invalidDiskType(t *testing.T) { func TestAccComputeInstanceTemplate_withScratchDisk(t *testing.T) { t.Parallel() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { - Config: testAccComputeInstanceTemplate_with375GbScratchDisk(RandString(t, 10)), + Config: testAccComputeInstanceTemplate_with375GbScratchDisk(acctest.RandString(t, 10)), }, { ResourceName: "google_compute_instance_template.foobar", @@ -847,12 +847,12 @@ func TestAccComputeInstanceTemplate_withScratchDisk(t *testing.T) { func TestAccComputeInstanceTemplate_with18TbScratchDisk(t *testing.T) { t.Parallel() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { - Config: testAccComputeInstanceTemplate_with18TbScratchDisk(RandString(t, 10)), + Config: testAccComputeInstanceTemplate_with18TbScratchDisk(acctest.RandString(t, 10)), }, { ResourceName: "google_compute_instance_template.foobar", @@ -868,14 +868,14 @@ func TestAccComputeInstanceTemplate_imageResourceTest(t *testing.T) { // Multiple fine-grained resources acctest.SkipIfVcr(t) t.Parallel() - diskName := "tf-test-disk-" + RandString(t, 10) - computeImage := "tf-test-image-" + RandString(t, 10) + diskName := "tf-test-disk-" + acctest.RandString(t, 10) + computeImage := "tf-test-image-" + acctest.RandString(t, 10) imageDesc1 := "Some description" imageDesc2 := "Some other description" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceTemplateDestroyProducer(t), Steps: []resource.TestStep{ { @@ -904,15 +904,15 @@ func TestAccComputeInstanceTemplate_diskResourcePolicies(t *testing.T) { t.Parallel() var instanceTemplate compute.InstanceTemplate - policyName := "tf-test-policy-" + RandString(t, 10) + policyName := "tf-test-policy-" + acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceTemplateDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccComputeInstanceTemplate_diskResourcePolicies(RandString(t, 10), policyName), + Config: testAccComputeInstanceTemplate_diskResourcePolicies(acctest.RandString(t, 10), policyName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeInstanceTemplateExists(t, "google_compute_instance_template.foobar", &instanceTemplate), testAccCheckComputeInstanceTemplateHasDiskResourcePolicy(&instanceTemplate, policyName), @@ -931,11 +931,11 @@ func TestAccComputeInstanceTemplate_nictype_update(t *testing.T) { t.Parallel() var instanceTemplate compute.InstanceTemplate - var instanceTemplateName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) + var instanceTemplateName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -960,11 +960,11 @@ func TestAccComputeInstanceTemplate_queueCount(t *testing.T) { t.Parallel() var instanceTemplate compute.InstanceTemplate - var instanceTemplateName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) + var instanceTemplateName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -983,13 +983,13 @@ func TestAccComputeInstanceTemplate_managedEnvoy(t *testing.T) { var instanceTemplate compute.InstanceTemplate - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceTemplateDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccComputeInstanceTemplate_managedEnvoy(RandString(t, 10)), + Config: testAccComputeInstanceTemplate_managedEnvoy(acctest.RandString(t, 10)), Check: resource.ComposeTestCheckFunc( testAccCheckComputeInstanceTemplateExists( t, "google_compute_instance_template.foobar", &instanceTemplate), @@ -1008,13 +1008,13 @@ func TestAccComputeInstanceTemplate_spot(t *testing.T) { t.Parallel() var instanceTemplate compute.InstanceTemplate - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceTemplateDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccComputeInstanceTemplate_spot(RandString(t, 10)), + Config: testAccComputeInstanceTemplate_spot(acctest.RandString(t, 10)), Check: resource.ComposeTestCheckFunc( testAccCheckComputeInstanceTemplateExists( t, "google_compute_instance_template.foobar", &instanceTemplate), @@ -1042,13 +1042,13 @@ func TestAccComputeInstanceTemplate_spot_maxRunDuration(t *testing.T) { expectedMaxRunDuration.Nanos = 123 expectedMaxRunDuration.Seconds = 60 - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceTemplateDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccComputeInstanceTemplate_spot_maxRunDuration(RandString(t, 10)), + Config: testAccComputeInstanceTemplate_spot_maxRunDuration(acctest.RandString(t, 10)), Check: resource.ComposeTestCheckFunc( testAccCheckComputeInstanceTemplateExists( t, "google_compute_instance_template.foobar", &instanceTemplate), @@ -1080,13 +1080,13 @@ func TestAccComputeInstanceTemplate_sourceSnapshotEncryptionKey(t *testing.T) { context := map[string]interface{}{ "kms_ring_name": tpgresource.GetResourceNameFromSelfLink(kmsKey.KeyRing.Name), "kms_key_name": tpgresource.GetResourceNameFromSelfLink(kmsKey.CryptoKey.Name), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceTemplateDestroyProducer(t), Steps: []resource.TestStep{ { @@ -1115,12 +1115,12 @@ func TestAccComputeInstanceTemplate_sourceImageEncryptionKey(t *testing.T) { context := map[string]interface{}{ "kms_ring_name": tpgresource.GetResourceNameFromSelfLink(kmsKey.KeyRing.Name), "kms_key_name": tpgresource.GetResourceNameFromSelfLink(kmsKey.CryptoKey.Name), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceTemplateDestroyProducer(t), Steps: []resource.TestStep{ { @@ -1155,13 +1155,13 @@ func TestAccComputeInstanceTemplate_NetworkAttachment(t *testing.T) { context := map[string]interface{}{ "subnet": subnetName, - "suffix": (RandString(t, 10)), + "suffix": (acctest.RandString(t, 10)), "network_attachment": fullFormNetworkAttachmentName, } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceTemplateDestroyProducer(t), Steps: []resource.TestStep{ { @@ -1184,7 +1184,7 @@ func TestAccComputeInstanceTemplate_NetworkAttachment(t *testing.T) { func testAccCheckComputeInstanceTemplateDestroyProducer(t *testing.T) func(s *terraform.State) error { return func(s *terraform.State) error { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) for _, rs := range s.RootModule().Resources { if rs.Type != "google_compute_instance_template" { @@ -1222,7 +1222,7 @@ func testAccCheckComputeInstanceTemplateExistsInProject(t *testing.T, n, p strin return fmt.Errorf("No ID is set") } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) splits := strings.Split(rs.Primary.ID, "/") templateName := splits[len(splits)-1] diff --git a/mmv1/third_party/terraform/tests/resource_compute_instance_test.go.erb b/mmv1/third_party/terraform/tests/resource_compute_instance_test.go.erb index 9d8154fb40cf..97869a3e359f 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_instance_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_compute_instance_test.go.erb @@ -47,11 +47,11 @@ func TestAccComputeInstance_basic1(t *testing.T) { t.Parallel() var instance compute.Instance - var instanceName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) + var instanceName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -82,11 +82,11 @@ func TestAccComputeInstance_basic2(t *testing.T) { t.Parallel() var instance compute.Instance - var instanceName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) + var instanceName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -107,11 +107,11 @@ func TestAccComputeInstance_basic3(t *testing.T) { t.Parallel() var instance compute.Instance - var instanceName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) + var instanceName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -132,11 +132,11 @@ func TestAccComputeInstance_basic4(t *testing.T) { t.Parallel() var instance compute.Instance - var instanceName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) + var instanceName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -157,11 +157,11 @@ func TestAccComputeInstance_basic5(t *testing.T) { t.Parallel() var instance compute.Instance - var instanceName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) + var instanceName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -182,16 +182,16 @@ func TestAccComputeInstance_resourceManagerTags(t *testing.T) { t.Parallel() var instance compute.Instance - var instanceName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) + var instanceName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) context := map[string]interface{}{ "project": envvar.GetTestProjectFromEnv(), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), "instance_name": instanceName, } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -208,12 +208,12 @@ func TestAccComputeInstance_IP(t *testing.T) { t.Parallel() var instance compute.Instance - var ipName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) - var instanceName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) + var ipName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + var instanceName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -232,13 +232,13 @@ func TestAccComputeInstance_IPv6(t *testing.T) { t.Parallel() var instance compute.Instance - var ipName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) - var instanceName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) - var ptrName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) + var ipName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + var instanceName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + var ptrName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -262,13 +262,13 @@ func TestAccComputeInstance_PTRRecord(t *testing.T) { t.Parallel() var instance compute.Instance - var ptrName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) - var ipName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) - var instanceName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) + var ptrName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + var ipName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + var instanceName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -295,11 +295,11 @@ func TestAccComputeInstance_PTRRecord(t *testing.T) { func TestAccComputeInstance_networkTier(t *testing.T) { var instance compute.Instance - var instanceName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) + var instanceName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -320,31 +320,31 @@ func TestAccComputeInstance_diskEncryption(t *testing.T) { t.Parallel() var instance compute.Instance - var instanceName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) + var instanceName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) bootEncryptionKey := "SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0=" bootEncryptionKeyHash := "esTuF7d4eatX4cnc4JsiEiaI+Rff78JgPhA/v1zxX9E=" diskNameToEncryptionKey := map[string]*compute.CustomerEncryptionKey{ - fmt.Sprintf("tf-testd-%s", RandString(t, 10)): { + fmt.Sprintf("tf-testd-%s", acctest.RandString(t, 10)): { RawKey: "Ym9vdDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTI=", Sha256: "awJ7p57H+uVZ9axhJjl1D3lfC2MgA/wnt/z88Ltfvss=", }, - fmt.Sprintf("tf-testd-%s", RandString(t, 10)): { + fmt.Sprintf("tf-testd-%s", acctest.RandString(t, 10)): { RawKey: "c2Vjb25kNzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTI=", Sha256: "7TpIwUdtCOJpq2m+3nt8GFgppu6a2Xsj1t0Gexk13Yc=", }, - fmt.Sprintf("tf-testd-%s", RandString(t, 10)): { + fmt.Sprintf("tf-testd-%s", acctest.RandString(t, 10)): { RawKey: "dGhpcmQ2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTI=", Sha256: "b3pvaS7BjDbCKeLPPTx7yXBuQtxyMobCHN1QJR43xeM=", }, } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccComputeInstance_disks_encryption(bootEncryptionKey, diskNameToEncryptionKey, instanceName, RandString(t, 10)), + Config: testAccComputeInstance_disks_encryption(bootEncryptionKey, diskNameToEncryptionKey, instanceName, acctest.RandString(t, 10)), Check: resource.ComposeTestCheckFunc( testAccCheckComputeInstanceExists( t, "google_compute_instance.foobar", &instance), @@ -359,19 +359,19 @@ func TestAccComputeInstance_diskEncryptionRestart(t *testing.T) { t.Parallel() var instance compute.Instance - var instanceName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) + var instanceName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) bootEncryptionKey := "SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0=" bootEncryptionKeyHash := "esTuF7d4eatX4cnc4JsiEiaI+Rff78JgPhA/v1zxX9E=" diskNameToEncryptionKey := map[string]*compute.CustomerEncryptionKey{ - fmt.Sprintf("tf-testd-%s", RandString(t, 10)): { + fmt.Sprintf("tf-testd-%s", acctest.RandString(t, 10)): { RawKey: "Ym9vdDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTI=", Sha256: "awJ7p57H+uVZ9axhJjl1D3lfC2MgA/wnt/z88Ltfvss=", }, } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -398,18 +398,18 @@ func TestAccComputeInstance_kmsDiskEncryption(t *testing.T) { t.Parallel() var instance compute.Instance - var instanceName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) + var instanceName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) kms := acctest.BootstrapKMSKey(t) bootKmsKeyName := kms.CryptoKey.Name diskNameToEncryptionKey := map[string]*compute.CustomerEncryptionKey{ - fmt.Sprintf("tf-testd-%s", RandString(t, 10)): { + fmt.Sprintf("tf-testd-%s", acctest.RandString(t, 10)): { KmsKeyName: kms.CryptoKey.Name, }, - fmt.Sprintf("tf-testd-%s", RandString(t, 10)): { + fmt.Sprintf("tf-testd-%s", acctest.RandString(t, 10)): { KmsKeyName: kms.CryptoKey.Name, }, - fmt.Sprintf("tf-testd-%s", RandString(t, 10)): { + fmt.Sprintf("tf-testd-%s", acctest.RandString(t, 10)): { KmsKeyName: kms.CryptoKey.Name, }, } @@ -418,13 +418,13 @@ func TestAccComputeInstance_kmsDiskEncryption(t *testing.T) { t.Fatal("Stopping the test because a role was added to the policy.") } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccComputeInstance_disks_kms(bootKmsKeyName, diskNameToEncryptionKey, instanceName, RandString(t, 10)), + Config: testAccComputeInstance_disks_kms(bootKmsKeyName, diskNameToEncryptionKey, instanceName, acctest.RandString(t, 10)), Check: resource.ComposeTestCheckFunc( testAccCheckComputeInstanceExists(t, "google_compute_instance.foobar", &instance), testAccCheckComputeInstanceDiskKmsEncryptionKey("google_compute_instance.foobar", &instance, bootKmsKeyName, diskNameToEncryptionKey), @@ -439,13 +439,13 @@ func TestAccComputeInstance_resourcePolicyUpdate(t *testing.T) { t.Parallel() var instance compute.Instance - var instanceName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) - var scheduleName1 = fmt.Sprintf("tf-tests-%s", RandString(t, 10)) - var scheduleName2 = fmt.Sprintf("tf-tests-%s", RandString(t, 10)) + var instanceName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + var scheduleName1 = fmt.Sprintf("tf-tests-%s", acctest.RandString(t, 10)) + var scheduleName2 = fmt.Sprintf("tf-tests-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -491,12 +491,12 @@ func TestAccComputeInstance_attachedDisk(t *testing.T) { t.Parallel() var instance compute.Instance - var instanceName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) - var diskName = fmt.Sprintf("tf-testd-%s", RandString(t, 10)) + var instanceName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + var diskName = fmt.Sprintf("tf-testd-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -516,12 +516,12 @@ func TestAccComputeInstance_attachedDisk_sourceUrl(t *testing.T) { t.Parallel() var instance compute.Instance - var instanceName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) - var diskName = fmt.Sprintf("tf-testd-%s", RandString(t, 10)) + var instanceName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + var diskName = fmt.Sprintf("tf-testd-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -541,12 +541,12 @@ func TestAccComputeInstance_attachedDisk_modeRo(t *testing.T) { t.Parallel() var instance compute.Instance - var instanceName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) - var diskName = fmt.Sprintf("tf-testd-%s", RandString(t, 10)) + var instanceName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + var diskName = fmt.Sprintf("tf-testd-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -566,13 +566,13 @@ func TestAccComputeInstance_attachedDiskUpdate(t *testing.T) { t.Parallel() var instance compute.Instance - var instanceName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) - var diskName = fmt.Sprintf("tf-testd-%s", RandString(t, 10)) - var diskName2 = fmt.Sprintf("tf-testd-%s", RandString(t, 10)) + var instanceName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + var diskName = fmt.Sprintf("tf-testd-%s", acctest.RandString(t, 10)) + var diskName2 = fmt.Sprintf("tf-testd-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -619,12 +619,12 @@ func TestAccComputeInstance_bootDisk_source(t *testing.T) { t.Parallel() var instance compute.Instance - var instanceName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) - var diskName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) + var instanceName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + var diskName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -644,12 +644,12 @@ func TestAccComputeInstance_bootDisk_sourceUrl(t *testing.T) { t.Parallel() var instance compute.Instance - var instanceName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) - var diskName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) + var instanceName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + var diskName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -669,12 +669,12 @@ func TestAccComputeInstance_bootDisk_type(t *testing.T) { t.Parallel() var instance compute.Instance - var instanceName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) + var instanceName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) var diskType = "pd-ssd" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -692,12 +692,12 @@ func TestAccComputeInstance_bootDisk_type(t *testing.T) { func TestAccComputeInstance_bootDisk_mode(t *testing.T) { t.Parallel() - var instanceName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) + var instanceName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) var diskMode = "READ_WRITE" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -712,11 +712,11 @@ func TestAccComputeInstance_with375GbScratchDisk(t *testing.T) { t.Parallel() var instance compute.Instance - var instanceName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) + var instanceName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -739,11 +739,11 @@ func TestAccComputeInstance_with18TbScratchDisk(t *testing.T) { t.Parallel() var instance compute.Instance - var instanceName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) + var instanceName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -763,11 +763,11 @@ func TestAccComputeInstance_forceNewAndChangeMetadata(t *testing.T) { t.Parallel() var instance compute.Instance - var instanceName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) + var instanceName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -794,11 +794,11 @@ func TestAccComputeInstance_update(t *testing.T) { t.Parallel() var instance compute.Instance - var instanceName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) + var instanceName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -828,11 +828,11 @@ func TestAccComputeInstance_stopInstanceToUpdate(t *testing.T) { t.Parallel() var instance compute.Instance - var instanceName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) + var instanceName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceDestroyProducer(t), Steps: []resource.TestStep{ // Set fields that require stopping the instance @@ -870,11 +870,11 @@ func TestAccComputeInstance_serviceAccount(t *testing.T) { t.Parallel() var instance compute.Instance - var instanceName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) + var instanceName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -899,11 +899,11 @@ func TestAccComputeInstance_serviceAccount_updated(t *testing.T) { t.Parallel() var instance compute.Instance - var instanceName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) + var instanceName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -950,11 +950,11 @@ func TestAccComputeInstance_serviceAccount_updated0to1to0scopes(t *testing.T) { t.Parallel() var instance compute.Instance - var instanceName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) + var instanceName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -992,11 +992,11 @@ func TestAccComputeInstance_scheduling(t *testing.T) { t.Parallel() var instance compute.Instance - var instanceName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) + var instanceName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -1023,11 +1023,11 @@ func TestAccComputeInstance_advancedMachineFeatures(t *testing.T) { t.Parallel() var instance compute.Instance - var instanceName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) + var instanceName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -1053,13 +1053,13 @@ func TestAccComputeInstance_advancedMachineFeatures(t *testing.T) { func TestAccComputeInstance_soleTenantNodeAffinities(t *testing.T) { t.Parallel() - var instanceName = fmt.Sprintf("tf-test-soletenant-%s", RandString(t, 10)) - var templateName = fmt.Sprintf("tf-test-nodetmpl-%s", RandString(t, 10)) - var groupName = fmt.Sprintf("tf-test-nodegroup-%s", RandString(t, 10)) + var instanceName = fmt.Sprintf("tf-test-soletenant-%s", acctest.RandString(t, 10)) + var templateName = fmt.Sprintf("tf-test-nodetmpl-%s", acctest.RandString(t, 10)) + var groupName = fmt.Sprintf("tf-test-nodegroup-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -1086,11 +1086,11 @@ func TestAccComputeInstance_reservationAffinities(t *testing.T) { t.Parallel() var instance compute.Instance - var instanceName = fmt.Sprintf("tf-test-resaffinity-%s", RandString(t, 10)) + var instanceName = fmt.Sprintf("tf-test-resaffinity-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -1125,15 +1125,15 @@ func TestAccComputeInstance_subnet_auto(t *testing.T) { t.Parallel() var instance compute.Instance - var instanceName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) + var instanceName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccComputeInstance_subnet_auto(RandString(t, 10), instanceName), + Config: testAccComputeInstance_subnet_auto(acctest.RandString(t, 10), instanceName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeInstanceExists( t, "google_compute_instance.foobar", &instance), @@ -1149,15 +1149,15 @@ func TestAccComputeInstance_subnet_custom(t *testing.T) { t.Parallel() var instance compute.Instance - var instanceName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) + var instanceName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccComputeInstance_subnet_custom(RandString(t, 10), instanceName), + Config: testAccComputeInstance_subnet_custom(acctest.RandString(t, 10), instanceName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeInstanceExists( t, "google_compute_instance.foobar", &instance), @@ -1175,18 +1175,18 @@ func TestAccComputeInstance_subnet_xpn(t *testing.T) { t.Parallel() var instance compute.Instance - var instanceName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) + var instanceName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) org := envvar.GetTestOrgFromEnv(t) billingId := envvar.GetTestBillingAccountFromEnv(t) projectName := fmt.Sprintf("tf-test-xpn-%d", time.Now().Unix()) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccComputeInstance_subnet_xpn(org, billingId, projectName, instanceName, RandString(t, 10)), + Config: testAccComputeInstance_subnet_xpn(org, billingId, projectName, instanceName, acctest.RandString(t, 10)), Check: resource.ComposeTestCheckFunc( testAccCheckComputeInstanceExistsInProject( t, "google_compute_instance.foobar", fmt.Sprintf("%s-service", projectName), @@ -1202,15 +1202,15 @@ func TestAccComputeInstance_networkIPAuto(t *testing.T) { t.Parallel() var instance compute.Instance - var instanceName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) + var instanceName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccComputeInstance_networkIPAuto(RandString(t, 10), instanceName), + Config: testAccComputeInstance_networkIPAuto(acctest.RandString(t, 10), instanceName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeInstanceExists( t, "google_compute_instance.foobar", &instance), @@ -1225,15 +1225,15 @@ func TestAccComputeInstance_network_ip_custom(t *testing.T) { t.Parallel() var instance compute.Instance - var instanceName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) + var instanceName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) var ipAddress = "10.0.200.200" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccComputeInstance_network_ip_custom(RandString(t, 10), instanceName, ipAddress), + Config: testAccComputeInstance_network_ip_custom(acctest.RandString(t, 10), instanceName, ipAddress), Check: resource.ComposeTestCheckFunc( testAccCheckComputeInstanceExists( t, "google_compute_instance.foobar", &instance), @@ -1248,13 +1248,13 @@ func TestAccComputeInstance_private_image_family(t *testing.T) { t.Parallel() var instance compute.Instance - var instanceName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) - var diskName = fmt.Sprintf("tf-testd-%s", RandString(t, 10)) - var familyName = fmt.Sprintf("tf-testf-%s", RandString(t, 10)) + var instanceName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + var diskName = fmt.Sprintf("tf-testd-%s", acctest.RandString(t, 10)) + var familyName = fmt.Sprintf("tf-testf-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -1272,13 +1272,13 @@ func TestAccComputeInstance_networkPerformanceConfig(t *testing.T) { t.Parallel() var instance compute.Instance - var instanceName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) - var diskName = fmt.Sprintf("tf-testd-%s", RandString(t, 10)) - var imageName = fmt.Sprintf("tf-testf-%s", RandString(t, 10)) + var instanceName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + var diskName = fmt.Sprintf("tf-testd-%s", acctest.RandString(t, 10)) + var imageName = fmt.Sprintf("tf-testf-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -1297,11 +1297,11 @@ func TestAccComputeInstance_forceChangeMachineTypeManually(t *testing.T) { t.Parallel() var instance compute.Instance - var instanceName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) + var instanceName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -1321,13 +1321,13 @@ func TestAccComputeInstance_multiNic(t *testing.T) { t.Parallel() var instance compute.Instance - instanceName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - networkName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - subnetworkName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + instanceName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + networkName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + subnetworkName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -1346,11 +1346,11 @@ func TestAccComputeInstance_nictype_update(t *testing.T) { t.Parallel() var instance compute.Instance - var instanceName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) + var instanceName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -1375,11 +1375,11 @@ func TestAccComputeInstance_guestAccelerator(t *testing.T) { t.Parallel() var instance compute.Instance - instanceName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + instanceName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -1399,11 +1399,11 @@ func TestAccComputeInstance_guestAcceleratorSkip(t *testing.T) { t.Parallel() var instance compute.Instance - instanceName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + instanceName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -1422,11 +1422,11 @@ func TestAccComputeInstance_minCpuPlatform(t *testing.T) { t.Parallel() var instance compute.Instance - instanceName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + instanceName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -1445,11 +1445,11 @@ func TestAccComputeInstance_deletionProtectionExplicitFalse(t *testing.T) { t.Parallel() var instance compute.Instance - var instanceName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) + var instanceName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -1468,11 +1468,11 @@ func TestAccComputeInstance_deletionProtectionExplicitTrueAndUpdateFalse(t *test t.Parallel() var instance compute.Instance - var instanceName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) + var instanceName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -1501,11 +1501,11 @@ func TestAccComputeInstance_primaryAliasIpRange(t *testing.T) { t.Parallel() var instance compute.Instance - instanceName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + instanceName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -1524,13 +1524,13 @@ func TestAccComputeInstance_secondaryAliasIpRange(t *testing.T) { t.Parallel() var instance compute.Instance - instanceName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - networkName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - subnetName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + instanceName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + networkName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + subnetName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -1557,11 +1557,11 @@ func TestAccComputeInstance_hostname(t *testing.T) { t.Parallel() var instance compute.Instance - instanceName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + instanceName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -1580,11 +1580,11 @@ func TestAccComputeInstance_shieldedVmConfig(t *testing.T) { t.Parallel() var instance compute.Instance - instanceName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + instanceName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -1611,11 +1611,11 @@ func TestAccComputeInstanceConfidentialInstanceConfigMain(t *testing.T) { t.Parallel() var instance compute.Instance - instanceName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + instanceName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -1632,11 +1632,11 @@ func TestAccComputeInstanceConfidentialInstanceConfigMain(t *testing.T) { func TestAccComputeInstance_enableDisplay(t *testing.T) { t.Parallel() - instanceName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + instanceName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -1655,11 +1655,11 @@ func TestAccComputeInstance_desiredStatusOnCreation(t *testing.T) { t.Parallel() var instance compute.Instance - var instanceName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) + var instanceName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -1682,11 +1682,11 @@ func TestAccComputeInstance_desiredStatusUpdateBasic(t *testing.T) { t.Parallel() var instance compute.Instance - var instanceName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) + var instanceName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -1736,11 +1736,11 @@ func TestAccComputeInstance_desiredStatusTerminatedUpdateFields(t *testing.T) { t.Parallel() var instance compute.Instance - var instanceName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) + var instanceName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -1778,11 +1778,11 @@ func TestAccComputeInstance_updateRunning_desiredStatusRunning_allowStoppingForU t.Parallel() var instance compute.Instance - var instanceName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) + var instanceName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -1812,11 +1812,11 @@ func TestAccComputeInstance_updateRunning_desiredStatusNotSet_notAllowStoppingFo t.Parallel() var instance compute.Instance - var instanceName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) + var instanceName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -1839,11 +1839,11 @@ func TestAccComputeInstance_updateRunning_desiredStatusRunning_notAllowStoppingF t.Parallel() var instance compute.Instance - var instanceName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) + var instanceName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -1866,11 +1866,11 @@ func TestAccComputeInstance_updateRunning_desiredStatusTerminated_allowStoppingF t.Parallel() var instance compute.Instance - var instanceName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) + var instanceName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -1898,11 +1898,11 @@ func TestAccComputeInstance_updateRunning_desiredStatusTerminated_notAllowStoppi t.Parallel() var instance compute.Instance - var instanceName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) + var instanceName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -1930,11 +1930,11 @@ func TestAccComputeInstance_updateTerminated_desiredStatusNotSet_allowStoppingFo t.Parallel() var instance compute.Instance - var instanceName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) + var instanceName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -1970,11 +1970,11 @@ func TestAccComputeInstance_updateTerminated_desiredStatusTerminated_allowStoppi t.Parallel() var instance compute.Instance - var instanceName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) + var instanceName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -2010,11 +2010,11 @@ func TestAccComputeInstance_updateTerminated_desiredStatusNotSet_notAllowStoppin t.Parallel() var instance compute.Instance - var instanceName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) + var instanceName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -2050,11 +2050,11 @@ func TestAccComputeInstance_updateTerminated_desiredStatusTerminated_notAllowSto t.Parallel() var instance compute.Instance - var instanceName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) + var instanceName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -2090,11 +2090,11 @@ func TestAccComputeInstance_updateTerminated_desiredStatusRunning_allowStoppingF t.Parallel() var instance compute.Instance - var instanceName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) + var instanceName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -2130,11 +2130,11 @@ func TestAccComputeInstance_updateTerminated_desiredStatusRunning_notAllowStoppi t.Parallel() var instance compute.Instance - var instanceName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) + var instanceName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -2169,15 +2169,15 @@ func TestAccComputeInstance_updateTerminated_desiredStatusRunning_notAllowStoppi func TestAccComputeInstance_resourcePolicyCollocate(t *testing.T) { t.Parallel() - instanceName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + instanceName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccComputeInstance_resourcePolicyCollocate(instanceName, RandString(t, 10)), + Config: testAccComputeInstance_resourcePolicyCollocate(instanceName, acctest.RandString(t, 10)), }, computeInstanceImportStep("us-east4-b", instanceName, []string{"allow_stopping_for_update"}), }, @@ -2186,12 +2186,12 @@ func TestAccComputeInstance_resourcePolicyCollocate(t *testing.T) { func TestAccComputeInstance_subnetworkUpdate(t *testing.T) { t.Parallel() - instanceName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - suffix := fmt.Sprintf("%s", RandString(t, 10)) + instanceName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + suffix := fmt.Sprintf("%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -2212,11 +2212,11 @@ func TestAccComputeInstance_subnetworkUpdate(t *testing.T) { func TestAccComputeInstance_queueCount(t *testing.T) { t.Parallel() - instanceName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + instanceName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -2232,10 +2232,10 @@ func TestAccComputeInstance_spotVM(t *testing.T) { t.Parallel() var instance compute.Instance - var instanceName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) - VcrTest(t, resource.TestCase{ + var instanceName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -2255,10 +2255,10 @@ func TestAccComputeInstance_spotVM_update(t *testing.T) { t.Parallel() var instance compute.Instance - var instanceName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) - VcrTest(t, resource.TestCase{ + var instanceName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -2286,15 +2286,15 @@ func TestAccComputeInstance_spotVM_maxRunDration(t *testing.T) { t.Parallel() var instance compute.Instance - var instanceName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) + var instanceName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) var expectedMaxRunDuration = compute.Duration{} // Define in testAccComputeInstance_spotVM_maxRunDuration expectedMaxRunDuration.Nanos = 123 expectedMaxRunDuration.Seconds = 60 - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -2315,14 +2315,14 @@ func TestAccComputeInstance_spotVM_maxRunDuration_update(t *testing.T) { t.Parallel() var instance compute.Instance - var instanceName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) + var instanceName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) // Define in testAccComputeInstance_spotVM_maxRunDuration var expectedMaxRunDuration = compute.Duration{} expectedMaxRunDuration.Nanos = 123 expectedMaxRunDuration.Seconds = 60 - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -2351,11 +2351,11 @@ func TestAccComputeInstance_metadataStartupScript_update(t *testing.T) { t.Parallel() var instance compute.Instance - var instanceName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) + var instanceName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -2387,7 +2387,7 @@ func testAccCheckComputeInstanceUpdateMachineType(t *testing.T, n string) resour return fmt.Errorf("No ID is set") } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) op, err := config.NewComputeClient(config.UserAgent).Instances.Stop(config.Project, rs.Primary.Attributes["zone"], rs.Primary.Attributes["name"]).Do() if err != nil { @@ -2417,7 +2417,7 @@ func testAccCheckComputeInstanceUpdateMachineType(t *testing.T, n string) resour func testAccCheckComputeInstanceDestroyProducer(t *testing.T) func(s *terraform.State) error { return func(s *terraform.State) error { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) for _, rs := range s.RootModule().Resources { if rs.Type != "google_compute_instance" { @@ -2454,7 +2454,7 @@ func testAccCheckComputeInstanceExistsInProject(t *testing.T, n, p string, insta return fmt.Errorf("No ID is set") } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) found, err := config.NewComputeClient(config.UserAgent).Instances.Get( p, rs.Primary.Attributes["zone"], rs.Primary.Attributes["name"]).Do() @@ -2657,7 +2657,7 @@ func testAccCheckComputeInstanceBootDisk(instance *compute.Instance, source stri func testAccCheckComputeInstanceBootDiskType(t *testing.T, instanceName string, diskType string) resource.TestCheckFunc { return func(s *terraform.State) error { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) // boot disk is named the same as the Instance disk, err := config.NewComputeClient(config.UserAgent).Disks.Get(config.Project, "us-central1-a", instanceName).Do() diff --git a/mmv1/third_party/terraform/tests/resource_compute_network_edge_security_service_test.go.erb b/mmv1/third_party/terraform/tests/resource_compute_network_edge_security_service_test.go.erb index 7147f7ba560b..4c065094a7cf 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_network_edge_security_service_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_compute_network_edge_security_service_test.go.erb @@ -7,17 +7,18 @@ import ( "testing" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-provider-google/google/acctest" ) func TestAccComputeNetworkEdgeSecurityService_update(t *testing.T) { t.Parallel() - pName := fmt.Sprintf("tf-test-security-policy-%s", RandString(t, 10)) - nesName := fmt.Sprintf("tf-test-edge-security-services-%s", RandString(t, 10)) + pName := fmt.Sprintf("tf-test-security-policy-%s", acctest.RandString(t, 10)) + nesName := fmt.Sprintf("tf-test-edge-security-services-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ - PreCheck: func() { AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + acctest.VcrTest(t, resource.TestCase{ + PreCheck: func() { acctest.AccTestPreCheck(t) }, + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeNetworkEdgeSecurityServiceDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_compute_network_endpoint_group_test.go.erb b/mmv1/third_party/terraform/tests/resource_compute_network_endpoint_group_test.go.erb index 01c9d08444d8..90d972932a47 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_network_endpoint_group_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_compute_network_endpoint_group_test.go.erb @@ -12,12 +12,12 @@ func TestAccComputeNetworkEndpointGroup_networkEndpointGroup(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeNetworkEndpointGroupDestroyProducer(t), Steps: []resource.TestStep{ { @@ -37,12 +37,12 @@ func TestAccComputeNetworkEndpointGroup_internalEndpoint(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeNetworkEndpointGroupDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_compute_network_endpoint_test.go.erb b/mmv1/third_party/terraform/tests/resource_compute_network_endpoint_test.go.erb index dca972a90a8b..1dc31fe5045b 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_network_endpoint_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_compute_network_endpoint_test.go.erb @@ -17,7 +17,7 @@ func TestAccComputeNetworkEndpoint_networkEndpointsBasic(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), "default_port": 90, "modified_port": 100, "add1_port": 101, @@ -26,9 +26,9 @@ func TestAccComputeNetworkEndpoint_networkEndpointsBasic(t *testing.T) { negId := fmt.Sprintf("projects/%s/zones/%s/networkEndpointGroups/tf-test-neg-%s", envvar.GetTestProjectFromEnv(), envvar.GetTestZoneFromEnv(), context["random_suffix"]) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { // Create one endpoint @@ -204,7 +204,7 @@ func testAccCheckComputeNetworkEndpointWithPortsDestroyed(t *testing.T, negId st } func testAccComputeNetworkEndpointListEndpointPorts(t *testing.T, negId string) (map[string]struct{}, error) { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) url := fmt.Sprintf("https://www.googleapis.com/compute/<% if version == 'ga' %>v1<% else %>beta<% end %>/%s/listNetworkEndpoints", negId) res, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ diff --git a/mmv1/third_party/terraform/tests/resource_compute_network_endpoints_test.go.erb b/mmv1/third_party/terraform/tests/resource_compute_network_endpoints_test.go.erb index 3b4f40b1a764..5ed5057141be 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_network_endpoints_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_compute_network_endpoints_test.go.erb @@ -20,7 +20,7 @@ func TestAccComputeNetworkEndpoints_networkEndpointsBasic(t *testing.T) { acctest.SkipIfVcr(t) context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), "default_port": 90, "modified_port": 100, "add1_port": 101, @@ -32,9 +32,9 @@ func TestAccComputeNetworkEndpoints_networkEndpointsBasic(t *testing.T) { negId := fmt.Sprintf("projects/%s/zones/%s/networkEndpointGroups/tf-test-neg-%s", envvar.GetTestProjectFromEnv(), envvar.GetTestZoneFromEnv(), context["random_suffix"]) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { // Create one endpoint @@ -279,7 +279,7 @@ func testAccCheckComputeNetworkEndpointsWithAllEndpointsDestroyed(t *testing.T, } func testAccComputeNetworkEndpointsListEndpoints(t *testing.T, negId string) ([]interface{}, error) { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) url := fmt.Sprintf("https://www.googleapis.com/compute/<% if version == 'ga' %>v1<% else %>beta<% end %>/%s/listNetworkEndpoints", negId) res, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ diff --git a/mmv1/third_party/terraform/tests/resource_compute_network_peering_test.go b/mmv1/third_party/terraform/tests/resource_compute_network_peering_test.go index b81bdab3577f..18bd000cd71e 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_network_peering_test.go +++ b/mmv1/third_party/terraform/tests/resource_compute_network_peering_test.go @@ -13,17 +13,17 @@ import ( func TestAccComputeNetworkPeering_basic(t *testing.T) { t.Parallel() - primaryNetworkName := fmt.Sprintf("tf-test-network-peering-1-%d", RandInt(t)) - peeringName := fmt.Sprintf("peering-test-1-%d", RandInt(t)) + primaryNetworkName := fmt.Sprintf("tf-test-network-peering-1-%d", acctest.RandInt(t)) + peeringName := fmt.Sprintf("peering-test-1-%d", acctest.RandInt(t)) importId := fmt.Sprintf("%s/%s/%s", envvar.GetTestProjectFromEnv(), primaryNetworkName, peeringName) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccComputeNetworkPeeringDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccComputeNetworkPeering_basic(primaryNetworkName, peeringName, RandString(t, 10)), + Config: testAccComputeNetworkPeering_basic(primaryNetworkName, peeringName, acctest.RandString(t, 10)), }, { ResourceName: "google_compute_network_peering.foo", @@ -39,17 +39,17 @@ func TestAccComputeNetworkPeering_basic(t *testing.T) { func TestAccComputeNetworkPeering_subnetRoutes(t *testing.T) { t.Parallel() - primaryNetworkName := fmt.Sprintf("tf-test-network-peering-1-%d", RandInt(t)) - peeringName := fmt.Sprintf("peering-test-%d", RandInt(t)) + primaryNetworkName := fmt.Sprintf("tf-test-network-peering-1-%d", acctest.RandInt(t)) + peeringName := fmt.Sprintf("peering-test-%d", acctest.RandInt(t)) importId := fmt.Sprintf("%s/%s/%s", envvar.GetTestProjectFromEnv(), primaryNetworkName, peeringName) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccComputeNetworkPeeringDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccComputeNetworkPeering_subnetRoutes(primaryNetworkName, peeringName, RandString(t, 10)), + Config: testAccComputeNetworkPeering_subnetRoutes(primaryNetworkName, peeringName, acctest.RandString(t, 10)), }, { ResourceName: "google_compute_network_peering.bar", @@ -64,14 +64,14 @@ func TestAccComputeNetworkPeering_subnetRoutes(t *testing.T) { func TestAccComputeNetworkPeering_customRoutesUpdate(t *testing.T) { t.Parallel() - primaryNetworkName := fmt.Sprintf("tf-test-network-peering-1-%d", RandInt(t)) - peeringName := fmt.Sprintf("peering-test-%d", RandInt(t)) + primaryNetworkName := fmt.Sprintf("tf-test-network-peering-1-%d", acctest.RandInt(t)) + peeringName := fmt.Sprintf("peering-test-%d", acctest.RandInt(t)) importId := fmt.Sprintf("%s/%s/%s", envvar.GetTestProjectFromEnv(), primaryNetworkName, peeringName) - suffix := RandString(t, 10) + suffix := acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccComputeNetworkPeeringDestroyProducer(t), Steps: []resource.TestStep{ { @@ -108,14 +108,14 @@ func TestAccComputeNetworkPeering_customRoutesUpdate(t *testing.T) { func TestAccComputeNetworkPeering_stackType(t *testing.T) { t.Parallel() - primaryNetworkName := fmt.Sprintf("tf-test-network-1-%d", RandInt(t)) - peeringNetworkName := fmt.Sprintf("tf-test-network-2-%d", RandInt(t)) - peeringName := fmt.Sprintf("tf-test-peering-%d", RandInt(t)) + primaryNetworkName := fmt.Sprintf("tf-test-network-1-%d", acctest.RandInt(t)) + peeringNetworkName := fmt.Sprintf("tf-test-network-2-%d", acctest.RandInt(t)) + peeringName := fmt.Sprintf("tf-test-peering-%d", acctest.RandInt(t)) importId := fmt.Sprintf("%s/%s/%s", GetTestProjectFromEnv(), primaryNetworkName, peeringName) - VcrTest(t, resource.TestCase{ - PreCheck: func() { AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + acctest.VcrTest(t, resource.TestCase{ + PreCheck: func() { acctest.AccTestPreCheck(t) }, + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccComputeNetworkPeeringDestroyProducer(t), Steps: []resource.TestStep{ { @@ -143,7 +143,7 @@ func TestAccComputeNetworkPeering_stackType(t *testing.T) { func testAccComputeNetworkPeeringDestroyProducer(t *testing.T) func(s *terraform.State) error { return func(s *terraform.State) error { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) for _, rs := range s.RootModule().Resources { if rs.Type != "google_compute_network_peering" { diff --git a/mmv1/third_party/terraform/tests/resource_compute_network_test.go.erb b/mmv1/third_party/terraform/tests/resource_compute_network_test.go.erb index 220c767deaa5..f9142b31838c 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_network_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_compute_network_test.go.erb @@ -21,13 +21,13 @@ func TestAccComputeNetwork_explicitAutoSubnet(t *testing.T) { var network compute.Network - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeNetworkDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccComputeNetwork_basic(RandString(t, 10)), + Config: testAccComputeNetwork_basic(acctest.RandString(t, 10)), Check: resource.ComposeTestCheckFunc( testAccCheckComputeNetworkExists( t, "google_compute_network.bar", &network), @@ -49,13 +49,13 @@ func TestAccComputeNetwork_customSubnet(t *testing.T) { var network compute.Network - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeNetworkDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccComputeNetwork_custom_subnet(RandString(t, 10)), + Config: testAccComputeNetwork_custom_subnet(acctest.RandString(t, 10)), Check: resource.ComposeTestCheckFunc( testAccCheckComputeNetworkExists( t, "google_compute_network.baz", &network), @@ -76,11 +76,11 @@ func TestAccComputeNetwork_routingModeAndUpdate(t *testing.T) { t.Parallel() var network compute.Network - networkName := RandString(t, 10) + networkName := acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeNetworkDestroyProducer(t), Steps: []resource.TestStep{ { @@ -113,13 +113,13 @@ func TestAccComputeNetwork_default_routing_mode(t *testing.T) { expectedRoutingMode := "REGIONAL" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeNetworkDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccComputeNetwork_basic(RandString(t, 10)), + Config: testAccComputeNetwork_basic(acctest.RandString(t, 10)), Check: resource.ComposeTestCheckFunc( testAccCheckComputeNetworkExists( t, "google_compute_network.bar", &network), @@ -136,13 +136,13 @@ func TestAccComputeNetwork_networkDeleteDefaultRoute(t *testing.T) { var network compute.Network - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeNetworkDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccComputeNetwork_deleteDefaultRoute(RandString(t, 10)), + Config: testAccComputeNetwork_deleteDefaultRoute(acctest.RandString(t, 10)), Check: resource.ComposeTestCheckFunc( testAccCheckComputeNetworkExists( t, "google_compute_network.bar", &network), @@ -159,14 +159,14 @@ func TestAccComputeNetwork_networkFirewallPolicyEnforcementOrderAndUpdate(t *tes var network compute.Network var updatedNetwork compute.Network - networkName := RandString(t, 10) + networkName := acctest.RandString(t, 10) defaultNetworkFirewallPolicyEnforcementOrder := "AFTER_CLASSIC_FIREWALL" explicitNetworkFirewallPolicyEnforcementOrder := "BEFORE_CLASSIC_FIREWALL" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeNetworkDestroyProducer(t), Steps: []resource.TestStep{ { @@ -216,7 +216,7 @@ func testAccCheckComputeNetworkExists(t *testing.T, n string, network *compute.N return fmt.Errorf("No ID is set") } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) found, err := config.NewComputeClient(config.UserAgent).Networks.Get( config.Project, rs.Primary.Attributes["name"]).Do() @@ -245,7 +245,7 @@ func testAccCheckComputeNetworkDefaultRoutesDeleted(t *testing.T, n string, netw return fmt.Errorf("No ID is set") } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) routes, err := config.NewComputeClient(config.UserAgent).Routes.List(config.Project).Filter(fmt.Sprintf("(network=\"%s\") AND (destRange=\"0.0.0.0/0\")", network.SelfLink)).Do() if err != nil { @@ -262,7 +262,7 @@ func testAccCheckComputeNetworkDefaultRoutesDeleted(t *testing.T, n string, netw func testAccCheckComputeNetworkIsAutoSubnet(t *testing.T, n string, network *compute.Network) resource.TestCheckFunc { return func(s *terraform.State) error { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) found, err := config.NewComputeClient(config.UserAgent).Networks.Get( config.Project, network.Name).Do() @@ -284,7 +284,7 @@ func testAccCheckComputeNetworkIsAutoSubnet(t *testing.T, n string, network *com func testAccCheckComputeNetworkIsCustomSubnet(t *testing.T, n string, network *compute.Network) resource.TestCheckFunc { return func(s *terraform.State) error { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) found, err := config.NewComputeClient(config.UserAgent).Networks.Get( config.Project, network.Name).Do() @@ -306,7 +306,7 @@ func testAccCheckComputeNetworkIsCustomSubnet(t *testing.T, n string, network *c func testAccCheckComputeNetworkHasRoutingMode(t *testing.T, n string, network *compute.Network, routingMode string) resource.TestCheckFunc { return func(s *terraform.State) error { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) rs, ok := s.RootModule().Resources[n] if !ok { @@ -335,7 +335,7 @@ func testAccCheckComputeNetworkHasRoutingMode(t *testing.T, n string, network *c func testAccCheckComputeNetworkHasNetworkFirewallPolicyEnforcementOrder(t *testing.T, n string, network *compute.Network, order string) resource.TestCheckFunc { return func(s *terraform.State) error { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) rs, ok := s.RootModule().Resources[n] if !ok { diff --git a/mmv1/third_party/terraform/tests/resource_compute_node_group_test.go.erb b/mmv1/third_party/terraform/tests/resource_compute_node_group_test.go.erb index a6d16b5196f1..ca7617052786 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_node_group_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_compute_node_group_test.go.erb @@ -16,13 +16,13 @@ import ( func TestAccComputeNodeGroup_updateNodeTemplate(t *testing.T) { t.Parallel() - groupName := fmt.Sprintf("group--%d", RandInt(t)) - tmplPrefix := fmt.Sprintf("tmpl--%d", RandInt(t)) + groupName := fmt.Sprintf("group--%d", acctest.RandInt(t)) + tmplPrefix := fmt.Sprintf("tmpl--%d", acctest.RandInt(t)) var timeCreated time.Time - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeNodeGroupDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_compute_organization_security_policy_rule_test.go.erb b/mmv1/third_party/terraform/tests/resource_compute_organization_security_policy_rule_test.go.erb index 476417960467..1e4d431e0937 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_organization_security_policy_rule_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_compute_organization_security_policy_rule_test.go.erb @@ -15,12 +15,12 @@ func TestAccComputeOrganizationSecurityPolicyRule_organizationSecurityPolicyRule context := map[string]interface{}{ "org_id": envvar.GetTestOrgFromEnv(t), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeOrganizationSecurityPolicyRuleDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_compute_organization_security_policy_test.go.erb b/mmv1/third_party/terraform/tests/resource_compute_organization_security_policy_test.go.erb index 42731ec20c1e..2fe15c8b25f8 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_organization_security_policy_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_compute_organization_security_policy_test.go.erb @@ -15,12 +15,12 @@ func TestAccComputeOrganizationSecurityPolicy_organizationSecurityPolicyUpdateEx context := map[string]interface{}{ "org_id": envvar.GetTestOrgFromEnv(t), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeOrganizationSecurityPolicyDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_compute_per_instance_config_test.go.erb b/mmv1/third_party/terraform/tests/resource_compute_per_instance_config_test.go.erb index adbaa4dc1234..f43566731528 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_per_instance_config_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_compute_per_instance_config_test.go.erb @@ -17,22 +17,22 @@ func TestAccComputePerInstanceConfig_statefulBasic(t *testing.T) { acctest.SkipIfVcr(t) t.Parallel() - suffix := RandString(t, 10) + suffix := acctest.RandString(t, 10) igmName := fmt.Sprintf("tf-test-igm-%s", suffix) context := map[string]interface{}{ "igm_name": igmName, "random_suffix": suffix, - "config_name": fmt.Sprintf("instance-%s", RandString(t, 10)), - "config_name2": fmt.Sprintf("instance-%s", RandString(t, 10)), - "config_name3": fmt.Sprintf("instance-%s", RandString(t, 10)), - "config_name4": fmt.Sprintf("instance-%s", RandString(t, 10)), + "config_name": fmt.Sprintf("instance-%s", acctest.RandString(t, 10)), + "config_name2": fmt.Sprintf("instance-%s", acctest.RandString(t, 10)), + "config_name3": fmt.Sprintf("instance-%s", acctest.RandString(t, 10)), + "config_name4": fmt.Sprintf("instance-%s", acctest.RandString(t, 10)), } igmId := fmt.Sprintf("projects/%s/zones/%s/instanceGroupManagers/%s", envvar.GetTestProjectFromEnv(), envvar.GetTestZoneFromEnv(), igmName) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { // Create one endpoint @@ -96,14 +96,14 @@ func TestAccComputePerInstanceConfig_update(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), - "igm_name": fmt.Sprintf("tf-test-igm-%s", RandString(t, 10)), - "config_name": fmt.Sprintf("instance-%s", RandString(t, 10)), + "random_suffix": acctest.RandString(t, 10), + "igm_name": fmt.Sprintf("tf-test-igm-%s", acctest.RandString(t, 10)), + "config_name": fmt.Sprintf("instance-%s", acctest.RandString(t, 10)), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { // Create one config @@ -134,18 +134,18 @@ func TestAccComputePerInstanceConfig_statefulIps(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), - "igm_name": fmt.Sprintf("tf-test-igm-%s", RandString(t, 10)), - "config_name": fmt.Sprintf("instance-%s", RandString(t, 10)), - "network": fmt.Sprintf("tf-test-igm-%s", RandString(t, 10)), - "subnetwork": fmt.Sprintf("tf-test-igm-%s", RandString(t, 10)), - "address1": fmt.Sprintf("tf-test-igm-address%s", RandString(t, 10)), - "address2": fmt.Sprintf("tf-test-igm-address%s", RandString(t, 10)), + "random_suffix": acctest.RandString(t, 10), + "igm_name": fmt.Sprintf("tf-test-igm-%s", acctest.RandString(t, 10)), + "config_name": fmt.Sprintf("instance-%s", acctest.RandString(t, 10)), + "network": fmt.Sprintf("tf-test-igm-%s", acctest.RandString(t, 10)), + "subnetwork": fmt.Sprintf("tf-test-igm-%s", acctest.RandString(t, 10)), + "address1": fmt.Sprintf("tf-test-igm-address%s", acctest.RandString(t, 10)), + "address2": fmt.Sprintf("tf-test-igm-address%s", acctest.RandString(t, 10)), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { // Create one config @@ -510,7 +510,7 @@ func testAccCheckComputePerInstanceConfigDestroyed(t *testing.T, igmId, configNa } func testAccComputePerInstanceConfigListNames(t *testing.T, igmId string) (map[string]struct{}, error) { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) url := fmt.Sprintf("%s%s/listPerInstanceConfigs", config.ComputeBasePath, igmId) res, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ diff --git a/mmv1/third_party/terraform/tests/resource_compute_project_default_network_tier_test.go b/mmv1/third_party/terraform/tests/resource_compute_project_default_network_tier_test.go index e5b552f901b7..466320c80219 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_project_default_network_tier_test.go +++ b/mmv1/third_party/terraform/tests/resource_compute_project_default_network_tier_test.go @@ -14,11 +14,11 @@ func TestAccComputeProjectDefaultNetworkTier_basic(t *testing.T) { org := envvar.GetTestOrgFromEnv(t) billingId := envvar.GetTestBillingAccountFromEnv(t) - projectID := fmt.Sprintf("tf-test-%d", RandInt(t)) + projectID := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccComputeProject_defaultNetworkTier_premium(projectID, org, billingId), @@ -37,11 +37,11 @@ func TestAccComputeProjectDefaultNetworkTier_modify(t *testing.T) { org := envvar.GetTestOrgFromEnv(t) billingId := envvar.GetTestBillingAccountFromEnv(t) - projectID := fmt.Sprintf("tf-test-%d", RandInt(t)) + projectID := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccComputeProject_defaultNetworkTier_premium(projectID, org, billingId), diff --git a/mmv1/third_party/terraform/tests/resource_compute_project_metadata_item_test.go b/mmv1/third_party/terraform/tests/resource_compute_project_metadata_item_test.go index 6969524a0b82..2b33fcb92422 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_project_metadata_item_test.go +++ b/mmv1/third_party/terraform/tests/resource_compute_project_metadata_item_test.go @@ -16,11 +16,11 @@ func TestAccComputeProjectMetadataItem_basic(t *testing.T) { t.Parallel() // Key must be unique to avoid concurrent tests interfering with each other - key := "myKey" + RandString(t, 10) + key := "myKey" + acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckProjectMetadataItemDestroyProducer(t), Steps: []resource.TestStep{ { @@ -41,14 +41,14 @@ func TestAccComputeProjectMetadataItem_basicMultiple(t *testing.T) { t.Parallel() // Generate a config of two config keys - key1 := "myKey" + RandString(t, 10) - key2 := "myKey" + RandString(t, 10) + key1 := "myKey" + acctest.RandString(t, 10) + key2 := "myKey" + acctest.RandString(t, 10) config := testAccProjectMetadataItem_basic("foobar", key1, "myValue") + testAccProjectMetadataItem_basic("foobar2", key2, "myOtherValue") - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckProjectMetadataItemDestroyProducer(t), Steps: []resource.TestStep{ { @@ -72,11 +72,11 @@ func TestAccComputeProjectMetadataItem_basicWithEmptyVal(t *testing.T) { t.Parallel() // Key must be unique to avoid concurrent tests interfering with each other - key := "myKey" + RandString(t, 10) + key := "myKey" + acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckProjectMetadataItemDestroyProducer(t), Steps: []resource.TestStep{ { @@ -95,11 +95,11 @@ func TestAccComputeProjectMetadataItem_basicUpdate(t *testing.T) { t.Parallel() // Key must be unique to avoid concurrent tests interfering with each other - key := "myKey" + RandString(t, 10) + key := "myKey" + acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckProjectMetadataItemDestroyProducer(t), Steps: []resource.TestStep{ { @@ -126,12 +126,12 @@ func TestAccComputeProjectMetadataItem_exists(t *testing.T) { t.Parallel() // Key must be unique to avoid concurrent tests interfering with each other - key := "myKey" + RandString(t, 10) + key := "myKey" + acctest.RandString(t, 10) originalConfig := testAccProjectMetadataItem_basic("foobar", key, "myValue") - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckProjectMetadataItemDestroyProducer(t), Steps: []resource.TestStep{ { @@ -153,7 +153,7 @@ func TestAccComputeProjectMetadataItem_exists(t *testing.T) { func testAccCheckProjectMetadataItemDestroyProducer(t *testing.T) func(s *terraform.State) error { return func(s *terraform.State) error { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) project, err := config.NewComputeClient(config.UserAgent).Projects.Get(config.Project).Do() if err != nil { diff --git a/mmv1/third_party/terraform/tests/resource_compute_project_metadata_test.go b/mmv1/third_party/terraform/tests/resource_compute_project_metadata_test.go index 870166641308..b6f85b6c5648 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_project_metadata_test.go +++ b/mmv1/third_party/terraform/tests/resource_compute_project_metadata_test.go @@ -16,11 +16,11 @@ func TestAccComputeProjectMetadata_basic(t *testing.T) { org := envvar.GetTestOrgFromEnv(t) billingId := envvar.GetTestBillingAccountFromEnv(t) - projectID := fmt.Sprintf("tf-test-%d", RandInt(t)) + projectID := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeProjectMetadataDestroyProducer(t), Steps: []resource.TestStep{ { @@ -41,11 +41,11 @@ func TestAccComputeProjectMetadata_modify_1(t *testing.T) { org := envvar.GetTestOrgFromEnv(t) billingId := envvar.GetTestBillingAccountFromEnv(t) - projectID := fmt.Sprintf("tf-test-%d", RandInt(t)) + projectID := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeProjectMetadataDestroyProducer(t), Steps: []resource.TestStep{ { @@ -75,11 +75,11 @@ func TestAccComputeProjectMetadata_modify_2(t *testing.T) { org := envvar.GetTestOrgFromEnv(t) billingId := envvar.GetTestBillingAccountFromEnv(t) - projectID := fmt.Sprintf("tf-test-%d", RandInt(t)) + projectID := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeProjectMetadataDestroyProducer(t), Steps: []resource.TestStep{ { @@ -105,7 +105,7 @@ func TestAccComputeProjectMetadata_modify_2(t *testing.T) { func testAccCheckComputeProjectMetadataDestroyProducer(t *testing.T) func(s *terraform.State) error { return func(s *terraform.State) error { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) for _, rs := range s.RootModule().Resources { if rs.Type != "google_compute_project_metadata" { diff --git a/mmv1/third_party/terraform/tests/resource_compute_public_advertised_prefix_test.go b/mmv1/third_party/terraform/tests/resource_compute_public_advertised_prefix_test.go index b117278adb1e..acbbb6bd4f37 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_public_advertised_prefix_test.go +++ b/mmv1/third_party/terraform/tests/resource_compute_public_advertised_prefix_test.go @@ -37,12 +37,12 @@ func testAccComputePublicAdvertisedPrefix_publicAdvertisedPrefixesBasicTest(t *t context := map[string]interface{}{ "description": envvar.GetTestPublicAdvertisedPrefixDescriptionFromEnv(t), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputePublicAdvertisedPrefixDestroyProducer(t), Steps: []resource.TestStep{ { @@ -71,12 +71,12 @@ resource "google_compute_public_advertised_prefix" "prefix" { func testAccComputePublicDelegatedPrefix_publicDelegatedPrefixesBasicTest(t *testing.T) { context := map[string]interface{}{ "description": envvar.GetTestPublicAdvertisedPrefixDescriptionFromEnv(t), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputePublicDelegatedPrefixDestroyProducer(t), Steps: []resource.TestStep{ { @@ -129,7 +129,7 @@ func testAccCheckComputePublicDelegatedPrefixDestroyProducer(t *testing.T) func( continue } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{ComputeBasePath}}projects/{{project}}/regions/{{region}}/publicDelegatedPrefixes/{{name}}") if err != nil { @@ -168,7 +168,7 @@ func testAccCheckComputePublicAdvertisedPrefixDestroyProducer(t *testing.T) func continue } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{ComputeBasePath}}projects/{{project}}/global/publicAdvertisedPrefixes/{{name}}") if err != nil { diff --git a/mmv1/third_party/terraform/tests/resource_compute_region_autoscaler_test.go.erb b/mmv1/third_party/terraform/tests/resource_compute_region_autoscaler_test.go.erb index b6b239998dc4..1a509e7abc81 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_region_autoscaler_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_compute_region_autoscaler_test.go.erb @@ -10,14 +10,14 @@ import ( ) func TestAccComputeRegionAutoscaler_update(t *testing.T) { - var itName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) - var tpName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) - var igmName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) - var autoscalerName = fmt.Sprintf("tf-test-region-autoscaler-%s", RandString(t, 10)) + var itName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + var tpName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + var igmName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + var autoscalerName = fmt.Sprintf("tf-test-region-autoscaler-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeRegionAutoscalerDestroyProducer(t), Steps: []resource.TestStep{ resource.TestStep{ @@ -43,14 +43,14 @@ func TestAccComputeRegionAutoscaler_update(t *testing.T) { func TestAccComputeRegionAutoscaler_scaleDownControl(t *testing.T) { t.Parallel() - var itName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) - var tpName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) - var igmName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) - var autoscalerName = fmt.Sprintf("tf-test-region-autoscaler-%s", RandString(t, 10)) + var itName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + var tpName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + var igmName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + var autoscalerName = fmt.Sprintf("tf-test-region-autoscaler-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeRegionAutoscalerDestroyProducer(t), Steps: []resource.TestStep{ resource.TestStep{ @@ -68,14 +68,14 @@ func TestAccComputeRegionAutoscaler_scaleDownControl(t *testing.T) { func TestAccComputeRegionAutoscaler_scalingSchedule(t *testing.T) { t.Parallel() - var itName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) - var tpName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) - var igmName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) - var autoscalerName = fmt.Sprintf("tf-test-region-autoscaler-%s", RandString(t, 10)) + var itName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + var tpName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + var igmName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + var autoscalerName = fmt.Sprintf("tf-test-region-autoscaler-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeRegionAutoscalerDestroyProducer(t), Steps: []resource.TestStep{ resource.TestStep{ @@ -93,14 +93,14 @@ func TestAccComputeRegionAutoscaler_scalingSchedule(t *testing.T) { func TestAccComputeRegionAutoscaler_scaleInControl(t *testing.T) { t.Parallel() - var itName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) - var tpName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) - var igmName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) - var autoscalerName = fmt.Sprintf("tf-test-region-autoscaler-%s", RandString(t, 10)) + var itName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + var tpName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + var igmName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + var autoscalerName = fmt.Sprintf("tf-test-region-autoscaler-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeRegionAutoscalerDestroyProducer(t), Steps: []resource.TestStep{ resource.TestStep{ diff --git a/mmv1/third_party/terraform/tests/resource_compute_region_backend_service_test.go.erb b/mmv1/third_party/terraform/tests/resource_compute_region_backend_service_test.go.erb index 59a124e27f76..a1d3a43253c7 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_region_backend_service_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_compute_region_backend_service_test.go.erb @@ -13,13 +13,13 @@ import ( func TestAccComputeRegionBackendService_basic(t *testing.T) { t.Parallel() - serviceName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - checkName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - extraCheckName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + serviceName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + checkName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + extraCheckName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeRegionBackendServiceDestroyProducer(t), Steps: []resource.TestStep{ resource.TestStep{ @@ -46,13 +46,13 @@ func TestAccComputeRegionBackendService_basic(t *testing.T) { func TestAccComputeRegionBackendService_withBackendInternal(t *testing.T) { t.Parallel() - serviceName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - igName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - itName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - checkName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - VcrTest(t, resource.TestCase{ + serviceName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + igName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + itName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + checkName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeRegionBackendServiceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -85,12 +85,12 @@ func TestAccComputeRegionBackendService_withBackendInternal(t *testing.T) { func TestAccComputeRegionBackendService_withBackendInternalManaged(t *testing.T) { t.Parallel() - serviceName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - igmName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - hcName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - VcrTest(t, resource.TestCase{ + serviceName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + igmName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + hcName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeRegionBackendServiceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -108,15 +108,15 @@ func TestAccComputeRegionBackendService_withBackendInternalManaged(t *testing.T) func TestAccComputeRegionBackendService_withBackendMultiNic(t *testing.T) { t.Parallel() - serviceName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - net1Name := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - net2Name := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - igName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - itName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - checkName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - VcrTest(t, resource.TestCase{ + serviceName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + net1Name := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + net2Name := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + igName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + itName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + checkName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeRegionBackendServiceDestroyProducer(t), Steps: []resource.TestStep{ resource.TestStep{ @@ -135,12 +135,12 @@ func TestAccComputeRegionBackendService_withBackendMultiNic(t *testing.T) { func TestAccComputeRegionBackendService_withConnectionDrainingAndUpdate(t *testing.T) { t.Parallel() - serviceName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - checkName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + serviceName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + checkName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeRegionBackendServiceDestroyProducer(t), Steps: []resource.TestStep{ resource.TestStep{ @@ -166,12 +166,12 @@ func TestAccComputeRegionBackendService_withConnectionDrainingAndUpdate(t *testi func TestAccComputeRegionBackendService_ilbUpdateBasic(t *testing.T) { t.Parallel() - backendName := fmt.Sprintf("foo-%s", RandString(t, 10)) - checkName := fmt.Sprintf("bar-%s", RandString(t, 10)) + backendName := fmt.Sprintf("foo-%s", acctest.RandString(t, 10)) + checkName := fmt.Sprintf("bar-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeRegionBackendServiceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -198,16 +198,16 @@ func TestAccComputeRegionBackendService_ilbUpdateBasic(t *testing.T) { func TestAccComputeRegionBackendService_ilbUpdateFull(t *testing.T) { t.Parallel() - randString := RandString(t, 10) + randString := acctest.RandString(t, 10) backendName := fmt.Sprintf("foo-%s", randString) checkName := fmt.Sprintf("bar-%s", randString) igName := fmt.Sprintf("tf-test-%s", randString) instanceName := fmt.Sprintf("tf-test-%s", randString) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeRegionBackendServiceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -232,12 +232,12 @@ func TestAccComputeRegionBackendService_ilbUpdateFull(t *testing.T) { <% end -%> func TestAccComputeRegionBackendService_withBackendAndIAP(t *testing.T) { - backendName := fmt.Sprintf("foo-%s", RandString(t, 10)) - checkName := fmt.Sprintf("bar-%s", RandString(t, 10)) + backendName := fmt.Sprintf("foo-%s", acctest.RandString(t, 10)) + checkName := fmt.Sprintf("bar-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeRegionBackendServiceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -264,12 +264,12 @@ func TestAccComputeRegionBackendService_withBackendAndIAP(t *testing.T) { func TestAccComputeRegionBackendService_UDPFailOverPolicyUpdate(t *testing.T) { t.Parallel() - serviceName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - checkName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + serviceName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + checkName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeRegionBackendServiceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -304,14 +304,14 @@ func TestAccComputeRegionBackendService_UDPFailOverPolicyUpdate(t *testing.T) { func TestAccComputeRegionBackendService_subsettingUpdate(t *testing.T) { t.Parallel() - randString := RandString(t, 10) + randString := acctest.RandString(t, 10) backendName := fmt.Sprintf("foo-%s", randString) checkName := fmt.Sprintf("bar-%s", randString) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeRegionBackendServiceDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_compute_region_disk_test.go.erb b/mmv1/third_party/terraform/tests/resource_compute_region_disk_test.go.erb index 7f1b3a676e79..1325a3b1a29b 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_region_disk_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_compute_region_disk_test.go.erb @@ -24,13 +24,13 @@ import ( func TestAccComputeRegionDisk_basic(t *testing.T) { t.Parallel() - diskName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + diskName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) var disk compute.Disk - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeRegionDiskDestroyProducer(t), Steps: []resource.TestStep{ { @@ -64,13 +64,13 @@ func TestAccComputeRegionDisk_basic(t *testing.T) { func TestAccComputeRegionDisk_basicUpdate(t *testing.T) { t.Parallel() - diskName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + diskName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) var disk compute.Disk - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeRegionDiskDestroyProducer(t), Steps: []resource.TestStep{ { @@ -108,12 +108,12 @@ func TestAccComputeRegionDisk_basicUpdate(t *testing.T) { func TestAccComputeRegionDisk_encryption(t *testing.T) { t.Parallel() - diskName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + diskName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) var disk compute.Disk - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeRegionDiskDestroyProducer(t), Steps: []resource.TestStep{ { @@ -132,15 +132,15 @@ func TestAccComputeRegionDisk_encryption(t *testing.T) { func TestAccComputeRegionDisk_deleteDetach(t *testing.T) { t.Parallel() - diskName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - regionDiskName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - regionDiskName2 := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - instanceName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + diskName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + regionDiskName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + regionDiskName2 := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + instanceName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) var disk compute.Disk - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeRegionDiskDestroyProducer(t), Steps: []resource.TestStep{ { @@ -188,13 +188,13 @@ func TestAccComputeRegionDisk_deleteDetach(t *testing.T) { func TestAccComputeRegionDisk_cloneDisk(t *testing.T) { t.Parallel() - diskName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + diskName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) var disk compute.Disk - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeRegionDiskDestroyProducer(t), Steps: []resource.TestStep{ { @@ -216,13 +216,13 @@ func TestAccComputeRegionDisk_cloneDisk(t *testing.T) { func TestAccComputeRegionDisk_featuresUpdated(t *testing.T) { t.Parallel() - diskName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + diskName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) var disk compute.Disk - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeRegionDiskDestroyProducer(t), Steps: []resource.TestStep{ { @@ -262,7 +262,7 @@ func testAccCheckComputeRegionDiskExists(t *testing.T, n string, disk *compute.D return fmt.Errorf("No ID is set") } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) found, err := config.NewComputeClient(config.UserAgent).RegionDisks.Get( p, rs.Primary.Attributes["region"], rs.Primary.Attributes["name"]).Do() diff --git a/mmv1/third_party/terraform/tests/resource_compute_region_health_check_test.go.erb b/mmv1/third_party/terraform/tests/resource_compute_region_health_check_test.go.erb index 67b6001060d0..c9b875c91186 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_region_health_check_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_compute_region_health_check_test.go.erb @@ -13,11 +13,11 @@ import ( func TestAccComputeRegionHealthCheck_tcp_update(t *testing.T) { t.Parallel() - hckName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + hckName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeRegionHealthCheckDestroyProducer(t), Steps: []resource.TestStep{ { @@ -43,11 +43,11 @@ func TestAccComputeRegionHealthCheck_tcp_update(t *testing.T) { func TestAccComputeRegionHealthCheck_ssl_port_spec(t *testing.T) { t.Parallel() - hckName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + hckName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeRegionHealthCheckDestroyProducer(t), Steps: []resource.TestStep{ { @@ -65,11 +65,11 @@ func TestAccComputeRegionHealthCheck_ssl_port_spec(t *testing.T) { func TestAccComputeRegionHealthCheck_http_port_spec(t *testing.T) { t.Parallel() - hckName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + hckName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeRegionHealthCheckDestroyProducer(t), Steps: []resource.TestStep{ { @@ -91,11 +91,11 @@ func TestAccComputeRegionHealthCheck_http_port_spec(t *testing.T) { func TestAccComputeRegionHealthCheck_https_serving_port(t *testing.T) { t.Parallel() - hckName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + hckName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeRegionHealthCheckDestroyProducer(t), Steps: []resource.TestStep{ { @@ -113,11 +113,11 @@ func TestAccComputeRegionHealthCheck_https_serving_port(t *testing.T) { func TestAccComputeRegionHealthCheck_typeTransition(t *testing.T) { t.Parallel() - hckName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + hckName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeRegionHealthCheckDestroyProducer(t), Steps: []resource.TestStep{ { @@ -147,11 +147,11 @@ func TestAccComputeRegionHealthCheck_tcpAndSsl_shouldFail(t *testing.T) { acctest.SkipIfVcr(t) t.Parallel() - hckName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + hckName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeRegionHealthCheckDestroyProducer(t), Steps: []resource.TestStep{ { @@ -166,11 +166,11 @@ func TestAccComputeRegionHealthCheck_tcpAndSsl_shouldFail(t *testing.T) { func TestAccComputeRegionHealthCheck_logConfigDisabled(t *testing.T) { t.Parallel() - hckName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + hckName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeHealthCheckDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_compute_region_instance_group_manager_test.go.erb b/mmv1/third_party/terraform/tests/resource_compute_region_instance_group_manager_test.go.erb index bec17ee78533..ae6d2404c2f7 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_region_instance_group_manager_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_compute_region_instance_group_manager_test.go.erb @@ -14,14 +14,14 @@ import ( func TestAccRegionInstanceGroupManager_basic(t *testing.T) { t.Parallel() - template := fmt.Sprintf("tf-test-rigm-%s", RandString(t, 10)) - target := fmt.Sprintf("tf-test-rigm-%s", RandString(t, 10)) - igm1 := fmt.Sprintf("tf-test-rigm-%s", RandString(t, 10)) - igm2 := fmt.Sprintf("tf-test-rigm-%s", RandString(t, 10)) + template := fmt.Sprintf("tf-test-rigm-%s", acctest.RandString(t, 10)) + target := fmt.Sprintf("tf-test-rigm-%s", acctest.RandString(t, 10)) + igm1 := fmt.Sprintf("tf-test-rigm-%s", acctest.RandString(t, 10)) + igm2 := fmt.Sprintf("tf-test-rigm-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckRegionInstanceGroupManagerDestroyProducer(t), Steps: []resource.TestStep{ { @@ -46,12 +46,12 @@ func TestAccRegionInstanceGroupManager_basic(t *testing.T) { func TestAccRegionInstanceGroupManager_targetSizeZero(t *testing.T) { t.Parallel() - templateName := fmt.Sprintf("tf-test-rigm-%s", RandString(t, 10)) - igmName := fmt.Sprintf("tf-test-rigm-%s", RandString(t, 10)) + templateName := fmt.Sprintf("tf-test-rigm-%s", acctest.RandString(t, 10)) + igmName := fmt.Sprintf("tf-test-rigm-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckRegionInstanceGroupManagerDestroyProducer(t), Steps: []resource.TestStep{ { @@ -70,15 +70,15 @@ func TestAccRegionInstanceGroupManager_targetSizeZero(t *testing.T) { func TestAccRegionInstanceGroupManager_update(t *testing.T) { t.Parallel() - template1 := fmt.Sprintf("tf-test-rigm-%s", RandString(t, 10)) - target1 := fmt.Sprintf("tf-test-rigm-%s", RandString(t, 10)) - target2 := fmt.Sprintf("tf-test-rigm-%s", RandString(t, 10)) - template2 := fmt.Sprintf("tf-test-rigm-%s", RandString(t, 10)) - igm := fmt.Sprintf("tf-test-rigm-%s", RandString(t, 10)) + template1 := fmt.Sprintf("tf-test-rigm-%s", acctest.RandString(t, 10)) + target1 := fmt.Sprintf("tf-test-rigm-%s", acctest.RandString(t, 10)) + target2 := fmt.Sprintf("tf-test-rigm-%s", acctest.RandString(t, 10)) + template2 := fmt.Sprintf("tf-test-rigm-%s", acctest.RandString(t, 10)) + igm := fmt.Sprintf("tf-test-rigm-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckRegionInstanceGroupManagerDestroyProducer(t), Steps: []resource.TestStep{ { @@ -119,11 +119,11 @@ func TestAccRegionInstanceGroupManager_updateLifecycle(t *testing.T) { tag1 := "tag1" tag2 := "tag2" - igm := fmt.Sprintf("tf-test-rigm-%s", RandString(t, 10)) + igm := fmt.Sprintf("tf-test-rigm-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckRegionInstanceGroupManagerDestroyProducer(t), Steps: []resource.TestStep{ { @@ -153,11 +153,11 @@ func TestAccRegionInstanceGroupManager_rollingUpdatePolicy(t *testing.T) { acctest.SkipIfVcr(t) t.Parallel() - igm := fmt.Sprintf("tf-test-rigm-%s", RandString(t, 10)) + igm := fmt.Sprintf("tf-test-rigm-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckInstanceGroupManagerDestroyProducer(t), Steps: []resource.TestStep{ { @@ -201,12 +201,12 @@ func TestAccRegionInstanceGroupManager_separateRegions(t *testing.T) { acctest.SkipIfVcr(t) t.Parallel() - igm1 := fmt.Sprintf("tf-test-rigm-%s", RandString(t, 10)) - igm2 := fmt.Sprintf("tf-test-rigm-%s", RandString(t, 10)) + igm1 := fmt.Sprintf("tf-test-rigm-%s", acctest.RandString(t, 10)) + igm2 := fmt.Sprintf("tf-test-rigm-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckRegionInstanceGroupManagerDestroyProducer(t), Steps: []resource.TestStep{ { @@ -231,13 +231,13 @@ func TestAccRegionInstanceGroupManager_separateRegions(t *testing.T) { func TestAccRegionInstanceGroupManager_versions(t *testing.T) { t.Parallel() - primaryTemplate := fmt.Sprintf("tf-test-rigm-%s", RandString(t, 10)) - canaryTemplate := fmt.Sprintf("tf-test-rigm-%s", RandString(t, 10)) - igm := fmt.Sprintf("tf-test-rigm-%s", RandString(t, 10)) + primaryTemplate := fmt.Sprintf("tf-test-rigm-%s", acctest.RandString(t, 10)) + canaryTemplate := fmt.Sprintf("tf-test-rigm-%s", acctest.RandString(t, 10)) + igm := fmt.Sprintf("tf-test-rigm-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckRegionInstanceGroupManagerDestroyProducer(t), Steps: []resource.TestStep{ { @@ -256,14 +256,14 @@ func TestAccRegionInstanceGroupManager_versions(t *testing.T) { func TestAccRegionInstanceGroupManager_autoHealingPolicies(t *testing.T) { t.Parallel() - template := fmt.Sprintf("tf-test-rigm-%s", RandString(t, 10)) - target := fmt.Sprintf("tf-test-rigm-%s", RandString(t, 10)) - igm := fmt.Sprintf("tf-test-rigm-%s", RandString(t, 10)) - hck := fmt.Sprintf("tf-test-rigm-%s", RandString(t, 10)) + template := fmt.Sprintf("tf-test-rigm-%s", acctest.RandString(t, 10)) + target := fmt.Sprintf("tf-test-rigm-%s", acctest.RandString(t, 10)) + igm := fmt.Sprintf("tf-test-rigm-%s", acctest.RandString(t, 10)) + hck := fmt.Sprintf("tf-test-rigm-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckRegionInstanceGroupManagerDestroyProducer(t), Steps: []resource.TestStep{ { @@ -291,13 +291,13 @@ func TestAccRegionInstanceGroupManager_autoHealingPolicies(t *testing.T) { func TestAccRegionInstanceGroupManager_distributionPolicy(t *testing.T) { t.Parallel() - template := fmt.Sprintf("tf-test-rigm-%s", RandString(t, 10)) - igm := fmt.Sprintf("tf-test-rigm-%s", RandString(t, 10)) + template := fmt.Sprintf("tf-test-rigm-%s", acctest.RandString(t, 10)) + igm := fmt.Sprintf("tf-test-rigm-%s", acctest.RandString(t, 10)) zones := []string{"us-central1-a", "us-central1-b"} - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckRegionInstanceGroupManagerDestroyProducer(t), Steps: []resource.TestStep{ { @@ -318,13 +318,13 @@ func TestAccRegionInstanceGroupManager_stateful(t *testing.T) { t.Skip() t.Parallel() - template := fmt.Sprintf("tf-test-rigm-%s", RandString(t, 10)) - igm := fmt.Sprintf("tf-test-rigm-%s", RandString(t, 10)) - network := fmt.Sprintf("tf-test-igm-%s", RandString(t, 10)) + template := fmt.Sprintf("tf-test-rigm-%s", acctest.RandString(t, 10)) + igm := fmt.Sprintf("tf-test-rigm-%s", acctest.RandString(t, 10)) + network := fmt.Sprintf("tf-test-igm-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckRegionInstanceGroupManagerDestroyProducer(t), Steps: []resource.TestStep{ { @@ -360,7 +360,7 @@ func TestAccRegionInstanceGroupManager_stateful(t *testing.T) { func testAccCheckRegionInstanceGroupManagerDestroyProducer(t *testing.T) func(s *terraform.State) error { return func(s *terraform.State) error { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) for _, rs := range s.RootModule().Resources { if rs.Type != "google_compute_region_instance_group_manager" { continue diff --git a/mmv1/third_party/terraform/tests/resource_compute_region_instance_template_test.go.erb b/mmv1/third_party/terraform/tests/resource_compute_region_instance_template_test.go.erb index f58a5ed7d000..42e238f4172f 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_region_instance_template_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_compute_region_instance_template_test.go.erb @@ -32,13 +32,13 @@ func TestAccComputeRegionInstanceTemplate_basic(t *testing.T) { var instanceTemplate compute.InstanceTemplate - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeRegionInstanceTemplateDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccComputeRegionInstanceTemplate_basic(RandString(t, 10)), + Config: testAccComputeRegionInstanceTemplate_basic(acctest.RandString(t, 10)), Check: resource.ComposeTestCheckFunc( testAccCheckComputeRegionInstanceTemplateExists( t, "google_compute_region_instance_template.foobar", &instanceTemplate), @@ -62,13 +62,13 @@ func TestAccComputeRegionInstanceTemplate_imageShorthand(t *testing.T) { var instanceTemplate compute.InstanceTemplate - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeRegionInstanceTemplateDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccComputeRegionInstanceTemplate_imageShorthand(RandString(t, 10)), + Config: testAccComputeRegionInstanceTemplate_imageShorthand(acctest.RandString(t, 10)), Check: resource.ComposeTestCheckFunc( testAccCheckComputeRegionInstanceTemplateExists( t, "google_compute_region_instance_template.foobar", &instanceTemplate), @@ -88,13 +88,13 @@ func TestAccComputeRegionInstanceTemplate_preemptible(t *testing.T) { var instanceTemplate compute.InstanceTemplate - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeRegionInstanceTemplateDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccComputeRegionInstanceTemplate_preemptible(RandString(t, 10)), + Config: testAccComputeRegionInstanceTemplate_preemptible(acctest.RandString(t, 10)), Check: resource.ComposeTestCheckFunc( testAccCheckComputeRegionInstanceTemplateExists( t, "google_compute_region_instance_template.foobar", &instanceTemplate), @@ -116,13 +116,13 @@ func TestAccComputeRegionInstanceTemplate_IP(t *testing.T) { var instanceTemplate compute.InstanceTemplate - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeRegionInstanceTemplateDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccComputeRegionInstanceTemplate_ip(RandString(t, 10)), + Config: testAccComputeRegionInstanceTemplate_ip(acctest.RandString(t, 10)), Check: resource.ComposeTestCheckFunc( testAccCheckComputeRegionInstanceTemplateExists( t, "google_compute_region_instance_template.foobar", &instanceTemplate), @@ -143,13 +143,13 @@ func TestAccComputeRegionInstanceTemplate_IPv6(t *testing.T) { var instanceTemplate compute.InstanceTemplate - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeRegionInstanceTemplateDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccComputeRegionInstanceTemplate_ipv6(RandString(t, 10)), + Config: testAccComputeRegionInstanceTemplate_ipv6(acctest.RandString(t, 10)), Check: resource.ComposeTestCheckFunc( testAccCheckComputeRegionInstanceTemplateExists( t, "google_compute_region_instance_template.foobar", &instanceTemplate), @@ -167,13 +167,13 @@ func TestAccComputeRegionInstanceTemplate_IPv6(t *testing.T) { func TestAccComputeRegionInstanceTemplate_networkTier(t *testing.T) { t.Parallel() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeRegionInstanceTemplateDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccComputeRegionInstanceTemplate_networkTier(RandString(t, 10)), + Config: testAccComputeRegionInstanceTemplate_networkTier(acctest.RandString(t, 10)), }, { ResourceName: "google_compute_region_instance_template.foobar", @@ -190,13 +190,13 @@ func TestAccComputeRegionInstanceTemplate_networkIP(t *testing.T) { var instanceTemplate compute.InstanceTemplate networkIP := "10.128.0.2" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeRegionInstanceTemplateDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccComputeRegionInstanceTemplate_networkIP(RandString(t, 10), networkIP), + Config: testAccComputeRegionInstanceTemplate_networkIP(acctest.RandString(t, 10), networkIP), Check: resource.ComposeTestCheckFunc( testAccCheckComputeRegionInstanceTemplateExists( t, "google_compute_region_instance_template.foobar", &instanceTemplate), @@ -220,13 +220,13 @@ func TestAccComputeRegionInstanceTemplate_networkIPAddress(t *testing.T) { var instanceTemplate compute.InstanceTemplate ipAddress := "10.128.0.2" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeRegionInstanceTemplateDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccComputeRegionInstanceTemplate_networkIPAddress(RandString(t, 10), ipAddress), + Config: testAccComputeRegionInstanceTemplate_networkIPAddress(acctest.RandString(t, 10), ipAddress), Check: resource.ComposeTestCheckFunc( testAccCheckComputeRegionInstanceTemplateExists( t, "google_compute_region_instance_template.foobar", &instanceTemplate), @@ -247,13 +247,13 @@ func TestAccComputeRegionInstanceTemplate_networkIPAddress(t *testing.T) { func TestAccComputeRegionInstanceTemplate_disksInvalid(t *testing.T) { t.Parallel() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeRegionInstanceTemplateDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccComputeRegionInstanceTemplate_disksInvalid(RandString(t, 10)), + Config: testAccComputeRegionInstanceTemplate_disksInvalid(acctest.RandString(t, 10)), ExpectError: regexp.MustCompile("Cannot use `source`.*"), }, }, @@ -263,13 +263,13 @@ func TestAccComputeRegionInstanceTemplate_disksInvalid(t *testing.T) { func TestAccComputeRegionInstanceTemplate_regionDisks(t *testing.T) { t.Parallel() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeRegionInstanceTemplateDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccComputeRegionInstanceTemplate_regionDisks(RandString(t, 10)), + Config: testAccComputeRegionInstanceTemplate_regionDisks(acctest.RandString(t, 10)), }, { ResourceName: "google_compute_region_instance_template.foobar", @@ -284,15 +284,15 @@ func TestAccComputeRegionInstanceTemplate_subnet_auto(t *testing.T) { t.Parallel() var instanceTemplate compute.InstanceTemplate - network := "tf-test-network-" + RandString(t, 10) + network := "tf-test-network-" + acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeRegionInstanceTemplateDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccComputeRegionInstanceTemplate_subnet_auto(network, RandString(t, 10)), + Config: testAccComputeRegionInstanceTemplate_subnet_auto(network, acctest.RandString(t, 10)), Check: resource.ComposeTestCheckFunc( testAccCheckComputeRegionInstanceTemplateExists( t, "google_compute_region_instance_template.foobar", &instanceTemplate), @@ -313,13 +313,13 @@ func TestAccComputeRegionInstanceTemplate_subnet_custom(t *testing.T) { var instanceTemplate compute.InstanceTemplate - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeRegionInstanceTemplateDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccComputeRegionInstanceTemplate_subnet_custom(RandString(t, 10)), + Config: testAccComputeRegionInstanceTemplate_subnet_custom(acctest.RandString(t, 10)), Check: resource.ComposeTestCheckFunc( testAccCheckComputeRegionInstanceTemplateExists( t, "google_compute_region_instance_template.foobar", &instanceTemplate), @@ -345,13 +345,13 @@ func TestAccComputeRegionInstanceTemplate_subnet_xpn(t *testing.T) { billingId := envvar.GetTestBillingAccountFromEnv(t) projectName := fmt.Sprintf("tf-testxpn-%d", time.Now().Unix()) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeRegionInstanceTemplateDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccComputeRegionInstanceTemplate_subnet_xpn(org, billingId, projectName, RandString(t, 10)), + Config: testAccComputeRegionInstanceTemplate_subnet_xpn(org, billingId, projectName, acctest.RandString(t, 10)), Check: resource.ComposeTestCheckFunc( testAccCheckComputeRegionInstanceTemplateExistsInProject( t, "google_compute_region_instance_template.foobar", fmt.Sprintf("%s-service", projectName), @@ -368,13 +368,13 @@ func TestAccComputeRegionInstanceTemplate_metadata_startup_script(t *testing.T) var instanceTemplate compute.InstanceTemplate - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeRegionInstanceTemplateDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccComputeRegionInstanceTemplate_startup_script(RandString(t, 10)), + Config: testAccComputeRegionInstanceTemplate_startup_script(acctest.RandString(t, 10)), Check: resource.ComposeTestCheckFunc( testAccCheckComputeRegionInstanceTemplateExists( t, "google_compute_region_instance_template.foobar", &instanceTemplate), @@ -390,13 +390,13 @@ func TestAccComputeRegionInstanceTemplate_primaryAliasIpRange(t *testing.T) { var instanceTemplate compute.InstanceTemplate - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeRegionInstanceTemplateDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccComputeRegionInstanceTemplate_primaryAliasIpRange(RandString(t, 10)), + Config: testAccComputeRegionInstanceTemplate_primaryAliasIpRange(acctest.RandString(t, 10)), Check: resource.ComposeTestCheckFunc( testAccCheckComputeRegionInstanceTemplateExists(t, "google_compute_region_instance_template.foobar", &instanceTemplate), testAccCheckComputeRegionInstanceTemplateHasAliasIpRange(&instanceTemplate, "", "/24"), @@ -416,13 +416,13 @@ func TestAccComputeRegionInstanceTemplate_secondaryAliasIpRange(t *testing.T) { var instanceTemplate compute.InstanceTemplate - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeRegionInstanceTemplateDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccComputeRegionInstanceTemplate_secondaryAliasIpRange(RandString(t, 10)), + Config: testAccComputeRegionInstanceTemplate_secondaryAliasIpRange(acctest.RandString(t, 10)), Check: resource.ComposeTestCheckFunc( testAccCheckComputeRegionInstanceTemplateExists(t, "google_compute_region_instance_template.foobar", &instanceTemplate), testAccCheckComputeRegionInstanceTemplateHasAliasIpRange(&instanceTemplate, "inst-test-secondary", "/24"), @@ -442,13 +442,13 @@ func TestAccComputeRegionInstanceTemplate_guestAccelerator(t *testing.T) { var instanceTemplate compute.InstanceTemplate - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeRegionInstanceTemplateDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccComputeRegionInstanceTemplate_guestAccelerator(RandString(t, 10), 1), + Config: testAccComputeRegionInstanceTemplate_guestAccelerator(acctest.RandString(t, 10), 1), Check: resource.ComposeTestCheckFunc( testAccCheckComputeRegionInstanceTemplateExists(t, "google_compute_region_instance_template.foobar", &instanceTemplate), testAccCheckComputeRegionInstanceTemplateHasGuestAccelerator(&instanceTemplate, "nvidia-tesla-k80", 1), @@ -469,13 +469,13 @@ func TestAccComputeRegionInstanceTemplate_guestAcceleratorSkip(t *testing.T) { var instanceTemplate compute.InstanceTemplate - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeRegionInstanceTemplateDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccComputeRegionInstanceTemplate_guestAccelerator(RandString(t, 10), 0), + Config: testAccComputeRegionInstanceTemplate_guestAccelerator(acctest.RandString(t, 10), 0), Check: resource.ComposeTestCheckFunc( testAccCheckComputeRegionInstanceTemplateExists(t, "google_compute_region_instance_template.foobar", &instanceTemplate), testAccCheckComputeRegionInstanceTemplateLacksGuestAccelerator(&instanceTemplate), @@ -491,13 +491,13 @@ func TestAccComputeRegionInstanceTemplate_minCpuPlatform(t *testing.T) { var instanceTemplate compute.InstanceTemplate - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeRegionInstanceTemplateDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccComputeRegionInstanceTemplate_minCpuPlatform(RandString(t, 10)), + Config: testAccComputeRegionInstanceTemplate_minCpuPlatform(acctest.RandString(t, 10)), Check: resource.ComposeTestCheckFunc( testAccCheckComputeRegionInstanceTemplateExists(t, "google_compute_region_instance_template.foobar", &instanceTemplate), testAccCheckComputeRegionInstanceTemplateHasMinCpuPlatform(&instanceTemplate, DEFAULT_MIN_CPU_TEST_VALUE), @@ -515,13 +515,13 @@ func TestAccComputeRegionInstanceTemplate_minCpuPlatform(t *testing.T) { func TestAccComputeRegionInstanceTemplate_soleTenantNodeAffinities(t *testing.T) { t.Parallel() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeRegionInstanceTemplateDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccComputeRegionInstanceTemplate_soleTenantInstanceTemplate(RandString(t, 10)), + Config: testAccComputeRegionInstanceTemplate_soleTenantInstanceTemplate(acctest.RandString(t, 10)), }, { ResourceName: "google_compute_region_instance_template.foobar", @@ -536,15 +536,15 @@ func TestAccComputeRegionInstanceTemplate_instanceResourcePolicies(t *testing.T) t.Parallel() var template compute.InstanceTemplate - var policyName = "tf-test-policy-" + RandString(t, 10) + var policyName = "tf-test-policy-" + acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeRegionInstanceTemplateDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccComputeRegionInstanceTemplate_instanceResourcePolicyCollocated(RandString(t, 10), policyName), + Config: testAccComputeRegionInstanceTemplate_instanceResourcePolicyCollocated(acctest.RandString(t, 10), policyName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeRegionInstanceTemplateExists(t, "google_compute_region_instance_template.foobar", &template), testAccCheckComputeRegionInstanceTemplateHasInstanceResourcePolicies(&template, policyName), @@ -563,11 +563,11 @@ func TestAccComputeRegionInstanceTemplate_reservationAffinities(t *testing.T) { t.Parallel() var template compute.InstanceTemplate - var templateName = RandString(t, 10) + var templateName = acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeRegionInstanceTemplateDestroyProducer(t), Steps: []resource.TestStep{ { @@ -615,13 +615,13 @@ func TestAccComputeRegionInstanceTemplate_shieldedVmConfig1(t *testing.T) { var instanceTemplate compute.InstanceTemplate - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeRegionInstanceTemplateDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccComputeRegionInstanceTemplate_shieldedVmConfig(RandString(t, 10), true, true, true), + Config: testAccComputeRegionInstanceTemplate_shieldedVmConfig(acctest.RandString(t, 10), true, true, true), Check: resource.ComposeTestCheckFunc( testAccCheckComputeRegionInstanceTemplateExists(t, "google_compute_region_instance_template.foobar", &instanceTemplate), testAccCheckComputeRegionInstanceTemplateHasShieldedVmConfig(&instanceTemplate, true, true, true), @@ -641,13 +641,13 @@ func TestAccComputeRegionInstanceTemplate_shieldedVmConfig2(t *testing.T) { var instanceTemplate compute.InstanceTemplate - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeRegionInstanceTemplateDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccComputeRegionInstanceTemplate_shieldedVmConfig(RandString(t, 10), true, true, false), + Config: testAccComputeRegionInstanceTemplate_shieldedVmConfig(acctest.RandString(t, 10), true, true, false), Check: resource.ComposeTestCheckFunc( testAccCheckComputeRegionInstanceTemplateExists(t, "google_compute_region_instance_template.foobar", &instanceTemplate), testAccCheckComputeRegionInstanceTemplateHasShieldedVmConfig(&instanceTemplate, true, true, false), @@ -667,13 +667,13 @@ func TestAccComputeRegionInstanceTemplate_ConfidentialInstanceConfigMain(t *test var instanceTemplate compute.InstanceTemplate - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeRegionInstanceTemplateDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccComputeRegionInstanceTemplateConfidentialInstanceConfig(RandString(t, 10), true), + Config: testAccComputeRegionInstanceTemplateConfidentialInstanceConfig(acctest.RandString(t, 10), true), Check: resource.ComposeTestCheckFunc( testAccCheckComputeRegionInstanceTemplateExists(t, "google_compute_region_instance_template.foobar", &instanceTemplate), testAccCheckComputeRegionInstanceTemplateHasConfidentialInstanceConfig(&instanceTemplate, true), @@ -688,13 +688,13 @@ func TestAccComputeRegionInstanceTemplate_AdvancedMachineFeatures(t *testing.T) var instanceTemplate compute.InstanceTemplate - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeRegionInstanceTemplateDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccComputeRegionInstanceTemplateAdvancedMachineFeatures(RandString(t, 10)), + Config: testAccComputeRegionInstanceTemplateAdvancedMachineFeatures(acctest.RandString(t, 10)), Check: resource.ComposeTestCheckFunc( testAccCheckComputeRegionInstanceTemplateExists(t, "google_compute_region_instance_template.foobar", &instanceTemplate), ), @@ -707,13 +707,13 @@ func TestAccComputeRegionInstanceTemplate_AdvancedMachineFeatures(t *testing.T) func TestAccComputeRegionInstanceTemplate_enableDisplay(t *testing.T) { t.Parallel() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeRegionInstanceTemplateDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccComputeRegionInstanceTemplate_enableDisplay(RandString(t, 10)), + Config: testAccComputeRegionInstanceTemplate_enableDisplay(acctest.RandString(t, 10)), }, { ResourceName: "google_compute_region_instance_template.foobar", @@ -732,13 +732,13 @@ func TestAccComputeRegionInstanceTemplate_maintenance_interval(t *testing.T) { var instanceTemplate compute.InstanceTemplate - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeRegionInstanceTemplateDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccComputeRegionInstanceTemplate_maintenance_interval(RandString(t, 10)), + Config: testAccComputeRegionInstanceTemplate_maintenance_interval(acctest.RandString(t, 10)), Check: resource.ComposeTestCheckFunc( testAccCheckComputeRegionInstanceTemplateExists( t, "google_compute_region_instance_template.foobar", &instanceTemplate), @@ -751,7 +751,7 @@ func TestAccComputeRegionInstanceTemplate_maintenance_interval(t *testing.T) { ImportStateVerify: true, }, { - Config: testAccComputeRegionInstanceTemplate_basic(RandString(t, 10)), + Config: testAccComputeRegionInstanceTemplate_basic(acctest.RandString(t, 10)), Check: resource.ComposeTestCheckFunc( testAccCheckComputeRegionInstanceTemplateExists( t, "google_compute_region_instance_template.foobar", &instanceTemplate), @@ -766,12 +766,12 @@ func TestAccComputeRegionInstanceTemplate_maintenance_interval(t *testing.T) { func TestAccComputeRegionInstanceTemplate_invalidDiskType(t *testing.T) { t.Parallel() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { - Config: testAccComputeRegionInstanceTemplate_invalidDiskType(RandString(t, 10)), + Config: testAccComputeRegionInstanceTemplate_invalidDiskType(acctest.RandString(t, 10)), ExpectError: regexp.MustCompile("SCRATCH disks must have a disk_type of local-ssd"), }, }, @@ -781,12 +781,12 @@ func TestAccComputeRegionInstanceTemplate_invalidDiskType(t *testing.T) { func TestAccComputeRegionInstanceTemplate_withScratchDisk(t *testing.T) { t.Parallel() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { - Config: testAccComputeRegionInstanceTemplate_with375GbScratchDisk(RandString(t, 10)), + Config: testAccComputeRegionInstanceTemplate_with375GbScratchDisk(acctest.RandString(t, 10)), }, { ResourceName: "google_compute_region_instance_template.foobar", @@ -801,12 +801,12 @@ func TestAccComputeRegionInstanceTemplate_withScratchDisk(t *testing.T) { func TestAccComputeRegionInstanceTemplate_with18TbScratchDisk(t *testing.T) { t.Parallel() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { - Config: testAccComputeRegionInstanceTemplate_with18TbScratchDisk(RandString(t, 10)), + Config: testAccComputeRegionInstanceTemplate_with18TbScratchDisk(acctest.RandString(t, 10)), }, { ResourceName: "google_compute_region_instance_template.foobar", @@ -822,14 +822,14 @@ func TestAccComputeRegionInstanceTemplate_imageResourceTest(t *testing.T) { // Multiple fine-grained resources acctest.SkipIfVcr(t) t.Parallel() - diskName := "tf-test-disk-" + RandString(t, 10) - computeImage := "tf-test-image-" + RandString(t, 10) + diskName := "tf-test-disk-" + acctest.RandString(t, 10) + computeImage := "tf-test-image-" + acctest.RandString(t, 10) imageDesc1 := "Some description" imageDesc2 := "Some other description" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeRegionInstanceTemplateDestroyProducer(t), Steps: []resource.TestStep{ { @@ -858,15 +858,15 @@ func TestAccComputeRegionInstanceTemplate_diskResourcePolicies(t *testing.T) { t.Parallel() var instanceTemplate compute.InstanceTemplate - policyName := "tf-test-policy-" + RandString(t, 10) + policyName := "tf-test-policy-" + acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeRegionInstanceTemplateDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccComputeRegionInstanceTemplate_diskResourcePolicies(RandString(t, 10), policyName), + Config: testAccComputeRegionInstanceTemplate_diskResourcePolicies(acctest.RandString(t, 10), policyName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeRegionInstanceTemplateExists(t, "google_compute_region_instance_template.foobar", &instanceTemplate), testAccCheckComputeRegionInstanceTemplateHasDiskResourcePolicy(&instanceTemplate, policyName), @@ -885,11 +885,11 @@ func TestAccComputeRegionInstanceTemplate_nictype_update(t *testing.T) { t.Parallel() var instanceTemplate compute.InstanceTemplate - var instanceTemplateName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) + var instanceTemplateName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -914,11 +914,11 @@ func TestAccComputeRegionInstanceTemplate_queueCount(t *testing.T) { t.Parallel() var instanceTemplate compute.InstanceTemplate - var instanceTemplateName = fmt.Sprintf("tf-test-%s", RandString(t, 10)) + var instanceTemplateName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -937,13 +937,13 @@ func TestAccComputeRegionInstanceTemplate_managedEnvoy(t *testing.T) { var instanceTemplate compute.InstanceTemplate - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeRegionInstanceTemplateDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccComputeRegionInstanceTemplate_managedEnvoy(RandString(t, 10)), + Config: testAccComputeRegionInstanceTemplate_managedEnvoy(acctest.RandString(t, 10)), Check: resource.ComposeTestCheckFunc( testAccCheckComputeRegionInstanceTemplateExists( t, "google_compute_region_instance_template.foobar", &instanceTemplate), @@ -962,13 +962,13 @@ func TestAccComputeRegionInstanceTemplate_spot(t *testing.T) { t.Parallel() var instanceTemplate compute.InstanceTemplate - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeRegionInstanceTemplateDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccComputeRegionInstanceTemplate_spot(RandString(t, 10)), + Config: testAccComputeRegionInstanceTemplate_spot(acctest.RandString(t, 10)), Check: resource.ComposeTestCheckFunc( testAccCheckComputeRegionInstanceTemplateExists( t, "google_compute_region_instance_template.foobar", &instanceTemplate), @@ -996,13 +996,13 @@ func TestAccComputeRegionInstanceTemplate_spot_maxRunDuration(t *testing.T) { expectedMaxRunDuration.Nanos = 123 expectedMaxRunDuration.Seconds = 60 - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeRegionInstanceTemplateDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccComputeRegionInstanceTemplate_spot_maxRunDuration(RandString(t, 10)), + Config: testAccComputeRegionInstanceTemplate_spot_maxRunDuration(acctest.RandString(t, 10)), Check: resource.ComposeTestCheckFunc( testAccCheckComputeRegionInstanceTemplateExists( t, "google_compute_region_instance_template.foobar", &instanceTemplate), @@ -1032,13 +1032,13 @@ func TestAccComputeRegionInstanceTemplate_sourceSnapshotEncryptionKey(t *testing context := map[string]interface{}{ "kms_ring_name": tpgresource.GetResourceNameFromSelfLink(kmsKey.KeyRing.Name), "kms_key_name": tpgresource.GetResourceNameFromSelfLink(kmsKey.CryptoKey.Name), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeRegionInstanceTemplateDestroyProducer(t), Steps: []resource.TestStep{ { @@ -1067,12 +1067,12 @@ func TestAccComputeRegionInstanceTemplate_sourceImageEncryptionKey(t *testing.T) context := map[string]interface{}{ "kms_ring_name": tpgresource.GetResourceNameFromSelfLink(kmsKey.KeyRing.Name), "kms_key_name": tpgresource.GetResourceNameFromSelfLink(kmsKey.CryptoKey.Name), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeRegionInstanceTemplateDestroyProducer(t), Steps: []resource.TestStep{ { @@ -1094,7 +1094,7 @@ func TestAccComputeRegionInstanceTemplate_sourceImageEncryptionKey(t *testing.T) func testAccCheckComputeRegionInstanceTemplateDestroyProducer(t *testing.T) func(s *terraform.State) error { return func(s *terraform.State) error { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) for _, rs := range s.RootModule().Resources { if rs.Type != "google_compute_region_instance_template" { @@ -1151,7 +1151,7 @@ func testAccCheckComputeRegionInstanceTemplateExistsInProject(t *testing.T, n, p return fmt.Errorf("No ID is set") } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) splits := strings.Split(rs.Primary.ID, "/") templateName := splits[len(splits)-1] diff --git a/mmv1/third_party/terraform/tests/resource_compute_region_network_endpoint_group_test.go.erb b/mmv1/third_party/terraform/tests/resource_compute_region_network_endpoint_group_test.go.erb index 01e5e8a69dd4..85654e600b1c 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_region_network_endpoint_group_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_compute_region_network_endpoint_group_test.go.erb @@ -15,12 +15,12 @@ func TestAccComputeRegionNetworkEndpointGroup_negWithServerlessDeployment(t *tes t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeRegionNetworkEndpointGroupDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_compute_region_per_instance_config_test.go.erb b/mmv1/third_party/terraform/tests/resource_compute_region_per_instance_config_test.go.erb index c68db36e1d94..628a2888973b 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_region_per_instance_config_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_compute_region_per_instance_config_test.go.erb @@ -16,22 +16,22 @@ func TestAccComputeRegionPerInstanceConfig_statefulBasic(t *testing.T) { acctest.SkipIfVcr(t) t.Parallel() - suffix := RandString(t, 10) + suffix := acctest.RandString(t, 10) rigmName := fmt.Sprintf("tf-test-rigm-%s", suffix) context := map[string]interface{}{ "rigm_name": rigmName, "random_suffix": suffix, - "config_name": fmt.Sprintf("instance-%s", RandString(t, 10)), - "config_name2": fmt.Sprintf("instance-%s", RandString(t, 10)), - "config_name3": fmt.Sprintf("instance-%s", RandString(t, 10)), - "config_name4": fmt.Sprintf("instance-%s", RandString(t, 10)), + "config_name": fmt.Sprintf("instance-%s", acctest.RandString(t, 10)), + "config_name2": fmt.Sprintf("instance-%s", acctest.RandString(t, 10)), + "config_name3": fmt.Sprintf("instance-%s", acctest.RandString(t, 10)), + "config_name4": fmt.Sprintf("instance-%s", acctest.RandString(t, 10)), } rigmId := fmt.Sprintf("projects/%s/regions/%s/instanceGroupManagers/%s", envvar.GetTestProjectFromEnv(), envvar.GetTestRegionFromEnv(), rigmName) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { // Create one endpoint @@ -95,14 +95,14 @@ func TestAccComputeRegionPerInstanceConfig_update(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), - "rigm_name": fmt.Sprintf("tf-test-rigm-%s", RandString(t, 10)), - "config_name": fmt.Sprintf("instance-%s", RandString(t, 10)), + "random_suffix": acctest.RandString(t, 10), + "rigm_name": fmt.Sprintf("tf-test-rigm-%s", acctest.RandString(t, 10)), + "config_name": fmt.Sprintf("instance-%s", acctest.RandString(t, 10)), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { // Create one config @@ -132,18 +132,18 @@ func TestAccComputeRegionPerInstanceConfig_statefulIps(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), - "rigm_name": fmt.Sprintf("tf-test-rigm-%s", RandString(t, 10)), - "config_name": fmt.Sprintf("instance-%s", RandString(t, 10)), - "network": fmt.Sprintf("tf-test-rigm-%s", RandString(t, 10)), - "subnetwork": fmt.Sprintf("tf-test-rigm-%s", RandString(t, 10)), - "address1": fmt.Sprintf("tf-test-rigm-address%s", RandString(t, 10)), - "address2": fmt.Sprintf("tf-test-rigm-address%s", RandString(t, 10)), + "random_suffix": acctest.RandString(t, 10), + "rigm_name": fmt.Sprintf("tf-test-rigm-%s", acctest.RandString(t, 10)), + "config_name": fmt.Sprintf("instance-%s", acctest.RandString(t, 10)), + "network": fmt.Sprintf("tf-test-rigm-%s", acctest.RandString(t, 10)), + "subnetwork": fmt.Sprintf("tf-test-rigm-%s", acctest.RandString(t, 10)), + "address1": fmt.Sprintf("tf-test-rigm-address%s", acctest.RandString(t, 10)), + "address2": fmt.Sprintf("tf-test-rigm-address%s", acctest.RandString(t, 10)), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { // Create one config diff --git a/mmv1/third_party/terraform/tests/resource_compute_region_security_policy_test.go.erb b/mmv1/third_party/terraform/tests/resource_compute_region_security_policy_test.go.erb index ee13bb6e0f87..ffa5ee011bb5 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_region_security_policy_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_compute_region_security_policy_test.go.erb @@ -13,12 +13,12 @@ func TestAccComputeRegionSecurityPolicy_regionSecurityPolicyBasicUpdateExample(t t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeRegionSecurityPolicyDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_compute_region_ssl_policy_test.go.erb b/mmv1/third_party/terraform/tests/resource_compute_region_ssl_policy_test.go.erb index 30004b9fc4f3..44b837951479 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_region_ssl_policy_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_compute_region_ssl_policy_test.go.erb @@ -21,11 +21,11 @@ func TestAccComputeRegionSslPolicy_update(t *testing.T) { t.Parallel() var sslPolicy compute.SslPolicy - sslPolicyName := fmt.Sprintf("test-ssl-policy-%s", RandString(t, 10)) + sslPolicyName := fmt.Sprintf("test-ssl-policy-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeSslPolicyDestroyProducer(t), Steps: []resource.TestStep{ { @@ -68,11 +68,11 @@ func TestAccComputeRegionSslPolicy_update_to_custom(t *testing.T) { t.Parallel() var sslPolicy compute.SslPolicy - sslPolicyName := fmt.Sprintf("test-ssl-policy-%s", RandString(t, 10)) + sslPolicyName := fmt.Sprintf("test-ssl-policy-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeSslPolicyDestroyProducer(t), Steps: []resource.TestStep{ { @@ -115,11 +115,11 @@ func TestAccComputeRegionSslPolicy_update_from_custom(t *testing.T) { t.Parallel() var sslPolicy compute.SslPolicy - sslPolicyName := fmt.Sprintf("test-ssl-policy-%s", RandString(t, 10)) + sslPolicyName := fmt.Sprintf("test-ssl-policy-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeSslPolicyDestroyProducer(t), Steps: []resource.TestStep{ { @@ -169,7 +169,7 @@ func testAccCheckComputeRegionSslPolicyExists(t *testing.T, n string, sslPolicy return fmt.Errorf("No ID is set") } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) project, err := acctest.GetTestProject(rs.Primary, config) if err != nil { diff --git a/mmv1/third_party/terraform/tests/resource_compute_region_target_http_proxy_test.go.erb b/mmv1/third_party/terraform/tests/resource_compute_region_target_http_proxy_test.go.erb index 5520ddfca757..b51fd9eb03e2 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_region_target_http_proxy_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_compute_region_target_http_proxy_test.go.erb @@ -12,15 +12,15 @@ import ( func TestAccComputeRegionTargetHttpProxy_update(t *testing.T) { t.Parallel() - target := fmt.Sprintf("thttp-test-%s", RandString(t, 10)) - backend := fmt.Sprintf("thttp-test-%s", RandString(t, 10)) - hc := fmt.Sprintf("thttp-test-%s", RandString(t, 10)) - urlmap1 := fmt.Sprintf("thttp-test-%s", RandString(t, 10)) - urlmap2 := fmt.Sprintf("thttp-test-%s", RandString(t, 10)) + target := fmt.Sprintf("thttp-test-%s", acctest.RandString(t, 10)) + backend := fmt.Sprintf("thttp-test-%s", acctest.RandString(t, 10)) + hc := fmt.Sprintf("thttp-test-%s", acctest.RandString(t, 10)) + urlmap1 := fmt.Sprintf("thttp-test-%s", acctest.RandString(t, 10)) + urlmap2 := fmt.Sprintf("thttp-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeTargetHttpProxyDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_compute_region_target_https_proxy_test.go.erb b/mmv1/third_party/terraform/tests/resource_compute_region_target_https_proxy_test.go.erb index 4ef49b4ab13a..899cdddfb95a 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_region_target_https_proxy_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_compute_region_target_https_proxy_test.go.erb @@ -12,11 +12,11 @@ import ( func TestAccComputeRegionTargetHttpsProxy_update(t *testing.T) { t.Parallel() - resourceSuffix := RandString(t, 10) + resourceSuffix := acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeTargetHttpsProxyDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_compute_region_target_tcp_proxy_test.go.erb b/mmv1/third_party/terraform/tests/resource_compute_region_target_tcp_proxy_test.go.erb index 94f25a43b98c..71d7485b9b04 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_region_target_tcp_proxy_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_compute_region_target_tcp_proxy_test.go.erb @@ -13,13 +13,13 @@ import ( func TestAccComputeRegionTargetTcpProxy_update(t *testing.T) { t.Parallel() - target := fmt.Sprintf("trtcp-test-%s", RandString(t, 10)) - backend := fmt.Sprintf("trtcp-test-%s", RandString(t, 10)) - hc := fmt.Sprintf("trtcp-test-%s", RandString(t, 10)) + target := fmt.Sprintf("trtcp-test-%s", acctest.RandString(t, 10)) + backend := fmt.Sprintf("trtcp-test-%s", acctest.RandString(t, 10)) + hc := fmt.Sprintf("trtcp-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeRegionTargetTcpProxyDestroyProducer(t), Steps: []resource.TestStep{ { @@ -66,7 +66,7 @@ func testAccCheckComputeRegionTargetTcpProxyExists(t *testing.T, n string) resou return fmt.Errorf("No ID is set") } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) name := rs.Primary.Attributes["name"] region := rs.Primary.Attributes["region"] diff --git a/mmv1/third_party/terraform/tests/resource_compute_region_url_map_test.go.erb b/mmv1/third_party/terraform/tests/resource_compute_region_url_map_test.go.erb index 058df7fce6a9..6345b5073262 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_region_url_map_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_compute_region_url_map_test.go.erb @@ -12,11 +12,11 @@ import ( func TestAccComputeRegionUrlMap_update_path_matcher(t *testing.T) { t.Parallel() - randomSuffix := RandString(t, 10) + randomSuffix := acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeUrlMapDestroyProducer(t), Steps: []resource.TestStep{ { @@ -42,11 +42,11 @@ func TestAccComputeRegionUrlMap_update_path_matcher(t *testing.T) { func TestAccComputeRegionUrlMap_advanced(t *testing.T) { t.Parallel() - randomSuffix := RandString(t, 10) + randomSuffix := acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeUrlMapDestroyProducer(t), Steps: []resource.TestStep{ { @@ -72,11 +72,11 @@ func TestAccComputeRegionUrlMap_advanced(t *testing.T) { func TestAccComputeRegionUrlMap_noPathRulesWithUpdate(t *testing.T) { t.Parallel() - randomSuffix := RandString(t, 10) + randomSuffix := acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeUrlMapDestroyProducer(t), Steps: []resource.TestStep{ { @@ -102,11 +102,11 @@ func TestAccComputeRegionUrlMap_noPathRulesWithUpdate(t *testing.T) { func TestAccComputeRegionUrlMap_ilbPathUpdate(t *testing.T) { t.Parallel() - randomSuffix := RandString(t, 10) + randomSuffix := acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeUrlMapDestroyProducer(t), Steps: []resource.TestStep{ { @@ -132,11 +132,11 @@ func TestAccComputeRegionUrlMap_ilbPathUpdate(t *testing.T) { func TestAccComputeRegionUrlMap_ilbRouteUpdate(t *testing.T) { t.Parallel() - randomSuffix := RandString(t, 10) + randomSuffix := acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeUrlMapDestroyProducer(t), Steps: []resource.TestStep{ { @@ -162,11 +162,11 @@ func TestAccComputeRegionUrlMap_ilbRouteUpdate(t *testing.T) { func TestAccComputeRegionUrlMap_defaultUrlRedirect(t *testing.T) { t.Parallel() - randomSuffix := RandString(t, 10) + randomSuffix := acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeUrlMapDestroyProducer(t), Steps: []resource.TestStep{ { @@ -184,11 +184,11 @@ func TestAccComputeRegionUrlMap_defaultUrlRedirect(t *testing.T) { func TestAccComputeRegionUrlMap_defaultUrlRedirectWithinPathMatcher(t *testing.T) { t.Parallel() - randomSuffix := RandString(t, 10) + randomSuffix := acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeUrlMapDestroyProducer(t), Steps: []resource.TestStep{ { @@ -207,11 +207,11 @@ func TestAccComputeRegionUrlMap_defaultUrlRedirectWithinPathMatcher(t *testing.T func TestAccComputeRegionUrlMap_defaultRouteAction_full_update(t *testing.T) { t.Parallel() - randomSuffix := RandString(t, 10) + randomSuffix := acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeUrlMapDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_compute_reservation_test.go b/mmv1/third_party/terraform/tests/resource_compute_reservation_test.go index d49485207cee..26a6dadacdb2 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_reservation_test.go +++ b/mmv1/third_party/terraform/tests/resource_compute_reservation_test.go @@ -11,11 +11,11 @@ import ( func TestAccComputeReservation_update(t *testing.T) { t.Parallel() - reservationName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + reservationName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeReservationDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_compute_resource_policy_test.go b/mmv1/third_party/terraform/tests/resource_compute_resource_policy_test.go index d0aca3c4af8c..9ba522f899e8 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_resource_policy_test.go +++ b/mmv1/third_party/terraform/tests/resource_compute_resource_policy_test.go @@ -11,13 +11,13 @@ import ( func TestAccComputeResourcePolicy_attached(t *testing.T) { t.Parallel() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeResourcePolicyDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccComputeResourcePolicy_attached(RandString(t, 10)), + Config: testAccComputeResourcePolicy_attached(acctest.RandString(t, 10)), }, { ResourceName: "google_compute_resource_policy.foo", diff --git a/mmv1/third_party/terraform/tests/resource_compute_route_test.go b/mmv1/third_party/terraform/tests/resource_compute_route_test.go index 31842ef6c7c2..a7a80672d75f 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_route_test.go +++ b/mmv1/third_party/terraform/tests/resource_compute_route_test.go @@ -11,13 +11,13 @@ import ( func TestAccComputeRoute_defaultInternetGateway(t *testing.T) { t.Parallel() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeRouteDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccComputeRoute_defaultInternetGateway(RandString(t, 10)), + Config: testAccComputeRoute_defaultInternetGateway(acctest.RandString(t, 10)), }, { ResourceName: "google_compute_route.foobar", @@ -29,16 +29,16 @@ func TestAccComputeRoute_defaultInternetGateway(t *testing.T) { } func TestAccComputeRoute_hopInstance(t *testing.T) { - instanceName := "tf-test-" + RandString(t, 10) + instanceName := "tf-test-" + acctest.RandString(t, 10) zone := "us-central1-b" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeRouteDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccComputeRoute_hopInstance(instanceName, zone, RandString(t, 10)), + Config: testAccComputeRoute_hopInstance(instanceName, zone, acctest.RandString(t, 10)), }, { ResourceName: "google_compute_route.foobar", diff --git a/mmv1/third_party/terraform/tests/resource_compute_router_bgp_peer_test.go b/mmv1/third_party/terraform/tests/resource_compute_router_bgp_peer_test.go index 9dd75ba6a06c..41bd0e16efcf 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_router_bgp_peer_test.go +++ b/mmv1/third_party/terraform/tests/resource_compute_router_bgp_peer_test.go @@ -12,10 +12,10 @@ import ( func TestAccComputeRouterPeer_basic(t *testing.T) { t.Parallel() - routerName := fmt.Sprintf("tf-test-router-%s", RandString(t, 10)) - VcrTest(t, resource.TestCase{ + routerName := fmt.Sprintf("tf-test-router-%s", acctest.RandString(t, 10)) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeRouterPeerDestroyProducer(t), Steps: []resource.TestStep{ { @@ -40,10 +40,10 @@ func TestAccComputeRouterPeer_basic(t *testing.T) { func TestAccComputeRouterPeer_advertiseMode(t *testing.T) { t.Parallel() - routerName := fmt.Sprintf("tf-test-router-%s", RandString(t, 10)) - VcrTest(t, resource.TestCase{ + routerName := fmt.Sprintf("tf-test-router-%s", acctest.RandString(t, 10)) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeRouterPeerDestroyProducer(t), Steps: []resource.TestStep{ { @@ -73,10 +73,10 @@ func TestAccComputeRouterPeer_advertiseMode(t *testing.T) { func TestAccComputeRouterPeer_enable(t *testing.T) { t.Parallel() - routerName := fmt.Sprintf("tf-test-router-%s", RandString(t, 10)) - VcrTest(t, resource.TestCase{ + routerName := fmt.Sprintf("tf-test-router-%s", acctest.RandString(t, 10)) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeRouterPeerDestroyProducer(t), Steps: []resource.TestStep{ { @@ -116,10 +116,10 @@ func TestAccComputeRouterPeer_enable(t *testing.T) { func TestAccComputeRouterPeer_bfd(t *testing.T) { t.Parallel() - routerName := fmt.Sprintf("tf-test-router-%s", RandString(t, 10)) - VcrTest(t, resource.TestCase{ + routerName := fmt.Sprintf("tf-test-router-%s", acctest.RandString(t, 10)) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeRouterPeerDestroyProducer(t), Steps: []resource.TestStep{ { @@ -159,10 +159,10 @@ func TestAccComputeRouterPeer_bfd(t *testing.T) { func TestAccComputeRouterPeer_routerApplianceInstance(t *testing.T) { t.Parallel() - routerName := fmt.Sprintf("tf-test-router-%s", RandString(t, 10)) - VcrTest(t, resource.TestCase{ + routerName := fmt.Sprintf("tf-test-router-%s", acctest.RandString(t, 10)) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeRouterPeerDestroyProducer(t), Steps: []resource.TestStep{ { @@ -182,11 +182,11 @@ func TestAccComputeRouterPeer_routerApplianceInstance(t *testing.T) { func TestAccComputeRouterPeer_Ipv6Basic(t *testing.T) { t.Parallel() - routerName := fmt.Sprintf("tf-test-router-%s", RandString(t, 10)) + routerName := fmt.Sprintf("tf-test-router-%s", acctest.RandString(t, 10)) resourceName := "google_compute_router_peer.foobar" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeRouterPeerDestroyProducer(t), Steps: []resource.TestStep{ { @@ -209,11 +209,11 @@ func TestAccComputeRouterPeer_Ipv6Basic(t *testing.T) { func TestAccComputeRouterPeer_UpdateIpv6Address(t *testing.T) { t.Parallel() - routerName := fmt.Sprintf("tf-test-router-%s", RandString(t, 10)) + routerName := fmt.Sprintf("tf-test-router-%s", acctest.RandString(t, 10)) resourceName := "google_compute_router_peer.foobar" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeRouterPeerDestroyProducer(t), Steps: []resource.TestStep{ { @@ -249,11 +249,11 @@ func TestAccComputeRouterPeer_UpdateIpv6Address(t *testing.T) { func TestAccComputeRouterPeer_EnableDisableIpv6(t *testing.T) { t.Parallel() - routerName := fmt.Sprintf("tf-test-router-%s", RandString(t, 10)) + routerName := fmt.Sprintf("tf-test-router-%s", acctest.RandString(t, 10)) resourceName := "google_compute_router_peer.foobar" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeRouterPeerDestroyProducer(t), Steps: []resource.TestStep{ { @@ -301,7 +301,7 @@ func TestAccComputeRouterPeer_EnableDisableIpv6(t *testing.T) { func testAccCheckComputeRouterPeerDestroyProducer(t *testing.T) func(s *terraform.State) error { return func(s *terraform.State) error { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) routersService := config.NewComputeClient(config.UserAgent).Routers @@ -336,7 +336,7 @@ func testAccCheckComputeRouterPeerDestroyProducer(t *testing.T) func(s *terrafor func testAccCheckComputeRouterPeerDelete(t *testing.T, n string) resource.TestCheckFunc { return func(s *terraform.State) error { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) routersService := config.NewComputeClient(config.UserAgent).Routers @@ -388,7 +388,7 @@ func testAccCheckComputeRouterPeerExists(t *testing.T, n string) resource.TestCh return fmt.Errorf("No ID is set") } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) project, err := acctest.GetTestProject(rs.Primary, config) if err != nil { diff --git a/mmv1/third_party/terraform/tests/resource_compute_router_interface_test.go b/mmv1/third_party/terraform/tests/resource_compute_router_interface_test.go index 2e711ca5376f..de650b885430 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_router_interface_test.go +++ b/mmv1/third_party/terraform/tests/resource_compute_router_interface_test.go @@ -13,16 +13,16 @@ import ( func TestAccComputeRouterInterface_basic(t *testing.T) { t.Parallel() - name := fmt.Sprintf("tf-test-router-%s", RandString(t, 10)) + name := fmt.Sprintf("tf-test-router-%s", acctest.RandString(t, 10)) context := map[string]interface{}{ "name": name, "region": "us-central1", } importIdFourPart := fmt.Sprintf("%s/%s/%s/%s", envvar.GetTestProjectFromEnv(), context["region"], context["name"], context["name"]) // name reused in config - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeRouterInterfaceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -53,10 +53,10 @@ func TestAccComputeRouterInterface_basic(t *testing.T) { func TestAccComputeRouterInterface_redundant(t *testing.T) { t.Parallel() - routerName := fmt.Sprintf("tf-test-router-%s", RandString(t, 10)) - VcrTest(t, resource.TestCase{ + routerName := fmt.Sprintf("tf-test-router-%s", acctest.RandString(t, 10)) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeRouterInterfaceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -76,10 +76,10 @@ func TestAccComputeRouterInterface_redundant(t *testing.T) { func TestAccComputeRouterInterface_withTunnel(t *testing.T) { t.Parallel() - routerName := fmt.Sprintf("tf-test-router-%s", RandString(t, 10)) - VcrTest(t, resource.TestCase{ + routerName := fmt.Sprintf("tf-test-router-%s", acctest.RandString(t, 10)) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeRouterInterfaceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -99,10 +99,10 @@ func TestAccComputeRouterInterface_withTunnel(t *testing.T) { func TestAccComputeRouterInterface_withPrivateIpAddress(t *testing.T) { t.Parallel() - routerName := fmt.Sprintf("tf-test-router-%s", RandString(t, 10)) - VcrTest(t, resource.TestCase{ + routerName := fmt.Sprintf("tf-test-router-%s", acctest.RandString(t, 10)) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeRouterInterfaceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -121,7 +121,7 @@ func TestAccComputeRouterInterface_withPrivateIpAddress(t *testing.T) { func testAccCheckComputeRouterInterfaceDestroyProducer(t *testing.T) func(s *terraform.State) error { return func(s *terraform.State) error { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) routersService := config.NewComputeClient(config.UserAgent).Routers @@ -156,7 +156,7 @@ func testAccCheckComputeRouterInterfaceDestroyProducer(t *testing.T) func(s *ter func testAccCheckComputeRouterInterfaceDelete(t *testing.T, n string) resource.TestCheckFunc { return func(s *terraform.State) error { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) routersService := config.NewComputeClient(config.UserAgent).Routers @@ -208,7 +208,7 @@ func testAccCheckComputeRouterInterfaceExists(t *testing.T, n string) resource.T return fmt.Errorf("No ID is set") } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) project, err := acctest.GetTestProject(rs.Primary, config) if err != nil { diff --git a/mmv1/third_party/terraform/tests/resource_compute_router_nat_test.go.erb b/mmv1/third_party/terraform/tests/resource_compute_router_nat_test.go.erb index 6e0aae9eaceb..53717e6cd87e 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_router_nat_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_compute_router_nat_test.go.erb @@ -20,12 +20,12 @@ func TestAccComputeRouterNat_basic(t *testing.T) { project := envvar.GetTestProjectFromEnv() region := envvar.GetTestRegionFromEnv() - testId := RandString(t, 10) + testId := acctest.RandString(t, 10) routerName := fmt.Sprintf("tf-test-router-nat-%s", testId) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeRouterNatDestroyProducer(t), Steps: []resource.TestStep{ { @@ -67,12 +67,12 @@ func TestAccComputeRouterNat_basic(t *testing.T) { func TestAccComputeRouterNat_update(t *testing.T) { t.Parallel() - testId := RandString(t, 10) + testId := acctest.RandString(t, 10) routerName := fmt.Sprintf("tf-test-router-nat-%s", testId) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeRouterNatDestroyProducer(t), Steps: []resource.TestStep{ { @@ -122,12 +122,12 @@ func TestAccComputeRouterNat_update(t *testing.T) { func TestAccComputeRouterNat_removeLogConfig(t *testing.T) { t.Parallel() - testId := RandString(t, 10) + testId := acctest.RandString(t, 10) routerName := fmt.Sprintf("tf-test-router-nat-%s", testId) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeRouterNatDestroyProducer(t), Steps: []resource.TestStep{ { @@ -153,12 +153,12 @@ func TestAccComputeRouterNat_removeLogConfig(t *testing.T) { func TestAccComputeRouterNat_withManualIpAndSubnetConfiguration(t *testing.T) { t.Parallel() - testId := RandString(t, 10) + testId := acctest.RandString(t, 10) routerName := fmt.Sprintf("tf-test-router-nat-%s", testId) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeRouterNatDestroyProducer(t), Steps: []resource.TestStep{ { @@ -176,12 +176,12 @@ func TestAccComputeRouterNat_withManualIpAndSubnetConfiguration(t *testing.T) { func TestAccComputeRouterNat_withPortAllocationMethods(t *testing.T) { t.Parallel() - testId := RandString(t, 10) + testId := acctest.RandString(t, 10) routerName := fmt.Sprintf("tf-test-router-nat-%s", testId) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeRouterNatDestroyProducer(t), Steps: []resource.TestStep{ { @@ -240,12 +240,12 @@ func TestAccComputeRouterNat_withPortAllocationMethods(t *testing.T) { func TestAccComputeRouterNat_withNatIpsAndDrainNatIps(t *testing.T) { t.Parallel() - testId := RandString(t, 10) + testId := acctest.RandString(t, 10) routerName := fmt.Sprintf("tf-test-router-nat-%s", testId) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeRouterNatDestroyProducer(t), Steps: []resource.TestStep{ // (ERROR): Creation with drain nat IPs should fail @@ -290,16 +290,16 @@ func TestAccComputeRouterNat_withNatIpsAndDrainNatIps(t *testing.T) { func TestAccComputeRouterNat_withNatRules(t *testing.T) { t.Parallel() - testId := RandString(t, 10) + testId := acctest.RandString(t, 10) routerName := fmt.Sprintf("tf-test-router-nat-%s", testId) - ruleDescription := RandString(t, 10) - ruleDescriptionUpdate := RandString(t, 10) + ruleDescription := acctest.RandString(t, 10) + ruleDescriptionUpdate := acctest.RandString(t, 10) match := "inIpRange(destination.ip, '1.1.0.0/16') || inIpRange(destination.ip, '2.2.0.0/16')" matchUpdate := "destination.ip == '1.1.0.1' || destination.ip == '8.8.8.8'" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeRouterNatDestroyProducer(t), Steps: []resource.TestStep{ { @@ -412,7 +412,7 @@ func TestAccComputeRouterNat_withNatRules(t *testing.T) { func testAccCheckComputeRouterNatDestroyProducer(t *testing.T) func(s *terraform.State) error { return func(s *terraform.State) error { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) routersService := config.NewComputeClient(config.UserAgent).Routers @@ -446,7 +446,7 @@ func testAccCheckComputeRouterNatDestroyProducer(t *testing.T) func(s *terraform func testAccCheckComputeRouterNatDelete(t *testing.T, n string) resource.TestCheckFunc { return func(s *terraform.State) error { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) routersService := config.NewComputeClient(config.UserAgent).Routers diff --git a/mmv1/third_party/terraform/tests/resource_compute_router_test.go b/mmv1/third_party/terraform/tests/resource_compute_router_test.go index daf7096318d3..66ad3c336993 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_router_test.go +++ b/mmv1/third_party/terraform/tests/resource_compute_router_test.go @@ -12,12 +12,12 @@ import ( func TestAccComputeRouter_basic(t *testing.T) { t.Parallel() - testId := RandString(t, 10) + testId := acctest.RandString(t, 10) routerName := fmt.Sprintf("tf-test-router-%s", testId) resourceRegion := "europe-west1" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeRouterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -35,12 +35,12 @@ func TestAccComputeRouter_basic(t *testing.T) { func TestAccComputeRouter_noRegion(t *testing.T) { t.Parallel() - testId := RandString(t, 10) + testId := acctest.RandString(t, 10) routerName := fmt.Sprintf("tf-test-router-%s", testId) providerRegion := "us-central1" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeRouterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -58,11 +58,11 @@ func TestAccComputeRouter_noRegion(t *testing.T) { func TestAccComputeRouter_full(t *testing.T) { t.Parallel() - testId := RandString(t, 10) + testId := acctest.RandString(t, 10) routerName := fmt.Sprintf("tf-test-router-%s", testId) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeRouterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -80,12 +80,12 @@ func TestAccComputeRouter_full(t *testing.T) { func TestAccComputeRouter_update(t *testing.T) { t.Parallel() - testId := RandString(t, 10) + testId := acctest.RandString(t, 10) routerName := fmt.Sprintf("tf-test-router-%s", testId) region := envvar.GetTestRegionFromEnv() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeRouterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -119,12 +119,12 @@ func TestAccComputeRouter_update(t *testing.T) { func TestAccComputeRouter_updateAddRemoveBGP(t *testing.T) { t.Parallel() - testId := RandString(t, 10) + testId := acctest.RandString(t, 10) routerName := fmt.Sprintf("tf-test-router-%s", testId) region := envvar.GetTestRegionFromEnv() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeRouterDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_compute_security_policy_test.go.erb b/mmv1/third_party/terraform/tests/resource_compute_security_policy_test.go.erb index 28956dfb63c0..b87112a54b6a 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_security_policy_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_compute_security_policy_test.go.erb @@ -15,11 +15,11 @@ import ( func TestAccComputeSecurityPolicy_basic(t *testing.T) { t.Parallel() - spName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + spName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeSecurityPolicyDestroyProducer(t), Steps: []resource.TestStep{ { @@ -37,11 +37,11 @@ func TestAccComputeSecurityPolicy_basic(t *testing.T) { func TestAccComputeSecurityPolicy_withRule(t *testing.T) { t.Parallel() - spName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + spName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeSecurityPolicyDestroyProducer(t), Steps: []resource.TestStep{ { @@ -59,11 +59,11 @@ func TestAccComputeSecurityPolicy_withRule(t *testing.T) { func TestAccComputeSecurityPolicy_withRuleExpr(t *testing.T) { t.Parallel() - spName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + spName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeSecurityPolicyDestroyProducer(t), Steps: []resource.TestStep{ { @@ -82,11 +82,11 @@ func TestAccComputeSecurityPolicy_withRuleExpr(t *testing.T) { func TestAccComputeSecurityPolicy_withPreconfiguredWafConfig(t *testing.T) { t.Parallel() - spName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + spName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeSecurityPolicyDestroyProducer(t), Steps: []resource.TestStep{ { @@ -121,11 +121,11 @@ func TestAccComputeSecurityPolicy_withPreconfiguredWafConfig(t *testing.T) { func TestAccComputeSecurityPolicy_update(t *testing.T) { t.Parallel() - spName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + spName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeSecurityPolicyDestroyProducer(t), Steps: []resource.TestStep{ { @@ -166,11 +166,11 @@ func TestAccComputeSecurityPolicy_update(t *testing.T) { func TestAccComputeSecurityPolicy_withAdvancedOptionsConfig(t *testing.T) { t.Parallel() - spName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + spName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeSecurityPolicyDestroyProducer(t), Steps: []resource.TestStep{ { @@ -205,11 +205,11 @@ func TestAccComputeSecurityPolicy_withAdvancedOptionsConfig(t *testing.T) { func TestAccComputeSecurityPolicy_withAdaptiveProtection(t *testing.T) { t.Parallel() - spName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + spName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeSecurityPolicyDestroyProducer(t), Steps: []resource.TestStep{ { @@ -236,11 +236,11 @@ func TestAccComputeSecurityPolicy_withAdaptiveProtection(t *testing.T) { func TestAccComputeSecurityPolicy_withAdaptiveProtectionAutoDeployConfig(t *testing.T) { t.Parallel() - spName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + spName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeSecurityPolicyDestroyProducer(t), Steps: []resource.TestStep{ { @@ -267,11 +267,11 @@ func TestAccComputeSecurityPolicy_withAdaptiveProtectionAutoDeployConfig(t *test func TestAccComputeSecurityPolicy_withRateLimitOptions(t *testing.T) { t.Parallel() - spName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + spName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeSecurityPolicyDestroyProducer(t), Steps: []resource.TestStep{ { @@ -289,11 +289,11 @@ func TestAccComputeSecurityPolicy_withRateLimitOptions(t *testing.T) { func TestAccComputeSecurityPolicy_withRateLimitWithRedirectOptions(t *testing.T) { t.Parallel() - spName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + spName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeSecurityPolicyDestroyProducer(t), Steps: []resource.TestStep{ { @@ -312,11 +312,11 @@ func TestAccComputeSecurityPolicy_withRateLimitWithRedirectOptions(t *testing.T) func TestAccComputeSecurityPolicy_withRateLimit_withEnforceOnKeyConfigs(t *testing.T) { t.Parallel() - spName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + spName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeSecurityPolicyDestroyProducer(t), Steps: []resource.TestStep{ { @@ -334,11 +334,11 @@ func TestAccComputeSecurityPolicy_withRateLimit_withEnforceOnKeyConfigs(t *testi func TestAccComputeSecurityPolicy_withRateLimitOption_withMultipleEnforceOnKeyConfigs(t *testing.T) { t.Parallel() - spName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + spName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeSecurityPolicyDestroyProducer(t), Steps: []resource.TestStep{ { @@ -357,11 +357,11 @@ func TestAccComputeSecurityPolicy_withRateLimitOption_withMultipleEnforceOnKeyCo func TestAccComputeSecurityPolicy_EnforceOnKeyUpdates(t *testing.T) { t.Parallel() - spName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + spName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeSecurityPolicyDestroyProducer(t), Steps: []resource.TestStep{ { @@ -406,11 +406,11 @@ func TestAccComputeSecurityPolicy_withRecaptchaOptionsConfig(t *testing.T) { t.Parallel() project := envvar.GetTestProjectFromEnv() - spName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + spName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeSecurityPolicyDestroyProducer(t), Steps: []resource.TestStep{ { @@ -452,15 +452,15 @@ func TestAccComputeSecurityPolicy_withRecaptchaOptionsConfig(t *testing.T) { func TestAccComputeSecurityPolicy_withHeadAction(t *testing.T) { t.Parallel() - spName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - headerName := fmt.Sprintf("tf-test-header-name-%s", RandString(t, 10)) - headerNameUpdate := fmt.Sprintf("tf-test-header-name-update-%s", RandString(t, 10)) - headerValue := fmt.Sprintf("tf-test-header-value-%s", RandString(t, 10)) - headerValueUpdate := fmt.Sprintf("tf-test-header-value-update-%s", RandString(t, 10)) + spName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + headerName := fmt.Sprintf("tf-test-header-name-%s", acctest.RandString(t, 10)) + headerNameUpdate := fmt.Sprintf("tf-test-header-name-update-%s", acctest.RandString(t, 10)) + headerValue := fmt.Sprintf("tf-test-header-value-%s", acctest.RandString(t, 10)) + headerValueUpdate := fmt.Sprintf("tf-test-header-value-update-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeSecurityPolicyDestroyProducer(t), Steps: []resource.TestStep{ { @@ -582,7 +582,7 @@ resource "google_compute_security_policy" "policy" { func testAccCheckComputeSecurityPolicyDestroyProducer(t *testing.T) func(s *terraform.State) error { return func(s *terraform.State) error { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) for _, rs := range s.RootModule().Resources { if rs.Type != "google_compute_security_policy" { @@ -1397,11 +1397,11 @@ resource "google_compute_security_policy" "policy" { func TestAccComputeSecurityPolicy_withRedirectOptionsRecaptcha(t *testing.T) { t.Parallel() - spName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + spName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeSecurityPolicyDestroyProducer(t), Steps: []resource.TestStep{ { @@ -1419,11 +1419,11 @@ func TestAccComputeSecurityPolicy_withRedirectOptionsRecaptcha(t *testing.T) { func TestAccComputeSecurityPolicy_withRedirectOptionsUpdate(t *testing.T) { t.Parallel() - spName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + spName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeSecurityPolicyDestroyProducer(t), Steps: []resource.TestStep{ { @@ -1449,11 +1449,11 @@ func TestAccComputeSecurityPolicy_withRedirectOptionsUpdate(t *testing.T) { func TestAccComputeSecurityPolicy_withRedirectOptionsExternal(t *testing.T) { t.Parallel() - spName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + spName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeSecurityPolicyDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_compute_service_attachment_test.go b/mmv1/third_party/terraform/tests/resource_compute_service_attachment_test.go index 36dc182e54ae..41fa5b4bffe7 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_service_attachment_test.go +++ b/mmv1/third_party/terraform/tests/resource_compute_service_attachment_test.go @@ -11,12 +11,12 @@ func TestAccComputeServiceAttachment_serviceAttachmentBasicExampleUpdate(t *test t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeServiceAttachmentDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_compute_shared_reservation_update_test.go b/mmv1/third_party/terraform/tests/resource_compute_shared_reservation_update_test.go index 2f21fec195b4..28465e6314f6 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_shared_reservation_update_test.go +++ b/mmv1/third_party/terraform/tests/resource_compute_shared_reservation_update_test.go @@ -16,12 +16,12 @@ func TestAccComputeSharedReservation_update(t *testing.T) { "project": envvar.GetTestProjectFromEnv(), "org_id": envvar.GetTestOrgFromEnv(t), "billing_account": envvar.GetTestBillingAccountFromEnv(t), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeReservationDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_compute_shared_vpc_test.go b/mmv1/third_party/terraform/tests/resource_compute_shared_vpc_test.go index 598f349faad4..65ccab6e28e9 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_shared_vpc_test.go +++ b/mmv1/third_party/terraform/tests/resource_compute_shared_vpc_test.go @@ -14,15 +14,15 @@ func TestAccComputeSharedVpc_basic(t *testing.T) { org := envvar.GetTestOrgFromEnv(t) billingId := envvar.GetTestBillingAccountFromEnv(t) - hostProject := fmt.Sprintf("tf-test-h-%d", RandInt(t)) - serviceProject := fmt.Sprintf("tf-test-s-%d", RandInt(t)) + hostProject := fmt.Sprintf("tf-test-h-%d", acctest.RandInt(t)) + serviceProject := fmt.Sprintf("tf-test-s-%d", acctest.RandInt(t)) hostProjectResourceName := "google_compute_shared_vpc_host_project.host" serviceProjectResourceName := "google_compute_shared_vpc_service_project.service" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ //Create resources with the deletion_policy flag { @@ -72,7 +72,7 @@ func TestAccComputeSharedVpc_basic(t *testing.T) { func testAccCheckComputeSharedVpcHostProject(t *testing.T, hostProject string, enabled bool) resource.TestCheckFunc { return func(s *terraform.State) error { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) found, err := config.NewComputeClient(config.UserAgent).Projects.Get(hostProject).Do() if err != nil { @@ -93,7 +93,7 @@ func testAccCheckComputeSharedVpcHostProject(t *testing.T, hostProject string, e func testAccCheckComputeSharedVpcServiceProject(t *testing.T, hostProject, serviceProject string, enabled bool) resource.TestCheckFunc { return func(s *terraform.State) error { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) serviceHostProject, err := config.NewComputeClient(config.UserAgent).Projects.GetXpnHost(serviceProject).Do() if err != nil { if enabled { diff --git a/mmv1/third_party/terraform/tests/resource_compute_snapshot_test.go b/mmv1/third_party/terraform/tests/resource_compute_snapshot_test.go index ab4a21033643..57963588d37a 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_snapshot_test.go +++ b/mmv1/third_party/terraform/tests/resource_compute_snapshot_test.go @@ -11,12 +11,12 @@ import ( func TestAccComputeSnapshot_encryption(t *testing.T) { t.Parallel() - snapshotName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - diskName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + snapshotName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + diskName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeSnapshotDestroyProducer(t), Steps: []resource.TestStep{ { @@ -37,12 +37,12 @@ func TestAccComputeSnapshot_encryptionCMEK(t *testing.T) { // KMS causes errors due to rotation acctest.SkipIfVcr(t) - snapshotName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - diskName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + snapshotName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + diskName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeSnapshotDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_compute_ssl_certificate_test.go b/mmv1/third_party/terraform/tests/resource_compute_ssl_certificate_test.go index f0840ced4926..56d182406502 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_ssl_certificate_test.go +++ b/mmv1/third_party/terraform/tests/resource_compute_ssl_certificate_test.go @@ -14,9 +14,9 @@ func TestAccComputeSslCertificate_no_name(t *testing.T) { acctest.SkipIfVcr(t) t.Parallel() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeSslCertificateDestroyProducer(t), Steps: []resource.TestStep{ { @@ -47,7 +47,7 @@ func testAccCheckComputeSslCertificateExists(t *testing.T, n string) resource.Te return fmt.Errorf("No ID is set") } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) // We don't specify a name, but it is saved during create name := rs.Primary.Attributes["name"] diff --git a/mmv1/third_party/terraform/tests/resource_compute_ssl_policy_test.go.erb b/mmv1/third_party/terraform/tests/resource_compute_ssl_policy_test.go.erb index 624acaa07a98..a9a6e1e4ec98 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_ssl_policy_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_compute_ssl_policy_test.go.erb @@ -20,11 +20,11 @@ func TestAccComputeSslPolicy_update(t *testing.T) { t.Parallel() var sslPolicy compute.SslPolicy - sslPolicyName := fmt.Sprintf("test-ssl-policy-%s", RandString(t, 10)) + sslPolicyName := fmt.Sprintf("test-ssl-policy-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeSslPolicyDestroyProducer(t), Steps: []resource.TestStep{ { @@ -67,11 +67,11 @@ func TestAccComputeSslPolicy_update_to_custom(t *testing.T) { t.Parallel() var sslPolicy compute.SslPolicy - sslPolicyName := fmt.Sprintf("test-ssl-policy-%s", RandString(t, 10)) + sslPolicyName := fmt.Sprintf("test-ssl-policy-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeSslPolicyDestroyProducer(t), Steps: []resource.TestStep{ { @@ -114,11 +114,11 @@ func TestAccComputeSslPolicy_update_from_custom(t *testing.T) { t.Parallel() var sslPolicy compute.SslPolicy - sslPolicyName := fmt.Sprintf("test-ssl-policy-%s", RandString(t, 10)) + sslPolicyName := fmt.Sprintf("test-ssl-policy-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeSslPolicyDestroyProducer(t), Steps: []resource.TestStep{ { @@ -168,7 +168,7 @@ func testAccCheckComputeSslPolicyExists(t *testing.T, n string, sslPolicy *compu return fmt.Errorf("No ID is set") } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) project, err := acctest.GetTestProject(rs.Primary, config) if err != nil { diff --git a/mmv1/third_party/terraform/tests/resource_compute_subnetwork_iam_test.go b/mmv1/third_party/terraform/tests/resource_compute_subnetwork_iam_test.go index 4c27d964d269..9971549c8edf 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_subnetwork_iam_test.go +++ b/mmv1/third_party/terraform/tests/resource_compute_subnetwork_iam_test.go @@ -15,14 +15,14 @@ func TestAccComputeSubnetworkIamPolicy(t *testing.T) { t.Parallel() project := envvar.GetTestProjectFromEnv() - account := fmt.Sprintf("tf-test-%d", RandInt(t)) + account := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) role := "roles/compute.networkUser" region := envvar.GetTestRegionFromEnv() - subnetwork := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + subnetwork := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccComputeSubnetworkIamPolicy_basic(account, region, subnetwork, role), diff --git a/mmv1/third_party/terraform/tests/resource_compute_subnetwork_test.go.erb b/mmv1/third_party/terraform/tests/resource_compute_subnetwork_test.go.erb index ebcec9ce8e69..faad0e6a0903 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_subnetwork_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_compute_subnetwork_test.go.erb @@ -62,14 +62,14 @@ func TestAccComputeSubnetwork_basic(t *testing.T) { var subnetwork1 compute.Subnetwork var subnetwork2 compute.Subnetwork - cnName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - subnetwork1Name := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - subnetwork2Name := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - subnetwork3Name := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + cnName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + subnetwork1Name := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + subnetwork2Name := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + subnetwork3Name := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeSubnetworkDestroyProducer(t), Steps: []resource.TestStep{ { @@ -100,12 +100,12 @@ func TestAccComputeSubnetwork_update(t *testing.T) { var subnetwork compute.Subnetwork - cnName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - subnetworkName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + cnName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + subnetworkName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeSubnetworkDestroyProducer(t), Steps: []resource.TestStep{ { @@ -157,12 +157,12 @@ func TestAccComputeSubnetwork_secondaryIpRanges(t *testing.T) { var subnetwork compute.Subnetwork - cnName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - subnetworkName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + cnName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + subnetworkName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeSubnetworkDestroyProducer(t), Steps: []resource.TestStep{ { @@ -213,12 +213,12 @@ func TestAccComputeSubnetwork_flowLogs(t *testing.T) { var subnetwork compute.Subnetwork - cnName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - subnetworkName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + cnName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + subnetworkName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeSubnetworkDestroyProducer(t), Steps: []resource.TestStep{ { @@ -290,12 +290,12 @@ func TestAccComputeSubnetwork_flowLogsMigrate(t *testing.T) { var subnetwork compute.Subnetwork - cnName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - subnetworkName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + cnName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + subnetworkName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeSubnetworkDestroyProducer(t), Steps: []resource.TestStep{ { @@ -341,12 +341,12 @@ func TestAccComputeSubnetwork_flowLogsMigrate(t *testing.T) { func TestAccComputeSubnetwork_ipv6(t *testing.T) { t.Parallel() - cnName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - subnetworkName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + cnName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + subnetworkName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeSubnetworkDestroyProducer(t), Steps: []resource.TestStep{ { @@ -380,7 +380,7 @@ func testAccCheckComputeSubnetworkExists(t *testing.T, n string, subnetwork *com return fmt.Errorf("No ID is set") } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) region := rs.Primary.Attributes["region"] subnet_name := rs.Primary.Attributes["name"] diff --git a/mmv1/third_party/terraform/tests/resource_compute_target_grpc_proxy_test.go b/mmv1/third_party/terraform/tests/resource_compute_target_grpc_proxy_test.go index 57fce7bc4769..46dd685bf247 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_target_grpc_proxy_test.go +++ b/mmv1/third_party/terraform/tests/resource_compute_target_grpc_proxy_test.go @@ -11,15 +11,15 @@ import ( func TestAccComputeTargetGrpcProxy_update(t *testing.T) { t.Parallel() - proxy := fmt.Sprintf("tf-manual-proxy-%s", RandString(t, 10)) - urlmap1 := fmt.Sprintf("tf-manual-urlmap1-%s", RandString(t, 10)) - urlmap2 := fmt.Sprintf("tf-manual-urlmap2-%s", RandString(t, 10)) - backend := fmt.Sprintf("tf-manual-backend-%s", RandString(t, 10)) - healthcheck := fmt.Sprintf("tf-manual-healthcheck-%s", RandString(t, 10)) + proxy := fmt.Sprintf("tf-manual-proxy-%s", acctest.RandString(t, 10)) + urlmap1 := fmt.Sprintf("tf-manual-urlmap1-%s", acctest.RandString(t, 10)) + urlmap2 := fmt.Sprintf("tf-manual-urlmap2-%s", acctest.RandString(t, 10)) + backend := fmt.Sprintf("tf-manual-backend-%s", acctest.RandString(t, 10)) + healthcheck := fmt.Sprintf("tf-manual-healthcheck-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeTargetGrpcProxyDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_compute_target_http_proxy_test.go b/mmv1/third_party/terraform/tests/resource_compute_target_http_proxy_test.go index 80ee827ff9e7..80524bcaf583 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_target_http_proxy_test.go +++ b/mmv1/third_party/terraform/tests/resource_compute_target_http_proxy_test.go @@ -12,15 +12,15 @@ import ( func TestAccComputeTargetHttpProxy_update(t *testing.T) { t.Parallel() - target := fmt.Sprintf("thttp-test-%s", RandString(t, 10)) - backend := fmt.Sprintf("thttp-test-%s", RandString(t, 10)) - hc := fmt.Sprintf("thttp-test-%s", RandString(t, 10)) - urlmap1 := fmt.Sprintf("thttp-test-%s", RandString(t, 10)) - urlmap2 := fmt.Sprintf("thttp-test-%s", RandString(t, 10)) + target := fmt.Sprintf("thttp-test-%s", acctest.RandString(t, 10)) + backend := fmt.Sprintf("thttp-test-%s", acctest.RandString(t, 10)) + hc := fmt.Sprintf("thttp-test-%s", acctest.RandString(t, 10)) + urlmap1 := fmt.Sprintf("thttp-test-%s", acctest.RandString(t, 10)) + urlmap2 := fmt.Sprintf("thttp-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeTargetHttpProxyDestroyProducer(t), Steps: []resource.TestStep{ { @@ -53,7 +53,7 @@ func testAccCheckComputeTargetHttpProxyExists(t *testing.T, n string) resource.T return fmt.Errorf("No ID is set") } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) name := rs.Primary.Attributes["name"] found, err := config.NewComputeClient(config.UserAgent).TargetHttpProxies.Get( diff --git a/mmv1/third_party/terraform/tests/resource_compute_target_https_proxy_test.go.erb b/mmv1/third_party/terraform/tests/resource_compute_target_https_proxy_test.go.erb index 4c13305bfd92..e2d82f40f99e 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_target_https_proxy_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_compute_target_https_proxy_test.go.erb @@ -26,11 +26,11 @@ func TestAccComputeTargetHttpsProxy_update(t *testing.T) { t.Parallel() var proxy compute.TargetHttpsProxy - resourceSuffix := RandString(t, 10) + resourceSuffix := acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeTargetHttpsProxyDestroyProducer(t), Steps: []resource.TestStep{ { @@ -61,11 +61,11 @@ func TestAccComputeTargetHttpsProxy_certificateMap(t *testing.T) { t.Parallel() var proxy compute.TargetHttpsProxy - resourceSuffix := RandString(t, 10) + resourceSuffix := acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeTargetHttpsProxyDestroyProducer(t), Steps: []resource.TestStep{ { @@ -92,7 +92,7 @@ func testAccCheckComputeTargetHttpsProxyExists(t *testing.T, n string, proxy *co return fmt.Errorf("No ID is set") } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) name := rs.Primary.Attributes["name"] found, err := config.NewComputeClient(config.UserAgent).TargetHttpsProxies.Get( @@ -122,7 +122,7 @@ func testAccComputeTargetHttpsProxyDescription(description string, proxy *comput func testAccComputeTargetHttpsProxyHasSslCertificate(t *testing.T, cert string, proxy *compute.TargetHttpsProxy) resource.TestCheckFunc { return func(s *terraform.State) error { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) certUrl := fmt.Sprintf(canonicalSslCertificateTemplate, config.Project, cert) for _, sslCertificate := range proxy.SslCertificates { @@ -137,7 +137,7 @@ func testAccComputeTargetHttpsProxyHasSslCertificate(t *testing.T, cert string, func testAccComputeTargetHttpsProxyHasCertificateMap(t *testing.T, certificateMap string, proxy *compute.TargetHttpsProxy) resource.TestCheckFunc { return func(s *terraform.State) error { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) certificateMapUrl := fmt.Sprintf(canonicalCertificateMapTemplate, config.Project, certificateMap) if tpgresource.ConvertSelfLinkToV1(proxy.CertificateMap) == certificateMapUrl { diff --git a/mmv1/third_party/terraform/tests/resource_compute_target_pool_test.go b/mmv1/third_party/terraform/tests/resource_compute_target_pool_test.go index 02605f00f7b8..4cfc7bd719d5 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_target_pool_test.go +++ b/mmv1/third_party/terraform/tests/resource_compute_target_pool_test.go @@ -14,13 +14,13 @@ import ( func TestAccComputeTargetPool_basic(t *testing.T) { t.Parallel() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeTargetPoolDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccComputeTargetPool_basic(RandString(t, 10)), + Config: testAccComputeTargetPool_basic(acctest.RandString(t, 10)), Check: resource.ComposeTestCheckFunc( testAccCheckComputeTargetPoolExists( t, "google_compute_target_pool.foo"), @@ -42,13 +42,13 @@ func TestAccComputeTargetPool_basic(t *testing.T) { func TestAccComputeTargetPool_update(t *testing.T) { t.Parallel() - tpname := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - name1 := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - name2 := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + tpname := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + name1 := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + name2 := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeTargetPoolDestroyProducer(t), Steps: []resource.TestStep{ { @@ -84,7 +84,7 @@ func TestAccComputeTargetPool_update(t *testing.T) { func testAccCheckComputeTargetPoolDestroyProducer(t *testing.T) func(s *terraform.State) error { return func(s *terraform.State) error { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) for _, rs := range s.RootModule().Resources { if rs.Type != "google_compute_target_pool" { @@ -113,7 +113,7 @@ func testAccCheckComputeTargetPoolExists(t *testing.T, n string) resource.TestCh return fmt.Errorf("No ID is set") } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) found, err := config.NewComputeClient(config.UserAgent).TargetPools.Get( config.Project, config.Region, rs.Primary.Attributes["name"]).Do() diff --git a/mmv1/third_party/terraform/tests/resource_compute_target_ssl_proxy_test.go.erb b/mmv1/third_party/terraform/tests/resource_compute_target_ssl_proxy_test.go.erb index e9b5dedd4a6f..6f8526642682 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_target_ssl_proxy_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_compute_target_ssl_proxy_test.go.erb @@ -19,20 +19,20 @@ import ( ) func TestAccComputeTargetSslProxy_update(t *testing.T) { - target := fmt.Sprintf("tf-test-tssl-%s", RandString(t, 10)) - sslPolicy := fmt.Sprintf("tf-test-tssl-%s", RandString(t, 10)) - cert1 := fmt.Sprintf("tf-test-tssl-%s", RandString(t, 10)) - cert2 := fmt.Sprintf("tf-test-tssl-%s", RandString(t, 10)) - backend1 := fmt.Sprintf("tf-test-tssl-%s", RandString(t, 10)) - backend2 := fmt.Sprintf("tf-test-tssl-%s", RandString(t, 10)) - hc := fmt.Sprintf("tf-test-tssl-%s", RandString(t, 10)) - - resourceSuffix := RandString(t, 10) + target := fmt.Sprintf("tf-test-tssl-%s", acctest.RandString(t, 10)) + sslPolicy := fmt.Sprintf("tf-test-tssl-%s", acctest.RandString(t, 10)) + cert1 := fmt.Sprintf("tf-test-tssl-%s", acctest.RandString(t, 10)) + cert2 := fmt.Sprintf("tf-test-tssl-%s", acctest.RandString(t, 10)) + backend1 := fmt.Sprintf("tf-test-tssl-%s", acctest.RandString(t, 10)) + backend2 := fmt.Sprintf("tf-test-tssl-%s", acctest.RandString(t, 10)) + hc := fmt.Sprintf("tf-test-tssl-%s", acctest.RandString(t, 10)) + + resourceSuffix := acctest.RandString(t, 10) var proxy compute.TargetSslProxy - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeTargetSslProxyDestroyProducer(t), Steps: []resource.TestStep{ { @@ -84,7 +84,7 @@ func testAccCheckComputeTargetSslProxyExists(t *testing.T, n string, proxy *comp return fmt.Errorf("No ID is set") } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) name := rs.Primary.Attributes["name"] found, err := config.NewComputeClient(config.UserAgent).TargetSslProxies.Get( @@ -114,7 +114,7 @@ func testAccCheckComputeTargetSslProxyHeader(t *testing.T, proxyHeader string, p func testAccCheckComputeTargetSslProxyHasSslCertificate(t *testing.T, cert string, proxy *compute.TargetSslProxy) resource.TestCheckFunc { return func(s *terraform.State) error { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) certURL := fmt.Sprintf(canonicalSslCertificateTemplate, config.Project, cert) for _, sslCertificate := range proxy.SslCertificates { @@ -129,7 +129,7 @@ func testAccCheckComputeTargetSslProxyHasSslCertificate(t *testing.T, cert strin func testAccCheckComputeTargetSslProxyHasCertificateMap(t *testing.T, certificateMap string, proxy *compute.TargetSslProxy) resource.TestCheckFunc { return func(s *terraform.State) error { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) wantCertMapURL := fmt.Sprintf(canonicalCertificateMapTemplate, config.Project, certificateMap) gotCertMapURL := tpgresource.ConvertSelfLinkToV1(proxy.CertificateMap) if wantCertMapURL != gotCertMapURL { diff --git a/mmv1/third_party/terraform/tests/resource_compute_target_tcp_proxy_test.go b/mmv1/third_party/terraform/tests/resource_compute_target_tcp_proxy_test.go index 1532503e2e70..f8c7640815de 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_target_tcp_proxy_test.go +++ b/mmv1/third_party/terraform/tests/resource_compute_target_tcp_proxy_test.go @@ -12,13 +12,13 @@ import ( func TestAccComputeTargetTcpProxy_update(t *testing.T) { t.Parallel() - target := fmt.Sprintf("ttcp-test-%s", RandString(t, 10)) - backend := fmt.Sprintf("ttcp-test-%s", RandString(t, 10)) - hc := fmt.Sprintf("ttcp-test-%s", RandString(t, 10)) + target := fmt.Sprintf("ttcp-test-%s", acctest.RandString(t, 10)) + backend := fmt.Sprintf("ttcp-test-%s", acctest.RandString(t, 10)) + hc := fmt.Sprintf("ttcp-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeTargetTcpProxyDestroyProducer(t), Steps: []resource.TestStep{ { @@ -50,7 +50,7 @@ func testAccCheckComputeTargetTcpProxyExists(t *testing.T, n string) resource.Te return fmt.Errorf("No ID is set") } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) name := rs.Primary.Attributes["name"] found, err := config.NewComputeClient(config.UserAgent).TargetTcpProxies.Get( diff --git a/mmv1/third_party/terraform/tests/resource_compute_url_map_test.go.erb b/mmv1/third_party/terraform/tests/resource_compute_url_map_test.go.erb index 291cc7d165ad..7aa184f29746 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_url_map_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_compute_url_map_test.go.erb @@ -13,12 +13,12 @@ import ( func TestAccComputeUrlMap_update_path_matcher(t *testing.T) { t.Parallel() - bsName := fmt.Sprintf("urlmap-test-%s", RandString(t, 10)) - hcName := fmt.Sprintf("urlmap-test-%s", RandString(t, 10)) - umName := fmt.Sprintf("urlmap-test-%s", RandString(t, 10)) - VcrTest(t, resource.TestCase{ + bsName := fmt.Sprintf("urlmap-test-%s", acctest.RandString(t, 10)) + hcName := fmt.Sprintf("urlmap-test-%s", acctest.RandString(t, 10)) + umName := fmt.Sprintf("urlmap-test-%s", acctest.RandString(t, 10)) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeUrlMapDestroyProducer(t), Steps: []resource.TestStep{ { @@ -43,13 +43,13 @@ func TestAccComputeUrlMap_update_path_matcher(t *testing.T) { func TestAccComputeUrlMap_advanced(t *testing.T) { t.Parallel() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeUrlMapDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccComputeUrlMap_advanced1(RandString(t, 10)), + Config: testAccComputeUrlMap_advanced1(acctest.RandString(t, 10)), Check: resource.ComposeTestCheckFunc( testAccCheckComputeUrlMapExists( t, "google_compute_url_map.foobar"), @@ -57,7 +57,7 @@ func TestAccComputeUrlMap_advanced(t *testing.T) { }, { - Config: testAccComputeUrlMap_advanced2(RandString(t, 10)), + Config: testAccComputeUrlMap_advanced2(acctest.RandString(t, 10)), Check: resource.ComposeTestCheckFunc( testAccCheckComputeUrlMapExists( t, "google_compute_url_map.foobar"), @@ -70,20 +70,20 @@ func TestAccComputeUrlMap_advanced(t *testing.T) { func TestAccComputeUrlMap_defaultRouteActionPathUrlRewrite(t *testing.T) { t.Parallel() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeUrlMapDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccComputeUrlMap_defaultRouteActionPathUrlRewrite(RandString(t, 10)), + Config: testAccComputeUrlMap_defaultRouteActionPathUrlRewrite(acctest.RandString(t, 10)), Check: resource.ComposeTestCheckFunc( testAccCheckComputeUrlMapExists( t, "google_compute_url_map.foobar"), ), }, { - Config: testAccComputeUrlMap_defaultRouteActionPathUrlRewrite_update(RandString(t, 10)), + Config: testAccComputeUrlMap_defaultRouteActionPathUrlRewrite_update(acctest.RandString(t, 10)), Check: resource.ComposeTestCheckFunc( testAccCheckComputeUrlMapExists( t, "google_compute_url_map.foobar"), @@ -96,13 +96,13 @@ func TestAccComputeUrlMap_defaultRouteActionPathUrlRewrite(t *testing.T) { func TestAccComputeUrlMap_defaultRouteActionUrlRewrite(t *testing.T) { t.Parallel() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeUrlMapDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccComputeUrlMap_defaultRouteActionUrlRewrite(RandString(t, 10)), + Config: testAccComputeUrlMap_defaultRouteActionUrlRewrite(acctest.RandString(t, 10)), Check: resource.ComposeTestCheckFunc( testAccCheckComputeUrlMapExists( t, "google_compute_url_map.foobar"), @@ -110,7 +110,7 @@ func TestAccComputeUrlMap_defaultRouteActionUrlRewrite(t *testing.T) { }, { - Config: testAccComputeUrlMap_defaultRouteActionUrlRewrite_update(RandString(t, 10)), + Config: testAccComputeUrlMap_defaultRouteActionUrlRewrite_update(acctest.RandString(t, 10)), Check: resource.ComposeTestCheckFunc( testAccCheckComputeUrlMapExists( t, "google_compute_url_map.foobar"), @@ -123,12 +123,12 @@ func TestAccComputeUrlMap_defaultRouteActionUrlRewrite(t *testing.T) { func TestAccComputeUrlMap_noPathRulesWithUpdate(t *testing.T) { t.Parallel() - bsName := fmt.Sprintf("urlmap-test-%s", RandString(t, 10)) - hcName := fmt.Sprintf("urlmap-test-%s", RandString(t, 10)) - umName := fmt.Sprintf("urlmap-test-%s", RandString(t, 10)) - VcrTest(t, resource.TestCase{ + bsName := fmt.Sprintf("urlmap-test-%s", acctest.RandString(t, 10)) + hcName := fmt.Sprintf("urlmap-test-%s", acctest.RandString(t, 10)) + umName := fmt.Sprintf("urlmap-test-%s", acctest.RandString(t, 10)) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeUrlMapDestroyProducer(t), Steps: []resource.TestStep{ { @@ -160,7 +160,7 @@ func testAccCheckComputeUrlMapExists(t *testing.T, n string) resource.TestCheckF return fmt.Errorf("No ID is set") } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) name := rs.Primary.Attributes["name"] found, err := config.NewComputeClient(config.UserAgent).UrlMaps.Get( @@ -179,14 +179,14 @@ func testAccCheckComputeUrlMapExists(t *testing.T, n string) resource.TestCheckF func TestAccComputeUrlMap_defaultRouteActionTrafficDirectorPathUpdate(t *testing.T) { t.Parallel() - randString := RandString(t, 10) + randString := acctest.RandString(t, 10) bsName := fmt.Sprintf("urlmap-test-%s", randString) hcName := fmt.Sprintf("urlmap-test-%s", randString) umName := fmt.Sprintf("urlmap-test-%s", randString) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeUrlMapDestroyProducer(t), Steps: []resource.TestStep{ { @@ -212,14 +212,14 @@ func TestAccComputeUrlMap_defaultRouteActionTrafficDirectorPathUpdate(t *testing func TestAccComputeUrlMap_defaultRouteActionTrafficDirectorUpdate(t *testing.T) { t.Parallel() - randString := RandString(t, 10) + randString := acctest.RandString(t, 10) bsName := fmt.Sprintf("urlmap-test-%s", randString) hcName := fmt.Sprintf("urlmap-test-%s", randString) umName := fmt.Sprintf("urlmap-test-%s", randString) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeUrlMapDestroyProducer(t), Steps: []resource.TestStep{ { @@ -245,14 +245,14 @@ func TestAccComputeUrlMap_defaultRouteActionTrafficDirectorUpdate(t *testing.T) func TestAccComputeUrlMap_trafficDirectorUpdate(t *testing.T) { t.Parallel() - randString := RandString(t, 10) + randString := acctest.RandString(t, 10) bsName := fmt.Sprintf("urlmap-test-%s", randString) hcName := fmt.Sprintf("urlmap-test-%s", randString) umName := fmt.Sprintf("urlmap-test-%s", randString) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeUrlMapDestroyProducer(t), Steps: []resource.TestStep{ { @@ -278,14 +278,14 @@ func TestAccComputeUrlMap_trafficDirectorUpdate(t *testing.T) { func TestAccComputeUrlMap_trafficDirectorPathUpdate(t *testing.T) { t.Parallel() - randString := RandString(t, 10) + randString := acctest.RandString(t, 10) bsName := fmt.Sprintf("urlmap-test-%s", randString) hcName := fmt.Sprintf("urlmap-test-%s", randString) umName := fmt.Sprintf("urlmap-test-%s", randString) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeUrlMapDestroyProducer(t), Steps: []resource.TestStep{ { @@ -311,14 +311,14 @@ func TestAccComputeUrlMap_trafficDirectorPathUpdate(t *testing.T) { func TestAccComputeUrlMap_trafficDirectorRemoveRouteRule(t *testing.T) { t.Parallel() - randString := RandString(t, 10) + randString := acctest.RandString(t, 10) bsName := fmt.Sprintf("urlmap-test-%s", randString) hcName := fmt.Sprintf("urlmap-test-%s", randString) umName := fmt.Sprintf("urlmap-test-%s", randString) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeUrlMapDestroyProducer(t), Steps: []resource.TestStep{ { @@ -344,11 +344,11 @@ func TestAccComputeUrlMap_trafficDirectorRemoveRouteRule(t *testing.T) { func TestAccComputeUrlMap_defaultUrlRedirect(t *testing.T) { t.Parallel() - randomSuffix := RandString(t, 10) + randomSuffix := acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeUrlMapDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_compute_vpn_tunnel_test.go b/mmv1/third_party/terraform/tests/resource_compute_vpn_tunnel_test.go index 713f26d660cf..79c085e7c134 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_vpn_tunnel_test.go +++ b/mmv1/third_party/terraform/tests/resource_compute_vpn_tunnel_test.go @@ -19,13 +19,13 @@ func TestAccComputeVpnTunnel_regionFromGateway(t *testing.T) { region = "us-west1" } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeVpnTunnelDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccComputeVpnTunnel_regionFromGateway(RandString(t, 10), region), + Config: testAccComputeVpnTunnel_regionFromGateway(acctest.RandString(t, 10), region), }, { ResourceName: "google_compute_vpn_tunnel.foobar", @@ -41,14 +41,14 @@ func TestAccComputeVpnTunnel_regionFromGateway(t *testing.T) { func TestAccComputeVpnTunnel_router(t *testing.T) { t.Parallel() - router := fmt.Sprintf("tf-test-tunnel-%s", RandString(t, 10)) - VcrTest(t, resource.TestCase{ + router := fmt.Sprintf("tf-test-tunnel-%s", acctest.RandString(t, 10)) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeVpnTunnelDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccComputeVpnTunnelRouter(RandString(t, 10), router), + Config: testAccComputeVpnTunnelRouter(acctest.RandString(t, 10), router), }, { ResourceName: "google_compute_vpn_tunnel.foobar", @@ -63,13 +63,13 @@ func TestAccComputeVpnTunnel_router(t *testing.T) { func TestAccComputeVpnTunnel_defaultTrafficSelectors(t *testing.T) { t.Parallel() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeVpnTunnelDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccComputeVpnTunnelDefaultTrafficSelectors(RandString(t, 10)), + Config: testAccComputeVpnTunnelDefaultTrafficSelectors(acctest.RandString(t, 10)), }, { ResourceName: "google_compute_vpn_tunnel.foobar", diff --git a/mmv1/third_party/terraform/tests/resource_container_analysis_occurrence_test.go b/mmv1/third_party/terraform/tests/resource_container_analysis_occurrence_test.go index e9cd96318d2c..882c4628fdb7 100644 --- a/mmv1/third_party/terraform/tests/resource_container_analysis_occurrence_test.go +++ b/mmv1/third_party/terraform/tests/resource_container_analysis_occurrence_test.go @@ -55,7 +55,7 @@ func getSignedTestOccurrenceAttestationPayload( func TestAccContainerAnalysisOccurrence_basic(t *testing.T) { t.Parallel() - randSuffix := RandString(t, 10) + randSuffix := acctest.RandString(t, 10) config := acctest.BootstrapConfig(t) if config == nil { @@ -74,9 +74,9 @@ func TestAccContainerAnalysisOccurrence_basic(t *testing.T) { "signature": base64.StdEncoding.EncodeToString([]byte(signed)), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerAnalysisNoteDestroyProducer(t), Steps: []resource.TestStep{ { @@ -93,7 +93,7 @@ func TestAccContainerAnalysisOccurrence_basic(t *testing.T) { func TestAccContainerAnalysisOccurrence_multipleSignatures(t *testing.T) { t.Parallel() - randSuffix := RandString(t, 10) + randSuffix := acctest.RandString(t, 10) config := acctest.BootstrapConfig(t) if config == nil { @@ -126,9 +126,9 @@ func TestAccContainerAnalysisOccurrence_multipleSignatures(t *testing.T) { "signature": base64.StdEncoding.EncodeToString([]byte(signature1)), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerAnalysisNoteDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_container_attached_cluster_update_test.go b/mmv1/third_party/terraform/tests/resource_container_attached_cluster_update_test.go index bad75730026a..9b05ff42c610 100644 --- a/mmv1/third_party/terraform/tests/resource_container_attached_cluster_update_test.go +++ b/mmv1/third_party/terraform/tests/resource_container_attached_cluster_update_test.go @@ -11,12 +11,12 @@ func TestAccContainerAttachedCluster_update(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerAttachedClusterDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_container_cluster_test.go.erb b/mmv1/third_party/terraform/tests/resource_container_cluster_test.go.erb index 78a9106e7f65..36aa886a4066 100644 --- a/mmv1/third_party/terraform/tests/resource_container_cluster_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_container_cluster_test.go.erb @@ -17,10 +17,10 @@ import ( func TestAccContainerCluster_basic(t *testing.T) { t.Parallel() - clusterName := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) - VcrTest(t, resource.TestCase{ + clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -54,10 +54,10 @@ func TestAccContainerCluster_basic(t *testing.T) { func TestAccContainerCluster_networkingModeRoutes(t *testing.T) { t.Parallel() - clusterName := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) - VcrTest(t, resource.TestCase{ + clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -75,10 +75,10 @@ func TestAccContainerCluster_networkingModeRoutes(t *testing.T) { func TestAccContainerCluster_misc(t *testing.T) { t.Parallel() - clusterName := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) - VcrTest(t, resource.TestCase{ + clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -110,12 +110,12 @@ func TestAccContainerCluster_misc(t *testing.T) { func TestAccContainerCluster_withAddons(t *testing.T) { t.Parallel() - clusterName := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) + clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) pid := envvar.GetTestProjectFromEnv() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -154,13 +154,13 @@ func TestAccContainerCluster_withAddons(t *testing.T) { func TestAccContainerCluster_withNotificationConfig(t *testing.T) { t.Parallel() - clusterName := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) - topic := fmt.Sprintf("tf-test-topic-%s", RandString(t, 10)) - newTopic := fmt.Sprintf("tf-test-topic-%s", RandString(t, 10)) + clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) + topic := fmt.Sprintf("tf-test-topic-%s", acctest.RandString(t, 10)) + newTopic := fmt.Sprintf("tf-test-topic-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -202,13 +202,13 @@ func TestAccContainerCluster_withNotificationConfig(t *testing.T) { func TestAccContainerCluster_withFilteredNotificationConfig(t *testing.T) { t.Parallel() - clusterName := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) - topic := fmt.Sprintf("tf-test-topic-%s", RandString(t, 10)) - newTopic := fmt.Sprintf("tf-test-topic-%s", RandString(t, 10)) + clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) + topic := fmt.Sprintf("tf-test-topic-%s", acctest.RandString(t, 10)) + newTopic := fmt.Sprintf("tf-test-topic-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -242,12 +242,12 @@ func TestAccContainerCluster_withFilteredNotificationConfig(t *testing.T) { func TestAccContainerCluster_withConfidentialNodes(t *testing.T) { t.Parallel() - clusterName := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) - npName := fmt.Sprintf("tf-test-cluster-nodepool-%s", RandString(t, 10)) + clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) + npName := fmt.Sprintf("tf-test-cluster-nodepool-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -281,12 +281,12 @@ func TestAccContainerCluster_withConfidentialNodes(t *testing.T) { func TestAccContainerCluster_withILBSubsetting(t *testing.T) { t.Parallel() - clusterName := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) - npName := fmt.Sprintf("tf-test-cluster-nodepool-%s", RandString(t, 10)) + clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) + npName := fmt.Sprintf("tf-test-cluster-nodepool-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -320,11 +320,11 @@ func TestAccContainerCluster_withILBSubsetting(t *testing.T) { func TestAccContainerCluster_withMasterAuthConfig_NoCert(t *testing.T) { t.Parallel() - clusterName := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) + clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -344,11 +344,11 @@ func TestAccContainerCluster_withMasterAuthConfig_NoCert(t *testing.T) { func TestAccContainerCluster_withAuthenticatorGroupsConfig(t *testing.T) { t.Parallel() - clusterName := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) + clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) orgDomain := envvar.GetTestOrgDomainFromEnv(t) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -394,11 +394,11 @@ func TestAccContainerCluster_withAuthenticatorGroupsConfig(t *testing.T) { func TestAccContainerCluster_withNetworkPolicyEnabled(t *testing.T) { t.Parallel() - clusterName := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) + clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -465,10 +465,10 @@ func TestAccContainerCluster_withNetworkPolicyEnabled(t *testing.T) { func TestAccContainerCluster_withReleaseChannelEnabled(t *testing.T) { t.Parallel() - clusterName := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) - VcrTest(t, resource.TestCase{ + clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -497,10 +497,10 @@ func TestAccContainerCluster_withReleaseChannelEnabled(t *testing.T) { func TestAccContainerCluster_withReleaseChannelEnabledDefaultVersion(t *testing.T) { t.Parallel() - clusterName := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) - VcrTest(t, resource.TestCase{ + clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -541,10 +541,10 @@ func TestAccContainerCluster_withInvalidReleaseChannel(t *testing.T) { // This is essentially a unit test, no interactions acctest.SkipIfVcr(t) t.Parallel() - clusterName := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) - VcrTest(t, resource.TestCase{ + clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -558,10 +558,10 @@ func TestAccContainerCluster_withInvalidReleaseChannel(t *testing.T) { <% unless version == 'ga' -%> func TestAccContainerCluster_withTelemetryEnabled(t *testing.T) { t.Parallel() - clusterName := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) - VcrTest(t, resource.TestCase{ + clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -602,11 +602,11 @@ func TestAccContainerCluster_withTelemetryEnabled(t *testing.T) { func TestAccContainerCluster_withMasterAuthorizedNetworksConfig(t *testing.T) { t.Parallel() - clusterName := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) + clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -665,11 +665,11 @@ func TestAccContainerCluster_withMasterAuthorizedNetworksConfig(t *testing.T) { func TestAccContainerCluster_withGcpPublicCidrsAccessEnabledToggle(t *testing.T) { t.Parallel() - clusterName := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) + clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -748,11 +748,11 @@ resource "google_container_cluster" "with_gcp_public_cidrs_access_enabled" { func TestAccContainerCluster_regional(t *testing.T) { t.Parallel() - clusterName := fmt.Sprintf("tf-test-cluster-regional-%s", RandString(t, 10)) + clusterName := fmt.Sprintf("tf-test-cluster-regional-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -770,12 +770,12 @@ func TestAccContainerCluster_regional(t *testing.T) { func TestAccContainerCluster_regionalWithNodePool(t *testing.T) { t.Parallel() - clusterName := fmt.Sprintf("tf-test-cluster-regional-%s", RandString(t, 10)) - npName := fmt.Sprintf("tf-test-cluster-nodepool-%s", RandString(t, 10)) + clusterName := fmt.Sprintf("tf-test-cluster-regional-%s", acctest.RandString(t, 10)) + npName := fmt.Sprintf("tf-test-cluster-nodepool-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -793,11 +793,11 @@ func TestAccContainerCluster_regionalWithNodePool(t *testing.T) { func TestAccContainerCluster_regionalWithNodeLocations(t *testing.T) { t.Parallel() - clusterName := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) + clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -824,12 +824,12 @@ func TestAccContainerCluster_regionalWithNodeLocations(t *testing.T) { func TestAccContainerCluster_withTpu(t *testing.T) { t.Parallel() - clusterName := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) - containerNetName := fmt.Sprintf("tf-test-container-net-%s", RandString(t, 10)) + clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) + containerNetName := fmt.Sprintf("tf-test-container-net-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -851,12 +851,12 @@ func TestAccContainerCluster_withTpu(t *testing.T) { func TestAccContainerCluster_withPrivateClusterConfigBasic(t *testing.T) { t.Parallel() - clusterName := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) - containerNetName := fmt.Sprintf("tf-test-container-net-%s", RandString(t, 10)) + clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) + containerNetName := fmt.Sprintf("tf-test-container-net-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -882,12 +882,12 @@ func TestAccContainerCluster_withPrivateClusterConfigBasic(t *testing.T) { func TestAccContainerCluster_withPrivateClusterConfigMissingCidrBlock(t *testing.T) { t.Parallel() - clusterName := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) - containerNetName := fmt.Sprintf("tf-test-container-net-%s", RandString(t, 10)) + clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) + containerNetName := fmt.Sprintf("tf-test-container-net-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -901,12 +901,12 @@ func TestAccContainerCluster_withPrivateClusterConfigMissingCidrBlock(t *testing func TestAccContainerCluster_withPrivateClusterConfigMissingCidrBlock_withAutopilot(t *testing.T) { t.Parallel() - clusterName := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) - containerNetName := fmt.Sprintf("tf-test-container-net-%s", RandString(t, 10)) + clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) + containerNetName := fmt.Sprintf("tf-test-container-net-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -924,11 +924,11 @@ func TestAccContainerCluster_withPrivateClusterConfigMissingCidrBlock_withAutopi func TestAccContainerCluster_withIntraNodeVisibility(t *testing.T) { t.Parallel() - clusterName := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) + clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -960,11 +960,11 @@ func TestAccContainerCluster_withIntraNodeVisibility(t *testing.T) { func TestAccContainerCluster_withVersion(t *testing.T) { t.Parallel() - clusterName := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) + clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -983,11 +983,11 @@ func TestAccContainerCluster_withVersion(t *testing.T) { func TestAccContainerCluster_updateVersion(t *testing.T) { t.Parallel() - clusterName := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) + clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -1015,11 +1015,11 @@ func TestAccContainerCluster_updateVersion(t *testing.T) { func TestAccContainerCluster_withNodeConfig(t *testing.T) { t.Parallel() - clusterName := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) + clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -1044,10 +1044,10 @@ func TestAccContainerCluster_withNodeConfig(t *testing.T) { func TestAccContainerCluster_withLoggingVariantInNodeConfig(t *testing.T) { t.Parallel() - clusterName := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) - VcrTest(t, resource.TestCase{ + clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -1064,11 +1064,11 @@ func TestAccContainerCluster_withLoggingVariantInNodeConfig(t *testing.T) { func TestAccContainerCluster_withLoggingVariantInNodePool(t *testing.T) { t.Parallel() - clusterName := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) - nodePoolName := fmt.Sprintf("tf-test-nodepool-%s", RandString(t, 10)) - VcrTest(t, resource.TestCase{ + clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) + nodePoolName := fmt.Sprintf("tf-test-nodepool-%s", acctest.RandString(t, 10)) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -1085,10 +1085,10 @@ func TestAccContainerCluster_withLoggingVariantInNodePool(t *testing.T) { func TestAccContainerCluster_withLoggingVariantUpdates(t *testing.T) { t.Parallel() - clusterName := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) - VcrTest(t, resource.TestCase{ + clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -1122,10 +1122,10 @@ func TestAccContainerCluster_withLoggingVariantUpdates(t *testing.T) { <% unless version == 'ga' -%> func TestAccContainerCluster_withNodePoolDefaults(t *testing.T) { t.Parallel() - clusterName := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) - VcrTest(t, resource.TestCase{ + clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -1177,11 +1177,11 @@ func TestAccContainerCluster_withNodePoolDefaults(t *testing.T) { func TestAccContainerCluster_withNodeConfigScopeAlias(t *testing.T) { t.Parallel() - clusterName := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) + clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -1199,11 +1199,11 @@ func TestAccContainerCluster_withNodeConfigScopeAlias(t *testing.T) { func TestAccContainerCluster_withNodeConfigShieldedInstanceConfig(t *testing.T) { t.Parallel() - clusterName := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) + clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -1221,11 +1221,11 @@ func TestAccContainerCluster_withNodeConfigShieldedInstanceConfig(t *testing.T) func TestAccContainerCluster_withNodeConfigReservationAffinity(t *testing.T) { t.Parallel() - clusterName := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) + clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -1249,12 +1249,12 @@ func TestAccContainerCluster_withNodeConfigReservationAffinity(t *testing.T) { func TestAccContainerCluster_withNodeConfigReservationAffinitySpecific(t *testing.T) { t.Parallel() - reservationName := fmt.Sprintf("tf-test-reservation-%s", RandString(t, 10)) - clusterName := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) + reservationName := fmt.Sprintf("tf-test-reservation-%s", acctest.RandString(t, 10)) + clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -1284,11 +1284,11 @@ func TestAccContainerCluster_withNodeConfigReservationAffinitySpecific(t *testin func TestAccContainerCluster_withWorkloadMetadataConfig(t *testing.T) { t.Parallel() - clusterName := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) + clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -1312,11 +1312,11 @@ func TestAccContainerCluster_withWorkloadMetadataConfig(t *testing.T) { func TestAccContainerCluster_withSandboxConfig(t *testing.T) { t.Parallel() - clusterName := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) + clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -1368,16 +1368,16 @@ func TestAccContainerCluster_withSandboxConfig(t *testing.T) { func TestAccContainerCluster_withBootDiskKmsKey(t *testing.T) { t.Parallel() - clusterName := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) + clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) kms := acctest.BootstrapKMSKeyInLocation(t, "us-central1") if acctest.BootstrapPSARole(t, "service-", "compute-system", "roles/cloudkms.cryptoKeyEncrypterDecrypter") { t.Fatal("Stopping the test because a role was added to the policy.") } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -1396,12 +1396,12 @@ func TestAccContainerCluster_withBootDiskKmsKey(t *testing.T) { func TestAccContainerCluster_network(t *testing.T) { t.Parallel() - clusterName := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) - network := fmt.Sprintf("tf-test-net-%s", RandString(t, 10)) + clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) + network := fmt.Sprintf("tf-test-net-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -1424,11 +1424,11 @@ func TestAccContainerCluster_network(t *testing.T) { func TestAccContainerCluster_backend(t *testing.T) { t.Parallel() - clusterName := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) + clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -1446,12 +1446,12 @@ func TestAccContainerCluster_backend(t *testing.T) { func TestAccContainerCluster_withNodePoolBasic(t *testing.T) { t.Parallel() - clusterName := fmt.Sprintf("tf-test-cluster-nodepool-%s", RandString(t, 10)) - npName := fmt.Sprintf("tf-test-cluster-nodepool-%s", RandString(t, 10)) + clusterName := fmt.Sprintf("tf-test-cluster-nodepool-%s", acctest.RandString(t, 10)) + npName := fmt.Sprintf("tf-test-cluster-nodepool-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -1469,12 +1469,12 @@ func TestAccContainerCluster_withNodePoolBasic(t *testing.T) { func TestAccContainerCluster_withNodePoolUpdateVersion(t *testing.T) { t.Parallel() - clusterName := fmt.Sprintf("tf-test-cluster-nodepool-%s", RandString(t, 10)) - npName := fmt.Sprintf("tf-test-cluster-nodepool-%s", RandString(t, 10)) + clusterName := fmt.Sprintf("tf-test-cluster-nodepool-%s", acctest.RandString(t, 10)) + npName := fmt.Sprintf("tf-test-cluster-nodepool-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -1502,11 +1502,11 @@ func TestAccContainerCluster_withNodePoolUpdateVersion(t *testing.T) { func TestAccContainerCluster_withNodePoolResize(t *testing.T) { t.Parallel() - clusterName := fmt.Sprintf("tf-test-cluster-nodepool-%s", RandString(t, 10)) - npName := fmt.Sprintf("tf-test-cluster-nodepool-%s", RandString(t, 10)) - VcrTest(t, resource.TestCase{ + clusterName := fmt.Sprintf("tf-test-cluster-nodepool-%s", acctest.RandString(t, 10)) + npName := fmt.Sprintf("tf-test-cluster-nodepool-%s", acctest.RandString(t, 10)) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -1538,12 +1538,12 @@ func TestAccContainerCluster_withNodePoolResize(t *testing.T) { func TestAccContainerCluster_withNodePoolAutoscaling(t *testing.T) { t.Parallel() - clusterName := fmt.Sprintf("tf-test-cluster-nodepool-%s", RandString(t, 10)) - npName := fmt.Sprintf("tf-test-cluster-nodepool-%s", RandString(t, 10)) + clusterName := fmt.Sprintf("tf-test-cluster-nodepool-%s", acctest.RandString(t, 10)) + npName := fmt.Sprintf("tf-test-cluster-nodepool-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerNodePoolDestroyProducer(t), Steps: []resource.TestStep{ resource.TestStep{ @@ -1589,12 +1589,12 @@ func TestAccContainerCluster_withNodePoolAutoscaling(t *testing.T) { func TestAccContainerCluster_withNodePoolCIA(t *testing.T) { t.Parallel() - clusterName := fmt.Sprintf("tf-test-cluster-nodepool-%s", RandString(t, 10)) - npName := fmt.Sprintf("tf-test-cluster-nodepool-%s", RandString(t, 10)) + clusterName := fmt.Sprintf("tf-test-cluster-nodepool-%s", acctest.RandString(t, 10)) + npName := fmt.Sprintf("tf-test-cluster-nodepool-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerNodePoolDestroyProducer(t), Steps: []resource.TestStep{ resource.TestStep{ @@ -1653,12 +1653,12 @@ func TestAccContainerCluster_withNodePoolNamePrefix(t *testing.T) { acctest.SkipIfVcr(t) t.Parallel() - clusterName := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) + clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) npNamePrefix := "tf-test-np-" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -1677,12 +1677,12 @@ func TestAccContainerCluster_withNodePoolNamePrefix(t *testing.T) { func TestAccContainerCluster_withNodePoolMultiple(t *testing.T) { t.Parallel() - clusterName := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) + clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) npNamePrefix := "tf-test-np-" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -1700,12 +1700,12 @@ func TestAccContainerCluster_withNodePoolMultiple(t *testing.T) { func TestAccContainerCluster_withNodePoolConflictingNameFields(t *testing.T) { t.Parallel() - clusterName := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) + clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) npPrefix := "tf-test-np" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -1719,12 +1719,12 @@ func TestAccContainerCluster_withNodePoolConflictingNameFields(t *testing.T) { func TestAccContainerCluster_withNodePoolNodeConfig(t *testing.T) { t.Parallel() - cluster := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) - np := fmt.Sprintf("tf-test-np-%s", RandString(t, 10)) + cluster := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) + np := fmt.Sprintf("tf-test-np-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -1742,12 +1742,12 @@ func TestAccContainerCluster_withNodePoolNodeConfig(t *testing.T) { func TestAccContainerCluster_withMaintenanceWindow(t *testing.T) { t.Parallel() - clusterName := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) + clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) resourceName := "google_container_cluster.with_maintenance_window" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -1779,12 +1779,12 @@ func TestAccContainerCluster_withMaintenanceWindow(t *testing.T) { func TestAccContainerCluster_withRecurringMaintenanceWindow(t *testing.T) { t.Parallel() - cluster := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) + cluster := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) resourceName := "google_container_cluster.with_recurring_maintenance_window" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -1824,12 +1824,12 @@ func TestAccContainerCluster_withRecurringMaintenanceWindow(t *testing.T) { func TestAccContainerCluster_withMaintenanceExclusionWindow(t *testing.T) { t.Parallel() - cluster := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) + cluster := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) resourceName := "google_container_cluster.with_maintenance_exclusion_window" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -1856,12 +1856,12 @@ func TestAccContainerCluster_withMaintenanceExclusionWindow(t *testing.T) { func TestAccContainerCluster_withMaintenanceExclusionOptions(t *testing.T) { t.Parallel() - cluster := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) + cluster := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) resourceName := "google_container_cluster.with_maintenance_exclusion_options" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -1886,12 +1886,12 @@ func TestAccContainerCluster_withMaintenanceExclusionOptions(t *testing.T) { func TestAccContainerCluster_deleteMaintenanceExclusionOptions(t *testing.T) { t.Parallel() - cluster := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) + cluster := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) resourceName := "google_container_cluster.with_maintenance_exclusion_options" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -1932,15 +1932,15 @@ func TestAccContainerCluster_deleteMaintenanceExclusionOptions(t *testing.T) { func TestAccContainerCluster_updateMaintenanceExclusionOptions(t *testing.T) { t.Parallel() - cluster := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) + cluster := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) resourceName := "google_container_cluster.with_maintenance_exclusion_options" // step1: create a new cluster and initialize the maintenceExclusion without exclusion scopes, // step2: add exclusion scopes to the maintenancePolicy, // step3: update the maintenceExclusion with new scopes - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -1998,12 +1998,12 @@ func TestAccContainerCluster_updateMaintenanceExclusionOptions(t *testing.T) { func TestAccContainerCluster_deleteExclusionWindow(t *testing.T) { t.Parallel() - cluster := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) + cluster := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) resourceName := "google_container_cluster.with_maintenance_exclusion_window" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -2040,11 +2040,11 @@ func TestAccContainerCluster_deleteExclusionWindow(t *testing.T) { func TestAccContainerCluster_withIPAllocationPolicy_existingSecondaryRanges(t *testing.T) { t.Parallel() - clusterName := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) - containerNetName := fmt.Sprintf("tf-test-container-net-%s", RandString(t, 10)) - VcrTest(t, resource.TestCase{ + clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) + containerNetName := fmt.Sprintf("tf-test-container-net-%s", acctest.RandString(t, 10)) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -2062,11 +2062,11 @@ func TestAccContainerCluster_withIPAllocationPolicy_existingSecondaryRanges(t *t func TestAccContainerCluster_withIPAllocationPolicy_specificIPRanges(t *testing.T) { t.Parallel() - clusterName := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) - containerNetName := fmt.Sprintf("tf-test-container-net-%s", RandString(t, 10)) - VcrTest(t, resource.TestCase{ + clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) + containerNetName := fmt.Sprintf("tf-test-container-net-%s", acctest.RandString(t, 10)) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -2084,11 +2084,11 @@ func TestAccContainerCluster_withIPAllocationPolicy_specificIPRanges(t *testing. func TestAccContainerCluster_withIPAllocationPolicy_specificSizes(t *testing.T) { t.Parallel() - clusterName := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) - containerNetName := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) - VcrTest(t, resource.TestCase{ + clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) + containerNetName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -2106,13 +2106,13 @@ func TestAccContainerCluster_withIPAllocationPolicy_specificSizes(t *testing.T) func TestAccContainerCluster_stackType_withDualStack(t *testing.T) { t.Parallel() - clusterName := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) - containerNetName := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) + clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) + containerNetName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) resourceName := "google_container_cluster.with_stack_type" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -2134,13 +2134,13 @@ func TestAccContainerCluster_stackType_withDualStack(t *testing.T) { func TestAccContainerCluster_stackType_withSingleStack(t *testing.T) { t.Parallel() - clusterName := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) - containerNetName := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) + clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) + containerNetName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) resourceName := "google_container_cluster.with_stack_type" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -2162,13 +2162,13 @@ func TestAccContainerCluster_stackType_withSingleStack(t *testing.T) { func TestAccContainerCluster_with_PodCIDROverprovisionDisabled(t *testing.T) { t.Parallel() - clusterName := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) - containerNetName := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) + clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) + containerNetName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) resourceName := "google_container_cluster.with_pco_disabled" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -2190,11 +2190,11 @@ func TestAccContainerCluster_with_PodCIDROverprovisionDisabled(t *testing.T) { func TestAccContainerCluster_nodeAutoprovisioning(t *testing.T) { t.Parallel() - clusterName := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) + clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -2230,12 +2230,12 @@ func TestAccContainerCluster_nodeAutoprovisioning(t *testing.T) { func TestAccContainerCluster_nodeAutoprovisioningDefaults(t *testing.T) { t.Parallel() - clusterName := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) + clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) includeMinCpuPlatform := true - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -2281,11 +2281,11 @@ func TestAccContainerCluster_nodeAutoprovisioningDefaults(t *testing.T) { func TestAccContainerCluster_autoprovisioningDefaultsUpgradeSettings(t *testing.T) { t.Parallel() - clusterName := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) + clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -2316,11 +2316,11 @@ func TestAccContainerCluster_autoprovisioningDefaultsUpgradeSettings(t *testing. func TestAccContainerCluster_nodeAutoprovisioningNetworkTags(t *testing.T) { t.Parallel() - clusterName := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) + clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -2344,11 +2344,11 @@ func TestAccContainerCluster_nodeAutoprovisioningNetworkTags(t *testing.T) { func TestAccContainerCluster_withShieldedNodes(t *testing.T) { t.Parallel() - clusterName := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) + clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -2375,12 +2375,12 @@ func TestAccContainerCluster_withAutopilot(t *testing.T) { t.Parallel() pid := envvar.GetTestProjectFromEnv() - containerNetName := fmt.Sprintf("tf-test-container-net-%s", RandString(t, 10)) - clusterName := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) + containerNetName := fmt.Sprintf("tf-test-container-net-%s", acctest.RandString(t, 10)) + clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -2400,13 +2400,13 @@ func TestAccContainerClusterCustomServiceAccount_withAutopilot(t *testing.T) { t.Parallel() pid := envvar.GetTestProjectFromEnv() - containerNetName := fmt.Sprintf("tf-test-container-net-%s", RandString(t, 10)) - clusterName := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) - serviceAccountName := fmt.Sprintf("tf-test-sa-%s", RandString(t, 10)) + containerNetName := fmt.Sprintf("tf-test-container-net-%s", acctest.RandString(t, 10)) + clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) + serviceAccountName := fmt.Sprintf("tf-test-sa-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -2435,12 +2435,12 @@ func TestAccContainerCluster_errorAutopilotLocation(t *testing.T) { t.Parallel() pid := envvar.GetTestProjectFromEnv() - containerNetName := fmt.Sprintf("tf-test-container-net-%s", RandString(t, 10)) - clusterName := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) + containerNetName := fmt.Sprintf("tf-test-container-net-%s", acctest.RandString(t, 10)) + clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -2456,12 +2456,12 @@ func TestAccContainerCluster_withAutopilotNetworkTags(t *testing.T) { t.Parallel() pid := envvar.GetTestProjectFromEnv() - containerNetName := fmt.Sprintf("tf-test-container-net-%s", RandString(t, 10)) - clusterName := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) + containerNetName := fmt.Sprintf("tf-test-container-net-%s", acctest.RandString(t, 10)) + clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -2481,12 +2481,12 @@ func TestAccContainerCluster_withAutopilotNetworkTags(t *testing.T) { func TestAccContainerCluster_withWorkloadIdentityConfig(t *testing.T) { t.Parallel() - clusterName := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) + clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) pid := envvar.GetTestProjectFromEnv() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -2524,10 +2524,10 @@ func TestAccContainerCluster_withWorkloadIdentityConfig(t *testing.T) { func TestAccContainerCluster_withIdentityServiceConfig(t *testing.T) { t.Parallel() - clusterName := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) - VcrTest(t, resource.TestCase{ + clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -2570,10 +2570,10 @@ func TestAccContainerCluster_withIdentityServiceConfig(t *testing.T) { func TestAccContainerCluster_withLoggingConfig(t *testing.T) { t.Parallel() - clusterName := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) - VcrTest(t, resource.TestCase{ + clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -2623,10 +2623,10 @@ func TestAccContainerCluster_withLoggingConfig(t *testing.T) { func TestAccContainerCluster_withMonitoringConfig(t *testing.T) { t.Parallel() - clusterName := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) - VcrTest(t, resource.TestCase{ + clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -2709,10 +2709,10 @@ func TestAccContainerCluster_withMonitoringConfig(t *testing.T) { func TestAccContainerCluster_withSoleTenantGroup(t *testing.T) { t.Parallel() - resourceName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - VcrTest(t, resource.TestCase{ + resourceName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -2733,10 +2733,10 @@ func TestAccContainerCluster_withSoleTenantGroup(t *testing.T) { func TestAccContainerCluster_withAutoscalingProfile(t *testing.T) { t.Parallel() - clusterName := fmt.Sprintf("cluster-test-%s", RandString(t, 10)) - VcrTest(t, resource.TestCase{ + clusterName := fmt.Sprintf("cluster-test-%s", acctest.RandString(t, 10)) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -2765,10 +2765,10 @@ func TestAccContainerCluster_withInvalidAutoscalingProfile(t *testing.T) { // This is essentially a unit test, no interactions acctest.SkipIfVcr(t) t.Parallel() - clusterName := fmt.Sprintf("cluster-test-%s", RandString(t, 10)) - VcrTest(t, resource.TestCase{ + clusterName := fmt.Sprintf("cluster-test-%s", acctest.RandString(t, 10)) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -2784,15 +2784,15 @@ func TestAccContainerCluster_sharedVpc(t *testing.T) { acctest.SkipIfVcr(t) t.Parallel() - clusterName := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) + clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) org := envvar.GetTestOrgFromEnv(t) billingId := envvar.GetTestBillingAccountFromEnv(t) - projectName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - suffix := RandString(t, 10) + projectName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + suffix := acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -2811,11 +2811,11 @@ func TestAccContainerCluster_sharedVpc(t *testing.T) { func TestAccContainerCluster_withBinaryAuthorizationEnabledBool(t *testing.T) { t.Parallel() - clusterName := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) + clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -2842,11 +2842,11 @@ func TestAccContainerCluster_withBinaryAuthorizationEnabledBool(t *testing.T) { func TestAccContainerCluster_withBinaryAuthorizationEnabledBoolLegacy(t *testing.T) { t.Parallel() - clusterName := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) + clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -2874,11 +2874,11 @@ func TestAccContainerCluster_withBinaryAuthorizationEnabledBoolLegacy(t *testing func TestAccContainerCluster_withBinaryAuthorizationEvaluationModeAutopilot(t *testing.T) { t.Parallel() - clusterName := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) + clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -2904,11 +2904,11 @@ func TestAccContainerCluster_withBinaryAuthorizationEvaluationModeAutopilot(t *t func TestAccContainerCluster_withBinaryAuthorizationEvaluationModeClassic(t *testing.T) { t.Parallel() - clusterName := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) + clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -2934,12 +2934,12 @@ func TestAccContainerCluster_withBinaryAuthorizationEvaluationModeClassic(t *tes func TestAccContainerCluster_withFlexiblePodCIDR(t *testing.T) { t.Parallel() - clusterName := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) - containerNetName := fmt.Sprintf("tf-test-container-net-%s", RandString(t, 10)) + clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) + containerNetName := fmt.Sprintf("tf-test-container-net-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -2958,12 +2958,12 @@ func TestAccContainerCluster_withFlexiblePodCIDR(t *testing.T) { func TestAccContainerCluster_nodeAutoprovisioningDefaultsDiskSizeGb(t *testing.T) { t.Parallel() - clusterName := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) + clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) includeDiskSizeGb := true - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -2991,12 +2991,12 @@ func TestAccContainerCluster_nodeAutoprovisioningDefaultsDiskSizeGb(t *testing.T func TestAccContainerCluster_nodeAutoprovisioningDefaultsDiskType(t *testing.T) { t.Parallel() - clusterName := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) + clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) includeDiskType := true - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -3024,12 +3024,12 @@ func TestAccContainerCluster_nodeAutoprovisioningDefaultsDiskType(t *testing.T) func TestAccContainerCluster_nodeAutoprovisioningDefaultsImageType(t *testing.T) { t.Parallel() - clusterName := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) + clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) includeImageType := true - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -3057,16 +3057,16 @@ func TestAccContainerCluster_nodeAutoprovisioningDefaultsImageType(t *testing.T) func TestAccContainerCluster_nodeAutoprovisioningDefaultsBootDiskKmsKey(t *testing.T) { t.Parallel() - clusterName := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) + clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) kms := acctest.BootstrapKMSKeyInLocation(t, "us-central1") if acctest.BootstrapPSARole(t, "service-", "compute-system", "roles/cloudkms.cryptoKeyEncrypterDecrypter") { t.Fatal("Stopping the test because a role was added to the policy.") } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -3088,11 +3088,11 @@ func TestAccContainerCluster_nodeAutoprovisioningDefaultsBootDiskKmsKey(t *testi func TestAccContainerCluster_nodeAutoprovisioningDefaultsShieldedInstance(t *testing.T) { t.Parallel() - clusterName := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) + clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -3111,11 +3111,11 @@ func TestAccContainerCluster_nodeAutoprovisioningDefaultsShieldedInstance(t *tes func TestAccContainerCluster_autoprovisioningDefaultsManagement(t *testing.T) { t.Parallel() - clusterName := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) + clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -3143,17 +3143,17 @@ func TestAccContainerCluster_autoprovisioningDefaultsManagement(t *testing.T) { func TestAccContainerCluster_errorCleanDanglingCluster(t *testing.T) { t.Parallel() - prefix := RandString(t, 10) + prefix := acctest.RandString(t, 10) clusterName := fmt.Sprintf("tf-test-cluster-%s", prefix) clusterNameError := fmt.Sprintf("tf-test-cluster-err-%s", prefix) - containerNetName := fmt.Sprintf("tf-test-container-net-%s", RandString(t, 10)) + containerNetName := fmt.Sprintf("tf-test-container-net-%s", acctest.RandString(t, 10)) initConfig := testAccContainerCluster_withInitialCIDR(containerNetName, clusterName) overlapConfig := testAccContainerCluster_withCIDROverlap(initConfig, clusterNameError) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -3181,9 +3181,9 @@ func TestAccContainerCluster_errorCleanDanglingCluster(t *testing.T) { func TestAccContainerCluster_errorNoClusterCreated(t *testing.T) { t.Parallel() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -3197,12 +3197,12 @@ func TestAccContainerCluster_errorNoClusterCreated(t *testing.T) { func TestAccContainerCluster_withExternalIpsConfig(t *testing.T) { t.Parallel() - clusterName := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) + clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) pid := envvar.GetTestProjectFromEnv() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -3228,12 +3228,12 @@ func TestAccContainerCluster_withExternalIpsConfig(t *testing.T) { func TestAccContainerCluster_withMeshCertificatesConfig(t *testing.T) { t.Parallel() - clusterName := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) + clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) pid := envvar.GetTestProjectFromEnv() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -3270,12 +3270,12 @@ func TestAccContainerCluster_withMeshCertificatesConfig(t *testing.T) { func TestAccContainerCluster_withCostManagementConfig(t *testing.T) { t.Parallel() - clusterName := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) + clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) pid := envvar.GetTestProjectFromEnv() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -3301,7 +3301,7 @@ func TestAccContainerCluster_withCostManagementConfig(t *testing.T) { func TestAccContainerCluster_withDatabaseEncryption(t *testing.T) { t.Parallel() - clusterName := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) + clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) // Use the bootstrapped KMS key so we can avoid creating keys needlessly // as they will pile up in the project because they can not be completely @@ -3310,9 +3310,9 @@ func TestAccContainerCluster_withDatabaseEncryption(t *testing.T) { // See https://cloud.google.com/kubernetes-engine/docs/how-to/encrypting-secrets#creating_a_key kmsData := acctest.BootstrapKMSKeyInLocation(t, "us-central1") - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -3339,11 +3339,11 @@ func TestAccContainerCluster_withDatabaseEncryption(t *testing.T) { func TestAccContainerCluster_withAdvancedDatapath(t *testing.T) { t.Parallel() - clusterName := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) + clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -3361,13 +3361,13 @@ func TestAccContainerCluster_withAdvancedDatapath(t *testing.T) { func TestAccContainerCluster_withResourceUsageExportConfig(t *testing.T) { t.Parallel() - suffix := RandString(t, 10) + suffix := acctest.RandString(t, 10) clusterName := fmt.Sprintf("tf-test-cluster-%s", suffix) datesetId := fmt.Sprintf("tf_test_cluster_resource_usage_%s", suffix) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -3401,12 +3401,12 @@ func TestAccContainerCluster_withResourceUsageExportConfig(t *testing.T) { func TestAccContainerCluster_withMasterAuthorizedNetworksDisabled(t *testing.T) { t.Parallel() - clusterName := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) - containerNetName := fmt.Sprintf("tf-test-container-net-%s", RandString(t, 10)) + clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) + containerNetName := fmt.Sprintf("tf-test-container-net-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -3427,12 +3427,12 @@ func TestAccContainerCluster_withMasterAuthorizedNetworksDisabled(t *testing.T) func TestAccContainerCluster_withEnableKubernetesAlpha(t *testing.T) { t.Parallel() - clusterName := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) - npName := fmt.Sprintf("tf-test-np-%s", RandString(t, 10)) + clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) + npName := fmt.Sprintf("tf-test-np-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -3450,10 +3450,10 @@ func TestAccContainerCluster_withEnableKubernetesAlpha(t *testing.T) { func TestAccContainerCluster_withIPv4Error(t *testing.T) { t.Parallel() - clusterName := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) - VcrTest(t, resource.TestCase{ + clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -3467,11 +3467,11 @@ func TestAccContainerCluster_withIPv4Error(t *testing.T) { func TestAccContainerCluster_withDNSConfig(t *testing.T) { t.Parallel() - clusterName := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) - domainName := fmt.Sprintf("tf-test-domain-%s", RandString(t, 10)) - VcrTest(t, resource.TestCase{ + clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) + domainName := fmt.Sprintf("tf-test-domain-%s", acctest.RandString(t, 10)) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -3488,10 +3488,10 @@ func TestAccContainerCluster_withDNSConfig(t *testing.T) { func TestAccContainerCluster_withGatewayApiConfig(t *testing.T) { t.Parallel() - clusterName := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) - VcrTest(t, resource.TestCase{ + clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -3524,11 +3524,11 @@ func TestAccContainerCluster_withGatewayApiConfig(t *testing.T) { func TestAccContainerCluster_withTPUConfig(t *testing.T) { t.Parallel() - clusterName := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) - containerNetName := fmt.Sprintf("tf-test-container-net-%s", RandString(t, 10)) - VcrTest(t, resource.TestCase{ + clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) + containerNetName := fmt.Sprintf("tf-test-container-net-%s", acctest.RandString(t, 10)) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -3548,11 +3548,11 @@ func TestAccContainerCluster_withTPUConfig(t *testing.T) { func TestAccContainerCluster_withProtectConfig(t *testing.T) { t.Parallel() - clusterName := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) + clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -3581,11 +3581,11 @@ func TestAccContainerCluster_withProtectConfig(t *testing.T) { func TestAccContainerCluster_withSecurityPostureConfig(t *testing.T) { t.Parallel() - clusterName := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) + clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ - PreCheck: func() { AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + acctest.VcrTest(t, resource.TestCase{ + PreCheck: func() { acctest.AccTestPreCheck(t) }, + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -3659,10 +3659,10 @@ resource "google_container_cluster" "with_security_posture_config" { func TestAccContainerCluster_autopilot_minimal(t *testing.T) { t.Parallel() - clusterName := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) - VcrTest(t, resource.TestCase{ + clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -3684,7 +3684,7 @@ func testAccContainerCluster_masterAuthorizedNetworksDisabled(t *testing.T, reso return fmt.Errorf("can't find %s in state", resource_name) } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) attributes := rs.Primary.Attributes cluster, err := config.NewContainerClient(config.UserAgent).Projects.Zones.Clusters.Get( @@ -3703,7 +3703,7 @@ func testAccContainerCluster_masterAuthorizedNetworksDisabled(t *testing.T, reso func testAccCheckContainerClusterDestroyProducer(t *testing.T) func(s *terraform.State) error { return func(s *terraform.State) error { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) for _, rs := range s.RootModule().Resources { if rs.Type != "google_container_cluster" { @@ -4476,7 +4476,7 @@ resource "google_container_cluster" "regional" { func TestAccContainerCluster_withPrivateEndpointSubnetwork(t *testing.T) { t.Parallel() - r := RandString(t, 10) + r := acctest.RandString(t, 10) subnet1Name := fmt.Sprintf("tf-test-container-subnetwork1-%s", r) subnet1Cidr := "10.0.36.0/24" @@ -4484,12 +4484,12 @@ func TestAccContainerCluster_withPrivateEndpointSubnetwork(t *testing.T) { subnet2Name := fmt.Sprintf("tf-test-container-subnetwork2-%s", r) subnet2Cidr := "10.9.26.0/24" - clusterName := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) + clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) containerNetName := fmt.Sprintf("tf-test-container-net-%s", r) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -4551,11 +4551,11 @@ resource "google_container_cluster" "with_private_endpoint_subnetwork" { func TestAccContainerCluster_withEnablePrivateEndpointToggle(t *testing.T) { t.Parallel() - clusterName := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) + clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -4595,14 +4595,14 @@ func TestAccContainerCluster_failedCreation(t *testing.T) { t.Skip() t.Parallel() - clusterName := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) + clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) project := acctest.BootstrapProject(t, "tf-fail-cluster-", envvar.GetTestBillingAccountFromEnv(t), []string{"container.googleapis.com"}) acctest.RemoveContainerServiceAgentRoleFromContainerEngineRobot(t, project) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccContainerCluster_failedCreation(clusterName, project.ProjectId), diff --git a/mmv1/third_party/terraform/tests/resource_container_node_pool_test.go.erb b/mmv1/third_party/terraform/tests/resource_container_node_pool_test.go.erb index a680181755ea..508e06da0f77 100644 --- a/mmv1/third_party/terraform/tests/resource_container_node_pool_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_container_node_pool_test.go.erb @@ -15,12 +15,12 @@ import ( func TestAccContainerNodePool_basic(t *testing.T) { t.Parallel() - cluster := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) - np := fmt.Sprintf("tf-test-nodepool-%s", RandString(t, 10)) + cluster := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) + np := fmt.Sprintf("tf-test-nodepool-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerNodePoolDestroyProducer(t), Steps: []resource.TestStep{ resource.TestStep{ @@ -38,12 +38,12 @@ func TestAccContainerNodePool_basic(t *testing.T) { func TestAccContainerNodePool_basicWithClusterId(t *testing.T) { t.Parallel() - cluster := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) - np := fmt.Sprintf("tf-test-nodepool-%s", RandString(t, 10)) + cluster := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) + np := fmt.Sprintf("tf-test-nodepool-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerNodePoolDestroyProducer(t), Steps: []resource.TestStep{ { @@ -62,13 +62,13 @@ func TestAccContainerNodePool_basicWithClusterId(t *testing.T) { func TestAccContainerNodePool_nodeLocations(t *testing.T) { t.Parallel() - cluster := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) - np := fmt.Sprintf("tf-test-nodepool-%s", RandString(t, 10)) - network := fmt.Sprintf("tf-test-net-%s", RandString(t, 10)) + cluster := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) + np := fmt.Sprintf("tf-test-nodepool-%s", acctest.RandString(t, 10)) + network := fmt.Sprintf("tf-test-net-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerNodePoolDestroyProducer(t), Steps: []resource.TestStep{ { @@ -86,13 +86,13 @@ func TestAccContainerNodePool_nodeLocations(t *testing.T) { func TestAccContainerNodePool_maxPodsPerNode(t *testing.T) { t.Parallel() - cluster := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) - np := fmt.Sprintf("tf-test-nodepool-%s", RandString(t, 10)) - network := fmt.Sprintf("tf-test-net-%s", RandString(t, 10)) + cluster := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) + np := fmt.Sprintf("tf-test-nodepool-%s", acctest.RandString(t, 10)) + network := fmt.Sprintf("tf-test-net-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerNodePoolDestroyProducer(t), Steps: []resource.TestStep{ { @@ -112,11 +112,11 @@ func TestAccContainerNodePool_namePrefix(t *testing.T) { acctest.SkipIfVcr(t) t.Parallel() - cluster := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) + cluster := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerNodePoolDestroyProducer(t), Steps: []resource.TestStep{ resource.TestStep{ @@ -137,11 +137,11 @@ func TestAccContainerNodePool_noName(t *testing.T) { acctest.SkipIfVcr(t) t.Parallel() - cluster := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) + cluster := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerNodePoolDestroyProducer(t), Steps: []resource.TestStep{ resource.TestStep{ @@ -159,12 +159,12 @@ func TestAccContainerNodePool_noName(t *testing.T) { func TestAccContainerNodePool_withLoggingVariantUpdates(t *testing.T) { t.Parallel() - cluster := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) - nodePool := fmt.Sprintf("tf-test-nodepool-%s", RandString(t, 10)) + cluster := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) + nodePool := fmt.Sprintf("tf-test-nodepool-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerNodePoolDestroyProducer(t), Steps: []resource.TestStep{ { @@ -198,12 +198,12 @@ func TestAccContainerNodePool_withLoggingVariantUpdates(t *testing.T) { func TestAccContainerNodePool_withNodeConfig(t *testing.T) { t.Parallel() - cluster := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) - nodePool := fmt.Sprintf("tf-test-nodepool-%s", RandString(t, 10)) + cluster := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) + nodePool := fmt.Sprintf("tf-test-nodepool-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerNodePoolDestroyProducer(t), Steps: []resource.TestStep{ resource.TestStep{ @@ -235,12 +235,12 @@ func TestAccContainerNodePool_withNodeConfig(t *testing.T) { func TestAccContainerNodePool_withReservationAffinity(t *testing.T) { t.Parallel() - cluster := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) - np := fmt.Sprintf("tf-test-np-%s", RandString(t, 10)) + cluster := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) + np := fmt.Sprintf("tf-test-np-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -264,13 +264,13 @@ func TestAccContainerNodePool_withReservationAffinity(t *testing.T) { func TestAccContainerNodePool_withReservationAffinitySpecific(t *testing.T) { t.Parallel() - cluster := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) - reservation := fmt.Sprintf("tf-test-reservation-%s", RandString(t, 10)) - np := fmt.Sprintf("tf-test-np-%s", RandString(t, 10)) + cluster := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) + reservation := fmt.Sprintf("tf-test-reservation-%s", acctest.RandString(t, 10)) + np := fmt.Sprintf("tf-test-np-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -301,12 +301,12 @@ func TestAccContainerNodePool_withWorkloadIdentityConfig(t *testing.T) { t.Parallel() pid := envvar.GetTestProjectFromEnv() - cluster := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) - np := fmt.Sprintf("tf-test-np-%s", RandString(t, 10)) + cluster := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) + np := fmt.Sprintf("tf-test-np-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -341,12 +341,12 @@ func TestAccContainerNodePool_withWorkloadIdentityConfig(t *testing.T) { func TestAccContainerNodePool_withSandboxConfig(t *testing.T) { t.Parallel() - cluster := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) - np := fmt.Sprintf("tf-test-np-%s", RandString(t, 10)) + cluster := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) + np := fmt.Sprintf("tf-test-np-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -395,12 +395,12 @@ func TestAccContainerNodePool_withSandboxConfig(t *testing.T) { func TestAccContainerNodePool_withKubeletConfig(t *testing.T) { t.Parallel() - cluster := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) - np := fmt.Sprintf("tf-test-np-%s", RandString(t, 10)) + cluster := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) + np := fmt.Sprintf("tf-test-np-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -438,12 +438,12 @@ func TestAccContainerNodePool_withInvalidKubeletCpuManagerPolicy(t *testing.T) { // Unit test, no interactions acctest.SkipIfVcr(t) - cluster := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) - np := fmt.Sprintf("tf-test-np-%s", RandString(t, 10)) + cluster := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) + np := fmt.Sprintf("tf-test-np-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -457,12 +457,12 @@ func TestAccContainerNodePool_withInvalidKubeletCpuManagerPolicy(t *testing.T) { func TestAccContainerNodePool_withLinuxNodeConfig(t *testing.T) { t.Parallel() - cluster := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) - np := fmt.Sprintf("tf-test-np-%s", RandString(t, 10)) + cluster := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) + np := fmt.Sprintf("tf-test-np-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -489,13 +489,13 @@ func TestAccContainerNodePool_withLinuxNodeConfig(t *testing.T) { func TestAccContainerNodePool_withNetworkConfig(t *testing.T) { t.Parallel() - cluster := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) - np := fmt.Sprintf("tf-test-np-%s", RandString(t, 10)) - network := fmt.Sprintf("tf-test-net-%s", RandString(t, 10)) + cluster := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) + np := fmt.Sprintf("tf-test-np-%s", acctest.RandString(t, 10)) + network := fmt.Sprintf("tf-test-net-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -525,13 +525,13 @@ func TestAccContainerNodePool_withNetworkConfig(t *testing.T) { func TestAccContainerNodePool_withEnablePrivateNodesToggle(t *testing.T) { t.Parallel() - cluster := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) - np := fmt.Sprintf("tf-test-np-%s", RandString(t, 10)) - network := fmt.Sprintf("tf-test-net-%s", RandString(t, 10)) + cluster := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) + np := fmt.Sprintf("tf-test-np-%s", acctest.RandString(t, 10)) + network := fmt.Sprintf("tf-test-net-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -621,16 +621,16 @@ func TestAccContainerNodePool_withBootDiskKmsKey(t *testing.T) { acctest.SkipIfVcr(t) t.Parallel() - cluster := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) - np := fmt.Sprintf("tf-test-np-%s", RandString(t, 10)) + cluster := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) + np := fmt.Sprintf("tf-test-np-%s", acctest.RandString(t, 10)) if acctest.BootstrapPSARole(t, "service-", "compute-system", "roles/cloudkms.cryptoKeyEncrypterDecrypter") { t.Fatal("Stopping the test because a role was added to the policy.") } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -649,12 +649,12 @@ func TestAccContainerNodePool_withBootDiskKmsKey(t *testing.T) { func TestAccContainerNodePool_withUpgradeSettings(t *testing.T) { t.Parallel() - cluster := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) - np := fmt.Sprintf("tf-test-np-%s", RandString(t, 10)) + cluster := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) + np := fmt.Sprintf("tf-test-np-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -704,12 +704,12 @@ func TestAccContainerNodePool_withUpgradeSettings(t *testing.T) { func TestAccContainerNodePool_withGPU(t *testing.T) { t.Parallel() - cluster := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) - np := fmt.Sprintf("tf-test-np-%s", RandString(t, 10)) + cluster := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) + np := fmt.Sprintf("tf-test-np-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerNodePoolDestroyProducer(t), Steps: []resource.TestStep{ resource.TestStep{ @@ -727,17 +727,17 @@ func TestAccContainerNodePool_withGPU(t *testing.T) { func TestAccContainerNodePool_withManagement(t *testing.T) { t.Parallel() - cluster := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) - nodePool := fmt.Sprintf("tf-test-nodepool-%s", RandString(t, 10)) + cluster := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) + nodePool := fmt.Sprintf("tf-test-nodepool-%s", acctest.RandString(t, 10)) management := ` management { auto_repair = "false" auto_upgrade = "false" }` - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerNodePoolDestroyProducer(t), Steps: []resource.TestStep{ resource.TestStep{ @@ -779,12 +779,12 @@ func TestAccContainerNodePool_withManagement(t *testing.T) { func TestAccContainerNodePool_withNodeConfigScopeAlias(t *testing.T) { t.Parallel() - cluster := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) - np := fmt.Sprintf("tf-test-np-%s", RandString(t, 10)) + cluster := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) + np := fmt.Sprintf("tf-test-np-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerNodePoolDestroyProducer(t), Steps: []resource.TestStep{ resource.TestStep{ @@ -803,12 +803,12 @@ func TestAccContainerNodePool_withNodeConfigScopeAlias(t *testing.T) { func TestAccContainerNodePool_regionalAutoscaling(t *testing.T) { t.Parallel() - cluster := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) - np := fmt.Sprintf("tf-test-nodepool-%s", RandString(t, 10)) + cluster := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) + np := fmt.Sprintf("tf-test-nodepool-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerNodePoolDestroyProducer(t), Steps: []resource.TestStep{ resource.TestStep{ @@ -858,12 +858,12 @@ func TestAccContainerNodePool_regionalAutoscaling(t *testing.T) { func TestAccContainerNodePool_totalSize(t *testing.T) { t.Parallel() - cluster := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) - np := fmt.Sprintf("tf-test-nodepool-%s", RandString(t, 10)) + cluster := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) + np := fmt.Sprintf("tf-test-nodepool-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerNodePoolDestroyProducer(t), Steps: []resource.TestStep{ resource.TestStep{ @@ -914,12 +914,12 @@ func TestAccContainerNodePool_totalSize(t *testing.T) { func TestAccContainerNodePool_autoscaling(t *testing.T) { t.Parallel() - cluster := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) - np := fmt.Sprintf("tf-test-nodepool-%s", RandString(t, 10)) + cluster := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) + np := fmt.Sprintf("tf-test-nodepool-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerNodePoolDestroyProducer(t), Steps: []resource.TestStep{ resource.TestStep{ @@ -968,12 +968,12 @@ func TestAccContainerNodePool_autoscaling(t *testing.T) { func TestAccContainerNodePool_resize(t *testing.T) { t.Parallel() - cluster := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) - np := fmt.Sprintf("tf-test-nodepool-%s", RandString(t, 10)) + cluster := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) + np := fmt.Sprintf("tf-test-nodepool-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -1005,12 +1005,12 @@ func TestAccContainerNodePool_resize(t *testing.T) { func TestAccContainerNodePool_version(t *testing.T) { t.Parallel() - cluster := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) - np := fmt.Sprintf("tf-test-nodepool-%s", RandString(t, 10)) + cluster := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) + np := fmt.Sprintf("tf-test-nodepool-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -1044,12 +1044,12 @@ func TestAccContainerNodePool_version(t *testing.T) { func TestAccContainerNodePool_regionalClusters(t *testing.T) { t.Parallel() - cluster := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) - np := fmt.Sprintf("tf-test-nodepool-%s", RandString(t, 10)) + cluster := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) + np := fmt.Sprintf("tf-test-nodepool-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerNodePoolDestroyProducer(t), Steps: []resource.TestStep{ resource.TestStep{ @@ -1067,12 +1067,12 @@ func TestAccContainerNodePool_regionalClusters(t *testing.T) { func TestAccContainerNodePool_012_ConfigModeAttr(t *testing.T) { t.Parallel() - cluster := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) - np := fmt.Sprintf("tf-test-nodepool-%s", RandString(t, 10)) + cluster := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) + np := fmt.Sprintf("tf-test-nodepool-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerNodePoolDestroyProducer(t), Steps: []resource.TestStep{ { @@ -1098,12 +1098,12 @@ func TestAccContainerNodePool_012_ConfigModeAttr(t *testing.T) { func TestAccContainerNodePool_EmptyGuestAccelerator(t *testing.T) { t.Parallel() - cluster := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) - np := fmt.Sprintf("tf-test-nodepool-%s", RandString(t, 10)) + cluster := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) + np := fmt.Sprintf("tf-test-nodepool-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerNodePoolDestroyProducer(t), Steps: []resource.TestStep{ { @@ -1143,12 +1143,12 @@ func TestAccContainerNodePool_EmptyGuestAccelerator(t *testing.T) { func TestAccContainerNodePool_shieldedInstanceConfig(t *testing.T) { t.Parallel() - cluster := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) - np := fmt.Sprintf("tf-test-nodepool-%s", RandString(t, 10)) + cluster := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) + np := fmt.Sprintf("tf-test-nodepool-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerNodePoolDestroyProducer(t), Steps: []resource.TestStep{ resource.TestStep{ @@ -1167,13 +1167,13 @@ func TestAccContainerNodePool_shieldedInstanceConfig(t *testing.T) { func TestAccContainerNodePool_concurrent(t *testing.T) { t.Parallel() - cluster := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) - np1 := fmt.Sprintf("tf-test-nodepool-%s", RandString(t, 10)) - np2 := fmt.Sprintf("tf-test-nodepool-%s", RandString(t, 10)) + cluster := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) + np1 := fmt.Sprintf("tf-test-nodepool-%s", acctest.RandString(t, 10)) + np2 := fmt.Sprintf("tf-test-nodepool-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerNodePoolDestroyProducer(t), Steps: []resource.TestStep{ { @@ -1209,12 +1209,12 @@ func TestAccContainerNodePool_concurrent(t *testing.T) { func TestAccContainerNodePool_withSoleTenantConfig(t *testing.T) { t.Parallel() - cluster := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) - np := fmt.Sprintf("tf-test-np-%s", RandString(t, 10)) + cluster := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) + np := fmt.Sprintf("tf-test-np-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -1233,12 +1233,12 @@ func TestAccContainerNodePool_withSoleTenantConfig(t *testing.T) { func TestAccContainerNodePool_ephemeralStorageConfig(t *testing.T) { t.Parallel() - cluster := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) - np := fmt.Sprintf("tf-test-nodepool-%s", RandString(t, 10)) + cluster := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) + np := fmt.Sprintf("tf-test-nodepool-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerNodePoolDestroyProducer(t), Steps: []resource.TestStep{ resource.TestStep{ @@ -1281,12 +1281,12 @@ resource "google_container_node_pool" "np" { func TestAccContainerNodePool_ephemeralStorageLocalSsdConfig(t *testing.T) { t.Parallel() - cluster := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) - np := fmt.Sprintf("tf-test-nodepool-%s", RandString(t, 10)) + cluster := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) + np := fmt.Sprintf("tf-test-nodepool-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerNodePoolDestroyProducer(t), Steps: []resource.TestStep{ { @@ -1335,12 +1335,12 @@ resource "google_container_node_pool" "np" { func TestAccContainerNodePool_localNvmeSsdBlockConfig(t *testing.T) { t.Parallel() - cluster := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) - np := fmt.Sprintf("tf-test-nodepool-%s", RandString(t, 10)) + cluster := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) + np := fmt.Sprintf("tf-test-nodepool-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerNodePoolDestroyProducer(t), Steps: []resource.TestStep{ { @@ -1389,12 +1389,12 @@ resource "google_container_node_pool" "np" { func TestAccContainerNodePool_gcfsConfig(t *testing.T) { t.Parallel() - cluster := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) - np := fmt.Sprintf("tf-test-nodepool-%s", RandString(t, 10)) + cluster := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) + np := fmt.Sprintf("tf-test-nodepool-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerNodePoolDestroyProducer(t), Steps: []resource.TestStep{ resource.TestStep{ @@ -1437,12 +1437,12 @@ resource "google_container_node_pool" "np" { func TestAccContainerNodePool_gvnic(t *testing.T) { t.Parallel() - cluster := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) - np := fmt.Sprintf("tf-test-nodepool-%s", RandString(t, 10)) + cluster := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) + np := fmt.Sprintf("tf-test-nodepool-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerNodePoolDestroyProducer(t), Steps: []resource.TestStep{ { @@ -1485,12 +1485,12 @@ resource "google_container_node_pool" "np" { func TestAccContainerNodePool_compactPlacement(t *testing.T) { t.Parallel() - cluster := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) - np := fmt.Sprintf("tf-test-nodepool-%s", RandString(t, 10)) + cluster := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) + np := fmt.Sprintf("tf-test-nodepool-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerNodePoolDestroyProducer(t), Steps: []resource.TestStep{ { @@ -1532,12 +1532,12 @@ resource "google_container_node_pool" "np" { func TestAccContainerNodePool_threadsPerCore(t *testing.T) { t.Parallel() - cluster := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) - np := fmt.Sprintf("tf-test-nodepool-%s", RandString(t, 10)) + cluster := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) + np := fmt.Sprintf("tf-test-nodepool-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerNodePoolDestroyProducer(t), Steps: []resource.TestStep{ { @@ -1585,7 +1585,7 @@ resource "google_container_node_pool" "np" { func testAccCheckContainerNodePoolDestroyProducer(t *testing.T) func(s *terraform.State) error { return func(s *terraform.State) error { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) for _, rs := range s.RootModule().Resources { if rs.Type != "google_container_node_pool" { diff --git a/mmv1/third_party/terraform/tests/resource_container_registry_test.go b/mmv1/third_party/terraform/tests/resource_container_registry_test.go index 857b16867bb0..6c1f3aeed65a 100644 --- a/mmv1/third_party/terraform/tests/resource_container_registry_test.go +++ b/mmv1/third_party/terraform/tests/resource_container_registry_test.go @@ -11,9 +11,9 @@ import ( func TestAccContainerRegistry_basic(t *testing.T) { t.Parallel() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccContainerRegistry_basic(), @@ -24,11 +24,11 @@ func TestAccContainerRegistry_basic(t *testing.T) { func TestAccContainerRegistry_iam(t *testing.T) { t.Parallel() - account := RandString(t, 10) + account := acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccContainerRegistry_iam(account), diff --git a/mmv1/third_party/terraform/tests/resource_containeranalysis_note_test.go.erb b/mmv1/third_party/terraform/tests/resource_containeranalysis_note_test.go.erb index 2608d68c9e99..1948382b83ad 100644 --- a/mmv1/third_party/terraform/tests/resource_containeranalysis_note_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_containeranalysis_note_test.go.erb @@ -13,11 +13,11 @@ import ( func TestAccContainerAnalysisNote_basic(t *testing.T) { t.Parallel() - name := RandString(t, 10) - readableName := RandString(t, 10) - VcrTest(t, resource.TestCase{ + name := acctest.RandString(t, 10) + readableName := acctest.RandString(t, 10) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerAnalysisNoteDestroyProducer(t), Steps: []resource.TestStep{ { @@ -35,12 +35,12 @@ func TestAccContainerAnalysisNote_basic(t *testing.T) { func TestAccContainerAnalysisNote_update(t *testing.T) { t.Parallel() - name := RandString(t, 10) - readableName := RandString(t, 10) - readableName2 := RandString(t, 10) - VcrTest(t, resource.TestCase{ + name := acctest.RandString(t, 10) + readableName := acctest.RandString(t, 10) + readableName2 := acctest.RandString(t, 10) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckContainerAnalysisNoteDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_data_catalog_entry_group_test.go b/mmv1/third_party/terraform/tests/resource_data_catalog_entry_group_test.go index 822b981b859a..ab53b0a8d100 100644 --- a/mmv1/third_party/terraform/tests/resource_data_catalog_entry_group_test.go +++ b/mmv1/third_party/terraform/tests/resource_data_catalog_entry_group_test.go @@ -11,12 +11,12 @@ func TestAccDataCatalogEntryGroup_update(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDataCatalogEntryGroupDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_data_catalog_entry_test.go b/mmv1/third_party/terraform/tests/resource_data_catalog_entry_test.go index a102a025dee2..50a7d172570f 100644 --- a/mmv1/third_party/terraform/tests/resource_data_catalog_entry_test.go +++ b/mmv1/third_party/terraform/tests/resource_data_catalog_entry_test.go @@ -11,12 +11,12 @@ func TestAccDataCatalogEntry_update(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDataCatalogEntryDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_data_catalog_tag_template_test.go b/mmv1/third_party/terraform/tests/resource_data_catalog_tag_template_test.go index 87da88e97227..5f38d7da1e33 100644 --- a/mmv1/third_party/terraform/tests/resource_data_catalog_tag_template_test.go +++ b/mmv1/third_party/terraform/tests/resource_data_catalog_tag_template_test.go @@ -13,12 +13,12 @@ func TestAccDataCatalogTagTemplate_dataCatalogTagTemplate_updateFields(t *testin context := map[string]interface{}{ "force_delete": true, - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDataCatalogTagTemplateDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_data_catalog_tag_test.go b/mmv1/third_party/terraform/tests/resource_data_catalog_tag_test.go index acc534253bd5..c146a9627d04 100644 --- a/mmv1/third_party/terraform/tests/resource_data_catalog_tag_test.go +++ b/mmv1/third_party/terraform/tests/resource_data_catalog_tag_test.go @@ -12,12 +12,12 @@ func TestAccDataCatalogTag_update(t *testing.T) { context := map[string]interface{}{ "force_delete": true, - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDataCatalogEntryDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_data_fusion_instance_test.go b/mmv1/third_party/terraform/tests/resource_data_fusion_instance_test.go index a3a1cf43ab32..4c9aa67cf698 100644 --- a/mmv1/third_party/terraform/tests/resource_data_fusion_instance_test.go +++ b/mmv1/third_party/terraform/tests/resource_data_fusion_instance_test.go @@ -11,11 +11,11 @@ import ( func TestAccDataFusionInstance_update(t *testing.T) { t.Parallel() - instanceName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + instanceName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccDataFusionInstance_basic(instanceName), @@ -87,11 +87,11 @@ resource "google_data_fusion_instance" "foobar" { func TestAccDataFusionInstanceEnterprise_update(t *testing.T) { t.Parallel() - instanceName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + instanceName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccDataFusionInstanceEnterprise_basic(instanceName), @@ -153,18 +153,18 @@ func TestAccDataFusionInstanceVersion_dataFusionInstanceUpdate(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), "version": "6.7.2", } contextUpdate := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), "version": "6.8.0", } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDataFusionInstanceDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_data_loss_prevention_deidentify_template_test.go b/mmv1/third_party/terraform/tests/resource_data_loss_prevention_deidentify_template_test.go index 956d770dbc1a..1ba292b73919 100644 --- a/mmv1/third_party/terraform/tests/resource_data_loss_prevention_deidentify_template_test.go +++ b/mmv1/third_party/terraform/tests/resource_data_loss_prevention_deidentify_template_test.go @@ -13,13 +13,13 @@ func TestAccDataLossPreventionDeidentifyTemplate_dlpDeidentifyTemplate_infoTypeT context := map[string]interface{}{ "organization": envvar.GetTestOrgFromEnv(t), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), "kms_key_name": acctest.BootstrapKMSKey(t).CryptoKey.Name, // global KMS key } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDataLossPreventionDeidentifyTemplateDestroyProducer(t), Steps: []resource.TestStep{ { @@ -455,13 +455,13 @@ func TestAccDataLossPreventionDeidentifyTemplate_dlpDeidentifyTemplate_recordTra context := map[string]interface{}{ "organization": envvar.GetTestOrgFromEnv(t), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), "kms_key_name": acctest.BootstrapKMSKey(t).CryptoKey.Name, // global KMS key } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDataLossPreventionDeidentifyTemplateDestroyProducer(t), Steps: []resource.TestStep{ { @@ -1047,13 +1047,13 @@ func TestAccDataLossPreventionDeidentifyTemplate_dlpDeidentifyTemplate_imageTran context := map[string]interface{}{ "organization": envvar.GetTestOrgFromEnv(t), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), "kms_key_name": acctest.BootstrapKMSKey(t).CryptoKey.Name, // global KMS key } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDataLossPreventionDeidentifyTemplateDestroyProducer(t), Steps: []resource.TestStep{ { @@ -1152,13 +1152,13 @@ func TestAccDataLossPreventionDeidentifyTemplate_dlpDeidentifyTemplate_infoTypeT context := map[string]interface{}{ "organization": envvar.GetTestOrgFromEnv(t), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), "kms_key_name": acctest.BootstrapKMSKey(t).CryptoKey.Name, // global KMS key } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDataLossPreventionDeidentifyTemplateDestroyProducer(t), Steps: []resource.TestStep{ { @@ -1484,13 +1484,13 @@ func TestAccDataLossPreventionDeidentifyTemplate_dlpDeidentifyTemplate_infoTypeT context := map[string]interface{}{ "organization": envvar.GetTestOrgFromEnv(t), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), "kms_key_name": acctest.BootstrapKMSKey(t).CryptoKey.Name, // global KMS key } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDataLossPreventionDeidentifyTemplateDestroyProducer(t), Steps: []resource.TestStep{ { @@ -1793,13 +1793,13 @@ func TestAccDataLossPreventionDeidentifyTemplate_dlpDeidentifyTemplate_infoTypeT context := map[string]interface{}{ "organization": envvar.GetTestOrgFromEnv(t), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), "kms_key_name": acctest.BootstrapKMSKey(t).CryptoKey.Name, // global KMS key } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDataLossPreventionDeidentifyTemplateDestroyProducer(t), Steps: []resource.TestStep{ { @@ -1891,13 +1891,13 @@ func TestAccDataLossPreventionDeidentifyTemplate_dlpDeidentifyTemplate_infoTypeT context := map[string]interface{}{ "organization": envvar.GetTestOrgFromEnv(t), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), "kms_key_name": acctest.BootstrapKMSKey(t).CryptoKey.Name, // global KMS key } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDataLossPreventionDeidentifyTemplateDestroyProducer(t), Steps: []resource.TestStep{ { @@ -2042,9 +2042,9 @@ func TestAccDataLossPreventionDeidentifyTemplate_dlpDeidentifyTemplate_recordTra "kms_key_name": acctest.BootstrapKMSKey(t).CryptoKey.Name, // global KMS key } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDataLossPreventionDeidentifyTemplateDestroyProducer(t), Steps: []resource.TestStep{ { @@ -2869,9 +2869,9 @@ func TestAccDataLossPreventionDeidentifyTemplate_dlpDeidentifyTemplate_recordTra "project": envvar.GetTestProjectFromEnv(), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDataLossPreventionDeidentifyTemplateDestroyProducer(t), Steps: []resource.TestStep{ { @@ -3333,9 +3333,9 @@ func TestAccDataLossPreventionDeidentifyTemplate_dlpDeidentifyTemplate_recordTra "kms_key_name": acctest.BootstrapKMSKey(t).CryptoKey.Name, // global KMS key } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDataLossPreventionDeidentifyTemplateDestroyProducer(t), Steps: []resource.TestStep{ { @@ -3580,9 +3580,9 @@ func TestAccDataLossPreventionDeidentifyTemplate_dlpDeidentifyTemplate_recordTra "project": envvar.GetTestProjectFromEnv(), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDataLossPreventionDeidentifyTemplateDestroyProducer(t), Steps: []resource.TestStep{ { @@ -4092,9 +4092,9 @@ func TestAccDataLossPreventionDeidentifyTemplate_dlpDeidentifyTemplate_recordTra "kms_key_name": acctest.BootstrapKMSKey(t).CryptoKey.Name, // global KMS key } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDataLossPreventionDeidentifyTemplateDestroyProducer(t), Steps: []resource.TestStep{ { @@ -4317,9 +4317,9 @@ func TestAccDataLossPreventionDeidentifyTemplate_dlpDeidentifyTemplate_recordTra "kms_key_name": acctest.BootstrapKMSKey(t).CryptoKey.Name, // global KMS key } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDataLossPreventionDeidentifyTemplateDestroyProducer(t), Steps: []resource.TestStep{ { @@ -4557,9 +4557,9 @@ func TestAccDataLossPreventionDeidentifyTemplate_dlpDeidentifyTemplate_recordTra "kms_key_name": acctest.BootstrapKMSKey(t).CryptoKey.Name, // global KMS key } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDataLossPreventionDeidentifyTemplateDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_data_loss_prevention_inspect_template_test.go b/mmv1/third_party/terraform/tests/resource_data_loss_prevention_inspect_template_test.go index 1c53c6f24051..23e672805c6b 100644 --- a/mmv1/third_party/terraform/tests/resource_data_loss_prevention_inspect_template_test.go +++ b/mmv1/third_party/terraform/tests/resource_data_loss_prevention_inspect_template_test.go @@ -13,12 +13,12 @@ func TestAccDataLossPreventionInspectTemplate_dlpInspectTemplateUpdate(t *testin context := map[string]interface{}{ "project": envvar.GetTestProjectFromEnv(), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDataLossPreventionInspectTemplateDestroyProducer(t), Steps: []resource.TestStep{ { @@ -247,12 +247,12 @@ func TestAccDataLossPreventionInspectTemplate_dlpInspectTemplate_withInfoTypesVe context := map[string]interface{}{ "project": envvar.GetTestProjectFromEnv(), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDataLossPreventionInspectTemplateDestroyProducer(t), Steps: []resource.TestStep{ { @@ -543,12 +543,12 @@ func TestAccDataLossPreventionInspectTemplate_dlpInspectTemplate_withExcludeByHo context := map[string]interface{}{ "project": envvar.GetTestProjectFromEnv(), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDataLossPreventionInspectTemplateDestroyProducer(t), Steps: []resource.TestStep{ { @@ -869,9 +869,9 @@ func TestAccDataLossPreventionInspectTemplate_dlpInspectTemplate_withSensitivity "project": envvar.GetTestProjectFromEnv(), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDataLossPreventionInspectTemplateDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_data_loss_prevention_job_trigger_test.go b/mmv1/third_party/terraform/tests/resource_data_loss_prevention_job_trigger_test.go index c193f5c8ec53..c4f9eeabc813 100644 --- a/mmv1/third_party/terraform/tests/resource_data_loss_prevention_job_trigger_test.go +++ b/mmv1/third_party/terraform/tests/resource_data_loss_prevention_job_trigger_test.go @@ -13,12 +13,12 @@ func TestAccDataLossPreventionJobTrigger_dlpJobTriggerUpdateExample(t *testing.T context := map[string]interface{}{ "project": envvar.GetTestProjectFromEnv(), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDataLossPreventionJobTriggerDestroyProducer(t), Steps: []resource.TestStep{ { @@ -48,12 +48,12 @@ func TestAccDataLossPreventionJobTrigger_dlpJobTriggerUpdateExample2(t *testing. context := map[string]interface{}{ "project": envvar.GetTestProjectFromEnv(), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDataLossPreventionJobTriggerDestroyProducer(t), Steps: []resource.TestStep{ { @@ -121,9 +121,9 @@ func TestAccDataLossPreventionJobTrigger_dlpJobTriggerPubsub(t *testing.T) { "project": envvar.GetTestProjectFromEnv(), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDataLossPreventionJobTriggerDestroyProducer(t), Steps: []resource.TestStep{ { @@ -144,12 +144,12 @@ func TestAccDataLossPreventionJobTrigger_dlpJobTriggerDeidentifyUpdate(t *testin context := map[string]interface{}{ "project": envvar.GetTestProjectFromEnv(), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDataLossPreventionJobTriggerDestroyProducer(t), Steps: []resource.TestStep{ { @@ -179,12 +179,12 @@ func TestAccDataLossPreventionJobTrigger_dlpJobTriggerChangingActions(t *testing context := map[string]interface{}{ "project": envvar.GetTestProjectFromEnv(), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDataLossPreventionJobTriggerDestroyProducer(t), Steps: []resource.TestStep{ { @@ -225,9 +225,9 @@ func TestAccDataLossPreventionJobTrigger_dlpJobTriggerHybridUpdate(t *testing.T) "project": envvar.GetTestProjectFromEnv(), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDataLossPreventionJobTriggerDestroyProducer(t), Steps: []resource.TestStep{ { @@ -259,9 +259,9 @@ func TestAccDataLossPreventionJobTrigger_dlpJobTriggerInspect(t *testing.T) { "project": envvar.GetTestProjectFromEnv(), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDataLossPreventionJobTriggerDestroyProducer(t), Steps: []resource.TestStep{ { @@ -302,9 +302,9 @@ func TestAccDataLossPreventionJobTrigger_dlpJobTriggerInspectCustomInfoTypes(t * "project": envvar.GetTestProjectFromEnv(), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDataLossPreventionJobTriggerDestroyProducer(t), Steps: []resource.TestStep{ { @@ -361,12 +361,12 @@ func TestAccDataLossPreventionJobTrigger_dlpJobTriggerActionsOptionalExample(t * context := map[string]interface{}{ "project": envvar.GetTestProjectFromEnv(), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDataLossPreventionJobTriggerDestroyProducer(t), Steps: []resource.TestStep{ { @@ -405,12 +405,12 @@ func TestAccDataLossPreventionJobTrigger_dlpJobTriggerInspectOptionalExample(t * context := map[string]interface{}{ "project": envvar.GetTestProjectFromEnv(), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDataLossPreventionJobTriggerDestroyProducer(t), Steps: []resource.TestStep{ { @@ -451,9 +451,9 @@ func TestAccDataLossPreventionJobTrigger_dlpJobTrigger_withSensitivityScore(t *t "project": envvar.GetTestProjectFromEnv(), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDataLossPreventionJobTriggerDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_data_loss_prevention_stored_info_type_test.go b/mmv1/third_party/terraform/tests/resource_data_loss_prevention_stored_info_type_test.go index a403d2255b39..99faf5da0bd4 100644 --- a/mmv1/third_party/terraform/tests/resource_data_loss_prevention_stored_info_type_test.go +++ b/mmv1/third_party/terraform/tests/resource_data_loss_prevention_stored_info_type_test.go @@ -13,12 +13,12 @@ func TestAccDataLossPreventionStoredInfoType_dlpStoredInfoTypeUpdate(t *testing. context := map[string]interface{}{ "project": envvar.GetTestProjectFromEnv(), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDataLossPreventionStoredInfoTypeDestroyProducer(t), Steps: []resource.TestStep{ { @@ -79,9 +79,9 @@ func TestAccDataLossPreventionStoredInfoType_dlpStoredInfoTypeGroupIndexUpdate(t "project": envvar.GetTestProjectFromEnv(), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDataLossPreventionStoredInfoTypeDestroyProducer(t), Steps: []resource.TestStep{ { @@ -154,12 +154,12 @@ func TestAccDataLossPreventionStoredInfoType_dlpStoredInfoTypeStoredInfoTypeId(t context := map[string]interface{}{ "project": envvar.GetTestProjectFromEnv(), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDataLossPreventionStoredInfoTypeDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_database_migration_service_connection_profile_test.go b/mmv1/third_party/terraform/tests/resource_database_migration_service_connection_profile_test.go index 4a9afb2f1f40..6fb6f79877d0 100644 --- a/mmv1/third_party/terraform/tests/resource_database_migration_service_connection_profile_test.go +++ b/mmv1/third_party/terraform/tests/resource_database_migration_service_connection_profile_test.go @@ -11,12 +11,12 @@ func TestAccDatabaseMigrationServiceConnectionProfile_update(t *testing.T) { t.Parallel() suffix := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccDatabaseMigrationServiceConnectionProfile_basic(suffix), diff --git a/mmv1/third_party/terraform/tests/resource_dataflow_flex_template_job_test.go.erb b/mmv1/third_party/terraform/tests/resource_dataflow_flex_template_job_test.go.erb index f8cf1d6e69de..c75a463a43a3 100644 --- a/mmv1/third_party/terraform/tests/resource_dataflow_flex_template_job_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_dataflow_flex_template_job_test.go.erb @@ -24,14 +24,14 @@ func TestAccDataflowFlexTemplateJob_basic(t *testing.T) { acctest.SkipIfVcr(t) t.Parallel() - randStr := RandString(t, 10) + randStr := acctest.RandString(t, 10) job := "tf-test-dataflow-job-" + randStr bucket := "tf-test-dataflow-bucket-" + randStr topic := "tf-test-topic" + randStr - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDataflowJobDestroyProducer(t), Steps: []resource.TestStep{ { @@ -56,15 +56,15 @@ func TestAccDataflowFlexTemplateJob_streamUpdate(t *testing.T) { acctest.SkipIfVcr(t) t.Parallel() - randStr := RandString(t, 10) + randStr := acctest.RandString(t, 10) job := "tf-test-dataflow-job-" + randStr bucket := "tf-test-dataflow-bucket-" + randStr topic := "tf-test-topic" + randStr topic2 := "tf-test-topic-2" + randStr - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDataflowJobDestroyProducer(t), Steps: []resource.TestStep{ { @@ -95,14 +95,14 @@ func TestAccDataflowFlexTemplateJob_streamFailUpdate(t *testing.T) { acctest.SkipIfVcr(t) t.Parallel() - randStr := RandString(t, 10) + randStr := acctest.RandString(t, 10) job := "tf-test-dataflow-job-" + randStr bucket := "tf-test-dataflow-bucket-" + randStr topic := "tf-test-topic" + randStr - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDataflowJobDestroyProducer(t), Steps: []resource.TestStep{ { @@ -128,14 +128,14 @@ func TestAccDataflowFlexTemplateJob_FullUpdate(t *testing.T) { acctest.SkipIfVcr(t) t.Parallel() - randStr := RandString(t, 10) + randStr := acctest.RandString(t, 10) job := "tf-test-dataflow-job-" + randStr bucket := "tf-test-dataflow-bucket-" + randStr topic := "tf-test-topic" + randStr - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDataflowJobDestroyProducer(t), Steps: []resource.TestStep{ { @@ -163,19 +163,19 @@ func TestAccDataflowFlexTemplateJob_FullUpdate(t *testing.T) { func TestAccDataflowFlexTemplateJob_withNetwork(t *testing.T) { // Dataflow responses include serialized java classes and bash commands // This makes body comparison infeasible - SkipIfVcr(t) + acctest.SkipIfVcr(t) t.Parallel() - randStr := RandString(t, 10) + randStr := acctest.RandString(t, 10) job := "tf-test-dataflow-job-" + randStr network1 := "tf-test-dataflow-net" + randStr network2 := "tf-test-dataflow-net2" + randStr bucket := "tf-test-dataflow-bucket-" + randStr topic := "tf-test-topic" + randStr - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDataflowJobDestroyProducer(t), Steps: []resource.TestStep{ { @@ -211,10 +211,10 @@ func TestAccDataflowFlexTemplateJob_withNetwork(t *testing.T) { func TestAccDataflowFlexTemplateJob_withSubNetwork(t *testing.T) { // Dataflow responses include serialized java classes and bash commands // This makes body comparison infeasible - SkipIfVcr(t) + acctest.SkipIfVcr(t) t.Parallel() - randStr := RandString(t, 10) + randStr := acctest.RandString(t, 10) job := "tf-test-dataflow-job-" + randStr network := "tf-test-dataflow-net" + randStr subnetwork1 := "tf-test-dataflow-subnetwork" + randStr @@ -222,9 +222,9 @@ func TestAccDataflowFlexTemplateJob_withSubNetwork(t *testing.T) { bucket := "tf-test-dataflow-bucket-" + randStr topic := "tf-test-topic" + randStr - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDataflowJobDestroyProducer(t), Steps: []resource.TestStep{ { @@ -260,19 +260,19 @@ func TestAccDataflowFlexTemplateJob_withSubNetwork(t *testing.T) { func TestAccDataflowFlexTemplateJob_withIpConfig(t *testing.T) { // Dataflow responses include serialized java classes and bash commands // This makes body comparison infeasible - SkipIfVcr(t) + acctest.SkipIfVcr(t) t.Parallel() - randStr := RandString(t, 10) + randStr := acctest.RandString(t, 10) job := "tf-test-dataflow-job-" + randStr bucket := "tf-test-dataflow-bucket-" + randStr topic := "tf-test-topic" + randStr network := "tf-test-dataflow-net" + randStr subnetwork := "tf-test-dataflow-subnetwork" + randStr - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDataflowJobDestroyProducer(t), Steps: []resource.TestStep{ { @@ -294,19 +294,19 @@ func TestAccDataflowFlexTemplateJob_withIpConfig(t *testing.T) { func TestAccDataflowFlexTemplateJob_withKmsKey(t *testing.T) { // Dataflow responses include serialized java classes and bash commands // This makes body comparison infeasible - SkipIfVcr(t) + acctest.SkipIfVcr(t) t.Parallel() - randStr := RandString(t, 10) + randStr := acctest.RandString(t, 10) job := "tf-test-dataflow-job-" + randStr key_ring := "tf-test-dataflow-kms-ring-" + randStr crypto_key := "tf-test-dataflow-kms-key-" + randStr bucket := "tf-test-dataflow-bucket-" + randStr topic := "tf-test-topic" + randStr - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDataflowJobDestroyProducer(t), Steps: []resource.TestStep{ { @@ -328,18 +328,18 @@ func TestAccDataflowFlexTemplateJob_withKmsKey(t *testing.T) { func TestAccDataflowFlexTemplateJob_withAdditionalExperiments(t *testing.T) { // Dataflow responses include serialized java classes and bash commands // This makes body comparison infeasible - SkipIfVcr(t) + acctest.SkipIfVcr(t) t.Parallel() - randStr := RandString(t, 10) + randStr := acctest.RandString(t, 10) job := "tf-test-dataflow-job-" + randStr additionalExperiments := []string{"enable_stackdriver_agent_metrics", "use_runner_v2"} bucket := "tf-test-dataflow-bucket-" + randStr topic := "tf-test-topic" + randStr - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDataflowJobDestroyProducer(t), Steps: []resource.TestStep{ { @@ -403,7 +403,7 @@ func testAccDataflowFlexTemplateJobHasAdditionalExperiments(t *testing.T, res st if rs.Primary.ID == "" { return fmt.Errorf("No ID is set") } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) job, err := config.NewDataflowClient(config.UserAgent).Projects.Jobs.Get(config.Project, rs.Primary.ID).View("JOB_VIEW_ALL").Do() if err != nil { @@ -436,7 +436,7 @@ func testAccDataflowFlexTemplateGetGeneratedInstanceTemplate(t *testing.T, s *te } filter := fmt.Sprintf("properties.labels.dataflow_job_id = %s", rs.Primary.ID) - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) var instanceTemplate *compute.InstanceTemplate @@ -1198,7 +1198,7 @@ func testAccDataflowFlexJobHasOption(t *testing.T, res, option, expectedValue st if rs.Primary.ID == "" { return fmt.Errorf("No ID is set") } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) job, err := config.NewDataflowClient(config.UserAgent).Projects.Jobs.Get(config.Project, rs.Primary.ID).View("JOB_VIEW_ALL").Do() if err != nil { @@ -1232,7 +1232,7 @@ func testAccDataflowFlexJobExists(t *testing.T, resource string, wait bool) reso return fmt.Errorf("no ID is set") } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) _, err := config.NewDataflowClient(config.UserAgent).Projects.Locations.Jobs.Get(config.Project, config.Region, rs.Primary.ID).Do() if err != nil { return fmt.Errorf("could not confirm Dataflow Job %q exists: %v", rs.Primary.ID, err) diff --git a/mmv1/third_party/terraform/tests/resource_dataflow_job_test.go.erb b/mmv1/third_party/terraform/tests/resource_dataflow_job_test.go.erb index bcaff0c3e066..ac6789135fbc 100644 --- a/mmv1/third_party/terraform/tests/resource_dataflow_job_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_dataflow_job_test.go.erb @@ -34,14 +34,14 @@ func TestAccDataflowJob_basic(t *testing.T) { acctest.SkipIfVcr(t) t.Parallel() - randStr := RandString(t, 10) + randStr := acctest.RandString(t, 10) bucket := "tf-test-dataflow-gcs-" + randStr job := "tf-test-dataflow-job-" + randStr zone := "us-central1-f" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDataflowJobDestroyProducer(t), Steps: []resource.TestStep{ { @@ -66,14 +66,14 @@ func TestAccDataflowJobSkipWait_basic(t *testing.T) { acctest.SkipIfVcr(t) t.Parallel() - randStr := RandString(t, 10) + randStr := acctest.RandString(t, 10) bucket := "tf-test-dataflow-gcs-" + randStr job := "tf-test-dataflow-job-" + randStr zone := "us-central1-f" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDataflowJobDestroyProducer(t), Steps: []resource.TestStep{ { @@ -98,13 +98,13 @@ func TestAccDataflowJob_withRegion(t *testing.T) { acctest.SkipIfVcr(t) t.Parallel() - randStr := RandString(t, 10) + randStr := acctest.RandString(t, 10) bucket := "tf-test-dataflow-gcs-" + randStr job := "tf-test-dataflow-job-" + randStr - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDataflowJobRegionDestroyProducer(t), Steps: []resource.TestStep{ { @@ -129,14 +129,14 @@ func TestAccDataflowJob_withServiceAccount(t *testing.T) { acctest.SkipIfVcr(t) t.Parallel() - randStr := RandString(t, 10) + randStr := acctest.RandString(t, 10) bucket := "tf-test-dataflow-gcs-" + randStr job := "tf-test-dataflow-job-" + randStr accountId := "tf-test-dataflow-sa" + randStr - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDataflowJobDestroyProducer(t), Steps: []resource.TestStep{ { @@ -162,14 +162,14 @@ func TestAccDataflowJob_withNetwork(t *testing.T) { acctest.SkipIfVcr(t) t.Parallel() - randStr := RandString(t, 10) + randStr := acctest.RandString(t, 10) bucket := "tf-test-dataflow-gcs-" + randStr job := "tf-test-dataflow-job-" + randStr network := "tf-test-dataflow-net" + randStr - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDataflowJobDestroyProducer(t), Steps: []resource.TestStep{ { @@ -195,15 +195,15 @@ func TestAccDataflowJob_withSubnetwork(t *testing.T) { acctest.SkipIfVcr(t) t.Parallel() - randStr := RandString(t, 10) + randStr := acctest.RandString(t, 10) bucket := "tf-test-dataflow-gcs-" + randStr job := "tf-test-dataflow-job-" + randStr network := "tf-test-dataflow-net" + randStr subnetwork := "tf-test-dataflow-subnet" + randStr - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDataflowJobDestroyProducer(t), Steps: []resource.TestStep{ { @@ -229,15 +229,15 @@ func TestAccDataflowJob_withLabels(t *testing.T) { acctest.SkipIfVcr(t) t.Parallel() - randStr := RandString(t, 10) + randStr := acctest.RandString(t, 10) bucket := "tf-test-dataflow-gcs-" + randStr job := "tf-test-dataflow-job-" + randStr key := "my-label" value := "my-value" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDataflowJobDestroyProducer(t), Steps: []resource.TestStep{ { @@ -263,13 +263,13 @@ func TestAccDataflowJob_withIpConfig(t *testing.T) { acctest.SkipIfVcr(t) t.Parallel() - randStr := RandString(t, 10) + randStr := acctest.RandString(t, 10) bucket := "tf-test-dataflow-gcs-" + randStr job := "tf-test-dataflow-job-" + randStr - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDataflowJobDestroyProducer(t), Steps: []resource.TestStep{ { @@ -294,7 +294,7 @@ func TestAccDataflowJob_withKmsKey(t *testing.T) { acctest.SkipIfVcr(t) t.Parallel() - randStr := RandString(t, 10) + randStr := acctest.RandString(t, 10) key_ring := "tf-test-dataflow-kms-ring-" + randStr crypto_key := "tf-test-dataflow-kms-key-" + randStr bucket := "tf-test-dataflow-gcs-" + randStr @@ -305,9 +305,9 @@ func TestAccDataflowJob_withKmsKey(t *testing.T) { t.Fatal("Stopping the test because a role was added to the policy.") } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDataflowJobDestroyProducer(t), Steps: []resource.TestStep{ { @@ -331,14 +331,14 @@ func TestAccDataflowJobWithAdditionalExperiments(t *testing.T) { acctest.SkipIfVcr(t) t.Parallel() - randStr := RandString(t, 10) + randStr := acctest.RandString(t, 10) bucket := "tf-test-dataflow-gcs-" + randStr job := "tf-test-dataflow-job-" + randStr additionalExperiments := []string{"enable_stackdriver_agent_metrics", "shuffle_mode=service"} - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDataflowJobDestroyProducer(t), Steps: []resource.TestStep{ { @@ -364,10 +364,10 @@ func TestAccDataflowJob_streamUpdate(t *testing.T) { acctest.SkipIfVcr(t) t.Parallel() - suffix := RandString(t, 10) - VcrTest(t, resource.TestCase{ + suffix := acctest.RandString(t, 10) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDataflowJobDestroyProducer(t), Steps: []resource.TestStep{ { @@ -398,13 +398,13 @@ func TestAccDataflowJob_virtualUpdate(t *testing.T) { acctest.SkipIfVcr(t) t.Parallel() - suffix := RandString(t, 10) + suffix := acctest.RandString(t, 10) // If the update is virtual-only, the ID should remain the same after updating. var id string - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDataflowJobDestroyProducer(t), Steps: []resource.TestStep{ { @@ -438,7 +438,7 @@ func testAccCheckDataflowJobDestroyProducer(t *testing.T) func(s *terraform.Stat continue } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) job, err := config.NewDataflowClient(config.UserAgent).Projects.Jobs.Get(config.Project, rs.Primary.ID).Do() if job != nil { var ok bool @@ -468,7 +468,7 @@ func testAccCheckDataflowJobRegionDestroyProducer(t *testing.T) func(s *terrafor if rs.Type != "google_dataflow_job" { continue } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) job, err := config.NewDataflowClient(config.UserAgent).Projects.Locations.Jobs.Get(config.Project, "us-central1", rs.Primary.ID).Do() if job != nil { var ok bool @@ -502,7 +502,7 @@ func testAccDataflowJobExists(t *testing.T, resource string) resource.TestCheckF return fmt.Errorf("no ID is set") } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) _, err := config.NewDataflowClient(config.UserAgent).Projects.Jobs.Get(config.Project, rs.Primary.ID).Do() if err != nil { return fmt.Errorf("could not confirm Dataflow Job %q exists: %v", rs.Primary.ID, err) @@ -600,7 +600,7 @@ func testAccDataflowJobGetGeneratedInstanceTemplate(t *testing.T, s *terraform.S } filter := fmt.Sprintf("properties.labels.dataflow_job_id = %s", rs.Primary.ID) - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) var instanceTemplate *compute.InstanceTemplate @@ -641,7 +641,7 @@ func testAccRegionalDataflowJobExists(t *testing.T, res, region string) resource if rs.Primary.ID == "" { return fmt.Errorf("No ID is set") } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) _, err := config.NewDataflowClient(config.UserAgent).Projects.Locations.Jobs.Get(config.Project, region, rs.Primary.ID).Do() if err != nil { return fmt.Errorf("Job does not exist") @@ -661,7 +661,7 @@ func testAccDataflowJobHasLabels(t *testing.T, res, key string) resource.TestChe if rs.Primary.ID == "" { return fmt.Errorf("No ID is set") } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) job, err := config.NewDataflowClient(config.UserAgent).Projects.Jobs.Get(config.Project, rs.Primary.ID).Do() if err != nil { @@ -686,7 +686,7 @@ func testAccDataflowJobHasExperiments(t *testing.T, res string, experiments []st if rs.Primary.ID == "" { return fmt.Errorf("No ID is set") } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) job, err := config.NewDataflowClient(config.UserAgent).Projects.Jobs.Get(config.Project, rs.Primary.ID).View("JOB_VIEW_ALL").Do() if err != nil { @@ -719,7 +719,7 @@ func testAccDataflowJobHasTempLocation(t *testing.T, res, targetLocation string) if rs.Primary.ID == "" { return fmt.Errorf("No ID is set") } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) job, err := config.NewDataflowClient(config.UserAgent).Projects.Jobs.Get(config.Project, rs.Primary.ID).View("JOB_VIEW_ALL").Do() if err != nil { diff --git a/mmv1/third_party/terraform/tests/resource_dataform_repository_test.go.erb b/mmv1/third_party/terraform/tests/resource_dataform_repository_test.go.erb index 8518a5307882..5ebff0d6de6c 100644 --- a/mmv1/third_party/terraform/tests/resource_dataform_repository_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_dataform_repository_test.go.erb @@ -14,12 +14,12 @@ func TestAccDataformRepository_updated(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderBetaFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), CheckDestroy: testAccCheckDataformRepositoryDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_dataproc_cluster_iam_test.go b/mmv1/third_party/terraform/tests/resource_dataproc_cluster_iam_test.go index e8c278b351bc..2aa921017dbf 100644 --- a/mmv1/third_party/terraform/tests/resource_dataproc_cluster_iam_test.go +++ b/mmv1/third_party/terraform/tests/resource_dataproc_cluster_iam_test.go @@ -12,16 +12,16 @@ import ( func TestAccDataprocClusterIamBinding(t *testing.T) { t.Parallel() - cluster := "tf-dataproc-iam-" + RandString(t, 10) - account := "tf-dataproc-iam-" + RandString(t, 10) + cluster := "tf-dataproc-iam-" + acctest.RandString(t, 10) + account := "tf-dataproc-iam-" + acctest.RandString(t, 10) role := "roles/editor" importId := fmt.Sprintf("projects/%s/regions/%s/clusters/%s %s", envvar.GetTestProjectFromEnv(), "us-central1", cluster, role) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { // Test IAM Binding creation @@ -54,8 +54,8 @@ func TestAccDataprocClusterIamBinding(t *testing.T) { func TestAccDataprocClusterIamMember(t *testing.T) { t.Parallel() - cluster := "tf-dataproc-iam-" + RandString(t, 10) - account := "tf-dataproc-iam-" + RandString(t, 10) + cluster := "tf-dataproc-iam-" + acctest.RandString(t, 10) + account := "tf-dataproc-iam-" + acctest.RandString(t, 10) role := "roles/editor" importId := fmt.Sprintf("projects/%s/regions/%s/clusters/%s %s serviceAccount:%s", @@ -65,9 +65,9 @@ func TestAccDataprocClusterIamMember(t *testing.T) { role, serviceAccountCanonicalEmail(account)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { // Test IAM Binding creation @@ -92,16 +92,16 @@ func TestAccDataprocClusterIamMember(t *testing.T) { func TestAccDataprocClusterIamPolicy(t *testing.T) { t.Parallel() - cluster := "tf-dataproc-iam-" + RandString(t, 10) - account := "tf-dataproc-iam-" + RandString(t, 10) + cluster := "tf-dataproc-iam-" + acctest.RandString(t, 10) + account := "tf-dataproc-iam-" + acctest.RandString(t, 10) role := "roles/editor" importId := fmt.Sprintf("projects/%s/regions/%s/clusters/%s", envvar.GetTestProjectFromEnv(), "us-central1", cluster) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { // Test IAM Binding creation diff --git a/mmv1/third_party/terraform/tests/resource_dataproc_cluster_test.go.erb b/mmv1/third_party/terraform/tests/resource_dataproc_cluster_test.go.erb index a27cc5891393..6ee40530a18f 100644 --- a/mmv1/third_party/terraform/tests/resource_dataproc_cluster_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_dataproc_cluster_test.go.erb @@ -27,10 +27,10 @@ import ( func TestAccDataprocCluster_missingZoneGlobalRegion1(t *testing.T) { t.Parallel() - rnd := RandString(t, 10) - VcrTest(t, resource.TestCase{ + rnd := acctest.RandString(t, 10) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccCheckDataproc_missingZoneGlobalRegion1(rnd), @@ -43,10 +43,10 @@ func TestAccDataprocCluster_missingZoneGlobalRegion1(t *testing.T) { func TestAccDataprocCluster_missingZoneGlobalRegion2(t *testing.T) { t.Parallel() - rnd := RandString(t, 10) - VcrTest(t, resource.TestCase{ + rnd := acctest.RandString(t, 10) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccCheckDataproc_missingZoneGlobalRegion2(rnd), @@ -60,10 +60,10 @@ func TestAccDataprocCluster_basic(t *testing.T) { t.Parallel() var cluster dataproc.Cluster - rnd := RandString(t, 10) - VcrTest(t, resource.TestCase{ + rnd := acctest.RandString(t, 10) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDataprocClusterDestroy(t), Steps: []resource.TestStep{ { @@ -110,13 +110,13 @@ func TestAccDataprocVirtualCluster_basic(t *testing.T) { t.Parallel() var cluster dataproc.Cluster - rnd := RandString(t, 10) + rnd := acctest.RandString(t, 10) pid := envvar.GetTestProjectFromEnv() version := "3.1-dataproc-7" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDataprocClusterDestroy(t), Steps: []resource.TestStep{ { @@ -147,16 +147,16 @@ func TestAccDataprocVirtualCluster_basic(t *testing.T) { func TestAccDataprocCluster_withAccelerators(t *testing.T) { t.Parallel() - rnd := RandString(t, 10) + rnd := acctest.RandString(t, 10) var cluster dataproc.Cluster project := envvar.GetTestProjectFromEnv() acceleratorType := "nvidia-tesla-k80" zone := "us-central1-c" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDataprocClusterDestroy(t), Steps: []resource.TestStep{ { @@ -211,10 +211,10 @@ func TestAccDataprocCluster_withInternalIpOnlyTrueAndShieldedConfig(t *testing.T t.Parallel() var cluster dataproc.Cluster - rnd := RandString(t, 10) - VcrTest(t, resource.TestCase{ + rnd := acctest.RandString(t, 10) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDataprocClusterDestroy(t), Steps: []resource.TestStep{ { @@ -237,10 +237,10 @@ func TestAccDataprocCluster_withMetadataAndTags(t *testing.T) { t.Parallel() var cluster dataproc.Cluster - rnd := RandString(t, 10) - VcrTest(t, resource.TestCase{ + rnd := acctest.RandString(t, 10) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDataprocClusterDestroy(t), Steps: []resource.TestStep{ { @@ -261,10 +261,10 @@ func TestAccDataprocCluster_withReservationAffinity(t *testing.T) { t.Parallel() var cluster dataproc.Cluster - rnd := RandString(t, 10) - VcrTest(t, resource.TestCase{ + rnd := acctest.RandString(t, 10) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDataprocClusterDestroy(t), Steps: []resource.TestStep{ { @@ -285,10 +285,10 @@ func TestAccDataprocCluster_withDataprocMetricConfig(t *testing.T) { t.Parallel() var cluster dataproc.Cluster - rnd := RandString(t, 10) - VcrTest(t, resource.TestCase{ + rnd := acctest.RandString(t, 10) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDataprocClusterDestroy(t), Steps: []resource.TestStep{ { @@ -310,10 +310,10 @@ func TestAccDataprocCluster_withNodeGroupAffinity(t *testing.T) { t.Parallel() var cluster dataproc.Cluster - rnd := RandString(t, 10) - VcrTest(t, resource.TestCase{ + rnd := acctest.RandString(t, 10) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDataprocClusterDestroy(t), Steps: []resource.TestStep{ { @@ -331,11 +331,11 @@ func TestAccDataprocCluster_withNodeGroupAffinity(t *testing.T) { func TestAccDataprocCluster_singleNodeCluster(t *testing.T) { t.Parallel() - rnd := RandString(t, 10) + rnd := acctest.RandString(t, 10) var cluster dataproc.Cluster - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDataprocClusterDestroy(t), Steps: []resource.TestStep{ { @@ -357,12 +357,12 @@ func TestAccDataprocCluster_singleNodeCluster(t *testing.T) { func TestAccDataprocCluster_updatable(t *testing.T) { t.Parallel() - rnd := RandString(t, 10) + rnd := acctest.RandString(t, 10) var cluster dataproc.Cluster - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDataprocClusterDestroy(t), Steps: []resource.TestStep{ { @@ -395,11 +395,11 @@ func TestAccDataprocCluster_updatable(t *testing.T) { func TestAccDataprocCluster_nonPreemptibleSecondary(t *testing.T) { t.Parallel() - rnd := RandString(t, 10) + rnd := acctest.RandString(t, 10) var cluster dataproc.Cluster - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDataprocClusterDestroy(t), Steps: []resource.TestStep{ { @@ -416,11 +416,11 @@ func TestAccDataprocCluster_nonPreemptibleSecondary(t *testing.T) { func TestAccDataprocCluster_spotSecondary(t *testing.T) { t.Parallel() - rnd := RandString(t, 10) + rnd := acctest.RandString(t, 10) var cluster dataproc.Cluster - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDataprocClusterDestroy(t), Steps: []resource.TestStep{ { @@ -437,14 +437,14 @@ func TestAccDataprocCluster_spotSecondary(t *testing.T) { func TestAccDataprocCluster_withStagingBucket(t *testing.T) { t.Parallel() - rnd := RandString(t, 10) + rnd := acctest.RandString(t, 10) var cluster dataproc.Cluster clusterName := fmt.Sprintf("tf-test-dproc-%s", rnd) bucketName := fmt.Sprintf("%s-bucket", clusterName) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDataprocClusterDestroy(t), Steps: []resource.TestStep{ { @@ -469,14 +469,14 @@ func TestAccDataprocCluster_withStagingBucket(t *testing.T) { func TestAccDataprocCluster_withTempBucket(t *testing.T) { t.Parallel() - rnd := RandString(t, 10) + rnd := acctest.RandString(t, 10) var cluster dataproc.Cluster clusterName := fmt.Sprintf("tf-test-dproc-%s", rnd) bucketName := fmt.Sprintf("%s-temp-bucket", clusterName) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDataprocClusterDestroy(t), Steps: []resource.TestStep{ { @@ -500,13 +500,13 @@ func TestAccDataprocCluster_withTempBucket(t *testing.T) { func TestAccDataprocCluster_withInitAction(t *testing.T) { t.Parallel() - rnd := RandString(t, 10) + rnd := acctest.RandString(t, 10) var cluster dataproc.Cluster bucketName := fmt.Sprintf("tf-test-dproc-%s-init-bucket", rnd) objectName := "msg.txt" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDataprocClusterDestroy(t), Steps: []resource.TestStep{ { @@ -525,11 +525,11 @@ func TestAccDataprocCluster_withInitAction(t *testing.T) { func TestAccDataprocCluster_withConfigOverrides(t *testing.T) { t.Parallel() - rnd := RandString(t, 10) + rnd := acctest.RandString(t, 10) var cluster dataproc.Cluster - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDataprocClusterDestroy(t), Steps: []resource.TestStep{ { @@ -546,15 +546,15 @@ func TestAccDataprocCluster_withConfigOverrides(t *testing.T) { func TestAccDataprocCluster_withServiceAcc(t *testing.T) { t.Parallel() - sa := "a" + RandString(t, 10) + sa := "a" + acctest.RandString(t, 10) saEmail := fmt.Sprintf("%s@%s.iam.gserviceaccount.com", sa, envvar.GetTestProjectFromEnv()) - rnd := RandString(t, 10) + rnd := acctest.RandString(t, 10) var cluster dataproc.Cluster - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDataprocClusterDestroy(t), Steps: []resource.TestStep{ { @@ -578,13 +578,13 @@ func TestAccDataprocCluster_withServiceAcc(t *testing.T) { func TestAccDataprocCluster_withImageVersion(t *testing.T) { t.Parallel() - rnd := RandString(t, 10) + rnd := acctest.RandString(t, 10) version := "2.0.35-debian10" var cluster dataproc.Cluster - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDataprocClusterDestroy(t), Steps: []resource.TestStep{ { @@ -601,11 +601,11 @@ func TestAccDataprocCluster_withImageVersion(t *testing.T) { func TestAccDataprocCluster_withOptionalComponents(t *testing.T) { t.Parallel() - rnd := RandString(t, 10) + rnd := acctest.RandString(t, 10) var cluster dataproc.Cluster - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDataprocClusterDestroy(t), Steps: []resource.TestStep{ { @@ -622,11 +622,11 @@ func TestAccDataprocCluster_withOptionalComponents(t *testing.T) { func TestAccDataprocCluster_withLifecycleConfigIdleDeleteTtl(t *testing.T) { t.Parallel() - rnd := RandString(t, 10) + rnd := acctest.RandString(t, 10) var cluster dataproc.Cluster - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDataprocClusterDestroy(t), Steps: []resource.TestStep{ { @@ -650,14 +650,14 @@ func TestAccDataprocCluster_withLifecycleConfigAutoDeletion(t *testing.T) { acctest.SkipIfVcr(t) t.Parallel() - rnd := RandString(t, 10) + rnd := acctest.RandString(t, 10) now := time.Now() fmtString := "2006-01-02T15:04:05.072Z" var cluster dataproc.Cluster - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDataprocClusterDestroy(t), Steps: []resource.TestStep{ { @@ -679,11 +679,11 @@ func TestAccDataprocCluster_withLifecycleConfigAutoDeletion(t *testing.T) { func TestAccDataprocCluster_withLabels(t *testing.T) { t.Parallel() - rnd := RandString(t, 10) + rnd := acctest.RandString(t, 10) var cluster dataproc.Cluster - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDataprocClusterDestroy(t), Steps: []resource.TestStep{ { @@ -706,11 +706,11 @@ func TestAccDataprocCluster_withNetworkRefs(t *testing.T) { t.Parallel() var c1, c2 dataproc.Cluster - rnd := RandString(t, 10) + rnd := acctest.RandString(t, 10) netName := fmt.Sprintf(`dproc-cluster-test-%s-net`, rnd) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDataprocClusterDestroy(t), Steps: []resource.TestStep{ { @@ -729,10 +729,10 @@ func TestAccDataprocCluster_withEndpointConfig(t *testing.T) { t.Parallel() var cluster dataproc.Cluster - rnd := RandString(t, 10) - VcrTest(t, resource.TestCase{ + rnd := acctest.RandString(t, 10) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDataprocClusterDestroy(t), Steps: []resource.TestStep{ { @@ -749,7 +749,7 @@ func TestAccDataprocCluster_withEndpointConfig(t *testing.T) { func TestAccDataprocCluster_KMS(t *testing.T) { t.Parallel() - rnd := RandString(t, 10) + rnd := acctest.RandString(t, 10) kms := acctest.BootstrapKMSKey(t) if acctest.BootstrapPSARole(t, "service-", "compute-system", "roles/cloudkms.cryptoKeyEncrypterDecrypter") { @@ -757,9 +757,9 @@ func TestAccDataprocCluster_KMS(t *testing.T) { } var cluster dataproc.Cluster - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDataprocClusterDestroy(t), Steps: []resource.TestStep{ { @@ -775,13 +775,13 @@ func TestAccDataprocCluster_KMS(t *testing.T) { func TestAccDataprocCluster_withKerberos(t *testing.T) { t.Parallel() - rnd := RandString(t, 10) + rnd := acctest.RandString(t, 10) kms := acctest.BootstrapKMSKey(t) var cluster dataproc.Cluster - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDataprocClusterDestroy(t), Steps: []resource.TestStep{ { @@ -797,12 +797,12 @@ func TestAccDataprocCluster_withKerberos(t *testing.T) { func TestAccDataprocCluster_withAutoscalingPolicy(t *testing.T) { t.Parallel() - rnd := RandString(t, 10) + rnd := acctest.RandString(t, 10) var cluster dataproc.Cluster - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDataprocClusterDestroy(t), Steps: []resource.TestStep{ { @@ -827,16 +827,16 @@ func TestAccDataprocCluster_withMetastoreConfig(t *testing.T) { t.Parallel() pid := envvar.GetTestProjectFromEnv() - basicServiceId := "tf-test-metastore-srv-" + RandString(t, 10) - updateServiceId := "tf-test-metastore-srv-update-" + RandString(t, 10) + basicServiceId := "tf-test-metastore-srv-" + acctest.RandString(t, 10) + updateServiceId := "tf-test-metastore-srv-update-" + acctest.RandString(t, 10) msName_basic := fmt.Sprintf("projects/%s/locations/us-central1/services/%s", pid, basicServiceId) msName_update := fmt.Sprintf("projects/%s/locations/us-central1/services/%s", pid, updateServiceId) var cluster dataproc.Cluster - clusterName := "tf-test-" + RandString(t, 10) - VcrTest(t, resource.TestCase{ + clusterName := "tf-test-" + acctest.RandString(t, 10) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDataprocClusterDestroy(t), Steps: []resource.TestStep{ { @@ -861,7 +861,7 @@ func TestAccDataprocCluster_withMetastoreConfig(t *testing.T) { func testAccCheckDataprocClusterDestroy(t *testing.T) resource.TestCheckFunc { return func(s *terraform.State) error { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) for _, rs := range s.RootModule().Resources { if rs.Type != "google_dataproc_cluster" { @@ -938,7 +938,7 @@ func validateBucketExists(bucket string, config *transport_tpg.Config) (bool, er func testAccCheckDataprocStagingBucketExists(t *testing.T, bucketName string) resource.TestCheckFunc { return func(s *terraform.State) error { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) exists, err := validateBucketExists(bucketName, config) if err != nil { @@ -954,7 +954,7 @@ func testAccCheckDataprocStagingBucketExists(t *testing.T, bucketName string) re func testAccCheckDataprocTempBucketExists(t *testing.T, bucketName string) resource.TestCheckFunc { return func(s *terraform.State) error { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) exists, err := validateBucketExists(bucketName, config) if err != nil { @@ -983,7 +983,7 @@ func testAccCheckDataprocClusterInitActionSucceeded(t *testing.T, bucket, object // The init script will have created an object in the specified bucket. // Ensure it exists return func(s *terraform.State) error { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) _, err := config.NewStorageClient(config.UserAgent).Objects.Get(bucket, object).Do() if err != nil { return fmt.Errorf("Unable to verify init action success: Error reading object %s in bucket %s: %v", object, bucket, err) @@ -1060,7 +1060,7 @@ func testAccCheckDataprocClusterExists(t *testing.T, n string, cluster *dataproc return fmt.Errorf("No ID is set for Dataproc cluster") } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) project, err := acctest.GetTestProject(rs.Primary, config) if err != nil { return err diff --git a/mmv1/third_party/terraform/tests/resource_dataproc_job_iam_test.go b/mmv1/third_party/terraform/tests/resource_dataproc_job_iam_test.go index 7f3ac559dafc..596fe7a37774 100644 --- a/mmv1/third_party/terraform/tests/resource_dataproc_job_iam_test.go +++ b/mmv1/third_party/terraform/tests/resource_dataproc_job_iam_test.go @@ -12,17 +12,17 @@ import ( func TestAccDataprocJobIamBinding(t *testing.T) { t.Parallel() - cluster := "tf-dataproc-iam-cluster" + RandString(t, 10) - job := "tf-dataproc-iam-job-" + RandString(t, 10) - account := "tf-dataproc-iam-" + RandString(t, 10) + cluster := "tf-dataproc-iam-cluster" + acctest.RandString(t, 10) + job := "tf-dataproc-iam-job-" + acctest.RandString(t, 10) + account := "tf-dataproc-iam-" + acctest.RandString(t, 10) role := "roles/editor" importId := fmt.Sprintf("projects/%s/regions/%s/jobs/%s %s", envvar.GetTestProjectFromEnv(), "us-central1", job, role) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { // Test IAM Binding creation @@ -51,9 +51,9 @@ func TestAccDataprocJobIamBinding(t *testing.T) { func TestAccDataprocJobIamMember(t *testing.T) { t.Parallel() - cluster := "tf-dataproc-iam-cluster" + RandString(t, 10) - job := "tf-dataproc-iam-jobid-" + RandString(t, 10) - account := "tf-dataproc-iam-" + RandString(t, 10) + cluster := "tf-dataproc-iam-cluster" + acctest.RandString(t, 10) + job := "tf-dataproc-iam-jobid-" + acctest.RandString(t, 10) + account := "tf-dataproc-iam-" + acctest.RandString(t, 10) role := "roles/editor" importId := fmt.Sprintf("projects/%s/regions/%s/jobs/%s %s serviceAccount:%s", @@ -63,9 +63,9 @@ func TestAccDataprocJobIamMember(t *testing.T) { role, serviceAccountCanonicalEmail(account)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { // Test IAM Binding creation @@ -84,17 +84,17 @@ func TestAccDataprocJobIamMember(t *testing.T) { func TestAccDataprocJobIamPolicy(t *testing.T) { t.Parallel() - cluster := "tf-dataproc-iam-cluster" + RandString(t, 10) - job := "tf-dataproc-iam-jobid-" + RandString(t, 10) - account := "tf-dataproc-iam-" + RandString(t, 10) + cluster := "tf-dataproc-iam-cluster" + acctest.RandString(t, 10) + job := "tf-dataproc-iam-jobid-" + acctest.RandString(t, 10) + account := "tf-dataproc-iam-" + acctest.RandString(t, 10) role := "roles/editor" importId := fmt.Sprintf("projects/%s/regions/%s/jobs/%s", envvar.GetTestProjectFromEnv(), "us-central1", job) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { // Test IAM Binding creation diff --git a/mmv1/third_party/terraform/tests/resource_dataproc_job_test.go.erb b/mmv1/third_party/terraform/tests/resource_dataproc_job_test.go.erb index 9939064b435e..f9ec11a17a3f 100644 --- a/mmv1/third_party/terraform/tests/resource_dataproc_job_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_dataproc_job_test.go.erb @@ -29,9 +29,9 @@ type jobTestField struct { // func TestAccDataprocJob_failForMissingJobConfig(t *testing.T) { // t.Parallel() -// VcrTest(t, resource.TestCase{ +// acctest.VcrTest(t, resource.TestCase{ // PreCheck: func() { acctest.AccTestPreCheck(t) }, -// ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), +// ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), // CheckDestroy: testAccCheckDataprocJobDestroyProducer(t), // Steps: []resource.TestStep{ // { @@ -46,11 +46,11 @@ func TestAccDataprocJob_updatable(t *testing.T) { t.Parallel() var job dataproc.Job - rnd := RandString(t, 10) + rnd := acctest.RandString(t, 10) jobId := fmt.Sprintf("dproc-update-job-id-%s", rnd) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDataprocJobDestroyProducer(t), Steps: []resource.TestStep{ { @@ -75,11 +75,11 @@ func TestAccDataprocJob_PySpark(t *testing.T) { t.Parallel() var job dataproc.Job - rnd := RandString(t, 10) + rnd := acctest.RandString(t, 10) jobId := fmt.Sprintf("dproc-custom-job-id-%s", rnd) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDataprocJobDestroyProducer(t), Steps: []resource.TestStep{ { @@ -114,10 +114,10 @@ func TestAccDataprocJob_Spark(t *testing.T) { t.Parallel() var job dataproc.Job - rnd := RandString(t, 10) - VcrTest(t, resource.TestCase{ + rnd := acctest.RandString(t, 10) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDataprocJobDestroyProducer(t), Steps: []resource.TestStep{ { @@ -146,10 +146,10 @@ func TestAccDataprocJob_Hadoop(t *testing.T) { t.Parallel() var job dataproc.Job - rnd := RandString(t, 10) - VcrTest(t, resource.TestCase{ + rnd := acctest.RandString(t, 10) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDataprocJobDestroyProducer(t), Steps: []resource.TestStep{ { @@ -178,10 +178,10 @@ func TestAccDataprocJob_Hive(t *testing.T) { t.Parallel() var job dataproc.Job - rnd := RandString(t, 10) - VcrTest(t, resource.TestCase{ + rnd := acctest.RandString(t, 10) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDataprocJobDestroyProducer(t), Steps: []resource.TestStep{ { @@ -210,10 +210,10 @@ func TestAccDataprocJob_Pig(t *testing.T) { t.Parallel() var job dataproc.Job - rnd := RandString(t, 10) - VcrTest(t, resource.TestCase{ + rnd := acctest.RandString(t, 10) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDataprocJobDestroyProducer(t), Steps: []resource.TestStep{ { @@ -242,10 +242,10 @@ func TestAccDataprocJob_SparkSql(t *testing.T) { t.Parallel() var job dataproc.Job - rnd := RandString(t, 10) - VcrTest(t, resource.TestCase{ + rnd := acctest.RandString(t, 10) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDataprocJobDestroyProducer(t), Steps: []resource.TestStep{ { @@ -274,10 +274,10 @@ func TestAccDataprocJob_Presto(t *testing.T) { t.Parallel() var job dataproc.Job - rnd := RandString(t, 10) - VcrTest(t, resource.TestCase{ + rnd := acctest.RandString(t, 10) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDataprocJobDestroyProducer(t), Steps: []resource.TestStep{ { @@ -304,7 +304,7 @@ func TestAccDataprocJob_Presto(t *testing.T) { func testAccCheckDataprocJobDestroyProducer(t *testing.T) func(s *terraform.State) error { return func(s *terraform.State) error { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) for _, rs := range s.RootModule().Resources { if rs.Type != "google_dataproc_job" { @@ -342,7 +342,7 @@ func testAccCheckDataprocJobDestroyProducer(t *testing.T) func(s *terraform.Stat func testAccCheckDataprocJobCompletesSuccessfully(t *testing.T, n string, job *dataproc.Job) resource.TestCheckFunc { return func(s *terraform.State) error { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) attributes := s.RootModule().Resources[n].Primary.Attributes region := attributes["region"] @@ -407,7 +407,7 @@ func testAccCheckDataprocJobExists(t *testing.T, n string, job *dataproc.Job) re return fmt.Errorf("No ID is set for Dataproc job") } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) parts := strings.Split(s.RootModule().Resources[n].Primary.ID, "/") jobId := parts[len(parts)-1] project, err := acctest.GetTestProject(s.RootModule().Resources[n].Primary, config) diff --git a/mmv1/third_party/terraform/tests/resource_dataproc_metastore_service_test.go.erb b/mmv1/third_party/terraform/tests/resource_dataproc_metastore_service_test.go.erb index 6b5c92d679b6..2143fe230ef4 100644 --- a/mmv1/third_party/terraform/tests/resource_dataproc_metastore_service_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_dataproc_metastore_service_test.go.erb @@ -12,12 +12,12 @@ import ( func TestAccDataprocMetastoreService_updateAndImport(t *testing.T) { t.Parallel() - name := "tf-test-metastore-" + RandString(t, 10) + name := "tf-test-metastore-" + acctest.RandString(t, 10) tier := [2]string{"DEVELOPER", "ENTERPRISE"} - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckBigqueryReservationReservationDestroyProducer(t), Steps: []resource.TestStep{ { @@ -59,12 +59,12 @@ func TestAccDataprocMetastoreService_PrivateServiceConnect(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDataprocMetastoreServiceDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_dataproc_workflow_template_test.go.erb b/mmv1/third_party/terraform/tests/resource_dataproc_workflow_template_test.go.erb index 1ad98ab8890e..a277266a01a4 100644 --- a/mmv1/third_party/terraform/tests/resource_dataproc_workflow_template_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_dataproc_workflow_template_test.go.erb @@ -18,14 +18,14 @@ func TestAccDataprocWorkflowTemplate_basic(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), "project": envvar.GetTestProjectFromEnv(), "version": "2.0.35-debian10", } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: funcAccTestDataprocWorkflowTemplateCheckDestroy(t), ExternalProviders: map[string]resource.ExternalProvider{ "random": {}, @@ -47,14 +47,14 @@ func TestAccDataprocWorkflowTemplate_withShieldedVMs(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), "project": envvar.GetTestProjectFromEnv(), "version": "2.0.35-debian10", } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: funcAccTestDataprocWorkflowTemplateCheckDestroy(t), ExternalProviders: map[string]resource.ExternalProvider{ "random": {}, @@ -199,7 +199,7 @@ func funcAccTestDataprocWorkflowTemplateCheckDestroy(t *testing.T) func(s *terra continue } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{DataprocBasePath}}projects/{{project}}/locations/{{location}}/workflowTemplates/{{name}}") if err != nil { diff --git a/mmv1/third_party/terraform/tests/resource_datastream_connection_profile_test.go b/mmv1/third_party/terraform/tests/resource_datastream_connection_profile_test.go index 73ef3a76921d..a3405c458550 100644 --- a/mmv1/third_party/terraform/tests/resource_datastream_connection_profile_test.go +++ b/mmv1/third_party/terraform/tests/resource_datastream_connection_profile_test.go @@ -13,12 +13,12 @@ func TestAccDatastreamConnectionProfile_update(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), ExternalProviders: map[string]resource.ExternalProvider{ "random": {}, }, diff --git a/mmv1/third_party/terraform/tests/resource_datastream_stream_test.go b/mmv1/third_party/terraform/tests/resource_datastream_stream_test.go index 0b4f9435957d..803ca02e94e9 100644 --- a/mmv1/third_party/terraform/tests/resource_datastream_stream_test.go +++ b/mmv1/third_party/terraform/tests/resource_datastream_stream_test.go @@ -13,13 +13,13 @@ func TestAccDatastreamStream_update(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), "deletion_protection": false, } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), ExternalProviders: map[string]resource.ExternalProvider{ "random": {}, }, diff --git a/mmv1/third_party/terraform/tests/resource_deployment_manager_deployment_test.go b/mmv1/third_party/terraform/tests/resource_deployment_manager_deployment_test.go index 65cdcb6dd9c5..7745d7f06780 100644 --- a/mmv1/third_party/terraform/tests/resource_deployment_manager_deployment_test.go +++ b/mmv1/third_party/terraform/tests/resource_deployment_manager_deployment_test.go @@ -19,16 +19,16 @@ import ( func TestAccDeploymentManagerDeployment_basicFile(t *testing.T) { t.Parallel() - randSuffix := RandString(t, 10) + randSuffix := acctest.RandString(t, 10) deploymentId := "tf-dm-" + randSuffix accountId := "tf-dm-account-" + randSuffix yamlPath := createYamlConfigFileForTest(t, "test-fixtures/deploymentmanager/service_account.yml.tmpl", map[string]interface{}{ "account_id": accountId, }) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: resource.ComposeTestCheckFunc( testAccCheckDeploymentManagerDeploymentDestroyProducer(t), testDeploymentManagerDeploymentVerifyServiceAccountMissing(t, accountId)), @@ -49,13 +49,13 @@ func TestAccDeploymentManagerDeployment_basicFile(t *testing.T) { func TestAccDeploymentManagerDeployment_deleteInvalidOnCreate(t *testing.T) { t.Parallel() - randStr := RandString(t, 10) + randStr := acctest.RandString(t, 10) deploymentName := "tf-dm-" + randStr accountId := "tf-dm-" + randStr - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDeploymentManagerDestroyInvalidDeployment(t, deploymentName), Steps: []resource.TestStep{ { @@ -69,13 +69,13 @@ func TestAccDeploymentManagerDeployment_deleteInvalidOnCreate(t *testing.T) { func TestAccDeploymentManagerDeployment_createDeletePolicy(t *testing.T) { t.Parallel() - randStr := RandString(t, 10) + randStr := acctest.RandString(t, 10) deploymentName := "tf-dm-" + randStr accountId := "tf-dm-" + randStr - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDeploymentManagerDeploymentDestroyProducer(t), Steps: []resource.TestStep{ { @@ -94,16 +94,16 @@ func TestAccDeploymentManagerDeployment_createDeletePolicy(t *testing.T) { func TestAccDeploymentManagerDeployment_imports(t *testing.T) { t.Parallel() - randStr := RandString(t, 10) + randStr := acctest.RandString(t, 10) deploymentName := "tf-dm-" + randStr accountId := "tf-dm-" + randStr importFilepath := createYamlConfigFileForTest(t, "test-fixtures/deploymentmanager/service_account.yml.tmpl", map[string]interface{}{ "account_id": "{{ env['name'] }}", }) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: resource.ComposeTestCheckFunc( testAccCheckDeploymentManagerDeploymentDestroyProducer(t), testDeploymentManagerDeploymentVerifyServiceAccountMissing(t, accountId)), @@ -125,14 +125,14 @@ func TestAccDeploymentManagerDeployment_imports(t *testing.T) { func TestAccDeploymentManagerDeployment_update(t *testing.T) { t.Parallel() - randStr := RandString(t, 10) + randStr := acctest.RandString(t, 10) deploymentName := "tf-dm-" + randStr accountId := "tf-dm-first" + randStr accountId2 := "tf-dm-second" + randStr - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: resource.ComposeTestCheckFunc( testAccCheckDeploymentManagerDeploymentDestroyProducer(t), testDeploymentManagerDeploymentVerifyServiceAccountMissing(t, accountId)), @@ -357,7 +357,7 @@ EOF func testDeploymentManagerDeploymentVerifyServiceAccountMissing(t *testing.T, accountId string) resource.TestCheckFunc { return func(s *terraform.State) error { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) exists, err := testCheckDeploymentServiceAccountExists(accountId, config) if err != nil { return err @@ -371,7 +371,7 @@ func testDeploymentManagerDeploymentVerifyServiceAccountMissing(t *testing.T, ac func testDeploymentManagerDeploymentVerifyServiceAccountExists(t *testing.T, accountId string) resource.TestCheckFunc { return func(s *terraform.State) error { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) exists, err := testCheckDeploymentServiceAccountExists(accountId, config) if err != nil { return err @@ -403,7 +403,7 @@ func testAccCheckDeploymentManagerDestroyInvalidDeployment(t *testing.T, deploym } } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) url := fmt.Sprintf("%sprojects/%s/global/deployments/%s", config.DeploymentManagerBasePath, envvar.GetTestProjectFromEnv(), deploymentName) _, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ Config: config, @@ -431,7 +431,7 @@ func testAccCheckDeploymentManagerDeploymentDestroyProducer(t *testing.T) func(s continue } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{DeploymentManagerBasePath}}projects/{{project}}/global/deployments/{{name}}") if err != nil { diff --git a/mmv1/third_party/terraform/tests/resource_dialogflow_agent_test.go.erb b/mmv1/third_party/terraform/tests/resource_dialogflow_agent_test.go.erb index 7ec827873edd..4303142fd9c0 100644 --- a/mmv1/third_party/terraform/tests/resource_dialogflow_agent_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_dialogflow_agent_test.go.erb @@ -15,12 +15,12 @@ func TestAccDialogflowAgent_update(t *testing.T) { context := map[string]interface{}{ "org_id": envvar.GetTestOrgFromEnv(t), "billing_account": envvar.GetTestBillingAccountFromEnv(t), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccDialogflowAgent_full1(context), diff --git a/mmv1/third_party/terraform/tests/resource_dialogflow_entity_type_test.go.erb b/mmv1/third_party/terraform/tests/resource_dialogflow_entity_type_test.go.erb index ef687be216bd..83be3a594e66 100644 --- a/mmv1/third_party/terraform/tests/resource_dialogflow_entity_type_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_dialogflow_entity_type_test.go.erb @@ -16,12 +16,12 @@ func TestAccDialogflowEntityType_update(t *testing.T) { context := map[string]interface{}{ "org_id": envvar.GetTestOrgFromEnv(t), "billing_account": envvar.GetTestBillingAccountFromEnv(t), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccDialogflowEntityType_full1(context), diff --git a/mmv1/third_party/terraform/tests/resource_dialogflow_fulfillment_test.go.erb b/mmv1/third_party/terraform/tests/resource_dialogflow_fulfillment_test.go.erb index ce651bc48ab8..f37701a23e2e 100644 --- a/mmv1/third_party/terraform/tests/resource_dialogflow_fulfillment_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_dialogflow_fulfillment_test.go.erb @@ -16,12 +16,12 @@ func TestAccDialogflowFulfillment_update(t *testing.T) { context := map[string]interface{}{ "org_id": envvar.GetTestOrgFromEnv(t), "billing_account": envvar.GetTestBillingAccountFromEnv(t), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccDialogflowFulfillment_basic(context), diff --git a/mmv1/third_party/terraform/tests/resource_dialogflow_intent_test.go.erb b/mmv1/third_party/terraform/tests/resource_dialogflow_intent_test.go.erb index c65cb59705d1..c39d1c6b9ab1 100644 --- a/mmv1/third_party/terraform/tests/resource_dialogflow_intent_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_dialogflow_intent_test.go.erb @@ -16,12 +16,12 @@ func TestAccDialogflowIntent_basic(t *testing.T) { context := map[string]interface{}{ "org_id": envvar.GetTestOrgFromEnv(t), "billing_account": envvar.GetTestBillingAccountFromEnv(t), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccDialogflowIntent_basic(context), @@ -41,12 +41,12 @@ func TestAccDialogflowIntent_update(t *testing.T) { context := map[string]interface{}{ "org_id": envvar.GetTestOrgFromEnv(t), "billing_account": envvar.GetTestBillingAccountFromEnv(t), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccDialogflowIntent_full1(context), diff --git a/mmv1/third_party/terraform/tests/resource_dialogflowcx_agent_test.go.erb b/mmv1/third_party/terraform/tests/resource_dialogflowcx_agent_test.go.erb index ccd9fbbfc340..4fd5bf9b29e2 100644 --- a/mmv1/third_party/terraform/tests/resource_dialogflowcx_agent_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_dialogflowcx_agent_test.go.erb @@ -16,12 +16,12 @@ func TestAccDialogflowCXAgent_update(t *testing.T) { context := map[string]interface{}{ "org_id": envvar.GetTestOrgFromEnv(t), "billing_account": envvar.GetTestBillingAccountFromEnv(t), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccDialogflowCXAgent_basic(context), diff --git a/mmv1/third_party/terraform/tests/resource_dialogflowcx_entity_type_test.go b/mmv1/third_party/terraform/tests/resource_dialogflowcx_entity_type_test.go index 1d527fd8945a..d9d717fd8ddd 100644 --- a/mmv1/third_party/terraform/tests/resource_dialogflowcx_entity_type_test.go +++ b/mmv1/third_party/terraform/tests/resource_dialogflowcx_entity_type_test.go @@ -14,12 +14,12 @@ func TestAccDialogflowCXEntityType_update(t *testing.T) { context := map[string]interface{}{ "org_id": envvar.GetTestOrgFromEnv(t), "billing_account": envvar.GetTestBillingAccountFromEnv(t), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccDialogflowCXEntityType_basic(context), diff --git a/mmv1/third_party/terraform/tests/resource_dialogflowcx_environment_test.go b/mmv1/third_party/terraform/tests/resource_dialogflowcx_environment_test.go index c15601c238c2..ff26e7f24619 100644 --- a/mmv1/third_party/terraform/tests/resource_dialogflowcx_environment_test.go +++ b/mmv1/third_party/terraform/tests/resource_dialogflowcx_environment_test.go @@ -20,12 +20,12 @@ func TestAccDialogflowCXEnvironment_update(t *testing.T) { context := map[string]interface{}{ "org_id": envvar.GetTestOrgFromEnv(t), "billing_account": envvar.GetTestBillingAccountFromEnv(t), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccDialogflowCXEnvironment_basic(context), @@ -139,12 +139,12 @@ func TestAccDialogflowCXEnvironment_dialogflowcxEnvironmentFullExample(t *testin t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDialogflowCXEnvironmentDestroyProducer(t), Steps: []resource.TestStep{ { @@ -198,12 +198,12 @@ func TestAccDialogflowCXEnvironment_dialogflowcxEnvironmentRegional(t *testing.T t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDialogflowCXEnvironmentDestroyProducer(t), Steps: []resource.TestStep{ { @@ -261,7 +261,7 @@ func testAccCheckDialogflowCXEnvironmentDestroyProducer(t *testing.T) func(s *te continue } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{DialogflowCXBasePath}}{{parent}}/environments/{{name}}") if err != nil { diff --git a/mmv1/third_party/terraform/tests/resource_dialogflowcx_flow_test.go b/mmv1/third_party/terraform/tests/resource_dialogflowcx_flow_test.go index d6560031659b..a17d5daf807f 100644 --- a/mmv1/third_party/terraform/tests/resource_dialogflowcx_flow_test.go +++ b/mmv1/third_party/terraform/tests/resource_dialogflowcx_flow_test.go @@ -14,12 +14,12 @@ func TestAccDialogflowCXFlow_update(t *testing.T) { context := map[string]interface{}{ "org_id": envvar.GetTestOrgFromEnv(t), "billing_account": envvar.GetTestBillingAccountFromEnv(t), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccDialogflowCXFlow_basic(context), diff --git a/mmv1/third_party/terraform/tests/resource_dialogflowcx_intent_test.go b/mmv1/third_party/terraform/tests/resource_dialogflowcx_intent_test.go index be2cdda865d8..40962fab7143 100644 --- a/mmv1/third_party/terraform/tests/resource_dialogflowcx_intent_test.go +++ b/mmv1/third_party/terraform/tests/resource_dialogflowcx_intent_test.go @@ -14,12 +14,12 @@ func TestAccDialogflowCXIntent_update(t *testing.T) { context := map[string]interface{}{ "org_id": envvar.GetTestOrgFromEnv(t), "billing_account": envvar.GetTestBillingAccountFromEnv(t), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccDialogflowCXIntent_basic(context), diff --git a/mmv1/third_party/terraform/tests/resource_dialogflowcx_page_test.go b/mmv1/third_party/terraform/tests/resource_dialogflowcx_page_test.go index d4ddea2574d8..37c27f722e2a 100644 --- a/mmv1/third_party/terraform/tests/resource_dialogflowcx_page_test.go +++ b/mmv1/third_party/terraform/tests/resource_dialogflowcx_page_test.go @@ -14,12 +14,12 @@ func TestAccDialogflowCXPage_update(t *testing.T) { context := map[string]interface{}{ "org_id": envvar.GetTestOrgFromEnv(t), "billing_account": envvar.GetTestBillingAccountFromEnv(t), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccDialogflowCXPage_basic(context), diff --git a/mmv1/third_party/terraform/tests/resource_dialogflowcx_version_test.go.erb b/mmv1/third_party/terraform/tests/resource_dialogflowcx_version_test.go.erb index 5b30684dd91a..0a2fdd341f8d 100644 --- a/mmv1/third_party/terraform/tests/resource_dialogflowcx_version_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_dialogflowcx_version_test.go.erb @@ -20,12 +20,12 @@ func TestAccDialogflowCXVersion_update(t *testing.T) { context := map[string]interface{}{ "org_id": envvar.GetTestOrgFromEnv(t), "billing_account": envvar.GetTestBillingAccountFromEnv(t), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccDialogflowCXVersion_basic(context), @@ -121,12 +121,12 @@ func TestAccDialogflowCXVersion_dialogflowcxVersionFullExample(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDialogflowCXVersionDestroyProducer(t), Steps: []resource.TestStep{ { @@ -178,7 +178,7 @@ func testAccCheckDialogflowCXVersionDestroyProducer(t *testing.T) func(s *terraf continue } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{DialogflowCXBasePath}}{{parent}}/versions/{{name}}") if err != nil { diff --git a/mmv1/third_party/terraform/tests/resource_dialogflowcx_webhook_test.go b/mmv1/third_party/terraform/tests/resource_dialogflowcx_webhook_test.go index 56d1538b6c6e..8ea3fad304e4 100644 --- a/mmv1/third_party/terraform/tests/resource_dialogflowcx_webhook_test.go +++ b/mmv1/third_party/terraform/tests/resource_dialogflowcx_webhook_test.go @@ -14,12 +14,12 @@ func TestAccDialogflowCXWebhook_update(t *testing.T) { context := map[string]interface{}{ "org_id": envvar.GetTestOrgFromEnv(t), "billing_account": envvar.GetTestBillingAccountFromEnv(t), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccDialogflowCXWebhook_basic(context), diff --git a/mmv1/third_party/terraform/tests/resource_dns_managed_zone_test.go.erb b/mmv1/third_party/terraform/tests/resource_dns_managed_zone_test.go.erb index 375abad10db9..e63d51d9d6ef 100644 --- a/mmv1/third_party/terraform/tests/resource_dns_managed_zone_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_dns_managed_zone_test.go.erb @@ -18,11 +18,11 @@ import ( func TestAccDNSManagedZone_update(t *testing.T) { t.Parallel() - zoneSuffix := RandString(t, 10) + zoneSuffix := acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDNSManagedZoneDestroyProducer(t), Steps: []resource.TestStep{ { @@ -48,11 +48,11 @@ func TestAccDNSManagedZone_update(t *testing.T) { func TestAccDNSManagedZone_privateUpdate(t *testing.T) { t.Parallel() - zoneSuffix := RandString(t, 10) + zoneSuffix := acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDNSManagedZoneDestroyProducer(t), Steps: []resource.TestStep{ resource.TestStep{ @@ -78,11 +78,11 @@ func TestAccDNSManagedZone_privateUpdate(t *testing.T) { func TestAccDNSManagedZone_dnssec_update(t *testing.T) { t.Parallel() - zoneSuffix := RandString(t, 10) + zoneSuffix := acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDNSManagedZoneDestroyProducer(t), Steps: []resource.TestStep{ resource.TestStep{ @@ -108,11 +108,11 @@ func TestAccDNSManagedZone_dnssec_update(t *testing.T) { func TestAccDNSManagedZone_dnssec_empty(t *testing.T) { t.Parallel() - zoneSuffix := RandString(t, 10) + zoneSuffix := acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDNSManagedZoneDestroyProducer(t), Steps: []resource.TestStep{ resource.TestStep{ @@ -130,11 +130,11 @@ func TestAccDNSManagedZone_dnssec_empty(t *testing.T) { func TestAccDNSManagedZone_privateForwardingUpdate(t *testing.T) { t.Parallel() - zoneSuffix := RandString(t, 10) + zoneSuffix := acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDNSManagedZoneDestroyProducer(t), Steps: []resource.TestStep{ resource.TestStep{ @@ -160,11 +160,11 @@ func TestAccDNSManagedZone_privateForwardingUpdate(t *testing.T) { func TestAccDNSManagedZone_cloudLoggingConfigUpdate(t *testing.T) { t.Parallel() - zoneSuffix := RandString(t, 10) + zoneSuffix := acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDNSManagedZoneDestroyProducer(t), Steps: []resource.TestStep{ { @@ -199,11 +199,11 @@ func TestAccDNSManagedZone_cloudLoggingConfigUpdate(t *testing.T) { func TestAccDNSManagedZone_reverseLookup(t *testing.T) { t.Parallel() - zoneSuffix := RandString(t, 10) + zoneSuffix := acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDNSManagedZoneDestroyProducer(t), Steps: []resource.TestStep{ resource.TestStep{ @@ -222,12 +222,12 @@ func TestAccDNSManagedZone_reverseLookup(t *testing.T) { func TestAccDNSManagedZone_forceDestroy(t *testing.T) { //t.Parallel() - zoneSuffix := RandString(t, 10) + zoneSuffix := acctest.RandString(t, 10) project := envvar.GetTestProjectFromEnv() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDNSManagedZoneDestroyProducer(t), Steps: []resource.TestStep{ { @@ -242,7 +242,7 @@ func TestAccDNSManagedZone_forceDestroy(t *testing.T) { func testAccCheckManagedZoneCreateRRs(t *testing.T, zoneSuffix string, project string) resource.TestCheckFunc { return func(s *terraform.State) error { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) zone := fmt.Sprintf("mzone-test-%s", zoneSuffix) // Build the change chg := &dns.Change{ @@ -626,12 +626,12 @@ func TestDnsManagedZoneImport_parseImportId(t *testing.T) { func TestAccDNSManagedZone_importWithProject(t *testing.T) { t.Parallel() - zoneSuffix := RandString(t, 10) + zoneSuffix := acctest.RandString(t, 10) project := envvar.GetTestProjectFromEnv() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDNSManagedZoneDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_dns_policy_test.go.erb b/mmv1/third_party/terraform/tests/resource_dns_policy_test.go.erb index 8c5f90e878c6..32c8d4fe9d58 100644 --- a/mmv1/third_party/terraform/tests/resource_dns_policy_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_dns_policy_test.go.erb @@ -12,11 +12,11 @@ import ( func TestAccDNSPolicy_update(t *testing.T) { t.Parallel() - policySuffix := RandString(t, 10) + policySuffix := acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDNSPolicyDestroyProducer(t), Steps: []resource.TestStep{ resource.TestStep{ diff --git a/mmv1/third_party/terraform/tests/resource_dns_record_set_test.go.erb b/mmv1/third_party/terraform/tests/resource_dns_record_set_test.go.erb index 22396dd0b424..9ae9afa73acb 100644 --- a/mmv1/third_party/terraform/tests/resource_dns_record_set_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_dns_record_set_test.go.erb @@ -64,10 +64,10 @@ func TestIpv6AddressDiffSuppress(t *testing.T) { func TestAccDNSRecordSet_basic(t *testing.T) { t.Parallel() - zoneName := fmt.Sprintf("dnszone-test-%s", RandString(t, 10)) - VcrTest(t, resource.TestCase{ + zoneName := fmt.Sprintf("dnszone-test-%s", acctest.RandString(t, 10)) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDnsRecordSetDestroyProducer(t), Steps: []resource.TestStep{ { @@ -93,10 +93,10 @@ func TestAccDNSRecordSet_basic(t *testing.T) { func TestAccDNSRecordSet_Update(t *testing.T) { t.Parallel() - zoneName := fmt.Sprintf("dnszone-test-%s", RandString(t, 10)) - VcrTest(t, resource.TestCase{ + zoneName := fmt.Sprintf("dnszone-test-%s", acctest.RandString(t, 10)) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDnsRecordSetDestroyProducer(t), Steps: []resource.TestStep{ { @@ -133,10 +133,10 @@ func TestAccDNSRecordSet_Update(t *testing.T) { func TestAccDNSRecordSet_changeType(t *testing.T) { t.Parallel() - zoneName := fmt.Sprintf("dnszone-test-%s", RandString(t, 10)) - VcrTest(t, resource.TestCase{ + zoneName := fmt.Sprintf("dnszone-test-%s", acctest.RandString(t, 10)) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDnsRecordSetDestroyProducer(t), Steps: []resource.TestStep{ { @@ -164,11 +164,11 @@ func TestAccDNSRecordSet_changeType(t *testing.T) { func TestAccDNSRecordSet_nestedNS(t *testing.T) { t.Parallel() - zoneName := fmt.Sprintf("dnszone-test-ns-%s", RandString(t, 10)) + zoneName := fmt.Sprintf("dnszone-test-ns-%s", acctest.RandString(t, 10)) recordSetName := fmt.Sprintf("\"nested.%s.hashicorptest.com.\"", zoneName) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDnsRecordSetDestroyProducer(t), Steps: []resource.TestStep{ { @@ -187,11 +187,11 @@ func TestAccDNSRecordSet_nestedNS(t *testing.T) { func TestAccDNSRecordSet_secondaryNS(t *testing.T) { t.Parallel() - zoneName := fmt.Sprintf("dnszone-test-ns-%s", RandString(t, 10)) + zoneName := fmt.Sprintf("dnszone-test-ns-%s", acctest.RandString(t, 10)) recordSetName := "google_dns_managed_zone.parent-zone.dns_name" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDnsRecordSetDestroyProducer(t), Steps: []resource.TestStep{ { @@ -210,10 +210,10 @@ func TestAccDNSRecordSet_secondaryNS(t *testing.T) { func TestAccDNSRecordSet_quotedTXT(t *testing.T) { t.Parallel() - zoneName := fmt.Sprintf("dnszone-test-txt-%s", RandString(t, 10)) - VcrTest(t, resource.TestCase{ + zoneName := fmt.Sprintf("dnszone-test-txt-%s", acctest.RandString(t, 10)) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDnsRecordSetDestroyProducer(t), Steps: []resource.TestStep{ { @@ -232,10 +232,10 @@ func TestAccDNSRecordSet_quotedTXT(t *testing.T) { func TestAccDNSRecordSet_uppercaseMX(t *testing.T) { t.Parallel() - zoneName := fmt.Sprintf("dnszone-test-txt-%s", RandString(t, 10)) - VcrTest(t, resource.TestCase{ + zoneName := fmt.Sprintf("dnszone-test-txt-%s", acctest.RandString(t, 10)) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDnsRecordSetDestroyProducer(t), Steps: []resource.TestStep{ { @@ -254,17 +254,17 @@ func TestAccDNSRecordSet_uppercaseMX(t *testing.T) { func TestAccDNSRecordSet_routingPolicy(t *testing.T) { t.Parallel() - networkName := fmt.Sprintf("tf-test-network-%s", RandString(t, 10)) - proxySubnetName := fmt.Sprintf("tf-test-proxy-subnet-%s", RandString(t, 10)) - httpHealthCheckName := fmt.Sprintf("tf-test-http-health-check-%s", RandString(t, 10)) - backendName := fmt.Sprintf("tf-test-backend-%s", RandString(t, 10)) - urlMapName := fmt.Sprintf("tf-test-url-map-%s", RandString(t, 10)) - httpProxyName := fmt.Sprintf("tf-test-http-proxy-%s", RandString(t, 10)) - forwardingRuleName := fmt.Sprintf("tf-test-forwarding-rule-%s", RandString(t, 10)) - zoneName := fmt.Sprintf("dnszone-test-%s", RandString(t, 10)) - VcrTest(t, resource.TestCase{ + networkName := fmt.Sprintf("tf-test-network-%s", acctest.RandString(t, 10)) + proxySubnetName := fmt.Sprintf("tf-test-proxy-subnet-%s", acctest.RandString(t, 10)) + httpHealthCheckName := fmt.Sprintf("tf-test-http-health-check-%s", acctest.RandString(t, 10)) + backendName := fmt.Sprintf("tf-test-backend-%s", acctest.RandString(t, 10)) + urlMapName := fmt.Sprintf("tf-test-url-map-%s", acctest.RandString(t, 10)) + httpProxyName := fmt.Sprintf("tf-test-http-proxy-%s", acctest.RandString(t, 10)) + forwardingRuleName := fmt.Sprintf("tf-test-forwarding-rule-%s", acctest.RandString(t, 10)) + zoneName := fmt.Sprintf("dnszone-test-%s", acctest.RandString(t, 10)) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDnsRecordSetDestroyProducer(t), Steps: []resource.TestStep{ { @@ -310,10 +310,10 @@ func TestAccDNSRecordSet_routingPolicy(t *testing.T) { func TestAccDNSRecordSet_changeRouting(t *testing.T) { t.Parallel() - zoneName := fmt.Sprintf("dnszone-test-%s", RandString(t, 10)) - VcrTest(t, resource.TestCase{ + zoneName := fmt.Sprintf("dnszone-test-%s", acctest.RandString(t, 10)) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDnsRecordSetDestroyProducer(t), Steps: []resource.TestStep{ { @@ -342,10 +342,10 @@ func TestAccDNSRecordSet_changeRouting(t *testing.T) { func TestAccDNSRecordSet_interpolated(t *testing.T) { t.Parallel() - zoneName := fmt.Sprintf("dnszone-test-%s", RandString(t, 10)) - VcrTest(t, resource.TestCase{ + zoneName := fmt.Sprintf("dnszone-test-%s", acctest.RandString(t, 10)) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDnsRecordSetDestroyProducer(t), Steps: []resource.TestStep{ { @@ -373,7 +373,7 @@ func testAccCheckDnsRecordSetDestroyProducer(t *testing.T) func(s *terraform.Sta continue } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{DNSBasePath}}projects/{{project}}/managedZones/{{managed_zone}}/rrsets/{{name}}/{{type}}") if err != nil { diff --git a/mmv1/third_party/terraform/tests/resource_dns_response_policy_rule_test.go.erb b/mmv1/third_party/terraform/tests/resource_dns_response_policy_rule_test.go.erb index 132d962ba993..7c6da6fd9410 100644 --- a/mmv1/third_party/terraform/tests/resource_dns_response_policy_rule_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_dns_response_policy_rule_test.go.erb @@ -13,11 +13,11 @@ import ( func TestAccDNSResponsePolicyRule_update(t *testing.T) { t.Parallel() - responsePolicyRuleSuffix := RandString(t, 10) + responsePolicyRuleSuffix := acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderBetaFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), CheckDestroy: testAccCheckDNSResponsePolicyRuleDestroyProducer(t), Steps: []resource.TestStep{ resource.TestStep{ @@ -43,11 +43,11 @@ func TestAccDNSResponsePolicyRule_update(t *testing.T) { func TestAccDNSResponsePolicyRuleBehavior_update(t *testing.T) { t.Parallel() - responsePolicyRuleSuffix := RandString(t, 10) + responsePolicyRuleSuffix := acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderBetaFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), CheckDestroy: testAccCheckDNSResponsePolicyRuleDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_dns_response_policy_test.go.erb b/mmv1/third_party/terraform/tests/resource_dns_response_policy_test.go.erb index 1e74272dce0c..567ee6b0a5b7 100644 --- a/mmv1/third_party/terraform/tests/resource_dns_response_policy_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_dns_response_policy_test.go.erb @@ -13,11 +13,11 @@ import ( func TestAccDNSResponsePolicy_update(t *testing.T) { t.Parallel() - responsePolicySuffix := RandString(t, 10) + responsePolicySuffix := acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderBetaFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), CheckDestroy: testAccCheckDNSResponsePolicyDestroyProducer(t), Steps: []resource.TestStep{ resource.TestStep{ diff --git a/mmv1/third_party/terraform/tests/resource_endpoints_service_test.go b/mmv1/third_party/terraform/tests/resource_endpoints_service_test.go index ec18e99312df..0a70df6cb840 100644 --- a/mmv1/third_party/terraform/tests/resource_endpoints_service_test.go +++ b/mmv1/third_party/terraform/tests/resource_endpoints_service_test.go @@ -18,12 +18,12 @@ func TestAccEndpointsService_basic(t *testing.T) { // Uses random provider acctest.SkipIfVcr(t) t.Parallel() - serviceId := "tf-test" + RandString(t, 10) + serviceId := "tf-test" + acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, CheckDestroy: testAccCheckEndpointServiceDestroyProducer(t), - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccEndpointsService_basic(serviceId, envvar.GetTestProjectFromEnv(), "1"), @@ -43,11 +43,11 @@ func TestAccEndpointsService_basic(t *testing.T) { func TestAccEndpointsService_grpc(t *testing.T) { t.Parallel() - serviceId := "tf-test" + RandString(t, 10) + serviceId := "tf-test" + acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckEndpointServiceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -131,7 +131,7 @@ EOF func testAccCheckEndpointExistsByName(t *testing.T, serviceId string) resource.TestCheckFunc { return func(s *terraform.State) error { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) service, err := config.NewServiceManClient(config.UserAgent).Services.GetConfig( fmt.Sprintf("%s.endpoints.%s.cloud.goog", serviceId, config.Project)).Do() if err != nil { @@ -147,7 +147,7 @@ func testAccCheckEndpointExistsByName(t *testing.T, serviceId string) resource.T func testAccCheckEndpointServiceDestroyProducer(t *testing.T) func(s *terraform.State) error { return func(s *terraform.State) error { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) for name, rs := range s.RootModule().Resources { if strings.HasPrefix(name, "data.") { diff --git a/mmv1/third_party/terraform/tests/resource_essential_contacts_contact_test.go b/mmv1/third_party/terraform/tests/resource_essential_contacts_contact_test.go index 4dec08c3dc2d..b1b6dd3aa06b 100644 --- a/mmv1/third_party/terraform/tests/resource_essential_contacts_contact_test.go +++ b/mmv1/third_party/terraform/tests/resource_essential_contacts_contact_test.go @@ -11,12 +11,12 @@ func TestAccEssentialContactsContact_update(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckEssentialContactsContactDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_eventarc_channel_test.go.erb b/mmv1/third_party/terraform/tests/resource_eventarc_channel_test.go.erb index d6db6b1a945e..fc0c07745be0 100644 --- a/mmv1/third_party/terraform/tests/resource_eventarc_channel_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_eventarc_channel_test.go.erb @@ -24,12 +24,12 @@ func TestAccEventarcChannel_basic(t *testing.T) { context := map[string]interface{}{ "region": envvar.GetTestRegionFromEnv(), "project_name": envvar.GetTestProjectFromEnv(), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckEventarcChannelDestroyProducer(t), Steps: []resource.TestStep{ { @@ -57,12 +57,12 @@ func TestAccEventarcChannel_cryptoKeyUpdate(t *testing.T) { "key_ring": tpgresource.GetResourceNameFromSelfLink(key1.KeyRing.Name), "key1": tpgresource.GetResourceNameFromSelfLink(key1.CryptoKey.Name), "key2": tpgresource.GetResourceNameFromSelfLink(key2.CryptoKey.Name), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckEventarcChannelDestroyProducer(t), Steps: []resource.TestStep{ { @@ -176,7 +176,7 @@ func testAccCheckEventarcChannelDestroyProducer(t *testing.T) func(s *terraform. continue } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) billingProject := "" if config.BillingProject != "" { diff --git a/mmv1/third_party/terraform/tests/resource_eventarc_google_channel_config_test.go.erb b/mmv1/third_party/terraform/tests/resource_eventarc_google_channel_config_test.go.erb index 3b498fa4b5f7..98713fee80d6 100644 --- a/mmv1/third_party/terraform/tests/resource_eventarc_google_channel_config_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_eventarc_google_channel_config_test.go.erb @@ -24,12 +24,12 @@ func TestAccEventarcGoogleChannelConfig_basic(t *testing.T) { context := map[string]interface{}{ "project_name": envvar.GetTestProjectFromEnv(), "region": envvar.GetTestRegionFromEnv(), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckEventarcGoogleChannelConfigDestroyProducer(t), Steps: []resource.TestStep{ { @@ -54,15 +54,15 @@ func TestAccEventarcGoogleChannelConfig_cryptoKeyUpdate(t *testing.T) { context := map[string]interface{}{ "project_name": envvar.GetTestProjectFromEnv(), "region": envvar.GetTestRegionFromEnv(), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), "key_ring": tpgresource.GetResourceNameFromSelfLink(key1.KeyRing.Name), "key1": tpgresource.GetResourceNameFromSelfLink(key1.CryptoKey.Name), "key2": tpgresource.GetResourceNameFromSelfLink(key2.CryptoKey.Name), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckEventarcGoogleChannelConfigDestroyProducer(t), Steps: []resource.TestStep{ { @@ -181,7 +181,7 @@ func testAccCheckEventarcGoogleChannelConfigDestroyProducer(t *testing.T) func(s continue } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) billingProject := "" if config.BillingProject != "" { diff --git a/mmv1/third_party/terraform/tests/resource_eventarc_trigger_test.go.erb b/mmv1/third_party/terraform/tests/resource_eventarc_trigger_test.go.erb index 30ccf20c634e..53a856f49570 100644 --- a/mmv1/third_party/terraform/tests/resource_eventarc_trigger_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_eventarc_trigger_test.go.erb @@ -33,12 +33,12 @@ func TestAccEventarcTrigger_channel(t *testing.T) { "key_ring": tpgresource.GetResourceNameFromSelfLink(key1.KeyRing.Name), "key1": tpgresource.GetResourceNameFromSelfLink(key1.CryptoKey.Name), "key2": tpgresource.GetResourceNameFromSelfLink(key2.CryptoKey.Name), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckEventarcChannelTriggerDestroyProducer(t), Steps: []resource.TestStep{ { @@ -144,7 +144,7 @@ func testAccCheckEventarcChannelTriggerDestroyProducer(t *testing.T) func(s *ter continue } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) billingProject := "" if config.BillingProject != "" { diff --git a/mmv1/third_party/terraform/tests/resource_filestore_backup_test.go b/mmv1/third_party/terraform/tests/resource_filestore_backup_test.go index c008c1e9438c..3d845262b539 100644 --- a/mmv1/third_party/terraform/tests/resource_filestore_backup_test.go +++ b/mmv1/third_party/terraform/tests/resource_filestore_backup_test.go @@ -11,12 +11,12 @@ import ( func TestAccFilestoreBackup_update(t *testing.T) { t.Parallel() - instName := fmt.Sprintf("tf-fs-inst-%d", RandInt(t)) - bkupName := fmt.Sprintf("tf-fs-bkup-%d", RandInt(t)) + instName := fmt.Sprintf("tf-fs-inst-%d", acctest.RandInt(t)) + bkupName := fmt.Sprintf("tf-fs-bkup-%d", acctest.RandInt(t)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckFilestoreBackupDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_filestore_instance_test.go b/mmv1/third_party/terraform/tests/resource_filestore_instance_test.go index ffbfe3e787b6..b18b0b49ec7f 100644 --- a/mmv1/third_party/terraform/tests/resource_filestore_instance_test.go +++ b/mmv1/third_party/terraform/tests/resource_filestore_instance_test.go @@ -42,11 +42,11 @@ func TestFilestoreInstanceStateUpgradeV0(t *testing.T) { func TestAccFilestoreInstance_update(t *testing.T) { t.Parallel() - name := fmt.Sprintf("tf-test-%d", RandInt(t)) + name := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckFilestoreInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -120,11 +120,11 @@ resource "google_filestore_instance" "instance" { func TestAccFilestoreInstance_reservedIpRange_update(t *testing.T) { t.Parallel() - name := fmt.Sprintf("tf-test-%d", RandInt(t)) + name := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckFilestoreInstanceDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_firebase_android_app_update_test.go.erb b/mmv1/third_party/terraform/tests/resource_firebase_android_app_update_test.go.erb index 71bcddcdf475..a1b9415b19fd 100644 --- a/mmv1/third_party/terraform/tests/resource_firebase_android_app_update_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_firebase_android_app_update_test.go.erb @@ -14,13 +14,13 @@ func TestAccFirebaseAndroidApp_update(t *testing.T) { t.Parallel() context := map[string]interface{}{ "project_id": envvar.GetTestProjectFromEnv(), - "package_name": "android.package.app" + RandString(t, 4), - "random_suffix": RandString(t, 10), + "package_name": "android.package.app" + acctest.RandString(t, 4), + "random_suffix": acctest.RandString(t, 10), "display_name": "tf-test Display Name N", } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderBetaFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), Steps: []resource.TestStep{ { Config: testAccFirebaseAndroidApp(context, ""), diff --git a/mmv1/third_party/terraform/tests/resource_firebase_apple_app_update_test.go.erb b/mmv1/third_party/terraform/tests/resource_firebase_apple_app_update_test.go.erb index 7ca6453d193a..0a13e1fa88a2 100644 --- a/mmv1/third_party/terraform/tests/resource_firebase_apple_app_update_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_firebase_apple_app_update_test.go.erb @@ -15,12 +15,12 @@ func TestAccFirebaseAppleApp_update(t *testing.T) { context := map[string]interface{}{ "project_id": envvar.GetTestProjectFromEnv(), "bundle_id": "apple.app.12345", - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), "display_name": "tf-test Display Name N", } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderBetaFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), Steps: []resource.TestStep{ { Config: testAccFirebaseAppleApp(context, 12345, "1"), diff --git a/mmv1/third_party/terraform/tests/resource_firebase_database_instance_test.go.erb b/mmv1/third_party/terraform/tests/resource_firebase_database_instance_test.go.erb index 7277e26b1a0e..eac6faab3d49 100644 --- a/mmv1/third_party/terraform/tests/resource_firebase_database_instance_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_firebase_database_instance_test.go.erb @@ -29,12 +29,12 @@ func TestAccFirebaseDatabaseInstance_firebaseDatabaseInstanceStateChange(t *test context := map[string]interface{}{ "project_id": envvar.GetTestProjectFromEnv(), "region": envvar.GetTestRegionFromEnv(), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderBetaFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), CheckDestroy: testAccCheckFirebaseDatabaseInstanceDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_firebase_extensions_instance_test.go.erb b/mmv1/third_party/terraform/tests/resource_firebase_extensions_instance_test.go.erb index 7c96841eaac8..1975c4d2677f 100644 --- a/mmv1/third_party/terraform/tests/resource_firebase_extensions_instance_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_firebase_extensions_instance_test.go.erb @@ -16,12 +16,12 @@ func TestAccFirebaseExtensionsInstance_firebaseExtentionsInstanceResizeImageUpda context := map[string]interface{}{ "project_id": acctest.GetTestProjectFromEnv(), "location": "us-central1", - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderBetaFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), CheckDestroy: testAccCheckFirebaseExtensionsInstanceDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_firebase_hosting_channel_test.go.erb b/mmv1/third_party/terraform/tests/resource_firebase_hosting_channel_test.go.erb index 291557296c9f..f63a62422393 100644 --- a/mmv1/third_party/terraform/tests/resource_firebase_hosting_channel_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_firebase_hosting_channel_test.go.erb @@ -15,12 +15,12 @@ func TestAccFirebaseHostingChannel_firebasehostingChannelUpdate(t *testing.T) { context := map[string]interface{}{ "project_id": envvar.GetTestProjectFromEnv(), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderBetaFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), CheckDestroy: testAccCheckFirebaseHostingChannelDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_firebase_hosting_site_test.go.erb b/mmv1/third_party/terraform/tests/resource_firebase_hosting_site_test.go.erb index df603604f294..6647c063e5f4 100644 --- a/mmv1/third_party/terraform/tests/resource_firebase_hosting_site_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_firebase_hosting_site_test.go.erb @@ -15,13 +15,13 @@ func TestAccFirebaseHostingSite_firebasehostingSiteUpdate(t *testing.T) { context := map[string]interface{}{ "project_id": envvar.GetTestProjectFromEnv(), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), "site_id": "tf-test-site-update-app", } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderBetaFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), CheckDestroy: testAccCheckFirebaseHostingSiteDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_firebase_project_test.go.erb b/mmv1/third_party/terraform/tests/resource_firebase_project_test.go.erb index 3dc2ccacca15..bd73c4c773fc 100644 --- a/mmv1/third_party/terraform/tests/resource_firebase_project_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_firebase_project_test.go.erb @@ -15,12 +15,12 @@ func TestAccFirebaseProject_destroyAndReapply(t *testing.T) { context := map[string]interface{}{ "org_id": envvar.GetTestOrgFromEnv(t), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderBetaFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), Steps: []resource.TestStep{ { Config: testAccFirebaseProject_firebaseProjectBasicExample(context), diff --git a/mmv1/third_party/terraform/tests/resource_firebase_web_app_test.go.erb b/mmv1/third_party/terraform/tests/resource_firebase_web_app_test.go.erb index 0ad5f19978dc..68ffd72efcd4 100644 --- a/mmv1/third_party/terraform/tests/resource_firebase_web_app_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_firebase_web_app_test.go.erb @@ -23,11 +23,11 @@ func TestAccFirebaseWebApp_firebaseWebAppFull(t *testing.T) { context := map[string]interface{}{ "org_id": envvar.GetTestOrgFromEnv(t), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), "display_name": "tf-test Display Name N", } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, Steps: []resource.TestStep{ { @@ -54,11 +54,11 @@ func TestAccFirebaseWebApp_firebaseWebAppFull(t *testing.T) { ), }, { - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Config: testAccFirebaseWebApp_firebaseWebAppFull(context, ""), }, { - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Config: testAccFirebaseWebApp_firebaseWebAppFull(context, "2"), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttrSet("data.google_firebase_web_app_config.default", "api_key"), @@ -109,13 +109,13 @@ func TestAccFirebaseWebApp_firebaseWebAppSkipDelete(t *testing.T) { context := map[string]interface{}{ "project_id": envvar.GetTestProjectFromEnv(), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), "display_name": "tf-test Display Name N", } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderBetaFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), CheckDestroy: testAccCheckFirebaseWebAppNotDestroyedProducer(t), Steps: []resource.TestStep{ { @@ -151,7 +151,7 @@ func testAccCheckFirebaseWebAppNotDestroyedProducer(t *testing.T) func(s *terraf continue } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{FirebaseBasePath}}{{name}}") if err != nil { diff --git a/mmv1/third_party/terraform/tests/resource_firestore_database_update_test.go.erb b/mmv1/third_party/terraform/tests/resource_firestore_database_update_test.go.erb index 258ab43740b6..9c756fed6b70 100644 --- a/mmv1/third_party/terraform/tests/resource_firestore_database_update_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_firestore_database_update_test.go.erb @@ -14,11 +14,11 @@ func TestAccFirestoreDatabase_update(t *testing.T) { t.Parallel() orgId := envvar.GetTestOrgFromEnv(t) - randomSuffix := RandString(t, 10) + randomSuffix := acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), ExternalProviders: map[string]resource.ExternalProvider{ "time": {}, }, diff --git a/mmv1/third_party/terraform/tests/resource_firestore_document_test.go b/mmv1/third_party/terraform/tests/resource_firestore_document_test.go index b9ecac49d45b..9541f042ea5a 100644 --- a/mmv1/third_party/terraform/tests/resource_firestore_document_test.go +++ b/mmv1/third_party/terraform/tests/resource_firestore_document_test.go @@ -12,12 +12,12 @@ import ( func TestAccFirestoreDocument_update(t *testing.T) { t.Parallel() - name := fmt.Sprintf("tf-test-%d", RandInt(t)) + name := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) project := envvar.GetTestFirestoreProjectFromEnv(t) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccFirestoreDocument_update(project, name), diff --git a/mmv1/third_party/terraform/tests/resource_firestore_field_test.go b/mmv1/third_party/terraform/tests/resource_firestore_field_test.go index 0552b321a738..4a008c0a3861 100644 --- a/mmv1/third_party/terraform/tests/resource_firestore_field_test.go +++ b/mmv1/third_party/terraform/tests/resource_firestore_field_test.go @@ -13,7 +13,7 @@ func TestAccFirestoreField_firestoreFieldUpdateAddIndexExample(t *testing.T) { context := map[string]interface{}{ "project_id": GetTestFirestoreProjectFromEnv(t), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), "resource_name": "add_index", } testAccFirestoreField_runUpdateTest(testAccFirestoreField_firestoreFieldUpdateAddIndexExample(context), t, context) @@ -24,7 +24,7 @@ func TestAccFirestoreField_firestoreFieldUpdateAddTTLExample(t *testing.T) { context := map[string]interface{}{ "project_id": GetTestFirestoreProjectFromEnv(t), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), "resource_name": "add_ttl", } testAccFirestoreField_runUpdateTest(testAccFirestoreField_firestoreFieldUpdateAddTTLExample(context), t, context) @@ -33,9 +33,9 @@ func TestAccFirestoreField_firestoreFieldUpdateAddTTLExample(t *testing.T) { func testAccFirestoreField_runUpdateTest(updateConfig string, t *testing.T, context map[string]interface{}) { resourceName := context["resource_name"].(string) - VcrTest(t, resource.TestCase{ - PreCheck: func() { AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + acctest.VcrTest(t, resource.TestCase{ + PreCheck: func() { acctest.AccTestPreCheck(t) }, + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckFirestoreFieldDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_gke_backup_backup_plan_test.go.erb b/mmv1/third_party/terraform/tests/resource_gke_backup_backup_plan_test.go.erb index 6bed9b39f6bf..1a0e13075643 100644 --- a/mmv1/third_party/terraform/tests/resource_gke_backup_backup_plan_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_gke_backup_backup_plan_test.go.erb @@ -15,12 +15,12 @@ func TestAccGKEBackupBackupPlan_update(t *testing.T) { context := map[string]interface{}{ "project": envvar.GetTestProjectFromEnv(), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckGKEBackupBackupPlanDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_gke_hub_feature_iam_test.go.erb b/mmv1/third_party/terraform/tests/resource_gke_hub_feature_iam_test.go.erb index 8e3c4f1429fa..0d18c0a6bcb7 100644 --- a/mmv1/third_party/terraform/tests/resource_gke_hub_feature_iam_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_gke_hub_feature_iam_test.go.erb @@ -17,16 +17,16 @@ func TestAccGKEHub2FeatureIamBindingGenerated(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), "role": "roles/viewer", - "project_id": fmt.Sprintf("tf-test-gkehub-%s", RandString(t, 10)), + "project_id": fmt.Sprintf("tf-test-gkehub-%s", acctest.RandString(t, 10)), "org_id": envvar.GetTestOrgFromEnv(t), "billing_account": envvar.GetTestBillingAccountFromEnv(t), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccGKEHub2FeatureIamBinding_basicGenerated(context), @@ -57,16 +57,16 @@ func TestAccGKEHub2FeatureIamMemberGenerated(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), "role": "roles/viewer", - "project_id": fmt.Sprintf("tf-test-gkehub-%s", RandString(t, 10)), + "project_id": fmt.Sprintf("tf-test-gkehub-%s", acctest.RandString(t, 10)), "org_id": envvar.GetTestOrgFromEnv(t), "billing_account": envvar.GetTestBillingAccountFromEnv(t), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { // Test Iam Member creation (no update for member, no need to test) @@ -88,16 +88,16 @@ func TestAccGKEHub2FeatureIamPolicyGenerated(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), "role": "roles/viewer", - "project_id": fmt.Sprintf("tf-test-gkehub-%s", RandString(t, 10)), + "project_id": fmt.Sprintf("tf-test-gkehub-%s", acctest.RandString(t, 10)), "org_id": envvar.GetTestOrgFromEnv(t), "billing_account": envvar.GetTestBillingAccountFromEnv(t), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccGKEHub2FeatureIamPolicy_basicGenerated(context), diff --git a/mmv1/third_party/terraform/tests/resource_gke_hub_feature_membership_test.go.erb b/mmv1/third_party/terraform/tests/resource_gke_hub_feature_membership_test.go.erb index 16b1c7583fd4..ce640740961e 100644 --- a/mmv1/third_party/terraform/tests/resource_gke_hub_feature_membership_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_gke_hub_feature_membership_test.go.erb @@ -23,14 +23,14 @@ func TestAccGKEHubFeatureMembership_gkehubFeatureAcmUpdate(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), "org_id": envvar.GetTestOrgFromEnv(t), "billing_account": envvar.GetTestBillingAccountFromEnv(t), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderBetaFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), CheckDestroy: testAccCheckGKEHubFeatureDestroyProducer(t), Steps: []resource.TestStep{ { @@ -333,14 +333,14 @@ func TestAccGKEHubFeatureMembership_gkehubFeatureAcmAllFields(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), "org_id": envvar.GetTestOrgFromEnv(t), "billing_account": envvar.GetTestBillingAccountFromEnv(t), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderBetaFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), CheckDestroy: testAccCheckGKEHubFeatureDestroyProducer(t), Steps: []resource.TestStep{ { @@ -592,14 +592,14 @@ func TestAccGKEHubFeatureMembership_gkehubFeatureAcmOci(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), "org_id": envvar.GetTestOrgFromEnv(t), "billing_account": envvar.GetTestBillingAccountFromEnv(t), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderBetaFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), CheckDestroy: testAccCheckGKEHubFeatureDestroyProducer(t), Steps: []resource.TestStep{ { @@ -790,14 +790,14 @@ func TestAccGKEHubFeatureMembership_gkehubFeatureMesh(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), "org_id": envvar.GetTestOrgFromEnv(t), "billing_account": envvar.GetTestBillingAccountFromEnv(t), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderBetaFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), CheckDestroy: testAccCheckGKEHubFeatureDestroyProducer(t), Steps: []resource.TestStep{ { @@ -1126,7 +1126,7 @@ resource "google_gke_hub_membership" "membership_acmoci" { func testAccCheckGkeHubFeatureMembershipPresent(t *testing.T, project, location, feature, membership string) resource.TestCheckFunc { return func(s *terraform.State) error { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) obj := &gkehub.FeatureMembership{ Feature: dcl.StringOrNil(feature), Location: dcl.StringOrNil(location), @@ -1144,7 +1144,7 @@ func testAccCheckGkeHubFeatureMembershipPresent(t *testing.T, project, location, func testAccCheckGkeHubFeatureMembershipNotPresent(t *testing.T, project, location, feature, membership string) resource.TestCheckFunc { return func(s *terraform.State) error { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) obj := &gkehub.FeatureMembership{ Feature: dcl.StringOrNil(feature), Location: dcl.StringOrNil(location), diff --git a/mmv1/third_party/terraform/tests/resource_gke_hub_feature_test.go.erb b/mmv1/third_party/terraform/tests/resource_gke_hub_feature_test.go.erb index 0f46636124b2..9628305e5725 100644 --- a/mmv1/third_party/terraform/tests/resource_gke_hub_feature_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_gke_hub_feature_test.go.erb @@ -22,14 +22,14 @@ func TestAccGKEHubFeature_gkehubFeatureFleetObservability(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), "org_id": envvar.GetTestOrgFromEnv(t), "billing_account": envvar.GetTestBillingAccountFromEnv(t), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderBetaFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), CheckDestroy: testAccCheckGKEHubFeatureDestroyProducer(t), ExternalProviders: map[string]resource.ExternalProvider{ "time": {}, @@ -208,14 +208,14 @@ func TestAccGKEHubFeature_gkehubFeatureMciUpdate(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), "org_id": envvar.GetTestOrgFromEnv(t), "billing_account": envvar.GetTestBillingAccountFromEnv(t), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckGKEHubFeatureDestroyProducer(t), Steps: []resource.TestStep{ { @@ -352,14 +352,14 @@ func TestAccGKEHubFeature_gkehubFeatureMcsd(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), "org_id": envvar.GetTestOrgFromEnv(t), "billing_account": envvar.GetTestBillingAccountFromEnv(t), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckGKEHubFeatureDestroyProducer(t), Steps: []resource.TestStep{ { @@ -471,7 +471,7 @@ func testAccCheckGKEHubFeatureDestroyProducer(t *testing.T) func(s *terraform.St continue } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{GKEHub2BasePath}}projects/{{project}}/locations/{{location}}/features/{{name}}") if err != nil { diff --git a/mmv1/third_party/terraform/tests/resource_gkeonprem_bare_metal_cluster_test.go.erb b/mmv1/third_party/terraform/tests/resource_gkeonprem_bare_metal_cluster_test.go.erb index ed02f04db2ba..d1b698a35b1a 100644 --- a/mmv1/third_party/terraform/tests/resource_gkeonprem_bare_metal_cluster_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_gkeonprem_bare_metal_cluster_test.go.erb @@ -13,9 +13,9 @@ func TestAccGkeonpremBareMetalCluster_bareMetalClusterUpdateBasic(t *testing.T) context := map[string]interface{}{} - VcrTest(t, resource.TestCase{ - PreCheck: func() { AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderBetaFactories(t), + acctest.VcrTest(t, resource.TestCase{ + PreCheck: func() { acctest.AccTestPreCheck(t) }, + ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), CheckDestroy: testAccCheckGkeonpremBareMetalClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -43,9 +43,9 @@ func TestAccGkeonpremBareMetalCluster_bareMetalClusterUpdateManualLb(t *testing. context := map[string]interface{}{} - VcrTest(t, resource.TestCase{ - PreCheck: func() { AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderBetaFactories(t), + acctest.VcrTest(t, resource.TestCase{ + PreCheck: func() { acctest.AccTestPreCheck(t) }, + ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), CheckDestroy: testAccCheckGkeonpremBareMetalClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -73,9 +73,9 @@ func TestAccGkeonpremBareMetalCluster_bareMetalClusterUpdateBgpLb(t *testing.T) context := map[string]interface{}{} - VcrTest(t, resource.TestCase{ - PreCheck: func() { AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderBetaFactories(t), + acctest.VcrTest(t, resource.TestCase{ + PreCheck: func() { acctest.AccTestPreCheck(t) }, + ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), CheckDestroy: testAccCheckGkeonpremBareMetalClusterDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_gkeonprem_bare_metal_node_pool_test.go.erb b/mmv1/third_party/terraform/tests/resource_gkeonprem_bare_metal_node_pool_test.go.erb index 9fd598d5dbe7..d1fd9db4f115 100644 --- a/mmv1/third_party/terraform/tests/resource_gkeonprem_bare_metal_node_pool_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_gkeonprem_bare_metal_node_pool_test.go.erb @@ -13,9 +13,9 @@ func TestAccGkeonpremBareMetalNodePool_bareMetalNodePoolUpdate(t *testing.T) { context := map[string]interface{}{} - VcrTest(t, resource.TestCase{ - PreCheck: func() { AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderBetaFactories(t), + acctest.VcrTest(t, resource.TestCase{ + PreCheck: func() { acctest.AccTestPreCheck(t) }, + ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), CheckDestroy: testAccCheckGkeonpremBareMetalNodePoolDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_gkeonprem_vmware_cluster_test.go.erb b/mmv1/third_party/terraform/tests/resource_gkeonprem_vmware_cluster_test.go.erb index 2265f100daca..32cd17719b56 100644 --- a/mmv1/third_party/terraform/tests/resource_gkeonprem_vmware_cluster_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_gkeonprem_vmware_cluster_test.go.erb @@ -13,9 +13,9 @@ func TestAccGkeonpremVmwareCluster_vmwareClusterUpdateBasic(t *testing.T) { context := map[string]interface{}{} - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderBetaFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), CheckDestroy: testAccCheckGkeonpremVmwareClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -43,9 +43,9 @@ func TestAccGkeonpremVmwareCluster_vmwareClusterUpdateF5Lb(t *testing.T) { context := map[string]interface{}{} - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderBetaFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), CheckDestroy: testAccCheckGkeonpremVmwareClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -75,9 +75,9 @@ func TestAccGkeonpremVmwareCluster_vmwareClusterUpdateManualLb(t *testing.T) { context := map[string]interface{}{} - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderBetaFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), CheckDestroy: testAccCheckGkeonpremVmwareClusterDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_gkeonprem_vmware_node_pool_test.go.erb b/mmv1/third_party/terraform/tests/resource_gkeonprem_vmware_node_pool_test.go.erb index abbee1c46e35..cc111f01c9a2 100644 --- a/mmv1/third_party/terraform/tests/resource_gkeonprem_vmware_node_pool_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_gkeonprem_vmware_node_pool_test.go.erb @@ -13,9 +13,9 @@ func TestAccGkeonpremVmwareNodePool_vmwareNodePoolUpdate(t *testing.T) { context := map[string]interface{}{} - VcrTest(t, resource.TestCase{ - PreCheck: func() { AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderBetaFactories(t), + acctest.VcrTest(t, resource.TestCase{ + PreCheck: func() { acctest.AccTestPreCheck(t) }, + ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), CheckDestroy: testAccCheckGkeonpremVmwareNodePoolDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_google_billing_account_iam_test.go b/mmv1/third_party/terraform/tests/resource_google_billing_account_iam_test.go index f96b97b4f26a..174837ea712a 100644 --- a/mmv1/third_party/terraform/tests/resource_google_billing_account_iam_test.go +++ b/mmv1/third_party/terraform/tests/resource_google_billing_account_iam_test.go @@ -19,11 +19,11 @@ func TestAccBillingAccountIam(t *testing.T) { t.Parallel() billing := envvar.GetTestMasterBillingAccountFromEnv(t) - account := fmt.Sprintf("tf-test-%d", RandInt(t)) + account := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) role := "roles/billing.viewer" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { // Test Iam Binding creation @@ -82,7 +82,7 @@ func testAccCheckGoogleBillingAccountIamBindingExists(t *testing.T, bindingResou return fmt.Errorf("Not found: %s", bindingResourceName) } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) p, err := config.NewBillingClient(config.UserAgent).BillingAccounts.GetIamPolicy("billingAccounts/" + bindingRs.Primary.Attributes["billing_account_id"]).Do() if err != nil { return err @@ -112,7 +112,7 @@ func testAccCheckGoogleBillingAccountIamMemberExists(t *testing.T, n, role, memb return fmt.Errorf("Not found: %s", n) } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) p, err := config.NewBillingClient(config.UserAgent).BillingAccounts.GetIamPolicy("billingAccounts/" + rs.Primary.Attributes["billing_account_id"]).Do() if err != nil { return err diff --git a/mmv1/third_party/terraform/tests/resource_google_billing_subaccount_test.go b/mmv1/third_party/terraform/tests/resource_google_billing_subaccount_test.go index ae1fd8142370..aa3cc37ac281 100644 --- a/mmv1/third_party/terraform/tests/resource_google_billing_subaccount_test.go +++ b/mmv1/third_party/terraform/tests/resource_google_billing_subaccount_test.go @@ -19,7 +19,7 @@ func TestAccBillingSubaccount_renameOnDestroy(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckGoogleBillingSubaccountRenameOnDestroy(t), Steps: []resource.TestStep{ { @@ -37,7 +37,7 @@ func TestAccBillingSubaccount_basic(t *testing.T) { masterBilling := envvar.GetTestMasterBillingAccountFromEnv(t) resource.Test(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { // Test Billing Subaccount creation @@ -100,7 +100,7 @@ func testAccCheckGoogleBillingSubaccountExists(t *testing.T, bindingResourceName return fmt.Errorf("Not found: %s", bindingResourceName) } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) _, err := config.NewBillingClient(config.UserAgent).BillingAccounts.Get(subaccount.Primary.ID).Do() if err != nil { return err @@ -120,7 +120,7 @@ func testAccCheckGoogleBillingSubaccountRenameOnDestroy(t *testing.T) func(s *te continue } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) res, err := config.NewBillingClient(config.UserAgent).BillingAccounts.Get(rs.Primary.ID).Do() if err != nil { diff --git a/mmv1/third_party/terraform/tests/resource_google_folder_iam_audit_config_test.go b/mmv1/third_party/terraform/tests/resource_google_folder_iam_audit_config_test.go index a7d633415a78..807d105976b6 100644 --- a/mmv1/third_party/terraform/tests/resource_google_folder_iam_audit_config_test.go +++ b/mmv1/third_party/terraform/tests/resource_google_folder_iam_audit_config_test.go @@ -16,11 +16,11 @@ func TestAccFolderIamAuditConfig_basic(t *testing.T) { t.Parallel() org := envvar.GetTestOrgFromEnv(t) - fname := "tf-test-" + RandString(t, 10) + fname := "tf-test-" + acctest.RandString(t, 10) service := "cloudkms.googleapis.com" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ // Create a new folder { @@ -44,13 +44,13 @@ func TestAccFolderIamAuditConfig_multiple(t *testing.T) { t.Parallel() org := envvar.GetTestOrgFromEnv(t) - fname := "tf-test-" + RandString(t, 10) + fname := "tf-test-" + acctest.RandString(t, 10) service := "cloudkms.googleapis.com" service2 := "cloudsql.googleapis.com" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ // Create a new folder { @@ -78,13 +78,13 @@ func TestAccFolderIamAuditConfig_multipleAtOnce(t *testing.T) { t.Parallel() org := envvar.GetTestOrgFromEnv(t) - fname := "tf-test-" + RandString(t, 10) + fname := "tf-test-" + acctest.RandString(t, 10) service := "cloudkms.googleapis.com" service2 := "cloudsql.googleapis.com" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ // Create a new folder { @@ -106,12 +106,12 @@ func TestAccFolderIamAuditConfig_update(t *testing.T) { t.Parallel() org := envvar.GetTestOrgFromEnv(t) - fname := "tf-test-" + RandString(t, 10) + fname := "tf-test-" + acctest.RandString(t, 10) service := "cloudkms.googleapis.com" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ // Create a new folder { @@ -143,13 +143,13 @@ func TestAccFolderIamAuditConfig_remove(t *testing.T) { t.Parallel() org := envvar.GetTestOrgFromEnv(t) - fname := "tf-test-" + RandString(t, 10) + fname := "tf-test-" + acctest.RandString(t, 10) service := "cloudkms.googleapis.com" service2 := "cloudsql.googleapis.com" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ // Create a new folder { @@ -178,14 +178,14 @@ func TestAccFolderIamAuditConfig_addFirstExemptMember(t *testing.T) { t.Parallel() org := envvar.GetTestOrgFromEnv(t) - fname := "tf-test-" + RandString(t, 10) + fname := "tf-test-" + acctest.RandString(t, 10) service := "cloudkms.googleapis.com" members := []string{} members2 := []string{"user:gterraformtest1@gmail.com"} - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ // Create a new folder { @@ -211,14 +211,14 @@ func TestAccFolderIamAuditConfig_removeLastExemptMember(t *testing.T) { t.Parallel() org := envvar.GetTestOrgFromEnv(t) - fname := "tf-test-" + RandString(t, 10) + fname := "tf-test-" + acctest.RandString(t, 10) service := "cloudkms.googleapis.com" members2 := []string{} members := []string{"user:gterraformtest1@gmail.com"} - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ // Create a new folder { @@ -244,14 +244,14 @@ func TestAccFolderIamAuditConfig_updateNoExemptMembers(t *testing.T) { t.Parallel() org := envvar.GetTestOrgFromEnv(t) - fname := "tf-test-" + RandString(t, 10) + fname := "tf-test-" + acctest.RandString(t, 10) logType := "DATA_READ" logType2 := "DATA_WRITE" service := "cloudkms.googleapis.com" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ // Create a new folder { diff --git a/mmv1/third_party/terraform/tests/resource_google_folder_iam_binding_test.go b/mmv1/third_party/terraform/tests/resource_google_folder_iam_binding_test.go index 902b687a2335..198451582efa 100644 --- a/mmv1/third_party/terraform/tests/resource_google_folder_iam_binding_test.go +++ b/mmv1/third_party/terraform/tests/resource_google_folder_iam_binding_test.go @@ -21,10 +21,10 @@ func TestAccFolderIamBinding_basic(t *testing.T) { t.Parallel() org := envvar.GetTestOrgFromEnv(t) - fname := "tf-test-" + RandString(t, 10) - VcrTest(t, resource.TestCase{ + fname := "tf-test-" + acctest.RandString(t, 10) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ // Create a new folder { @@ -54,10 +54,10 @@ func TestAccFolderIamBinding_multiple(t *testing.T) { t.Parallel() org := envvar.GetTestOrgFromEnv(t) - fname := "tf-test-" + RandString(t, 10) - VcrTest(t, resource.TestCase{ + fname := "tf-test-" + acctest.RandString(t, 10) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ // Create a new folder { @@ -101,10 +101,10 @@ func TestAccFolderIamBinding_multipleAtOnce(t *testing.T) { t.Parallel() org := envvar.GetTestOrgFromEnv(t) - fname := "tf-test-" + RandString(t, 10) - VcrTest(t, resource.TestCase{ + fname := "tf-test-" + acctest.RandString(t, 10) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ // Create a new folder { @@ -136,10 +136,10 @@ func TestAccFolderIamBinding_update(t *testing.T) { t.Parallel() org := envvar.GetTestOrgFromEnv(t) - fname := "tf-test-" + RandString(t, 10) - VcrTest(t, resource.TestCase{ + fname := "tf-test-" + acctest.RandString(t, 10) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ // Create a new folder { @@ -189,10 +189,10 @@ func TestAccFolderIamBinding_remove(t *testing.T) { t.Parallel() org := envvar.GetTestOrgFromEnv(t) - fname := "tf-test-" + RandString(t, 10) - VcrTest(t, resource.TestCase{ + fname := "tf-test-" + acctest.RandString(t, 10) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ // Create a new folder { @@ -228,7 +228,7 @@ func TestAccFolderIamBinding_remove(t *testing.T) { func testAccCheckGoogleFolderIamBindingExists(t *testing.T, expected *cloudresourcemanager.Binding, org, fname string) resource.TestCheckFunc { return func(s *terraform.State) error { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) folderPolicy, err := getFolderIamPolicyByParentAndDisplayName("organizations/"+org, fname, config) if err != nil { return fmt.Errorf("Failed to retrieve IAM policy for folder %q: %s", fname, err) diff --git a/mmv1/third_party/terraform/tests/resource_google_folder_iam_member_test.go b/mmv1/third_party/terraform/tests/resource_google_folder_iam_member_test.go index c3b0ff2bc390..6d4689f70350 100644 --- a/mmv1/third_party/terraform/tests/resource_google_folder_iam_member_test.go +++ b/mmv1/third_party/terraform/tests/resource_google_folder_iam_member_test.go @@ -15,10 +15,10 @@ func TestAccFolderIamMember_basic(t *testing.T) { t.Parallel() org := envvar.GetTestOrgFromEnv(t) - fname := "tf-test-" + RandString(t, 10) - VcrTest(t, resource.TestCase{ + fname := "tf-test-" + acctest.RandString(t, 10) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ // Create a new folder { @@ -47,10 +47,10 @@ func TestAccFolderIamMember_multiple(t *testing.T) { t.Parallel() org := envvar.GetTestOrgFromEnv(t) - fname := "tf-test-" + RandString(t, 10) - VcrTest(t, resource.TestCase{ + fname := "tf-test-" + acctest.RandString(t, 10) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ // Create a new folder { @@ -89,10 +89,10 @@ func TestAccFolderIamMember_remove(t *testing.T) { t.Parallel() org := envvar.GetTestOrgFromEnv(t) - fname := "tf-test-" + RandString(t, 10) - VcrTest(t, resource.TestCase{ + fname := "tf-test-" + acctest.RandString(t, 10) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ // Create a new folder { diff --git a/mmv1/third_party/terraform/tests/resource_google_folder_iam_policy_test.go b/mmv1/third_party/terraform/tests/resource_google_folder_iam_policy_test.go index 4c0c0a49cf6b..231407f18483 100644 --- a/mmv1/third_party/terraform/tests/resource_google_folder_iam_policy_test.go +++ b/mmv1/third_party/terraform/tests/resource_google_folder_iam_policy_test.go @@ -14,13 +14,13 @@ import ( func TestAccFolderIamPolicy_basic(t *testing.T) { t.Parallel() - folderDisplayName := "tf-test-" + RandString(t, 10) + folderDisplayName := "tf-test-" + acctest.RandString(t, 10) org := envvar.GetTestOrgFromEnv(t) parent := "organizations/" + org - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckGoogleFolderIamPolicyDestroyProducer(t), Steps: []resource.TestStep{ { @@ -47,13 +47,13 @@ func TestAccFolderIamPolicy_basic(t *testing.T) { func TestAccFolderIamPolicy_auditConfigs(t *testing.T) { t.Parallel() - folderDisplayName := "tf-test-" + RandString(t, 10) + folderDisplayName := "tf-test-" + acctest.RandString(t, 10) org := envvar.GetTestOrgFromEnv(t) parent := "organizations/" + org - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckGoogleFolderIamPolicyDestroyProducer(t), Steps: []resource.TestStep{ { @@ -70,7 +70,7 @@ func TestAccFolderIamPolicy_auditConfigs(t *testing.T) { func testAccCheckGoogleFolderIamPolicyDestroyProducer(t *testing.T) func(s *terraform.State) error { return func(s *terraform.State) error { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) for _, rs := range s.RootModule().Resources { if rs.Type != "google_folder_iam_policy" { @@ -91,7 +91,7 @@ func testAccCheckGoogleFolderIamPolicyDestroyProducer(t *testing.T) func(s *terr // Confirm that a folder has an IAM policy with at least 1 binding func testAccFolderExistingPolicy(t *testing.T, org, fname string) resource.TestCheckFunc { return func(s *terraform.State) error { - c := GoogleProviderConfig(t) + c := acctest.GoogleProviderConfig(t) var err error OriginalPolicy, err := getFolderIamPolicyByParentAndDisplayName("organizations/"+org, fname, c) if err != nil { diff --git a/mmv1/third_party/terraform/tests/resource_google_folder_organization_policy_test.go b/mmv1/third_party/terraform/tests/resource_google_folder_organization_policy_test.go index 517a7cac2d72..34222cbe5168 100644 --- a/mmv1/third_party/terraform/tests/resource_google_folder_organization_policy_test.go +++ b/mmv1/third_party/terraform/tests/resource_google_folder_organization_policy_test.go @@ -18,12 +18,12 @@ import ( func TestAccFolderOrganizationPolicy_boolean(t *testing.T) { t.Parallel() - folder := fmt.Sprintf("tf-test-%d", RandInt(t)) + folder := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) org := envvar.GetTestOrgFromEnv(t) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckGoogleFolderOrganizationPolicyDestroyProducer(t), Steps: []resource.TestStep{ { @@ -57,12 +57,12 @@ func TestAccFolderOrganizationPolicy_boolean(t *testing.T) { func TestAccFolderOrganizationPolicy_list_allowAll(t *testing.T) { t.Parallel() - folder := fmt.Sprintf("tf-test-%d", RandInt(t)) + folder := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) org := envvar.GetTestOrgFromEnv(t) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckGoogleFolderOrganizationPolicyDestroyProducer(t), Steps: []resource.TestStep{ { @@ -81,12 +81,12 @@ func TestAccFolderOrganizationPolicy_list_allowAll(t *testing.T) { func TestAccFolderOrganizationPolicy_list_allowSome(t *testing.T) { t.Parallel() - folder := fmt.Sprintf("tf-test-%d", RandInt(t)) + folder := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) org := envvar.GetTestOrgFromEnv(t) project := envvar.GetTestProjectFromEnv() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckGoogleFolderOrganizationPolicyDestroyProducer(t), Steps: []resource.TestStep{ { @@ -105,11 +105,11 @@ func TestAccFolderOrganizationPolicy_list_allowSome(t *testing.T) { func TestAccFolderOrganizationPolicy_list_denySome(t *testing.T) { t.Parallel() - folder := fmt.Sprintf("tf-test-%d", RandInt(t)) + folder := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) org := envvar.GetTestOrgFromEnv(t) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckGoogleFolderOrganizationPolicyDestroyProducer(t), Steps: []resource.TestStep{ { @@ -128,11 +128,11 @@ func TestAccFolderOrganizationPolicy_list_denySome(t *testing.T) { func TestAccFolderOrganizationPolicy_list_update(t *testing.T) { t.Parallel() - folder := fmt.Sprintf("tf-test-%d", RandInt(t)) + folder := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) org := envvar.GetTestOrgFromEnv(t) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckGoogleFolderOrganizationPolicyDestroyProducer(t), Steps: []resource.TestStep{ { @@ -155,11 +155,11 @@ func TestAccFolderOrganizationPolicy_list_update(t *testing.T) { func TestAccFolderOrganizationPolicy_restore_defaultTrue(t *testing.T) { t.Parallel() - folder := fmt.Sprintf("tf-test-%d", RandInt(t)) + folder := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) org := envvar.GetTestOrgFromEnv(t) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckGoogleOrganizationPolicyDestroyProducer(t), Steps: []resource.TestStep{ { @@ -177,7 +177,7 @@ func TestAccFolderOrganizationPolicy_restore_defaultTrue(t *testing.T) { func testAccCheckGoogleFolderOrganizationPolicyDestroyProducer(t *testing.T) func(s *terraform.State) error { return func(s *terraform.State) error { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) for _, rs := range s.RootModule().Resources { if rs.Type != "google_folder_organization_policy" { @@ -297,7 +297,7 @@ func getGoogleFolderOrganizationPolicyTestResource(t *testing.T, s *terraform.St return nil, fmt.Errorf("No ID is set") } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) folder := resourcemanager.CanonicalFolderId(rs.Primary.Attributes["folder"]) return config.NewResourceManagerClient(config.UserAgent).Folders.GetOrgPolicy(folder, &cloudresourcemanager.GetOrgPolicyRequest{ diff --git a/mmv1/third_party/terraform/tests/resource_google_folder_test.go b/mmv1/third_party/terraform/tests/resource_google_folder_test.go index 850ab8544c50..95182caa643a 100644 --- a/mmv1/third_party/terraform/tests/resource_google_folder_test.go +++ b/mmv1/third_party/terraform/tests/resource_google_folder_test.go @@ -15,15 +15,15 @@ import ( func TestAccFolder_rename(t *testing.T) { t.Parallel() - folderDisplayName := "tf-test-" + RandString(t, 10) - newFolderDisplayName := "tf-test-renamed-" + RandString(t, 10) + folderDisplayName := "tf-test-" + acctest.RandString(t, 10) + newFolderDisplayName := "tf-test-renamed-" + acctest.RandString(t, 10) org := envvar.GetTestOrgFromEnv(t) parent := "organizations/" + org folder := resourceManagerV3.Folder{} - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckGoogleFolderDestroyProducer(t), Steps: []resource.TestStep{ { @@ -53,16 +53,16 @@ func TestAccFolder_rename(t *testing.T) { func TestAccFolder_moveParent(t *testing.T) { t.Parallel() - folder1DisplayName := "tf-test-" + RandString(t, 10) - folder2DisplayName := "tf-test-" + RandString(t, 10) + folder1DisplayName := "tf-test-" + acctest.RandString(t, 10) + folder2DisplayName := "tf-test-" + acctest.RandString(t, 10) org := envvar.GetTestOrgFromEnv(t) parent := "organizations/" + org folder1 := resourceManagerV3.Folder{} folder2 := resourceManagerV3.Folder{} - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckGoogleFolderDestroyProducer(t), Steps: []resource.TestStep{ { @@ -89,7 +89,7 @@ func TestAccFolder_moveParent(t *testing.T) { func testAccCheckGoogleFolderDestroyProducer(t *testing.T) func(s *terraform.State) error { return func(s *terraform.State) error { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) for _, rs := range s.RootModule().Resources { if rs.Type != "google_folder" { @@ -117,7 +117,7 @@ func testAccCheckGoogleFolderExists(t *testing.T, n string, folder *resourceMana return fmt.Errorf("No ID is set") } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) found, err := config.NewResourceManagerV3Client(config.UserAgent).Folders.Get(rs.Primary.ID).Do() if err != nil { diff --git a/mmv1/third_party/terraform/tests/resource_google_organization_iam_audit_config_test.go b/mmv1/third_party/terraform/tests/resource_google_organization_iam_audit_config_test.go index ba29ee4bcf2f..5e984562a820 100644 --- a/mmv1/third_party/terraform/tests/resource_google_organization_iam_audit_config_test.go +++ b/mmv1/third_party/terraform/tests/resource_google_organization_iam_audit_config_test.go @@ -30,9 +30,9 @@ func TestAccOrganizationIamAuditConfig_basic(t *testing.T) { } org := envvar.GetTestOrgFromEnv(t) service := "cloudkms.googleapis.com" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ // Apply an IAM audit config { @@ -52,9 +52,9 @@ func TestAccOrganizationIamAuditConfig_multiple(t *testing.T) { service := "cloudkms.googleapis.com" service2 := "cloudsql.googleapis.com" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ // Apply an IAM audit config { @@ -81,9 +81,9 @@ func TestAccOrganizationIamAuditConfig_multipleAtOnce(t *testing.T) { service := "cloudkms.googleapis.com" service2 := "cloudsql.googleapis.com" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ // Apply an IAM audit config { @@ -103,9 +103,9 @@ func TestAccOrganizationIamAuditConfig_update(t *testing.T) { org := envvar.GetTestOrgFromEnv(t) service := "cloudkms.googleapis.com" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ // Apply an IAM audit config { @@ -139,9 +139,9 @@ func TestAccOrganizationIamAuditConfig_remove(t *testing.T) { service := "cloudkms.googleapis.com" service2 := "cloudsql.googleapis.com" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ // Apply multiple IAM audit configs { @@ -169,9 +169,9 @@ func TestAccOrganizationIamAuditConfig_addFirstExemptMember(t *testing.T) { members := []string{} members2 := []string{"user:gterraformtest1@gmail.com"} - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ // Apply IAM audit config with no members { @@ -198,9 +198,9 @@ func TestAccOrganizationIamAuditConfig_removeLastExemptMember(t *testing.T) { members := []string{"user:gterraformtest1@gmail.com"} members2 := []string{} - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ // Apply IAM audit config with member { @@ -227,9 +227,9 @@ func TestAccOrganizationIamAuditConfig_updateNoExemptMembers(t *testing.T) { logType2 := "DATA_WRITE" service := "cloudkms.googleapis.com" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ // Apply IAM audit config with DATA_READ { diff --git a/mmv1/third_party/terraform/tests/resource_google_organization_iam_custom_role_test.go b/mmv1/third_party/terraform/tests/resource_google_organization_iam_custom_role_test.go index 7553e3c62084..add18c555de3 100644 --- a/mmv1/third_party/terraform/tests/resource_google_organization_iam_custom_role_test.go +++ b/mmv1/third_party/terraform/tests/resource_google_organization_iam_custom_role_test.go @@ -17,11 +17,11 @@ func TestAccOrganizationIamCustomRole_basic(t *testing.T) { t.Parallel() org := envvar.GetTestOrgFromEnv(t) - roleId := "tfIamCustomRole" + RandString(t, 10) + roleId := "tfIamCustomRole" + acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckGoogleOrganizationIamCustomRoleDestroyProducer(t), Steps: []resource.TestStep{ { @@ -57,11 +57,11 @@ func TestAccOrganizationIamCustomRole_undelete(t *testing.T) { t.Parallel() org := envvar.GetTestOrgFromEnv(t) - roleId := "tfIamCustomRole" + RandString(t, 10) + roleId := "tfIamCustomRole" + acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckGoogleOrganizationIamCustomRoleDestroyProducer(t), Steps: []resource.TestStep{ { @@ -87,11 +87,11 @@ func TestAccOrganizationIamCustomRole_createAfterDestroy(t *testing.T) { t.Parallel() org := envvar.GetTestOrgFromEnv(t) - roleId := "tfIamCustomRole" + RandString(t, 10) + roleId := "tfIamCustomRole" + acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckGoogleOrganizationIamCustomRoleDestroyProducer(t), Steps: []resource.TestStep{ { @@ -126,7 +126,7 @@ func TestAccOrganizationIamCustomRole_createAfterDestroy(t *testing.T) { func testAccCheckGoogleOrganizationIamCustomRoleDestroyProducer(t *testing.T) func(s *terraform.State) error { return func(s *terraform.State) error { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) for _, rs := range s.RootModule().Resources { if rs.Type != "google_organization_iam_custom_role" { @@ -160,7 +160,7 @@ func testAccCheckGoogleOrganizationIamCustomRole(t *testing.T, n, title, descrip return fmt.Errorf("No ID is set") } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) role, err := config.NewIamClient(config.UserAgent).Organizations.Roles.Get(rs.Primary.ID).Do() if err != nil { @@ -200,7 +200,7 @@ func testAccCheckGoogleOrganizationIamCustomRoleDeletionStatus(t *testing.T, n s return fmt.Errorf("No ID is set") } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) role, err := config.NewIamClient(config.UserAgent).Organizations.Roles.Get(rs.Primary.ID).Do() if err != nil { diff --git a/mmv1/third_party/terraform/tests/resource_google_organization_iam_test.go b/mmv1/third_party/terraform/tests/resource_google_organization_iam_test.go index 083459e929b7..a58fbeef4751 100644 --- a/mmv1/third_party/terraform/tests/resource_google_organization_iam_test.go +++ b/mmv1/third_party/terraform/tests/resource_google_organization_iam_test.go @@ -49,11 +49,11 @@ func TestAccOrganizationIamMembersAndBindings(t *testing.T) { func testAccOrganizationIamBinding_basic(t *testing.T) { org := envvar.GetTestOrgFromEnv(t) - account := fmt.Sprintf("tf-test-%d", RandInt(t)) - roleId := "tfIamTest" + RandString(t, 10) - VcrTest(t, resource.TestCase{ + account := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) + roleId := "tfIamTest" + acctest.RandString(t, 10) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { // Test Iam Binding creation @@ -88,12 +88,12 @@ func testAccOrganizationIamBinding_basic(t *testing.T) { func testAccOrganizationIamBinding_condition(t *testing.T) { org := envvar.GetTestOrgFromEnv(t) - account := fmt.Sprintf("tf-test-%d", RandInt(t)) - roleId := "tfIamTest" + RandString(t, 10) + account := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) + roleId := "tfIamTest" + acctest.RandString(t, 10) conditionTitle := "expires_after_2019_12_31" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { // Test Iam Binding creation @@ -114,10 +114,10 @@ func testAccOrganizationIamBinding_condition(t *testing.T) { func testAccOrganizationIamMember_basic(t *testing.T) { org := envvar.GetTestOrgFromEnv(t) - account := fmt.Sprintf("tf-test-%d", RandInt(t)) - VcrTest(t, resource.TestCase{ + account := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { // Test Iam Member creation (no update for member, no need to test) @@ -138,11 +138,11 @@ func testAccOrganizationIamMember_basic(t *testing.T) { func testAccOrganizationIamMember_condition(t *testing.T) { org := envvar.GetTestOrgFromEnv(t) - account := fmt.Sprintf("tf-test-%d", RandInt(t)) + account := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) conditionTitle := "expires_after_2019_12_31" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { // Test Iam Member creation (no update for member, no need to test) @@ -179,7 +179,7 @@ func testAccCheckGoogleOrganizationIamBindingExists(t *testing.T, bindingResourc return fmt.Errorf("Not found: %s", roleResourceName) } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) p, err := config.NewResourceManagerClient(config.UserAgent).Organizations.GetIamPolicy( "organizations/"+bindingRs.Primary.Attributes["org_id"], &cloudresourcemanager.GetIamPolicyRequest{ @@ -216,7 +216,7 @@ func testAccCheckGoogleOrganizationIamMemberExists(t *testing.T, n, role, member return fmt.Errorf("Not found: %s", n) } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) p, err := config.NewResourceManagerClient(config.UserAgent).Organizations.GetIamPolicy( "organizations/"+rs.Primary.Attributes["org_id"], &cloudresourcemanager.GetIamPolicyRequest{ diff --git a/mmv1/third_party/terraform/tests/resource_google_organization_policy_test.go b/mmv1/third_party/terraform/tests/resource_google_organization_policy_test.go index d732d8b00b61..3a5f6cfa2ef1 100644 --- a/mmv1/third_party/terraform/tests/resource_google_organization_policy_test.go +++ b/mmv1/third_party/terraform/tests/resource_google_organization_policy_test.go @@ -47,9 +47,9 @@ func TestAccOrganizationPolicy(t *testing.T) { func testAccOrganizationPolicy_boolean(t *testing.T) { org := envvar.GetTestOrgTargetFromEnv(t) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckGoogleOrganizationPolicyDestroyProducer(t), Steps: []resource.TestStep{ { @@ -88,9 +88,9 @@ func testAccOrganizationPolicy_boolean(t *testing.T) { func testAccOrganizationPolicy_list_allowAll(t *testing.T) { org := envvar.GetTestOrgTargetFromEnv(t) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckGoogleOrganizationPolicyDestroyProducer(t), Steps: []resource.TestStep{ { @@ -109,9 +109,9 @@ func testAccOrganizationPolicy_list_allowAll(t *testing.T) { func testAccOrganizationPolicy_list_allowSome(t *testing.T) { org := envvar.GetTestOrgTargetFromEnv(t) project := envvar.GetTestProjectFromEnv() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckGoogleOrganizationPolicyDestroyProducer(t), Steps: []resource.TestStep{ { @@ -129,9 +129,9 @@ func testAccOrganizationPolicy_list_allowSome(t *testing.T) { func testAccOrganizationPolicy_list_denySome(t *testing.T) { org := envvar.GetTestOrgTargetFromEnv(t) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckGoogleOrganizationPolicyDestroyProducer(t), Steps: []resource.TestStep{ { @@ -149,9 +149,9 @@ func testAccOrganizationPolicy_list_denySome(t *testing.T) { func testAccOrganizationPolicy_list_update(t *testing.T) { org := envvar.GetTestOrgTargetFromEnv(t) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckGoogleOrganizationPolicyDestroyProducer(t), Steps: []resource.TestStep{ { @@ -173,9 +173,9 @@ func testAccOrganizationPolicy_list_update(t *testing.T) { func testAccOrganizationPolicy_list_inheritFromParent(t *testing.T) { org := envvar.GetTestOrgTargetFromEnv(t) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckGoogleOrganizationPolicyDestroyProducer(t), Steps: []resource.TestStep{ { @@ -192,9 +192,9 @@ func testAccOrganizationPolicy_list_inheritFromParent(t *testing.T) { func testAccOrganizationPolicy_restore_defaultTrue(t *testing.T) { org := envvar.GetTestOrgTargetFromEnv(t) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckGoogleOrganizationPolicyDestroyProducer(t), Steps: []resource.TestStep{ { @@ -212,7 +212,7 @@ func testAccOrganizationPolicy_restore_defaultTrue(t *testing.T) { func testAccCheckGoogleOrganizationPolicyDestroyProducer(t *testing.T) func(s *terraform.State) error { return func(s *terraform.State) error { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) for _, rs := range s.RootModule().Resources { if rs.Type != "google_organization_policy" { @@ -332,7 +332,7 @@ func getGoogleOrganizationPolicyTestResource(t *testing.T, s *terraform.State, n return nil, fmt.Errorf("No ID is set") } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) return config.NewResourceManagerClient(config.UserAgent).Organizations.GetOrgPolicy("organizations/"+rs.Primary.Attributes["org_id"], &cloudresourcemanager.GetOrgPolicyRequest{ Constraint: rs.Primary.Attributes["constraint"], diff --git a/mmv1/third_party/terraform/tests/resource_google_project_default_service_accounts_test.go b/mmv1/third_party/terraform/tests/resource_google_project_default_service_accounts_test.go index 837c6575eef4..67317fcade61 100644 --- a/mmv1/third_party/terraform/tests/resource_google_project_default_service_accounts_test.go +++ b/mmv1/third_party/terraform/tests/resource_google_project_default_service_accounts_test.go @@ -18,12 +18,12 @@ func TestAccResourceGoogleProjectDefaultServiceAccountsBasic(t *testing.T) { resourceName := "google_project_default_service_accounts.acceptance" org := envvar.GetTestOrgFromEnv(t) - project := fmt.Sprintf("tf-test-%d", RandInt(t)) + project := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) billingAccount := envvar.GetTestBillingAccountFromEnv(t) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccCheckGoogleProjectDefaultServiceAccountsBasic(org, project, billingAccount), @@ -58,14 +58,14 @@ func TestAccResourceGoogleProjectDefaultServiceAccountsDisable(t *testing.T) { t.Parallel() org := envvar.GetTestOrgFromEnv(t) - project := fmt.Sprintf("tf-test-%d", RandInt(t)) + project := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) billingAccount := envvar.GetTestBillingAccountFromEnv(t) action := "DISABLE" restorePolicy := "REVERT" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckGoogleProjectDefaultServiceAccountsRevert(t, project, action), Steps: []resource.TestStep{ { @@ -87,14 +87,14 @@ func TestAccResourceGoogleProjectDefaultServiceAccountsDelete(t *testing.T) { t.Parallel() org := envvar.GetTestOrgFromEnv(t) - project := fmt.Sprintf("tf-test-%d", RandInt(t)) + project := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) billingAccount := envvar.GetTestBillingAccountFromEnv(t) action := "DELETE" restorePolicy := "REVERT" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckGoogleProjectDefaultServiceAccountsRevert(t, project, action), Steps: []resource.TestStep{ { @@ -116,14 +116,14 @@ func TestAccResourceGoogleProjectDefaultServiceAccountsDeleteRevertIgnoreFailure t.Parallel() org := envvar.GetTestOrgFromEnv(t) - project := fmt.Sprintf("tf-test-%d", RandInt(t)) + project := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) billingAccount := envvar.GetTestBillingAccountFromEnv(t) action := "DELETE" restorePolicy := "REVERT_AND_IGNORE_FAILURE" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccCheckGoogleProjectDefaultServiceAccountsAdvanced(org, project, billingAccount, action, restorePolicy), @@ -144,14 +144,14 @@ func TestAccResourceGoogleProjectDefaultServiceAccountsDeprivilege(t *testing.T) t.Parallel() org := envvar.GetTestOrgFromEnv(t) - project := fmt.Sprintf("tf-test-%d", RandInt(t)) + project := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) billingAccount := envvar.GetTestBillingAccountFromEnv(t) action := "DEPRIVILEGE" restorePolicy := "REVERT" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckGoogleProjectDefaultServiceAccountsRevert(t, project, action), Steps: []resource.TestStep{ { @@ -196,7 +196,7 @@ resource "google_project_default_service_accounts" "acceptance" { func testAccCheckGoogleProjectDefaultServiceAccountsChanges(t *testing.T, project, action string) func(s *terraform.State) error { return func(s *terraform.State) error { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) response, err := config.NewIamClient(config.UserAgent).Projects.ServiceAccounts.List(PrefixedProject(project)).Do() if err != nil { return fmt.Errorf("failed to list service accounts on project %q: %v", project, err) @@ -233,7 +233,7 @@ func testAccCheckGoogleProjectDefaultServiceAccountsChanges(t *testing.T, projec // Test if actions were reverted properly func testAccCheckGoogleProjectDefaultServiceAccountsRevert(t *testing.T, project, action string) func(s *terraform.State) error { return func(s *terraform.State) error { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) response, err := config.NewIamClient(config.UserAgent).Projects.ServiceAccounts.List(PrefixedProject(project)).Do() if err != nil { return fmt.Errorf("failed to list service accounts on project %q: %v", project, err) diff --git a/mmv1/third_party/terraform/tests/resource_google_project_iam_audit_config_test.go b/mmv1/third_party/terraform/tests/resource_google_project_iam_audit_config_test.go index 76dab4650429..c4f44a786ada 100644 --- a/mmv1/third_party/terraform/tests/resource_google_project_iam_audit_config_test.go +++ b/mmv1/third_party/terraform/tests/resource_google_project_iam_audit_config_test.go @@ -25,11 +25,11 @@ func TestAccProjectIamAuditConfig_basic(t *testing.T) { t.Parallel() org := envvar.GetTestOrgFromEnv(t) - pid := fmt.Sprintf("tf-test-%d", RandInt(t)) + pid := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) service := "cloudkms.googleapis.com" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ // Create a new project { @@ -52,13 +52,13 @@ func TestAccProjectIamAuditConfig_multiple(t *testing.T) { t.Parallel() org := envvar.GetTestOrgFromEnv(t) - pid := fmt.Sprintf("tf-test-%d", RandInt(t)) + pid := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) service := "cloudkms.googleapis.com" service2 := "cloudsql.googleapis.com" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ // Create a new project { @@ -88,13 +88,13 @@ func TestAccProjectIamAuditConfig_multipleAtOnce(t *testing.T) { t.Parallel() org := envvar.GetTestOrgFromEnv(t) - pid := fmt.Sprintf("tf-test-%d", RandInt(t)) + pid := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) service := "cloudkms.googleapis.com" service2 := "cloudsql.googleapis.com" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ // Create a new project { @@ -118,12 +118,12 @@ func TestAccProjectIamAuditConfig_update(t *testing.T) { t.Parallel() org := envvar.GetTestOrgFromEnv(t) - pid := fmt.Sprintf("tf-test-%d", RandInt(t)) + pid := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) service := "cloudkms.googleapis.com" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ // Create a new project { @@ -160,13 +160,13 @@ func TestAccProjectIamAuditConfig_remove(t *testing.T) { t.Parallel() org := envvar.GetTestOrgFromEnv(t) - pid := fmt.Sprintf("tf-test-%d", RandInt(t)) + pid := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) service := "cloudkms.googleapis.com" service2 := "cloudsql.googleapis.com" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ // Create a new project { @@ -198,14 +198,14 @@ func TestAccProjectIamAuditConfig_addFirstExemptMember(t *testing.T) { t.Parallel() org := envvar.GetTestOrgFromEnv(t) - pid := fmt.Sprintf("tf-test-%d", RandInt(t)) + pid := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) service := "cloudkms.googleapis.com" members := []string{} members2 := []string{"user:gterraformtest1@gmail.com"} - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ // Create a new project { @@ -234,14 +234,14 @@ func TestAccProjectIamAuditConfig_removeLastExemptMember(t *testing.T) { t.Parallel() org := envvar.GetTestOrgFromEnv(t) - pid := fmt.Sprintf("tf-test-%d", RandInt(t)) + pid := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) service := "cloudkms.googleapis.com" members2 := []string{} members := []string{"user:gterraformtest1@gmail.com"} - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ // Create a new project { @@ -270,14 +270,14 @@ func TestAccProjectIamAuditConfig_updateNoExemptMembers(t *testing.T) { t.Parallel() org := envvar.GetTestOrgFromEnv(t) - pid := fmt.Sprintf("tf-test-%d", RandInt(t)) + pid := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) logType := "DATA_READ" logType2 := "DATA_WRITE" service := "cloudkms.googleapis.com" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ // Create a new project { diff --git a/mmv1/third_party/terraform/tests/resource_google_project_iam_binding_test.go.erb b/mmv1/third_party/terraform/tests/resource_google_project_iam_binding_test.go.erb index 5dc2efd08a6e..7810f6375f7f 100644 --- a/mmv1/third_party/terraform/tests/resource_google_project_iam_binding_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_google_project_iam_binding_test.go.erb @@ -25,12 +25,12 @@ func TestAccProjectIamBinding_basic(t *testing.T) { t.Parallel() org := envvar.GetTestOrgFromEnv(t) - pid := fmt.Sprintf("tf-test-%d", RandInt(t)) + pid := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) role := "roles/compute.instanceAdmin" member := "user:admin@hashicorptest.com" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ // Create a new project { @@ -53,14 +53,14 @@ func TestAccProjectIamBinding_multiple(t *testing.T) { t.Parallel() org := envvar.GetTestOrgFromEnv(t) - pid := fmt.Sprintf("tf-test-%d", RandInt(t)) + pid := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) role := "roles/compute.instanceAdmin" role2 := "roles/viewer" member := "user:admin@hashicorptest.com" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ // Create a new project { @@ -90,13 +90,13 @@ func TestAccProjectIamBinding_multipleAtOnce(t *testing.T) { t.Parallel() org := envvar.GetTestOrgFromEnv(t) - pid := fmt.Sprintf("tf-test-%d", RandInt(t)) + pid := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) role := "roles/compute.instanceAdmin" role2 := "roles/viewer" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ // Create a new project { @@ -120,13 +120,13 @@ func TestAccProjectIamBinding_update(t *testing.T) { t.Parallel() org := envvar.GetTestOrgFromEnv(t) - pid := fmt.Sprintf("tf-test-%d", RandInt(t)) + pid := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) role := "roles/compute.instanceAdmin" member := "user:admin@hashicorptest.com" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ // Create a new project { @@ -163,13 +163,13 @@ func TestAccProjectIamBinding_remove(t *testing.T) { t.Parallel() org := envvar.GetTestOrgFromEnv(t) - pid := fmt.Sprintf("tf-test-%d", RandInt(t)) + pid := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) role := "roles/compute.instanceAdmin" role2 := "roles/viewer" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ // Create a new project { @@ -201,11 +201,11 @@ func TestAccProjectIamBinding_noMembers(t *testing.T) { t.Parallel() org := envvar.GetTestOrgFromEnv(t) - pid := fmt.Sprintf("tf-test-%d", RandInt(t)) + pid := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) role := "roles/compute.instanceAdmin" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ // Create a new project { @@ -227,12 +227,12 @@ func TestAccProjectIamBinding_withCondition(t *testing.T) { t.Parallel() org := envvar.GetTestOrgFromEnv(t) - pid := fmt.Sprintf("tf-test-%d", RandInt(t)) + pid := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) role := "roles/compute.instanceAdmin" conditionTitle := "expires_after_2019_12_31" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ // Create a new project { @@ -260,11 +260,11 @@ func TestAccProjectIamBinding_invalidMembers(t *testing.T) { t.Parallel() org := envvar.GetTestOrgFromEnv(t) - pid := fmt.Sprintf("tf-test-%d", RandInt(t)) + pid := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) role := "roles/compute.instanceAdmin" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccProjectAssociateBindingBasic(pid, org, role, "admin@hashicorptest.com"), diff --git a/mmv1/third_party/terraform/tests/resource_google_project_iam_custom_role_test.go b/mmv1/third_party/terraform/tests/resource_google_project_iam_custom_role_test.go index 26eb785fd0d7..324ceecae20b 100644 --- a/mmv1/third_party/terraform/tests/resource_google_project_iam_custom_role_test.go +++ b/mmv1/third_party/terraform/tests/resource_google_project_iam_custom_role_test.go @@ -14,11 +14,11 @@ func TestAccProjectIamCustomRole_basic(t *testing.T) { t.Parallel() project := envvar.GetTestProjectFromEnv() - roleId := "tfIamCustomRole" + RandString(t, 10) + roleId := "tfIamCustomRole" + acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckGoogleProjectIamCustomRoleDestroyProducer(t), Steps: []resource.TestStep{ { @@ -57,11 +57,11 @@ func TestAccProjectIamCustomRole_basic(t *testing.T) { func TestAccProjectIamCustomRole_undelete(t *testing.T) { t.Parallel() - roleId := "tfIamCustomRole" + RandString(t, 10) + roleId := "tfIamCustomRole" + acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckGoogleProjectIamCustomRoleDestroyProducer(t), Steps: []resource.TestStep{ { @@ -97,10 +97,10 @@ func TestAccProjectIamCustomRole_undelete(t *testing.T) { func TestAccProjectIamCustomRole_createAfterDestroy(t *testing.T) { t.Parallel() - roleId := "tfIamCustomRole" + RandString(t, 10) - VcrTest(t, resource.TestCase{ + roleId := "tfIamCustomRole" + acctest.RandString(t, 10) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckGoogleProjectIamCustomRoleDestroyProducer(t), Steps: []resource.TestStep{ { @@ -131,7 +131,7 @@ func TestAccProjectIamCustomRole_createAfterDestroy(t *testing.T) { func testAccCheckGoogleProjectIamCustomRoleDestroyProducer(t *testing.T) func(s *terraform.State) error { return func(s *terraform.State) error { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) for _, rs := range s.RootModule().Resources { if rs.Type != "google_project_iam_custom_role" { @@ -165,7 +165,7 @@ func testAccCheckGoogleProjectIamCustomRoleDeletionStatus(t *testing.T, n string return fmt.Errorf("No ID is set") } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) role, err := config.NewIamClient(config.UserAgent).Projects.Roles.Get(rs.Primary.ID).Do() if err != nil { diff --git a/mmv1/third_party/terraform/tests/resource_google_project_iam_member_test.go.erb b/mmv1/third_party/terraform/tests/resource_google_project_iam_member_test.go.erb index 7732e15495f7..bda60c9118e8 100644 --- a/mmv1/third_party/terraform/tests/resource_google_project_iam_member_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_google_project_iam_member_test.go.erb @@ -25,13 +25,13 @@ func TestAccProjectIamMember_basic(t *testing.T) { t.Parallel() org := envvar.GetTestOrgFromEnv(t) - pid := fmt.Sprintf("tf-test-%d", RandInt(t)) + pid := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) resourceName := "google_project_iam_member.acceptance" role := "roles/compute.instanceAdmin" member := "user:admin@hashicorptest.com" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ // Create a new project { @@ -58,16 +58,16 @@ func TestAccProjectIamMember_multiple(t *testing.T) { org := envvar.GetTestOrgFromEnv(t) acctest.SkipIfEnvNotSet(t, "GOOGLE_ORG") - pid := fmt.Sprintf("tf-test-%d", RandInt(t)) + pid := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) resourceName := "google_project_iam_member.acceptance" resourceName2 := "google_project_iam_member.multiple" role := "roles/compute.instanceAdmin" member := "user:admin@hashicorptest.com" member2 := "user:gterraformtest1@gmail.com" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ // Create a new project { @@ -101,15 +101,15 @@ func TestAccProjectIamMember_remove(t *testing.T) { org := envvar.GetTestOrgFromEnv(t) acctest.SkipIfEnvNotSet(t, "GOOGLE_ORG") - pid := fmt.Sprintf("tf-test-%d", RandInt(t)) + pid := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) resourceName := "google_project_iam_member.acceptance" role := "roles/compute.instanceAdmin" member := "user:admin@hashicorptest.com" member2 := "user:gterraformtest1@gmail.com" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ // Create a new project { @@ -141,14 +141,14 @@ func TestAccProjectIamMember_withCondition(t *testing.T) { t.Parallel() org := envvar.GetTestOrgFromEnv(t) - pid := fmt.Sprintf("tf-test-%d", RandInt(t)) + pid := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) resourceName := "google_project_iam_member.acceptance" role := "roles/compute.instanceAdmin" member := "user:admin@hashicorptest.com" conditionTitle := "expires_after_2019_12_31" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ // Create a new project { @@ -175,12 +175,12 @@ func TestAccProjectIamMember_invalidMembers(t *testing.T) { t.Parallel() org := envvar.GetTestOrgFromEnv(t) - pid := fmt.Sprintf("tf-test-%d", RandInt(t)) + pid := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) role := "roles/compute.instanceAdmin" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccProjectAssociateMemberBasic(pid, org, role, "admin@hashicorptest.com"), diff --git a/mmv1/third_party/terraform/tests/resource_google_project_iam_policy_test.go.erb b/mmv1/third_party/terraform/tests/resource_google_project_iam_policy_test.go.erb index 1d53d326963d..874e12406ab2 100644 --- a/mmv1/third_party/terraform/tests/resource_google_project_iam_policy_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_google_project_iam_policy_test.go.erb @@ -22,11 +22,11 @@ func TestAccProjectIamPolicy_basic(t *testing.T) { t.Parallel() org := envvar.GetTestOrgFromEnv(t) - pid := fmt.Sprintf("tf-test-%d", RandInt(t)) + pid := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) member := "user:evanbrown@google.com" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ // Create a new project { @@ -54,10 +54,10 @@ func TestAccProjectIamPolicy_emptyMembers(t *testing.T) { t.Parallel() org := envvar.GetTestOrgFromEnv(t) - pid := fmt.Sprintf("tf-test-%d", RandInt(t)) - VcrTest(t, resource.TestCase{ + pid := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccProjectIamPolicyEmptyMembers(pid, org), @@ -71,10 +71,10 @@ func TestAccProjectIamPolicy_expanded(t *testing.T) { t.Parallel() org := envvar.GetTestOrgFromEnv(t) - pid := fmt.Sprintf("tf-test-%d", RandInt(t)) - VcrTest(t, resource.TestCase{ + pid := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccProjectAssociatePolicyExpanded(pid, org), @@ -91,10 +91,10 @@ func TestAccProjectIamPolicy_basicAuditConfig(t *testing.T) { t.Parallel() org := envvar.GetTestOrgFromEnv(t) - pid := fmt.Sprintf("tf-test-%d", RandInt(t)) - VcrTest(t, resource.TestCase{ + pid := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ // Create a new project { @@ -121,10 +121,10 @@ func TestAccProjectIamPolicy_expandedAuditConfig(t *testing.T) { t.Parallel() org := envvar.GetTestOrgFromEnv(t) - pid := fmt.Sprintf("tf-test-%d", RandInt(t)) - VcrTest(t, resource.TestCase{ + pid := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccProjectAssociatePolicyAuditConfigExpanded(pid, org), @@ -140,10 +140,10 @@ func TestAccProjectIamPolicy_withCondition(t *testing.T) { t.Parallel() org := envvar.GetTestOrgFromEnv(t) - pid := fmt.Sprintf("tf-test-%d", RandInt(t)) - VcrTest(t, resource.TestCase{ + pid := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ // Create a new project { @@ -170,11 +170,11 @@ func TestAccProjectIamPolicy_invalidMembers(t *testing.T) { t.Parallel() org := envvar.GetTestOrgFromEnv(t) - pid := fmt.Sprintf("tf-test-%d", RandInt(t)) + pid := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccProjectAssociatePolicyBasic(pid, org, "admin@hashicorptest.com"), @@ -246,7 +246,7 @@ func testAccCheckGoogleProjectIamPolicyExists(projectRes, policyRes, pid string) // Confirm that a project has an IAM policy with at least 1 binding func testAccProjectExistingPolicy(t *testing.T, pid string) resource.TestCheckFunc { return func(s *terraform.State) error { - c := GoogleProviderConfig(t) + c := acctest.GoogleProviderConfig(t) var err error OriginalPolicy, err := resourcemanager.GetProjectIamPolicy(pid, c) if err != nil { diff --git a/mmv1/third_party/terraform/tests/resource_google_project_organization_policy_test.go b/mmv1/third_party/terraform/tests/resource_google_project_organization_policy_test.go index 5d0d3152f527..2f839973edd4 100644 --- a/mmv1/third_party/terraform/tests/resource_google_project_organization_policy_test.go +++ b/mmv1/third_party/terraform/tests/resource_google_project_organization_policy_test.go @@ -44,9 +44,9 @@ func TestAccProjectOrganizationPolicy(t *testing.T) { func testAccProjectOrganizationPolicy_boolean(t *testing.T) { projectId := envvar.GetTestProjectFromEnv() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckGoogleProjectOrganizationPolicyDestroyProducer(t), Steps: []resource.TestStep{ { @@ -80,9 +80,9 @@ func testAccProjectOrganizationPolicy_boolean(t *testing.T) { func testAccProjectOrganizationPolicy_list_allowAll(t *testing.T) { projectId := envvar.GetTestProjectFromEnv() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckGoogleProjectOrganizationPolicyDestroyProducer(t), Steps: []resource.TestStep{ { @@ -101,9 +101,9 @@ func testAccProjectOrganizationPolicy_list_allowAll(t *testing.T) { func testAccProjectOrganizationPolicy_list_allowSome(t *testing.T) { project := envvar.GetTestProjectFromEnv() canonicalProject := canonicalProjectId(project) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckGoogleProjectOrganizationPolicyDestroyProducer(t), Steps: []resource.TestStep{ { @@ -121,9 +121,9 @@ func testAccProjectOrganizationPolicy_list_allowSome(t *testing.T) { func testAccProjectOrganizationPolicy_list_denySome(t *testing.T) { projectId := envvar.GetTestProjectFromEnv() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckGoogleProjectOrganizationPolicyDestroyProducer(t), Steps: []resource.TestStep{ { @@ -141,9 +141,9 @@ func testAccProjectOrganizationPolicy_list_denySome(t *testing.T) { func testAccProjectOrganizationPolicy_list_update(t *testing.T) { projectId := envvar.GetTestProjectFromEnv() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckGoogleProjectOrganizationPolicyDestroyProducer(t), Steps: []resource.TestStep{ { @@ -166,9 +166,9 @@ func testAccProjectOrganizationPolicy_list_update(t *testing.T) { func testAccProjectOrganizationPolicy_restore_defaultTrue(t *testing.T) { projectId := envvar.GetTestProjectFromEnv() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckGoogleProjectOrganizationPolicyDestroyProducer(t), Steps: []resource.TestStep{ { @@ -187,9 +187,9 @@ func testAccProjectOrganizationPolicy_restore_defaultTrue(t *testing.T) { func testAccProjectOrganizationPolicy_none(t *testing.T) { projectId := envvar.GetTestProjectFromEnv() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckGoogleProjectOrganizationPolicyDestroyProducer(t), Steps: []resource.TestStep{ { @@ -207,7 +207,7 @@ func testAccProjectOrganizationPolicy_none(t *testing.T) { func testAccCheckGoogleProjectOrganizationPolicyDestroyProducer(t *testing.T) func(s *terraform.State) error { return func(s *terraform.State) error { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) for _, rs := range s.RootModule().Resources { if rs.Type != "google_project_organization_policy" { @@ -331,7 +331,7 @@ func getGoogleProjectOrganizationPolicyTestResource(t *testing.T, s *terraform.S return nil, fmt.Errorf("No ID is set") } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) projectId := canonicalProjectId(rs.Primary.Attributes["project"]) return config.NewResourceManagerClient(config.UserAgent).Projects.GetOrgPolicy(projectId, &cloudresourcemanager.GetOrgPolicyRequest{ diff --git a/mmv1/third_party/terraform/tests/resource_google_project_service_test.go b/mmv1/third_party/terraform/tests/resource_google_project_service_test.go index 2d13e4f46a3f..e5b8c967306a 100644 --- a/mmv1/third_party/terraform/tests/resource_google_project_service_test.go +++ b/mmv1/third_party/terraform/tests/resource_google_project_service_test.go @@ -21,11 +21,11 @@ func TestAccProjectService_basic(t *testing.T) { acctest.SkipIfVcr(t) org := envvar.GetTestOrgFromEnv(t) - pid := fmt.Sprintf("tf-test-%d", RandInt(t)) + pid := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) services := []string{"iam.googleapis.com", "cloudresourcemanager.googleapis.com"} - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccProjectService_basic(services, pid, org), @@ -77,12 +77,12 @@ func TestAccProjectService_disableDependentServices(t *testing.T) { org := envvar.GetTestOrgFromEnv(t) billingId := envvar.GetTestBillingAccountFromEnv(t) - pid := fmt.Sprintf("tf-test-%d", RandInt(t)) + pid := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) services := []string{"cloudbuild.googleapis.com", "containerregistry.googleapis.com"} - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccProjectService_disableDependentServices(services, pid, org, billingId, "false"), @@ -118,11 +118,11 @@ func TestAccProjectService_handleNotFound(t *testing.T) { t.Parallel() org := envvar.GetTestOrgFromEnv(t) - pid := fmt.Sprintf("tf-test-%d", RandInt(t)) + pid := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) service := "iam.googleapis.com" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccProjectService_handleNotFound(service, pid, org), @@ -152,10 +152,10 @@ func TestAccProjectService_renamedService(t *testing.T) { } org := envvar.GetTestOrgFromEnv(t) - pid := fmt.Sprintf("tf-test-%d", RandInt(t)) - VcrTest(t, resource.TestCase{ + pid := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccProjectService_single(newName, pid, org), @@ -172,7 +172,7 @@ func TestAccProjectService_renamedService(t *testing.T) { func testAccCheckProjectService(t *testing.T, services []string, pid string, expectEnabled bool) resource.TestCheckFunc { return func(s *terraform.State) error { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) currentlyEnabled, err := ListCurrentlyEnabledServices(pid, "", config.UserAgent, config, time.Minute*10) if err != nil { return fmt.Errorf("Error listing services for project %q: %v", pid, err) diff --git a/mmv1/third_party/terraform/tests/resource_google_project_test.go b/mmv1/third_party/terraform/tests/resource_google_project_test.go index 021ad87062ba..331002899d66 100644 --- a/mmv1/third_party/terraform/tests/resource_google_project_test.go +++ b/mmv1/third_party/terraform/tests/resource_google_project_test.go @@ -29,10 +29,10 @@ func TestAccProject_createWithoutOrg(t *testing.T) { t.Skip("Service accounts cannot create projects without a parent. Requires user credentials.") } - pid := fmt.Sprintf("%s-%d", TestPrefix, RandInt(t)) - VcrTest(t, resource.TestCase{ + pid := fmt.Sprintf("%s-%d", TestPrefix, acctest.RandInt(t)) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ // This step creates a new project { @@ -51,10 +51,10 @@ func TestAccProject_create(t *testing.T) { t.Parallel() org := envvar.GetTestOrgFromEnv(t) - pid := fmt.Sprintf("%s-%d", TestPrefix, RandInt(t)) - VcrTest(t, resource.TestCase{ + pid := fmt.Sprintf("%s-%d", TestPrefix, acctest.RandInt(t)) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ // This step creates a new project { @@ -77,10 +77,10 @@ func TestAccProject_billing(t *testing.T) { acctest.SkipIfEnvNotSet(t, "GOOGLE_BILLING_ACCOUNT_2") billingId2 := os.Getenv("GOOGLE_BILLING_ACCOUNT_2") billingId := envvar.GetTestBillingAccountFromEnv(t) - pid := fmt.Sprintf("%s-%d", TestPrefix, RandInt(t)) - VcrTest(t, resource.TestCase{ + pid := fmt.Sprintf("%s-%d", TestPrefix, acctest.RandInt(t)) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ // This step creates a new project with a billing account { @@ -119,10 +119,10 @@ func TestAccProject_labels(t *testing.T) { t.Parallel() org := envvar.GetTestOrgFromEnv(t) - pid := fmt.Sprintf("%s-%d", TestPrefix, RandInt(t)) - VcrTest(t, resource.TestCase{ + pid := fmt.Sprintf("%s-%d", TestPrefix, acctest.RandInt(t)) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccProject_labels(pid, org, map[string]string{"test": "that"}), @@ -161,11 +161,11 @@ func TestAccProject_deleteDefaultNetwork(t *testing.T) { t.Parallel() org := envvar.GetTestOrgFromEnv(t) - pid := fmt.Sprintf("%s-%d", TestPrefix, RandInt(t)) + pid := fmt.Sprintf("%s-%d", TestPrefix, acctest.RandInt(t)) billingId := envvar.GetTestBillingAccountFromEnv(t) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccProject_deleteDefaultNetwork(pid, org, billingId), @@ -178,11 +178,11 @@ func TestAccProject_parentFolder(t *testing.T) { t.Parallel() org := envvar.GetTestOrgFromEnv(t) - pid := fmt.Sprintf("%s-%d", TestPrefix, RandInt(t)) - folderDisplayName := TestPrefix + RandString(t, 10) - VcrTest(t, resource.TestCase{ + pid := fmt.Sprintf("%s-%d", TestPrefix, acctest.RandInt(t)) + folderDisplayName := TestPrefix + acctest.RandString(t, 10) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccProject_parentFolder(pid, folderDisplayName, org), @@ -195,11 +195,11 @@ func TestAccProject_migrateParent(t *testing.T) { t.Parallel() org := envvar.GetTestOrgFromEnv(t) - pid := fmt.Sprintf("%s-%d", TestPrefix, RandInt(t)) - folderDisplayName := TestPrefix + RandString(t, 10) - VcrTest(t, resource.TestCase{ + pid := fmt.Sprintf("%s-%d", TestPrefix, acctest.RandInt(t)) + folderDisplayName := TestPrefix + acctest.RandString(t, 10) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccProject_migrateParentFolder(pid, folderDisplayName, org), @@ -266,7 +266,7 @@ func testAccCheckGoogleProjectHasBillingAccount(t *testing.T, r, pid, billingId // Actual value in API should match state and expected // Read the billing account - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) ba, err := config.NewBillingClient(config.UserAgent).Projects.GetBillingInfo(PrefixedProject(pid)).Do() if err != nil { return fmt.Errorf("Error reading billing account for project %q: %v", PrefixedProject(pid), err) @@ -291,7 +291,7 @@ func testAccCheckGoogleProjectHasLabels(t *testing.T, r, pid string, expected ma } // Actual value in API should match state and expected - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) found, err := config.NewResourceManagerClient(config.UserAgent).Projects.Get(pid).Do() if err != nil { @@ -333,7 +333,7 @@ func testAccCheckGoogleProjectHasNoLabels(t *testing.T, r, pid string) resource. } // Actual value in API should match state and expected - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) found, err := config.NewResourceManagerClient(config.UserAgent).Projects.Get(pid).Do() if err != nil { diff --git a/mmv1/third_party/terraform/tests/resource_google_security_scanner_scan_config_test.go.erb b/mmv1/third_party/terraform/tests/resource_google_security_scanner_scan_config_test.go.erb index 0d9b60e429bb..8ba783015236 100644 --- a/mmv1/third_party/terraform/tests/resource_google_security_scanner_scan_config_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_google_security_scanner_scan_config_test.go.erb @@ -12,8 +12,8 @@ import ( func TestAccSecurityScannerScanConfig_scanConfigUpdate(t *testing.T) { t.Parallel() - firstAddressSuffix := RandString(t, 10) - secondAddressSuffix := RandString(t, 10) + firstAddressSuffix := acctest.RandString(t, 10) + secondAddressSuffix := acctest.RandString(t, 10) context := map[string]interface{}{ "random_suffix": firstAddressSuffix, "random_suffix2": secondAddressSuffix, @@ -31,9 +31,9 @@ func TestAccSecurityScannerScanConfig_scanConfigUpdate(t *testing.T) { "max_qps": 20, } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckSecurityScannerScanConfigDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_google_service_account_iam_test.go.erb b/mmv1/third_party/terraform/tests/resource_google_service_account_iam_test.go.erb index d0585600e499..d17bc18cfade 100644 --- a/mmv1/third_party/terraform/tests/resource_google_service_account_iam_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_google_service_account_iam_test.go.erb @@ -17,11 +17,11 @@ import ( func TestAccServiceAccountIamBinding(t *testing.T) { t.Parallel() - account := fmt.Sprintf("tf-test-%d", RandInt(t)) + account := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccServiceAccountIamBinding_basic(account), @@ -40,13 +40,13 @@ func TestAccServiceAccountIamBinding(t *testing.T) { func TestAccServiceAccountIamBinding_withCondition(t *testing.T) { t.Parallel() - account := fmt.Sprintf("tf-test-%d", RandInt(t)) + account := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) conditionExpr := `request.time < timestamp(\"2020-01-01T00:00:00Z\")` conditionTitle := "expires_after_2019_12_31" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccServiceAccountIamBinding_withCondition(account, "user:admin@hashicorptest.com", conditionTitle, conditionExpr), @@ -67,13 +67,13 @@ func TestAccServiceAccountIamBinding_withAndWithoutCondition(t *testing.T) { acctest.SkipIfVcr(t) t.Parallel() - account := fmt.Sprintf("tf-test-%d", RandInt(t)) + account := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) conditionExpr := `request.time < timestamp(\"2020-01-01T00:00:00Z\")` conditionTitle := "expires_after_2019_12_31" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccServiceAccountIamBinding_withAndWithoutCondition(account, "user:admin@hashicorptest.com", conditionTitle, conditionExpr), @@ -98,13 +98,13 @@ func TestAccServiceAccountIamBinding_withAndWithoutCondition(t *testing.T) { func TestAccServiceAccountIamMember(t *testing.T) { t.Parallel() - account := fmt.Sprintf("tf-test-%d", RandInt(t)) + account := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) email := serviceAccountCanonicalEmail(account) identity := fmt.Sprintf("serviceAccount:%s", email) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccServiceAccountIamMember_basic(account, email), @@ -131,13 +131,13 @@ func TestAccServiceAccountIamMember(t *testing.T) { func TestAccServiceAccountIamMember_withCondition(t *testing.T) { t.Parallel() - account := fmt.Sprintf("tf-test-%d", RandInt(t)) + account := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) identity := fmt.Sprintf("serviceAccount:%s", serviceAccountCanonicalEmail(account)) conditionTitle := "expires_after_2019_12_31" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccServiceAccountIamMember_withCondition(account, conditionTitle), @@ -158,13 +158,13 @@ func TestAccServiceAccountIamMember_withAndWithoutCondition(t *testing.T) { acctest.SkipIfVcr(t) t.Parallel() - account := fmt.Sprintf("tf-test-%d", RandInt(t)) + account := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) identity := fmt.Sprintf("serviceAccount:%s", serviceAccountCanonicalEmail(account)) conditionTitle := "expires_after_2019_12_31" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccServiceAccountIamMember_withAndWithoutCondition(account, conditionTitle), @@ -189,11 +189,11 @@ func TestAccServiceAccountIamMember_withAndWithoutCondition(t *testing.T) { func TestAccServiceAccountIamPolicy(t *testing.T) { t.Parallel() - account := fmt.Sprintf("tf-test-%d", RandInt(t)) + account := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccServiceAccountIamPolicy_basic(account), @@ -212,11 +212,11 @@ func TestAccServiceAccountIamPolicy(t *testing.T) { func TestAccServiceAccountIamPolicy_withCondition(t *testing.T) { t.Parallel() - account := fmt.Sprintf("tf-test-%d", RandInt(t)) + account := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccServiceAccountIamPolicy_withCondition(account), @@ -236,12 +236,12 @@ func TestAccServiceAccountIamPolicy_withCondition(t *testing.T) { func TestAccServiceAccountIamMember_federatedIdentity(t *testing.T) { t.Parallel() - account := fmt.Sprintf("tf-test-%d", RandInt(t)) - pool := fmt.Sprintf("tf-test-%d", RandInt(t)) + account := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) + pool := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccServiceAccountIamMember_federatedIdentity(account, pool), @@ -259,12 +259,12 @@ func TestAccServiceAccountIamMember_federatedIdentity(t *testing.T) { func TestAccServiceAccountIamBinding_federatedIdentity(t *testing.T) { t.Parallel() - account := fmt.Sprintf("tf-test-%d", RandInt(t)) - pool := fmt.Sprintf("tf-test-%d", RandInt(t)) + account := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) + pool := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccServiceAccountIamBinding_federatedIdentity(account, pool), @@ -283,12 +283,12 @@ func TestAccServiceAccountIamBinding_federatedIdentity(t *testing.T) { func TestAccServiceAccountIamPolicy_federatedIdentity(t *testing.T) { t.Parallel() - account := fmt.Sprintf("tf-test-%d", RandInt(t)) - pool := fmt.Sprintf("tf-test-%d", RandInt(t)) + account := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) + pool := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccServiceAccountIamPolicy_federatedIdentity(account, pool), @@ -321,7 +321,7 @@ func testAccServiceAccountIamMember_generateFederatedIdentityStateId(state *terr // The content of the binding is tested in the import tests. func testAccCheckGoogleServiceAccountIam(t *testing.T, account string, numBindings int) resource.TestCheckFunc { return func(s *terraform.State) error { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) p, err := config.NewIamClient(config.UserAgent).Projects.ServiceAccounts.GetIamPolicy(serviceAccountCanonicalId(account)).OptionsRequestedPolicyVersion(tpgiamresource.IamPolicyVersion).Do() if err != nil { return err diff --git a/mmv1/third_party/terraform/tests/resource_google_service_account_key_test.go b/mmv1/third_party/terraform/tests/resource_google_service_account_key_test.go index d851989a878d..5f5147f08d98 100644 --- a/mmv1/third_party/terraform/tests/resource_google_service_account_key_test.go +++ b/mmv1/third_party/terraform/tests/resource_google_service_account_key_test.go @@ -14,11 +14,11 @@ func TestAccServiceAccountKey_basic(t *testing.T) { t.Parallel() resourceName := "google_service_account_key.acceptance" - accountID := "a" + RandString(t, 10) + accountID := "a" + acctest.RandString(t, 10) displayName := "Terraform Test" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccServiceAccountKey(accountID, displayName), @@ -38,11 +38,11 @@ func TestAccServiceAccountKey_fromEmail(t *testing.T) { t.Parallel() resourceName := "google_service_account_key.acceptance" - accountID := "a" + RandString(t, 10) + accountID := "a" + acctest.RandString(t, 10) displayName := "Terraform Test" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccServiceAccountKey_fromEmail(accountID, displayName), @@ -62,11 +62,11 @@ func TestAccServiceAccountKey_fromCertificate(t *testing.T) { t.Parallel() resourceName := "google_service_account_key.acceptance" - accountID := "a" + RandString(t, 10) + accountID := "a" + acctest.RandString(t, 10) displayName := "Terraform Test" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccServiceAccountKey_fromCertificate(accountID, displayName), @@ -93,7 +93,7 @@ func testAccCheckGoogleServiceAccountKeyExists(t *testing.T, r string) resource. if rs.Primary.ID == "" { return fmt.Errorf("No ID is set") } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) _, err := config.NewIamClient(config.UserAgent).Projects.ServiceAccounts.Keys.Get(rs.Primary.ID).Do() if err != nil { diff --git a/mmv1/third_party/terraform/tests/resource_google_service_account_test.go b/mmv1/third_party/terraform/tests/resource_google_service_account_test.go index b01926ce1e91..f784bc06829e 100644 --- a/mmv1/third_party/terraform/tests/resource_google_service_account_test.go +++ b/mmv1/third_party/terraform/tests/resource_google_service_account_test.go @@ -14,7 +14,7 @@ import ( func TestAccServiceAccount_basic(t *testing.T) { t.Parallel() - accountId := "a" + RandString(t, 10) + accountId := "a" + acctest.RandString(t, 10) uniqueId := "" displayName := "Terraform Test" displayName2 := "Terraform Test Update" @@ -22,9 +22,9 @@ func TestAccServiceAccount_basic(t *testing.T) { desc2 := "" project := envvar.GetTestProjectFromEnv() expectedEmail := fmt.Sprintf("%s@%s.iam.gserviceaccount.com", accountId, project) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ // The first step creates a basic service account { @@ -91,15 +91,15 @@ func TestAccServiceAccount_basic(t *testing.T) { func TestAccServiceAccount_Disabled(t *testing.T) { t.Parallel() - accountId := "a" + RandString(t, 10) + accountId := "a" + acctest.RandString(t, 10) uniqueId := "" displayName := "Terraform Test" desc := "test description" project := envvar.GetTestProjectFromEnv() expectedEmail := fmt.Sprintf("%s@%s.iam.gserviceaccount.com", accountId, project) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ // The first step creates a basic service account { diff --git a/mmv1/third_party/terraform/tests/resource_google_service_networking_peered_dns_domain_test.go b/mmv1/third_party/terraform/tests/resource_google_service_networking_peered_dns_domain_test.go index 670ce4b1bb2d..7029ae1a0c18 100644 --- a/mmv1/third_party/terraform/tests/resource_google_service_networking_peered_dns_domain_test.go +++ b/mmv1/third_party/terraform/tests/resource_google_service_networking_peered_dns_domain_test.go @@ -14,13 +14,13 @@ func TestAccServiceNetworkingPeeredDNSDomain_basic(t *testing.T) { org := envvar.GetTestOrgFromEnv(t) billingId := envvar.GetTestBillingAccountFromEnv(t) - project := fmt.Sprintf("tf-test-%d", RandInt(t)) - name := fmt.Sprintf("test-name-%d", RandInt(t)) + project := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) + name := fmt.Sprintf("test-name-%d", acctest.RandInt(t)) service := "servicenetworking.googleapis.com" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccServiceNetworkingPeeredDNSDomain_basic(project, org, billingId, name, service), diff --git a/mmv1/third_party/terraform/tests/resource_google_service_usage_consumer_quota_override_test.go.erb b/mmv1/third_party/terraform/tests/resource_google_service_usage_consumer_quota_override_test.go.erb index 8ef9e2812fdc..cbe90de7c983 100644 --- a/mmv1/third_party/terraform/tests/resource_google_service_usage_consumer_quota_override_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_google_service_usage_consumer_quota_override_test.go.erb @@ -17,12 +17,12 @@ func TestAccServiceUsageConsumerQuotaOverride_consumerQuotaOverrideCustomIncorre context := map[string]interface{}{ "org_id": envvar.GetTestOrgFromEnv(t), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderBetaFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), CheckDestroy: testAccCheckServiceUsageConsumerQuotaOverrideDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_healthcare_dataset_iam_test.go b/mmv1/third_party/terraform/tests/resource_healthcare_dataset_iam_test.go index 215dca9d0d9d..160b2c5d6b11 100644 --- a/mmv1/third_party/terraform/tests/resource_healthcare_dataset_iam_test.go +++ b/mmv1/third_party/terraform/tests/resource_healthcare_dataset_iam_test.go @@ -20,9 +20,9 @@ func TestAccHealthcareDatasetIamBinding(t *testing.T) { t.Parallel() projectId := envvar.GetTestProjectFromEnv() - account := fmt.Sprintf("tf-test-%d", RandInt(t)) + account := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) roleId := "roles/healthcare.datasetAdmin" - datasetName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + datasetName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) datasetId := &healthcare.HealthcareDatasetId{ Project: projectId, @@ -30,9 +30,9 @@ func TestAccHealthcareDatasetIamBinding(t *testing.T) { Name: datasetName, } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { // Test Iam Binding creation @@ -69,9 +69,9 @@ func TestAccHealthcareDatasetIamMember(t *testing.T) { t.Parallel() projectId := envvar.GetTestProjectFromEnv() - account := fmt.Sprintf("tf-test-%d", RandInt(t)) + account := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) roleId := "roles/healthcare.datasetViewer" - datasetName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + datasetName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) datasetId := &healthcare.HealthcareDatasetId{ Project: projectId, @@ -79,9 +79,9 @@ func TestAccHealthcareDatasetIamMember(t *testing.T) { Name: datasetName, } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { // Test Iam Member creation (no update for member, no need to test) @@ -104,9 +104,9 @@ func TestAccHealthcareDatasetIamPolicy(t *testing.T) { t.Parallel() projectId := envvar.GetTestProjectFromEnv() - account := fmt.Sprintf("tf-test-%d", RandInt(t)) + account := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) roleId := "roles/healthcare.datasetAdmin" - datasetName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + datasetName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) datasetId := &healthcare.HealthcareDatasetId{ Project: projectId, @@ -114,9 +114,9 @@ func TestAccHealthcareDatasetIamPolicy(t *testing.T) { Name: datasetName, } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccHealthcareDatasetIamPolicy_basic(account, datasetName, roleId), @@ -139,7 +139,7 @@ func TestAccHealthcareDatasetIamPolicy(t *testing.T) { func testAccCheckGoogleHealthcareDatasetIam(t *testing.T, datasetId, role string, members []string) resource.TestCheckFunc { return func(s *terraform.State) error { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) p, err := config.NewHealthcareClient(config.UserAgent).Projects.Locations.Datasets.GetIamPolicy(datasetId).Do() if err != nil { return err diff --git a/mmv1/third_party/terraform/tests/resource_healthcare_dataset_test.go b/mmv1/third_party/terraform/tests/resource_healthcare_dataset_test.go index d390a3c41ca9..98ff303f3994 100644 --- a/mmv1/third_party/terraform/tests/resource_healthcare_dataset_test.go +++ b/mmv1/third_party/terraform/tests/resource_healthcare_dataset_test.go @@ -76,13 +76,13 @@ func TestAccHealthcareDataset_basic(t *testing.T) { t.Parallel() location := "us-central1" - datasetName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + datasetName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) timeZone := "America/New_York" resourceName := "google_healthcare_dataset.dataset" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckHealthcareDatasetDestroyProducer(t), Steps: []resource.TestStep{ { @@ -115,7 +115,7 @@ func testAccCheckGoogleHealthcareDatasetUpdate(t *testing.T, timeZone string) re continue } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) gcpResourceUri, err := tpgresource.ReplaceVarsForTest(config, rs, "projects/{{project}}/locations/{{location}}/datasets/{{name}}") if err != nil { diff --git a/mmv1/third_party/terraform/tests/resource_healthcare_dicom_store_iam_test.go b/mmv1/third_party/terraform/tests/resource_healthcare_dicom_store_iam_test.go index 6b296f406cba..1e71aef36932 100644 --- a/mmv1/third_party/terraform/tests/resource_healthcare_dicom_store_iam_test.go +++ b/mmv1/third_party/terraform/tests/resource_healthcare_dicom_store_iam_test.go @@ -18,19 +18,19 @@ func TestAccHealthcareDicomStoreIamBinding(t *testing.T) { t.Parallel() projectId := envvar.GetTestProjectFromEnv() - account := fmt.Sprintf("tf-test-%d", RandInt(t)) + account := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) roleId := "roles/healthcare.dicomStoreAdmin" - datasetName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + datasetName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) datasetId := &healthcare.HealthcareDatasetId{ Project: projectId, Location: DEFAULT_HEALTHCARE_TEST_LOCATION, Name: datasetName, } - dicomStoreName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + dicomStoreName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { // Test Iam Binding creation @@ -67,19 +67,19 @@ func TestAccHealthcareDicomStoreIamMember(t *testing.T) { t.Parallel() projectId := envvar.GetTestProjectFromEnv() - account := fmt.Sprintf("tf-test-%d", RandInt(t)) + account := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) roleId := "roles/healthcare.dicomEditor" - datasetName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + datasetName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) datasetId := &healthcare.HealthcareDatasetId{ Project: projectId, Location: DEFAULT_HEALTHCARE_TEST_LOCATION, Name: datasetName, } - dicomStoreName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + dicomStoreName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { // Test Iam Member creation (no update for member, no need to test) @@ -102,19 +102,19 @@ func TestAccHealthcareDicomStoreIamPolicy(t *testing.T) { t.Parallel() projectId := envvar.GetTestProjectFromEnv() - account := fmt.Sprintf("tf-test-%d", RandInt(t)) + account := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) roleId := "roles/healthcare.dicomViewer" - datasetName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + datasetName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) datasetId := &healthcare.HealthcareDatasetId{ Project: projectId, Location: DEFAULT_HEALTHCARE_TEST_LOCATION, Name: datasetName, } - dicomStoreName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + dicomStoreName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { // Test Iam Policy creation (no update for policy, no need to test) @@ -143,7 +143,7 @@ func testAccCheckGoogleHealthcareDicomStoreIamBindingExists(t *testing.T, bindin return fmt.Errorf("Not found: %s", bindingResourceName) } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) dicomStoreId, err := healthcare.ParseHealthcareDicomStoreId(bindingRs.Primary.Attributes["dicom_store_id"], config) if err != nil { @@ -179,7 +179,7 @@ func testAccCheckGoogleHealthcareDicomStoreIamMemberExists(t *testing.T, n, role return fmt.Errorf("Not found: %s", n) } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) dicomStoreId, err := healthcare.ParseHealthcareDicomStoreId(rs.Primary.Attributes["dicom_store_id"], config) if err != nil { @@ -214,7 +214,7 @@ func testAccCheckGoogleHealthcareDicomStoreIamPolicyExists(t *testing.T, n, role return fmt.Errorf("Not found: %s", n) } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) dicomStoreId, err := healthcare.ParseHealthcareDicomStoreId(rs.Primary.Attributes["dicom_store_id"], config) if err != nil { diff --git a/mmv1/third_party/terraform/tests/resource_healthcare_dicom_store_test.go b/mmv1/third_party/terraform/tests/resource_healthcare_dicom_store_test.go index 6e466948dc7c..85691668c365 100644 --- a/mmv1/third_party/terraform/tests/resource_healthcare_dicom_store_test.go +++ b/mmv1/third_party/terraform/tests/resource_healthcare_dicom_store_test.go @@ -77,14 +77,14 @@ func TestAccHealthcareDicomStoreIdParsing(t *testing.T) { func TestAccHealthcareDicomStore_basic(t *testing.T) { t.Parallel() - datasetName := fmt.Sprintf("tf-test-dataset-%s", RandString(t, 10)) - dicomStoreName := fmt.Sprintf("tf-test-dicom-store-%s", RandString(t, 10)) - pubsubTopic := fmt.Sprintf("tf-test-topic-%s", RandString(t, 10)) + datasetName := fmt.Sprintf("tf-test-dataset-%s", acctest.RandString(t, 10)) + dicomStoreName := fmt.Sprintf("tf-test-dicom-store-%s", acctest.RandString(t, 10)) + pubsubTopic := fmt.Sprintf("tf-test-topic-%s", acctest.RandString(t, 10)) resourceName := "google_healthcare_dicom_store.default" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckHealthcareDicomStoreDestroyProducer(t), Steps: []resource.TestStep{ { @@ -167,7 +167,7 @@ func testAccCheckGoogleHealthcareDicomStoreUpdate(t *testing.T, pubsubTopic stri } foundResource = true - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) gcpResourceUri, err := tpgresource.ReplaceVarsForTest(config, rs, "{{dataset}}/dicomStores/{{name}}") if err != nil { diff --git a/mmv1/third_party/terraform/tests/resource_healthcare_fhir_store_iam_test.go b/mmv1/third_party/terraform/tests/resource_healthcare_fhir_store_iam_test.go index 3024349fe708..8d89943612e7 100644 --- a/mmv1/third_party/terraform/tests/resource_healthcare_fhir_store_iam_test.go +++ b/mmv1/third_party/terraform/tests/resource_healthcare_fhir_store_iam_test.go @@ -18,19 +18,19 @@ func TestAccHealthcareFhirStoreIamBinding(t *testing.T) { t.Parallel() projectId := envvar.GetTestProjectFromEnv() - account := fmt.Sprintf("tf-test-%d", RandInt(t)) + account := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) roleId := "roles/healthcare.fhirStoreAdmin" - datasetName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + datasetName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) datasetId := &healthcare.HealthcareDatasetId{ Project: projectId, Location: DEFAULT_HEALTHCARE_TEST_LOCATION, Name: datasetName, } - fhirStoreName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + fhirStoreName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { // Test Iam Binding creation @@ -67,19 +67,19 @@ func TestAccHealthcareFhirStoreIamMember(t *testing.T) { t.Parallel() projectId := envvar.GetTestProjectFromEnv() - account := fmt.Sprintf("tf-test-%d", RandInt(t)) + account := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) roleId := "roles/healthcare.fhirResourceEditor" - datasetName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + datasetName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) datasetId := &healthcare.HealthcareDatasetId{ Project: projectId, Location: DEFAULT_HEALTHCARE_TEST_LOCATION, Name: datasetName, } - fhirStoreName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + fhirStoreName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { // Test Iam Member creation (no update for member, no need to test) @@ -102,19 +102,19 @@ func TestAccHealthcareFhirStoreIamPolicy(t *testing.T) { t.Parallel() projectId := envvar.GetTestProjectFromEnv() - account := fmt.Sprintf("tf-test-%d", RandInt(t)) + account := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) roleId := "roles/healthcare.fhirResourceEditor" - datasetName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + datasetName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) datasetId := &healthcare.HealthcareDatasetId{ Project: projectId, Location: DEFAULT_HEALTHCARE_TEST_LOCATION, Name: datasetName, } - fhirStoreName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + fhirStoreName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { // Test Iam Policy creation (no update for policy, no need to test) @@ -143,7 +143,7 @@ func testAccCheckGoogleHealthcareFhirStoreIamBindingExists(t *testing.T, binding return fmt.Errorf("Not found: %s", bindingResourceName) } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) fhirStoreId, err := healthcare.ParseHealthcareFhirStoreId(bindingRs.Primary.Attributes["fhir_store_id"], config) if err != nil { @@ -179,7 +179,7 @@ func testAccCheckGoogleHealthcareFhirStoreIamMemberExists(t *testing.T, n, role, return fmt.Errorf("Not found: %s", n) } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) fhirStoreId, err := healthcare.ParseHealthcareFhirStoreId(rs.Primary.Attributes["fhir_store_id"], config) if err != nil { @@ -214,7 +214,7 @@ func testAccCheckGoogleHealthcareFhirStoreIamPolicyExists(t *testing.T, n, role, return fmt.Errorf("Not found: %s", n) } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) fhirStoreId, err := healthcare.ParseHealthcareFhirStoreId(rs.Primary.Attributes["fhir_store_id"], config) if err != nil { diff --git a/mmv1/third_party/terraform/tests/resource_healthcare_fhir_store_test.go b/mmv1/third_party/terraform/tests/resource_healthcare_fhir_store_test.go index 1fb31757c077..8d5205347bf8 100644 --- a/mmv1/third_party/terraform/tests/resource_healthcare_fhir_store_test.go +++ b/mmv1/third_party/terraform/tests/resource_healthcare_fhir_store_test.go @@ -77,14 +77,14 @@ func TestAccHealthcareFhirStoreIdParsing(t *testing.T) { func TestAccHealthcareFhirStore_basic(t *testing.T) { t.Parallel() - datasetName := fmt.Sprintf("tf-test-dataset-%s", RandString(t, 10)) - fhirStoreName := fmt.Sprintf("tf-test-fhir-store-%s", RandString(t, 10)) - pubsubTopic := fmt.Sprintf("tf-test-topic-%s", RandString(t, 10)) + datasetName := fmt.Sprintf("tf-test-dataset-%s", acctest.RandString(t, 10)) + fhirStoreName := fmt.Sprintf("tf-test-fhir-store-%s", acctest.RandString(t, 10)) + pubsubTopic := fmt.Sprintf("tf-test-topic-%s", acctest.RandString(t, 10)) resourceName := "google_healthcare_fhir_store.default" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckHealthcareFhirStoreDestroyProducer(t), Steps: []resource.TestStep{ { @@ -177,7 +177,7 @@ func testAccCheckGoogleHealthcareFhirStoreUpdate(t *testing.T, pubsubTopic strin } foundResource = true - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) gcpResourceUri, err := tpgresource.ReplaceVarsForTest(config, rs, "{{dataset}}/fhirStores/{{name}}") if err != nil { diff --git a/mmv1/third_party/terraform/tests/resource_healthcare_hl7_v2_store_iam_test.go b/mmv1/third_party/terraform/tests/resource_healthcare_hl7_v2_store_iam_test.go index 7d4f5e8e3a25..6ef1e396225d 100644 --- a/mmv1/third_party/terraform/tests/resource_healthcare_hl7_v2_store_iam_test.go +++ b/mmv1/third_party/terraform/tests/resource_healthcare_hl7_v2_store_iam_test.go @@ -18,19 +18,19 @@ func TestAccHealthcareHl7V2StoreIamBinding(t *testing.T) { t.Parallel() projectId := envvar.GetTestProjectFromEnv() - account := fmt.Sprintf("tf-test-%d", RandInt(t)) + account := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) roleId := "roles/healthcare.hl7V2StoreAdmin" - datasetName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + datasetName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) datasetId := &healthcare.HealthcareDatasetId{ Project: projectId, Location: DEFAULT_HEALTHCARE_TEST_LOCATION, Name: datasetName, } - hl7V2StoreName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + hl7V2StoreName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { // Test Iam Binding creation @@ -67,19 +67,19 @@ func TestAccHealthcareHl7V2StoreIamMember(t *testing.T) { t.Parallel() projectId := envvar.GetTestProjectFromEnv() - account := fmt.Sprintf("tf-test-%d", RandInt(t)) + account := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) roleId := "roles/healthcare.hl7V2Editor" - datasetName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + datasetName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) datasetId := &healthcare.HealthcareDatasetId{ Project: projectId, Location: DEFAULT_HEALTHCARE_TEST_LOCATION, Name: datasetName, } - hl7V2StoreName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + hl7V2StoreName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { // Test Iam Member creation (no update for member, no need to test) @@ -102,19 +102,19 @@ func TestAccHealthcareHl7V2StoreIamPolicy(t *testing.T) { t.Parallel() projectId := envvar.GetTestProjectFromEnv() - account := fmt.Sprintf("tf-test-%d", RandInt(t)) + account := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) roleId := "roles/healthcare.hl7V2Consumer" - datasetName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + datasetName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) datasetId := &healthcare.HealthcareDatasetId{ Project: projectId, Location: DEFAULT_HEALTHCARE_TEST_LOCATION, Name: datasetName, } - hl7V2StoreName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + hl7V2StoreName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { // Test Iam Policy creation (no update for policy, no need to test) @@ -143,7 +143,7 @@ func testAccCheckGoogleHealthcareHl7V2StoreIamBindingExists(t *testing.T, bindin return fmt.Errorf("Not found: %s", bindingResourceName) } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) hl7V2StoreId, err := healthcare.ParseHealthcareHl7V2StoreId(bindingRs.Primary.Attributes["hl7_v2_store_id"], config) if err != nil { @@ -179,7 +179,7 @@ func testAccCheckGoogleHealthcareHl7V2StoreIamMemberExists(t *testing.T, n, role return fmt.Errorf("Not found: %s", n) } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) hl7V2StoreId, err := healthcare.ParseHealthcareHl7V2StoreId(rs.Primary.Attributes["hl7_v2_store_id"], config) if err != nil { @@ -214,7 +214,7 @@ func testAccCheckGoogleHealthcareHl7V2StoreIamPolicyExists(t *testing.T, n, role return fmt.Errorf("Not found: %s", n) } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) hl7V2StoreId, err := healthcare.ParseHealthcareHl7V2StoreId(rs.Primary.Attributes["hl7_v2_store_id"], config) if err != nil { diff --git a/mmv1/third_party/terraform/tests/resource_healthcare_hl7_v2_store_test.go.erb b/mmv1/third_party/terraform/tests/resource_healthcare_hl7_v2_store_test.go.erb index 1b4981df2592..69c0b15a1857 100644 --- a/mmv1/third_party/terraform/tests/resource_healthcare_hl7_v2_store_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_healthcare_hl7_v2_store_test.go.erb @@ -78,14 +78,14 @@ func TestAccHealthcareHl7V2StoreIdParsing(t *testing.T) { func TestAccHealthcareHl7V2Store_basic(t *testing.T) { t.Parallel() - datasetName := fmt.Sprintf("tf-test-dataset-%s", RandString(t, 10)) - hl7_v2StoreName := fmt.Sprintf("tf-test-hl7_v2-store-%s", RandString(t, 10)) - pubsubTopic := fmt.Sprintf("tf-test-topic-%s", RandString(t, 10)) + datasetName := fmt.Sprintf("tf-test-dataset-%s", acctest.RandString(t, 10)) + hl7_v2StoreName := fmt.Sprintf("tf-test-hl7_v2-store-%s", acctest.RandString(t, 10)) + pubsubTopic := fmt.Sprintf("tf-test-topic-%s", acctest.RandString(t, 10)) resourceName := "google_healthcare_hl7_v2_store.default" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckHealthcareHl7V2StoreDestroyProducer(t), Steps: []resource.TestStep{ { @@ -124,13 +124,13 @@ func TestAccHealthcareHl7V2Store_basic(t *testing.T) { func TestAccHealthcareHl7V2Store_updateSchema(t *testing.T) { t.Parallel() - datasetName := fmt.Sprintf("tf-test-dataset-%s", RandString(t, 10)) - hl7_v2StoreName := fmt.Sprintf("tf-test-hl7_v2-store-%s", RandString(t, 10)) + datasetName := fmt.Sprintf("tf-test-dataset-%s", acctest.RandString(t, 10)) + hl7_v2StoreName := fmt.Sprintf("tf-test-hl7_v2-store-%s", acctest.RandString(t, 10)) resourceName := "google_healthcare_hl7_v2_store.default" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderBetaFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), CheckDestroy: testAccCheckHealthcareHl7V2StoreDestroyProducer(t), Steps: []resource.TestStep{ { @@ -263,7 +263,7 @@ func testAccCheckGoogleHealthcareHl7V2StoreUpdate(t *testing.T, pubsubTopic stri } foundResource = true - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) gcpResourceUri, err := tpgresource.ReplaceVarsForTest(config, rs, "{{dataset}}/hl7V2Stores/{{name}}") if err != nil { diff --git a/mmv1/third_party/terraform/tests/resource_iam_access_boundary_policy_test.go b/mmv1/third_party/terraform/tests/resource_iam_access_boundary_policy_test.go index d1852830f7c1..0daff55c0e65 100644 --- a/mmv1/third_party/terraform/tests/resource_iam_access_boundary_policy_test.go +++ b/mmv1/third_party/terraform/tests/resource_iam_access_boundary_policy_test.go @@ -38,12 +38,12 @@ func testAccIAM2AccessBoundaryPolicy_iamAccessBoundaryPolicyBasic(t *testing.T) context := map[string]interface{}{ "org_id": envvar.GetTestOrgFromEnv(t), "billing_account": envvar.GetTestBillingAccountFromEnv(t), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckIAM2AccessBoundaryPolicyDestroyProducer(t), Steps: []resource.TestStep{ { @@ -185,7 +185,7 @@ func testAccCheckIAM2AccessBoundaryPolicyDestroyProducer(t *testing.T) func(s *t continue } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{IAM2BasePath}}policies/{{parent}}/accessboundarypolicies/{{name}}") if err != nil { diff --git a/mmv1/third_party/terraform/tests/resource_iam_beta_workload_identity_pool_provider_test.go.erb b/mmv1/third_party/terraform/tests/resource_iam_beta_workload_identity_pool_provider_test.go.erb index 9f76f6e2722d..29f70790ce80 100644 --- a/mmv1/third_party/terraform/tests/resource_iam_beta_workload_identity_pool_provider_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_iam_beta_workload_identity_pool_provider_test.go.erb @@ -13,12 +13,12 @@ func TestAccIAMBetaWorkloadIdentityPoolProvider_aws(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckIAMBetaWorkloadIdentityPoolProviderDestroyProducer(t), Steps: []resource.TestStep{ { @@ -53,12 +53,12 @@ func TestAccIAMBetaWorkloadIdentityPoolProvider_oidc(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckIAMBetaWorkloadIdentityPoolProviderDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_iam_beta_workload_identity_pool_test.go.erb b/mmv1/third_party/terraform/tests/resource_iam_beta_workload_identity_pool_test.go.erb index 9cd45d306a25..624ddb328437 100644 --- a/mmv1/third_party/terraform/tests/resource_iam_beta_workload_identity_pool_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_iam_beta_workload_identity_pool_test.go.erb @@ -13,11 +13,11 @@ import ( func TestAccIAMBetaWorkloadIdentityPool_full(t *testing.T) { t.Parallel() - randomSuffix := RandString(t, 10) + randomSuffix := acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckIAMBetaWorkloadIdentityPoolDestroyProducer(t), Steps: []resource.TestStep{ { @@ -43,11 +43,11 @@ func TestAccIAMBetaWorkloadIdentityPool_full(t *testing.T) { func TestAccIAMBetaWorkloadIdentityPool_minimal(t *testing.T) { t.Parallel() - randomSuffix := RandString(t, 10) + randomSuffix := acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckIAMBetaWorkloadIdentityPoolDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_iam_deny_policy_test.go.erb b/mmv1/third_party/terraform/tests/resource_iam_deny_policy_test.go.erb index 904be93543c7..8fb1ffbdd762 100644 --- a/mmv1/third_party/terraform/tests/resource_iam_deny_policy_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_iam_deny_policy_test.go.erb @@ -18,12 +18,12 @@ func TestAccIAM2DenyPolicy_iamDenyPolicyUpdate(t *testing.T) { context := map[string]interface{}{ "org_id": envvar.GetTestOrgFromEnv(t), "billing_account": envvar.GetTestBillingAccountFromEnv(t), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderBetaFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), CheckDestroy: testAccCheckIAM2DenyPolicyDestroyProducer(t), Steps: []resource.TestStep{ { @@ -62,12 +62,12 @@ func TestAccIAM2DenyPolicy_iamDenyPolicyFolderParent(t *testing.T) { context := map[string]interface{}{ "org_id": envvar.GetTestOrgFromEnv(t), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderBetaFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), CheckDestroy: testAccCheckIAM2DenyPolicyDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_iam_workforce_pool_workforce_pool_provider_test.go.erb b/mmv1/third_party/terraform/tests/resource_iam_workforce_pool_workforce_pool_provider_test.go.erb index b540ea979323..4bcb3d0cf0d1 100644 --- a/mmv1/third_party/terraform/tests/resource_iam_workforce_pool_workforce_pool_provider_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_iam_workforce_pool_workforce_pool_provider_test.go.erb @@ -17,15 +17,15 @@ import ( func TestAccIAMWorkforcePoolWorkforcePoolProvider_oidc(t *testing.T) { t.Parallel() - random_suffix := RandString(t, 10) + random_suffix := acctest.RandString(t, 10) context := map[string]interface{}{ "org_id": envvar.GetTestOrgFromEnv(t), "random_suffix": random_suffix, } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckIAMWorkforcePoolWorkforcePoolDestroyProducer(t), Steps: []resource.TestStep{ { @@ -65,15 +65,15 @@ func TestAccIAMWorkforcePoolWorkforcePoolProvider_oidc(t *testing.T) { func TestAccIAMWorkforcePoolWorkforcePoolProvider_saml(t *testing.T) { t.Parallel() - random_suffix := RandString(t, 10) + random_suffix := acctest.RandString(t, 10) context := map[string]interface{}{ "org_id": envvar.GetTestOrgFromEnv(t), "random_suffix": random_suffix, } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckIAMWorkforcePoolWorkforcePoolDestroyProducer(t), Steps: []resource.TestStep{ { @@ -117,7 +117,7 @@ func testAccCheckIAMWorkforcePoolWorkforcePoolProviderAccess(t *testing.T, rando if !ok { return fmt.Errorf("Resource %s Not found", pool_resource_name) } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) pool_url, err := tpgresource.ReplaceVarsForTest(config, pool_rs, "{{IAMWorkforcePoolBasePath}}locations/{{location}}/workforcePools/{{workforce_pool_id}}") if err != nil { diff --git a/mmv1/third_party/terraform/tests/resource_iam_workforce_pool_workforce_pool_test.go.erb b/mmv1/third_party/terraform/tests/resource_iam_workforce_pool_workforce_pool_test.go.erb index f55aec007f02..cfb2f52f4354 100644 --- a/mmv1/third_party/terraform/tests/resource_iam_workforce_pool_workforce_pool_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_iam_workforce_pool_workforce_pool_test.go.erb @@ -13,12 +13,12 @@ func TestAccIAMWorkforcePoolWorkforcePool_full(t *testing.T) { context := map[string]interface{}{ "org_id": envvar.GetTestOrgFromEnv(t), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckIAMWorkforcePoolWorkforcePoolDestroyProducer(t), Steps: []resource.TestStep{ { @@ -46,12 +46,12 @@ func TestAccIAMWorkforcePoolWorkforcePool_minimal(t *testing.T) { context := map[string]interface{}{ "org_id": envvar.GetTestOrgFromEnv(t), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckIAMWorkforcePoolWorkforcePoolDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_iap_brand_test.go b/mmv1/third_party/terraform/tests/resource_iap_brand_test.go index 00222785c3c2..0f5b056c34a4 100644 --- a/mmv1/third_party/terraform/tests/resource_iap_brand_test.go +++ b/mmv1/third_party/terraform/tests/resource_iap_brand_test.go @@ -14,12 +14,12 @@ func TestAccIapBrand_iapBrandExample(t *testing.T) { context := map[string]interface{}{ "org_id": envvar.GetTestOrgFromEnv(t), "org_domain": envvar.GetTestOrgDomainFromEnv(t), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccIapBrand_iapBrandExample(context), diff --git a/mmv1/third_party/terraform/tests/resource_identity_platform_default_supported_idp_config_test.go b/mmv1/third_party/terraform/tests/resource_identity_platform_default_supported_idp_config_test.go index 9109d605fc46..c208e70ba2f1 100644 --- a/mmv1/third_party/terraform/tests/resource_identity_platform_default_supported_idp_config_test.go +++ b/mmv1/third_party/terraform/tests/resource_identity_platform_default_supported_idp_config_test.go @@ -17,12 +17,12 @@ func TestAccIdentityPlatformDefaultSupportedIdpConfig_defaultSupportedIdpConfigU t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckIdentityPlatformDefaultSupportedIdpConfigDestroyProducer(t), Steps: []resource.TestStep{ { @@ -55,7 +55,7 @@ func testAccCheckIdentityPlatformDefaultSupportedIdpConfigDestroyProducer(t *tes continue } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{IdentityPlatformBasePath}}projects/{{project}}/defaultSupportedIdpConfigs/{{client_id}}") if err != nil { diff --git a/mmv1/third_party/terraform/tests/resource_identity_platform_inbound_saml_config_test.go b/mmv1/third_party/terraform/tests/resource_identity_platform_inbound_saml_config_test.go index 88a1e4cbaf48..e9b2e2444f12 100644 --- a/mmv1/third_party/terraform/tests/resource_identity_platform_inbound_saml_config_test.go +++ b/mmv1/third_party/terraform/tests/resource_identity_platform_inbound_saml_config_test.go @@ -11,12 +11,12 @@ func TestAccIdentityPlatformInboundSamlConfig_inboundSamlConfigUpdate(t *testing t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckIdentityPlatformInboundSamlConfigDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_identity_platform_oauth_idp_config_test.go b/mmv1/third_party/terraform/tests/resource_identity_platform_oauth_idp_config_test.go index f3dd35b0ea21..9f9d8546889b 100644 --- a/mmv1/third_party/terraform/tests/resource_identity_platform_oauth_idp_config_test.go +++ b/mmv1/third_party/terraform/tests/resource_identity_platform_oauth_idp_config_test.go @@ -11,12 +11,12 @@ func TestAccIdentityPlatformOauthIdpConfig_identityPlatformOauthIdpConfigUpdate( t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckIdentityPlatformOauthIdpConfigDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_identity_platform_tenant_default_supported_idp_config_test.go b/mmv1/third_party/terraform/tests/resource_identity_platform_tenant_default_supported_idp_config_test.go index 1270a014efaf..d21311c8c688 100644 --- a/mmv1/third_party/terraform/tests/resource_identity_platform_tenant_default_supported_idp_config_test.go +++ b/mmv1/third_party/terraform/tests/resource_identity_platform_tenant_default_supported_idp_config_test.go @@ -11,12 +11,12 @@ func TestAccIdentityPlatformTenantDefaultSupportedIdpConfig_identityPlatformTena t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckIdentityPlatformTenantDefaultSupportedIdpConfigDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_identity_platform_tenant_indound_saml_config_test.go b/mmv1/third_party/terraform/tests/resource_identity_platform_tenant_indound_saml_config_test.go index a542fe2f599e..22932cee9d55 100644 --- a/mmv1/third_party/terraform/tests/resource_identity_platform_tenant_indound_saml_config_test.go +++ b/mmv1/third_party/terraform/tests/resource_identity_platform_tenant_indound_saml_config_test.go @@ -11,12 +11,12 @@ func TestAccIdentityPlatformTenantInboundSamlConfig_identityPlatformTenantInboun t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckIdentityPlatformTenantInboundSamlConfigDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_identity_platform_tenant_oauth_idp_config_test.go b/mmv1/third_party/terraform/tests/resource_identity_platform_tenant_oauth_idp_config_test.go index 0ce83cb99bfc..7a05382fde64 100644 --- a/mmv1/third_party/terraform/tests/resource_identity_platform_tenant_oauth_idp_config_test.go +++ b/mmv1/third_party/terraform/tests/resource_identity_platform_tenant_oauth_idp_config_test.go @@ -11,12 +11,12 @@ func TestAccIdentityPlatformTenantOauthIdpConfig_identityPlatformTenantOauthIdpC t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckIdentityPlatformTenantOauthIdpConfigDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_identity_platform_tenant_test.go b/mmv1/third_party/terraform/tests/resource_identity_platform_tenant_test.go index 39cd8d8d54d7..b28041dfca84 100644 --- a/mmv1/third_party/terraform/tests/resource_identity_platform_tenant_test.go +++ b/mmv1/third_party/terraform/tests/resource_identity_platform_tenant_test.go @@ -11,12 +11,12 @@ func TestAccIdentityPlatformTenant_identityPlatformTenantUpdate(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckIdentityPlatformTenantDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_kms_crypto_key_iam_test.go.erb b/mmv1/third_party/terraform/tests/resource_kms_crypto_key_iam_test.go.erb index d5d1a4f31e3d..e7845940c6c2 100644 --- a/mmv1/third_party/terraform/tests/resource_kms_crypto_key_iam_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_kms_crypto_key_iam_test.go.erb @@ -19,21 +19,21 @@ func TestAccKmsCryptoKeyIamBinding(t *testing.T) { t.Parallel() orgId := envvar.GetTestOrgFromEnv(t) - projectId := fmt.Sprintf("tf-test-%d", RandInt(t)) + projectId := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) billingAccount := envvar.GetTestBillingAccountFromEnv(t) - account := fmt.Sprintf("tf-test-%d", RandInt(t)) + account := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) roleId := "roles/cloudkms.cryptoKeyDecrypter" - keyRingName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + keyRingName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) keyRingId := &kms.KmsKeyRingId{ Project: projectId, Location: DEFAULT_KMS_TEST_LOCATION, Name: keyRingName, } - cryptoKeyName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + cryptoKeyName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { // Test Iam Binding creation @@ -71,22 +71,22 @@ func TestAccKmsCryptoKeyIamBinding_withCondition(t *testing.T) { t.Parallel() orgId := envvar.GetTestOrgFromEnv(t) - projectId := fmt.Sprintf("tf-test-%d", RandInt(t)) + projectId := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) billingAccount := envvar.GetTestBillingAccountFromEnv(t) - account := fmt.Sprintf("tf-test-%d", RandInt(t)) + account := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) roleId := "roles/cloudkms.cryptoKeyDecrypter" - keyRingName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + keyRingName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) keyRingId := &kms.KmsKeyRingId{ Project: projectId, Location: DEFAULT_KMS_TEST_LOCATION, Name: keyRingName, } - cryptoKeyName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + cryptoKeyName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) conditionTitle := "expires_after_2019_12_31" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccKmsCryptoKeyIamBinding_withCondition(projectId, orgId, billingAccount, account, keyRingName, cryptoKeyName, roleId, conditionTitle), @@ -106,21 +106,21 @@ func TestAccKmsCryptoKeyIamMember(t *testing.T) { t.Parallel() orgId := envvar.GetTestOrgFromEnv(t) - projectId := fmt.Sprintf("tf-test-%d", RandInt(t)) + projectId := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) billingAccount := envvar.GetTestBillingAccountFromEnv(t) - account := fmt.Sprintf("tf-test-%d", RandInt(t)) + account := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) roleId := "roles/cloudkms.cryptoKeyEncrypter" - keyRingName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + keyRingName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) keyRingId := &kms.KmsKeyRingId{ Project: projectId, Location: DEFAULT_KMS_TEST_LOCATION, Name: keyRingName, } - cryptoKeyName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + cryptoKeyName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { // Test Iam Member creation (no update for member, no need to test) @@ -144,22 +144,22 @@ func TestAccKmsCryptoKeyIamMember_withCondition(t *testing.T) { t.Parallel() orgId := envvar.GetTestOrgFromEnv(t) - projectId := fmt.Sprintf("tf-test-%d", RandInt(t)) + projectId := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) billingAccount := envvar.GetTestBillingAccountFromEnv(t) - account := fmt.Sprintf("tf-test-%d", RandInt(t)) + account := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) roleId := "roles/cloudkms.cryptoKeyEncrypter" - keyRingName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + keyRingName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) keyRingId := &kms.KmsKeyRingId{ Project: projectId, Location: DEFAULT_KMS_TEST_LOCATION, Name: keyRingName, } - cryptoKeyName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + cryptoKeyName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) conditionTitle := "expires_after_2019_12_31" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccKmsCryptoKeyIamMember_withCondition(projectId, orgId, billingAccount, account, keyRingName, cryptoKeyName, roleId, conditionTitle), @@ -179,22 +179,22 @@ func TestAccKmsCryptoKeyIamPolicy(t *testing.T) { t.Parallel() orgId := envvar.GetTestOrgFromEnv(t) - projectId := fmt.Sprintf("tf-test-%d", RandInt(t)) + projectId := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) billingAccount := envvar.GetTestBillingAccountFromEnv(t) - account := fmt.Sprintf("tf-test-%d", RandInt(t)) + account := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) roleId := "roles/cloudkms.cryptoKeyEncrypter" - keyRingName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + keyRingName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) keyRingId := &kms.KmsKeyRingId{ Project: projectId, Location: DEFAULT_KMS_TEST_LOCATION, Name: keyRingName, } - cryptoKeyName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + cryptoKeyName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccKmsCryptoKeyIamPolicy_basic(projectId, orgId, billingAccount, account, keyRingName, cryptoKeyName, roleId), @@ -220,23 +220,23 @@ func TestAccKmsCryptoKeyIamPolicy_withCondition(t *testing.T) { t.Parallel() orgId := envvar.GetTestOrgFromEnv(t) - projectId := fmt.Sprintf("tf-test-%d", RandInt(t)) + projectId := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) billingAccount := envvar.GetTestBillingAccountFromEnv(t) - account := fmt.Sprintf("tf-test-%d", RandInt(t)) + account := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) roleId := "roles/cloudkms.cryptoKeyEncrypter" - keyRingName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + keyRingName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) keyRingId := &kms.KmsKeyRingId{ Project: projectId, Location: DEFAULT_KMS_TEST_LOCATION, Name: keyRingName, } - cryptoKeyName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + cryptoKeyName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) conditionTitle := "expires_after_2019_12_31" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccKmsCryptoKeyIamPolicy_withCondition(projectId, orgId, billingAccount, account, keyRingName, cryptoKeyName, roleId, conditionTitle), @@ -259,7 +259,7 @@ func testAccCheckGoogleKmsCryptoKeyIamBindingExists(t *testing.T, bindingResourc return fmt.Errorf("Not found: %s", bindingResourceName) } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) cryptoKeyId, err := kms.ParseKmsCryptoKeyId(bindingRs.Primary.Attributes["crypto_key_id"], config) if err != nil { @@ -295,7 +295,7 @@ func testAccCheckGoogleKmsCryptoKeyIamMemberExists(t *testing.T, n, role, member return fmt.Errorf("Not found: %s", n) } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) cryptoKeyId, err := kms.ParseKmsCryptoKeyId(rs.Primary.Attributes["crypto_key_id"], config) if err != nil { @@ -330,7 +330,7 @@ func testAccCheckGoogleCryptoKmsKeyIam(t *testing.T, n, role string, members []s return fmt.Errorf("IAM policy resource not found") } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) cryptoKeyId, err := kms.ParseKmsCryptoKeyId(rs.Primary.Attributes["crypto_key_id"], config) if err != nil { diff --git a/mmv1/third_party/terraform/tests/resource_kms_crypto_key_test.go b/mmv1/third_party/terraform/tests/resource_kms_crypto_key_test.go index 6c4ccc53de09..701e80b0e479 100644 --- a/mmv1/third_party/terraform/tests/resource_kms_crypto_key_test.go +++ b/mmv1/third_party/terraform/tests/resource_kms_crypto_key_test.go @@ -137,16 +137,16 @@ func TestCryptoKeyStateUpgradeV0(t *testing.T) { func TestAccKmsCryptoKey_basic(t *testing.T) { t.Parallel() - projectId := fmt.Sprintf("tf-test-%d", RandInt(t)) + projectId := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) projectOrg := envvar.GetTestOrgFromEnv(t) location := envvar.GetTestRegionFromEnv() projectBillingAccount := envvar.GetTestBillingAccountFromEnv(t) - keyRingName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - cryptoKeyName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + keyRingName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + cryptoKeyName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testGoogleKmsCryptoKey_basic(projectId, projectOrg, projectBillingAccount, keyRingName, cryptoKeyName), @@ -181,18 +181,18 @@ func TestAccKmsCryptoKey_rotation(t *testing.T) { acctest.SkipIfVcr(t) t.Parallel() - projectId := fmt.Sprintf("tf-test-%d", RandInt(t)) + projectId := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) projectOrg := envvar.GetTestOrgFromEnv(t) location := envvar.GetTestRegionFromEnv() projectBillingAccount := envvar.GetTestBillingAccountFromEnv(t) - keyRingName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - cryptoKeyName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + keyRingName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + cryptoKeyName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) rotationPeriod := "100000s" updatedRotationPeriod := "7776000s" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testGoogleKmsCryptoKey_rotation(projectId, projectOrg, projectBillingAccount, keyRingName, cryptoKeyName, rotationPeriod), @@ -234,18 +234,18 @@ func TestAccKmsCryptoKey_rotation(t *testing.T) { func TestAccKmsCryptoKey_template(t *testing.T) { t.Parallel() - projectId := fmt.Sprintf("tf-test-%d", RandInt(t)) + projectId := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) projectOrg := envvar.GetTestOrgFromEnv(t) location := envvar.GetTestRegionFromEnv() projectBillingAccount := envvar.GetTestBillingAccountFromEnv(t) - keyRingName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - cryptoKeyName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + keyRingName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + cryptoKeyName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) algorithm := "EC_SIGN_P256_SHA256" updatedAlgorithm := "EC_SIGN_P384_SHA384" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testGoogleKmsCryptoKey_template(projectId, projectOrg, projectBillingAccount, keyRingName, cryptoKeyName, algorithm), @@ -279,16 +279,16 @@ func TestAccKmsCryptoKey_template(t *testing.T) { func TestAccKmsCryptoKey_destroyDuration(t *testing.T) { t.Parallel() - projectId := fmt.Sprintf("tf-test-%d", RandInt(t)) + projectId := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) projectOrg := envvar.GetTestOrgFromEnv(t) location := envvar.GetTestRegionFromEnv() projectBillingAccount := envvar.GetTestBillingAccountFromEnv(t) - keyRingName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - cryptoKeyName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + keyRingName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + cryptoKeyName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testGoogleKmsCryptoKey_destroyDuration(projectId, projectOrg, projectBillingAccount, keyRingName, cryptoKeyName), @@ -314,16 +314,16 @@ func TestAccKmsCryptoKey_destroyDuration(t *testing.T) { func TestAccKmsCryptoKey_importOnly(t *testing.T) { t.Parallel() - projectId := fmt.Sprintf("tf-test-%d", RandInt(t)) + projectId := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) projectOrg := envvar.GetTestOrgFromEnv(t) location := envvar.GetTestRegionFromEnv() projectBillingAccount := envvar.GetTestBillingAccountFromEnv(t) - keyRingName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - cryptoKeyName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + keyRingName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + cryptoKeyName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testGoogleKmsCryptoKey_importOnly(projectId, projectOrg, projectBillingAccount, keyRingName, cryptoKeyName), @@ -365,7 +365,7 @@ func testAccCheckGoogleKmsCryptoKeyWasRemovedFromState(resourceName string) reso // sub-resources were scheduled to be destroyed, rendering the key itself inoperable. func testAccCheckGoogleKmsCryptoKeyVersionsDestroyed(t *testing.T, projectId, location, keyRingName, cryptoKeyName string) resource.TestCheckFunc { return func(_ *terraform.State) error { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) gcpResourceUri := fmt.Sprintf("projects/%s/locations/%s/keyRings/%s/cryptoKeys/%s", projectId, location, keyRingName, cryptoKeyName) response, err := config.NewKmsClient(config.UserAgent).Projects.Locations.KeyRings.CryptoKeys.CryptoKeyVersions.List(gcpResourceUri).Do() @@ -390,7 +390,7 @@ func testAccCheckGoogleKmsCryptoKeyVersionsDestroyed(t *testing.T, projectId, lo // was disabled to prevent more versions of the key from being created. func testAccCheckGoogleKmsCryptoKeyRotationDisabled(t *testing.T, projectId, location, keyRingName, cryptoKeyName string) resource.TestCheckFunc { return func(_ *terraform.State) error { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) gcpResourceUri := fmt.Sprintf("projects/%s/locations/%s/keyRings/%s/cryptoKeys/%s", projectId, location, keyRingName, cryptoKeyName) response, err := config.NewKmsClient(config.UserAgent).Projects.Locations.KeyRings.CryptoKeys.Get(gcpResourceUri).Do() @@ -412,15 +412,15 @@ func testAccCheckGoogleKmsCryptoKeyRotationDisabled(t *testing.T, projectId, loc func TestAccKmsCryptoKeyVersion_basic(t *testing.T) { t.Parallel() - projectId := fmt.Sprintf("tf-test-%d", RandInt(t)) + projectId := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) projectOrg := envvar.GetTestOrgFromEnv(t) projectBillingAccount := envvar.GetTestBillingAccountFromEnv(t) - keyRingName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - cryptoKeyName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + keyRingName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + cryptoKeyName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testGoogleKmsCryptoKeyVersion_basic(projectId, projectOrg, projectBillingAccount, keyRingName, cryptoKeyName), @@ -440,15 +440,15 @@ func TestAccKmsCryptoKeyVersion_basic(t *testing.T) { func TestAccKmsCryptoKeyVersion_skipInitialVersion(t *testing.T) { t.Parallel() - projectId := fmt.Sprintf("tf-test-%d", RandInt(t)) + projectId := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) projectOrg := envvar.GetTestOrgFromEnv(t) projectBillingAccount := envvar.GetTestBillingAccountFromEnv(t) - keyRingName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - cryptoKeyName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + keyRingName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + cryptoKeyName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testGoogleKmsCryptoKeyVersion_skipInitialVersion(projectId, projectOrg, projectBillingAccount, keyRingName, cryptoKeyName), @@ -465,16 +465,16 @@ func TestAccKmsCryptoKeyVersion_skipInitialVersion(t *testing.T) { func TestAccKmsCryptoKeyVersion_patch(t *testing.T) { t.Parallel() - projectId := fmt.Sprintf("tf-test-%d", RandInt(t)) + projectId := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) projectOrg := envvar.GetTestOrgFromEnv(t) projectBillingAccount := envvar.GetTestBillingAccountFromEnv(t) - keyRingName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - cryptoKeyName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + keyRingName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + cryptoKeyName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) state := "DISABLED" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testGoogleKmsCryptoKeyVersion_patchInitialize(projectId, projectOrg, projectBillingAccount, keyRingName, cryptoKeyName), diff --git a/mmv1/third_party/terraform/tests/resource_kms_key_ring_iam_test.go.erb b/mmv1/third_party/terraform/tests/resource_kms_key_ring_iam_test.go.erb index 4e1b81e7d6a5..3d8a0c2e82af 100644 --- a/mmv1/third_party/terraform/tests/resource_kms_key_ring_iam_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_kms_key_ring_iam_test.go.erb @@ -21,11 +21,11 @@ func TestAccKmsKeyRingIamBinding(t *testing.T) { t.Parallel() orgId := envvar.GetTestOrgFromEnv(t) - projectId := fmt.Sprintf("tf-test-%d", RandInt(t)) + projectId := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) billingAccount := envvar.GetTestBillingAccountFromEnv(t) - account := fmt.Sprintf("tf-test-%d", RandInt(t)) + account := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) roleId := "roles/cloudkms.cryptoKeyDecrypter" - keyRingName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + keyRingName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) keyRingId := &kms.KmsKeyRingId{ Project: projectId, @@ -33,9 +33,9 @@ func TestAccKmsKeyRingIamBinding(t *testing.T) { Name: keyRingName, } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { // Test Iam Binding creation @@ -73,11 +73,11 @@ func TestAccKmsKeyRingIamBinding_withCondition(t *testing.T) { t.Parallel() orgId := envvar.GetTestOrgFromEnv(t) - projectId := fmt.Sprintf("tf-test-%d", RandInt(t)) + projectId := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) billingAccount := envvar.GetTestBillingAccountFromEnv(t) - account := fmt.Sprintf("tf-test-%d", RandInt(t)) + account := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) roleId := "roles/cloudkms.cryptoKeyDecrypter" - keyRingName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + keyRingName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) conditionTitle := "expires_after_2019_12_31" keyRingId := &kms.KmsKeyRingId{ @@ -86,9 +86,9 @@ func TestAccKmsKeyRingIamBinding_withCondition(t *testing.T) { Name: keyRingName, } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccKmsKeyRingIamBinding_withCondition(projectId, orgId, billingAccount, account, keyRingName, roleId, conditionTitle), @@ -108,11 +108,11 @@ func TestAccKmsKeyRingIamMember(t *testing.T) { t.Parallel() orgId := envvar.GetTestOrgFromEnv(t) - projectId := fmt.Sprintf("tf-test-%d", RandInt(t)) + projectId := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) billingAccount := envvar.GetTestBillingAccountFromEnv(t) - account := fmt.Sprintf("tf-test-%d", RandInt(t)) + account := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) roleId := "roles/cloudkms.cryptoKeyEncrypter" - keyRingName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + keyRingName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) keyRingId := &kms.KmsKeyRingId{ Project: projectId, @@ -120,9 +120,9 @@ func TestAccKmsKeyRingIamMember(t *testing.T) { Name: keyRingName, } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { // Test Iam Member creation (no update for member, no need to test) @@ -146,11 +146,11 @@ func TestAccKmsKeyRingIamMember_withCondition(t *testing.T) { t.Parallel() orgId := envvar.GetTestOrgFromEnv(t) - projectId := fmt.Sprintf("tf-test-%d", RandInt(t)) + projectId := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) billingAccount := envvar.GetTestBillingAccountFromEnv(t) - account := fmt.Sprintf("tf-test-%d", RandInt(t)) + account := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) roleId := "roles/cloudkms.cryptoKeyEncrypter" - keyRingName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + keyRingName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) conditionTitle := "expires_after_2019_12_31" keyRingId := &kms.KmsKeyRingId{ @@ -159,9 +159,9 @@ func TestAccKmsKeyRingIamMember_withCondition(t *testing.T) { Name: keyRingName, } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccKmsKeyRingIamMember_withCondition(projectId, orgId, billingAccount, account, keyRingName, roleId, conditionTitle), @@ -181,11 +181,11 @@ func TestAccKmsKeyRingIamPolicy(t *testing.T) { t.Parallel() orgId := envvar.GetTestOrgFromEnv(t) - projectId := fmt.Sprintf("tf-test-%d", RandInt(t)) + projectId := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) billingAccount := envvar.GetTestBillingAccountFromEnv(t) - account := fmt.Sprintf("tf-test-%d", RandInt(t)) + account := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) roleId := "roles/cloudkms.cryptoKeyEncrypter" - keyRingName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + keyRingName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) keyRingId := &kms.KmsKeyRingId{ Project: projectId, @@ -193,9 +193,9 @@ func TestAccKmsKeyRingIamPolicy(t *testing.T) { Name: keyRingName, } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccKmsKeyRingIamPolicy_basic(projectId, orgId, billingAccount, account, keyRingName, roleId), @@ -218,11 +218,11 @@ func TestAccKmsKeyRingIamPolicy_withCondition(t *testing.T) { t.Parallel() orgId := envvar.GetTestOrgFromEnv(t) - projectId := fmt.Sprintf("tf-test-%d", RandInt(t)) + projectId := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) billingAccount := envvar.GetTestBillingAccountFromEnv(t) - account := fmt.Sprintf("tf-test-%d", RandInt(t)) + account := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) roleId := "roles/cloudkms.cryptoKeyEncrypter" - keyRingName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + keyRingName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) conditionTitle := "expires_after_2019_12_31" keyRingId := &kms.KmsKeyRingId{ @@ -231,9 +231,9 @@ func TestAccKmsKeyRingIamPolicy_withCondition(t *testing.T) { Name: keyRingName, } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccKmsKeyRingIamPolicy_withCondition(projectId, orgId, billingAccount, account, keyRingName, roleId, conditionTitle), @@ -251,7 +251,7 @@ func TestAccKmsKeyRingIamPolicy_withCondition(t *testing.T) { func testAccCheckGoogleKmsKeyRingIam(t *testing.T, keyRingId, role string, members []string) resource.TestCheckFunc { return func(s *terraform.State) error { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) p, err := config.NewKmsClient(config.UserAgent).Projects.Locations.KeyRings.GetIamPolicy(keyRingId).Do() if err != nil { return err diff --git a/mmv1/third_party/terraform/tests/resource_kms_key_ring_import_job_test.go b/mmv1/third_party/terraform/tests/resource_kms_key_ring_import_job_test.go index df6266784b3e..bc46509f1c01 100644 --- a/mmv1/third_party/terraform/tests/resource_kms_key_ring_import_job_test.go +++ b/mmv1/third_party/terraform/tests/resource_kms_key_ring_import_job_test.go @@ -11,12 +11,12 @@ func TestAccKmsKeyRingImportJob_basic(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testGoogleKmsKeyRingImportJob_basic(context), diff --git a/mmv1/third_party/terraform/tests/resource_kms_key_ring_test.go b/mmv1/third_party/terraform/tests/resource_kms_key_ring_test.go index 69fe89243e2b..0ab6a1528ee2 100644 --- a/mmv1/third_party/terraform/tests/resource_kms_key_ring_test.go +++ b/mmv1/third_party/terraform/tests/resource_kms_key_ring_test.go @@ -11,14 +11,14 @@ import ( ) func TestAccKmsKeyRing_basic(t *testing.T) { - projectId := fmt.Sprintf("tf-test-%d", RandInt(t)) + projectId := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) projectOrg := envvar.GetTestOrgFromEnv(t) projectBillingAccount := envvar.GetTestBillingAccountFromEnv(t) - keyRingName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + keyRingName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckGoogleKmsKeyRingWasRemovedFromState("google_kms_key_ring.key_ring"), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_kms_secret_ciphertext_test.go b/mmv1/third_party/terraform/tests/resource_kms_secret_ciphertext_test.go index bc6e9ea5a062..ce856cac45b9 100644 --- a/mmv1/third_party/terraform/tests/resource_kms_secret_ciphertext_test.go +++ b/mmv1/third_party/terraform/tests/resource_kms_secret_ciphertext_test.go @@ -18,12 +18,12 @@ func TestAccKmsSecretCiphertext_basic(t *testing.T) { kms := acctest.BootstrapKMSKey(t) - plaintext := fmt.Sprintf("secret-%s", RandString(t, 10)) + plaintext := fmt.Sprintf("secret-%s", acctest.RandString(t, 10)) aad := "plainaad" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testGoogleKmsSecretCiphertext(kms.CryptoKey.Name, plaintext), @@ -55,7 +55,7 @@ func TestAccKmsSecretCiphertext_basic(t *testing.T) { } func testAccDecryptSecretDataWithCryptoKey(t *testing.T, s *terraform.State, cryptoKeyId string, secretCiphertextResourceName, aad string) (string, error) { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) rs, ok := s.RootModule().Resources[secretCiphertextResourceName] if !ok { return "", fmt.Errorf("Resource not found: %s", secretCiphertextResourceName) diff --git a/mmv1/third_party/terraform/tests/resource_logging_billing_account_exclusion_test.go b/mmv1/third_party/terraform/tests/resource_logging_billing_account_exclusion_test.go index 4b3fa5e11ad1..d6b7d9715d17 100644 --- a/mmv1/third_party/terraform/tests/resource_logging_billing_account_exclusion_test.go +++ b/mmv1/third_party/terraform/tests/resource_logging_billing_account_exclusion_test.go @@ -34,12 +34,12 @@ func TestAccLoggingBillingAccountExclusion(t *testing.T) { func testAccLoggingBillingAccountExclusion_basic(t *testing.T) { billingAccount := envvar.GetTestMasterBillingAccountFromEnv(t) - exclusionName := "tf-test-exclusion-" + RandString(t, 10) - description := "Description " + RandString(t, 10) + exclusionName := "tf-test-exclusion-" + acctest.RandString(t, 10) + description := "Description " + acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckLoggingBillingAccountExclusionDestroyProducer(t), Steps: []resource.TestStep{ { @@ -56,13 +56,13 @@ func testAccLoggingBillingAccountExclusion_basic(t *testing.T) { func testAccLoggingBillingAccountExclusion_update(t *testing.T) { billingAccount := envvar.GetTestMasterBillingAccountFromEnv(t) - exclusionName := "tf-test-exclusion-" + RandString(t, 10) - descriptionBefore := "Basic BillingAccount Logging Exclusion" + RandString(t, 10) - descriptionAfter := "Updated Basic BillingAccount Logging Exclusion" + RandString(t, 10) + exclusionName := "tf-test-exclusion-" + acctest.RandString(t, 10) + descriptionBefore := "Basic BillingAccount Logging Exclusion" + acctest.RandString(t, 10) + descriptionAfter := "Updated Basic BillingAccount Logging Exclusion" + acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckLoggingBillingAccountExclusionDestroyProducer(t), Steps: []resource.TestStep{ { @@ -88,13 +88,13 @@ func testAccLoggingBillingAccountExclusion_update(t *testing.T) { func testAccLoggingBillingAccountExclusion_multiple(t *testing.T) { billingAccount := envvar.GetTestMasterBillingAccountFromEnv(t) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckLoggingBillingAccountExclusionDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccLoggingBillingAccountExclusion_multipleCfg("tf-test-exclusion-"+RandString(t, 10), billingAccount), + Config: testAccLoggingBillingAccountExclusion_multipleCfg("tf-test-exclusion-"+acctest.RandString(t, 10), billingAccount), }, { ResourceName: "google_logging_billing_account_exclusion.basic0", @@ -117,7 +117,7 @@ func testAccLoggingBillingAccountExclusion_multiple(t *testing.T) { func testAccCheckLoggingBillingAccountExclusionDestroyProducer(t *testing.T) func(s *terraform.State) error { return func(s *terraform.State) error { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) for _, rs := range s.RootModule().Resources { if rs.Type != "google_logging_billing_account_exclusion" { diff --git a/mmv1/third_party/terraform/tests/resource_logging_billing_account_sink_test.go b/mmv1/third_party/terraform/tests/resource_logging_billing_account_sink_test.go index 528b781575b1..6eea276f5ec0 100644 --- a/mmv1/third_party/terraform/tests/resource_logging_billing_account_sink_test.go +++ b/mmv1/third_party/terraform/tests/resource_logging_billing_account_sink_test.go @@ -14,15 +14,15 @@ import ( func TestAccLoggingBillingAccountSink_basic(t *testing.T) { t.Parallel() - sinkName := "tf-test-sink-" + RandString(t, 10) - bucketName := "tf-test-sink-bucket-" + RandString(t, 10) + sinkName := "tf-test-sink-" + acctest.RandString(t, 10) + bucketName := "tf-test-sink-bucket-" + acctest.RandString(t, 10) billingAccount := envvar.GetTestMasterBillingAccountFromEnv(t) var sink logging.LogSink - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckLoggingBillingAccountSinkDestroyProducer(t), Steps: []resource.TestStep{ { @@ -43,16 +43,16 @@ func TestAccLoggingBillingAccountSink_basic(t *testing.T) { func TestAccLoggingBillingAccountSink_update(t *testing.T) { t.Parallel() - sinkName := "tf-test-sink-" + RandString(t, 10) - bucketName := "tf-test-sink-bucket-" + RandString(t, 10) - updatedBucketName := "tf-test-sink-bucket-" + RandString(t, 10) + sinkName := "tf-test-sink-" + acctest.RandString(t, 10) + bucketName := "tf-test-sink-bucket-" + acctest.RandString(t, 10) + updatedBucketName := "tf-test-sink-bucket-" + acctest.RandString(t, 10) billingAccount := envvar.GetTestMasterBillingAccountFromEnv(t) var sinkBefore, sinkAfter logging.LogSink - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckLoggingBillingAccountSinkDestroyProducer(t), Steps: []resource.TestStep{ { @@ -88,13 +88,13 @@ func TestAccLoggingBillingAccountSink_update(t *testing.T) { func TestAccLoggingBillingAccountSink_described(t *testing.T) { t.Parallel() - sinkName := "tf-test-sink-" + RandString(t, 10) - bucketName := "tf-test-sink-bucket-" + RandString(t, 10) + sinkName := "tf-test-sink-" + acctest.RandString(t, 10) + bucketName := "tf-test-sink-bucket-" + acctest.RandString(t, 10) billingAccount := envvar.GetTestMasterBillingAccountFromEnv(t) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckLoggingBillingAccountSinkDestroyProducer(t), Steps: []resource.TestStep{ { @@ -111,13 +111,13 @@ func TestAccLoggingBillingAccountSink_described(t *testing.T) { func TestAccLoggingBillingAccountSink_disabled(t *testing.T) { t.Parallel() - sinkName := "tf-test-sink-" + RandString(t, 10) - bucketName := "tf-test-sink-bucket-" + RandString(t, 10) + sinkName := "tf-test-sink-" + acctest.RandString(t, 10) + bucketName := "tf-test-sink-bucket-" + acctest.RandString(t, 10) billingAccount := envvar.GetTestMasterBillingAccountFromEnv(t) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckLoggingBillingAccountSinkDestroyProducer(t), Steps: []resource.TestStep{ { @@ -134,13 +134,13 @@ func TestAccLoggingBillingAccountSink_disabled(t *testing.T) { func TestAccLoggingBillingAccountSink_updateBigquerySink(t *testing.T) { t.Parallel() - sinkName := "tf-test-sink-" + RandString(t, 10) - bqDatasetID := "tf_test_sink_" + RandString(t, 10) + sinkName := "tf-test-sink-" + acctest.RandString(t, 10) + bqDatasetID := "tf_test_sink_" + acctest.RandString(t, 10) billingAccount := envvar.GetTestMasterBillingAccountFromEnv(t) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckLoggingBillingAccountSinkDestroyProducer(t), Steps: []resource.TestStep{ { @@ -166,15 +166,15 @@ func TestAccLoggingBillingAccountSink_updateBigquerySink(t *testing.T) { func TestAccLoggingBillingAccountSink_heredoc(t *testing.T) { t.Parallel() - sinkName := "tf-test-sink-" + RandString(t, 10) - bucketName := "tf-test-sink-bucket-" + RandString(t, 10) + sinkName := "tf-test-sink-" + acctest.RandString(t, 10) + bucketName := "tf-test-sink-bucket-" + acctest.RandString(t, 10) billingAccount := envvar.GetTestMasterBillingAccountFromEnv(t) var sink logging.LogSink - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckLoggingBillingAccountSinkDestroyProducer(t), Steps: []resource.TestStep{ { @@ -194,7 +194,7 @@ func TestAccLoggingBillingAccountSink_heredoc(t *testing.T) { func testAccCheckLoggingBillingAccountSinkDestroyProducer(t *testing.T) func(s *terraform.State) error { return func(s *terraform.State) error { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) for _, rs := range s.RootModule().Resources { if rs.Type != "google_logging_billing_account_sink" { @@ -219,7 +219,7 @@ func testAccCheckLoggingBillingAccountSinkExists(t *testing.T, n string, sink *l if err != nil { return err } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) si, err := config.NewLoggingClient(config.UserAgent).BillingAccounts.Sinks.Get(attributes["id"]).Do() if err != nil { diff --git a/mmv1/third_party/terraform/tests/resource_logging_bucket_config_test.go b/mmv1/third_party/terraform/tests/resource_logging_bucket_config_test.go index 849ac3c6a864..a1295ef5612c 100644 --- a/mmv1/third_party/terraform/tests/resource_logging_bucket_config_test.go +++ b/mmv1/third_party/terraform/tests/resource_logging_bucket_config_test.go @@ -13,14 +13,14 @@ func TestAccLoggingBucketConfigFolder_basic(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), - "folder_name": "tf-test-" + RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), + "folder_name": "tf-test-" + acctest.RandString(t, 10), "org_id": envvar.GetTestOrgFromEnv(t), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccLoggingBucketConfigFolder_basic(context, 30), @@ -48,14 +48,14 @@ func TestAccLoggingBucketConfigProject_basic(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), - "project_name": "tf-test-" + RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), + "project_name": "tf-test-" + acctest.RandString(t, 10), "org_id": envvar.GetTestOrgFromEnv(t), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccLoggingBucketConfigProject_basic(context, 30), @@ -92,14 +92,14 @@ func TestAccLoggingBucketConfigProject_analyticsEnabled(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), - "project_name": "tf-test-" + RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), + "project_name": "tf-test-" + acctest.RandString(t, 10), "org_id": envvar.GetTestOrgFromEnv(t), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccLoggingBucketConfigProject_analyticsEnabled(context, true), @@ -127,15 +127,15 @@ func TestAccLoggingBucketConfigProject_locked(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), - "project_name": "tf-test-" + RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), + "project_name": "tf-test-" + acctest.RandString(t, 10), "org_id": envvar.GetTestOrgFromEnv(t), "billing_account": envvar.GetTestBillingAccountFromEnv(t), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccLoggingBucketConfigProject_locked(context, false), @@ -163,19 +163,19 @@ func TestAccLoggingBucketConfigProject_cmekSettings(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "project_name": "tf-test-" + RandString(t, 10), + "project_name": "tf-test-" + acctest.RandString(t, 10), "org_id": envvar.GetTestOrgFromEnv(t), "billing_account": envvar.GetTestBillingAccountFromEnv(t), } - bucketId := fmt.Sprintf("tf-test-bucket-%s", RandString(t, 10)) - keyRingName := fmt.Sprintf("tf-test-key-ring-%s", RandString(t, 10)) - cryptoKeyName := fmt.Sprintf("tf-test-crypto-key-%s", RandString(t, 10)) - cryptoKeyNameUpdate := fmt.Sprintf("tf-test-crypto-key-%s", RandString(t, 10)) + bucketId := fmt.Sprintf("tf-test-bucket-%s", acctest.RandString(t, 10)) + keyRingName := fmt.Sprintf("tf-test-key-ring-%s", acctest.RandString(t, 10)) + cryptoKeyName := fmt.Sprintf("tf-test-crypto-key-%s", acctest.RandString(t, 10)) + cryptoKeyNameUpdate := fmt.Sprintf("tf-test-crypto-key-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccLoggingBucketConfigProject_cmekSettings(context, bucketId, keyRingName, cryptoKeyName, cryptoKeyNameUpdate), @@ -203,14 +203,14 @@ func TestAccLoggingBucketConfigBillingAccount_basic(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), "billing_account_name": "billingAccounts/" + envvar.GetTestMasterBillingAccountFromEnv(t), "org_id": envvar.GetTestOrgFromEnv(t), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccLoggingBucketConfigBillingAccount_basic(context, 30), @@ -238,13 +238,13 @@ func TestAccLoggingBucketConfigOrganization_basic(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), "org_id": envvar.GetTestOrgFromEnv(t), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccLoggingBucketConfigOrganization_basic(context, 30), @@ -443,19 +443,19 @@ func TestAccLoggingBucketConfig_CreateBuckets_withCustomId(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), "billing_account_name": envvar.GetTestBillingAccountFromEnv(t), "org_id": envvar.GetTestOrgFromEnv(t), - "project_name": "tf-test-" + RandString(t, 10), - "bucket_id": "tf-test-bucket-" + RandString(t, 10), + "project_name": "tf-test-" + acctest.RandString(t, 10), + "bucket_id": "tf-test-bucket-" + acctest.RandString(t, 10), } configList := getLoggingBucketConfigs(context) for res, config := range configList { - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: config, diff --git a/mmv1/third_party/terraform/tests/resource_logging_folder_exclusion_test.go b/mmv1/third_party/terraform/tests/resource_logging_folder_exclusion_test.go index 48a1263045ac..56c23985f8f1 100644 --- a/mmv1/third_party/terraform/tests/resource_logging_folder_exclusion_test.go +++ b/mmv1/third_party/terraform/tests/resource_logging_folder_exclusion_test.go @@ -36,13 +36,13 @@ func TestAccLoggingFolderExclusion(t *testing.T) { func testAccLoggingFolderExclusion_basic(t *testing.T) { org := envvar.GetTestOrgFromEnv(t) - exclusionName := "tf-test-exclusion-" + RandString(t, 10) - folderName := "tf-test-folder-" + RandString(t, 10) - description := "Description " + RandString(t, 10) + exclusionName := "tf-test-exclusion-" + acctest.RandString(t, 10) + folderName := "tf-test-folder-" + acctest.RandString(t, 10) + description := "Description " + acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckLoggingFolderExclusionDestroyProducer(t), Steps: []resource.TestStep{ { @@ -59,9 +59,9 @@ func testAccLoggingFolderExclusion_basic(t *testing.T) { func testAccLoggingFolderExclusion_folderAcceptsFullFolderPath(t *testing.T) { org := envvar.GetTestOrgFromEnv(t) - exclusionName := "tf-test-exclusion-" + RandString(t, 10) - folderName := "tf-test-folder-" + RandString(t, 10) - description := "Description " + RandString(t, 10) + exclusionName := "tf-test-exclusion-" + acctest.RandString(t, 10) + folderName := "tf-test-folder-" + acctest.RandString(t, 10) + description := "Description " + acctest.RandString(t, 10) checkFn := func(s []*terraform.InstanceState) error { loggingExclusionId, err := logging.ParseLoggingExclusionId(s[0].ID) @@ -77,9 +77,9 @@ func testAccLoggingFolderExclusion_folderAcceptsFullFolderPath(t *testing.T) { return nil } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckLoggingFolderExclusionDestroyProducer(t), Steps: []resource.TestStep{ { @@ -102,15 +102,15 @@ func testAccLoggingFolderExclusion_folderAcceptsFullFolderPath(t *testing.T) { func testAccLoggingFolderExclusion_update(t *testing.T) { org := envvar.GetTestOrgFromEnv(t) - exclusionName := "tf-test-exclusion-" + RandString(t, 10) - folderName := "tf-test-folder-" + RandString(t, 10) + exclusionName := "tf-test-exclusion-" + acctest.RandString(t, 10) + folderName := "tf-test-folder-" + acctest.RandString(t, 10) parent := "organizations/" + org - descriptionBefore := "Basic Folder Logging Exclusion" + RandString(t, 10) - descriptionAfter := "Updated Basic Folder Logging Exclusion" + RandString(t, 10) + descriptionBefore := "Basic Folder Logging Exclusion" + acctest.RandString(t, 10) + descriptionAfter := "Updated Basic Folder Logging Exclusion" + acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckLoggingFolderExclusionDestroyProducer(t), Steps: []resource.TestStep{ { @@ -135,16 +135,16 @@ func testAccLoggingFolderExclusion_update(t *testing.T) { func testAccLoggingFolderExclusion_multiple(t *testing.T) { org := envvar.GetTestOrgFromEnv(t) - folderName := "tf-test-folder-" + RandString(t, 10) + folderName := "tf-test-folder-" + acctest.RandString(t, 10) parent := "organizations/" + org - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckLoggingFolderExclusionDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccLoggingFolderExclusion_multipleCfg(folderName, parent, "tf-test-exclusion-"+RandString(t, 10)), + Config: testAccLoggingFolderExclusion_multipleCfg(folderName, parent, "tf-test-exclusion-"+acctest.RandString(t, 10)), }, { ResourceName: "google_logging_folder_exclusion.basic0", @@ -167,7 +167,7 @@ func testAccLoggingFolderExclusion_multiple(t *testing.T) { func testAccCheckLoggingFolderExclusionDestroyProducer(t *testing.T) func(s *terraform.State) error { return func(s *terraform.State) error { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) for _, rs := range s.RootModule().Resources { if rs.Type != "google_logging_folder_exclusion" { diff --git a/mmv1/third_party/terraform/tests/resource_logging_folder_sink_test.go b/mmv1/third_party/terraform/tests/resource_logging_folder_sink_test.go index 134c45585e58..c2c6860c27d7 100644 --- a/mmv1/third_party/terraform/tests/resource_logging_folder_sink_test.go +++ b/mmv1/third_party/terraform/tests/resource_logging_folder_sink_test.go @@ -18,15 +18,15 @@ func TestAccLoggingFolderSink_basic(t *testing.T) { t.Parallel() org := envvar.GetTestOrgFromEnv(t) - sinkName := "tf-test-sink-" + RandString(t, 10) - bucketName := "tf-test-sink-bucket-" + RandString(t, 10) - folderName := "tf-test-folder-" + RandString(t, 10) + sinkName := "tf-test-sink-" + acctest.RandString(t, 10) + bucketName := "tf-test-sink-bucket-" + acctest.RandString(t, 10) + folderName := "tf-test-folder-" + acctest.RandString(t, 10) var sink logging.LogSink - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckLoggingFolderSinkDestroyProducer(t), Steps: []resource.TestStep{ { @@ -48,13 +48,13 @@ func TestAccLoggingFolderSink_described(t *testing.T) { t.Parallel() org := envvar.GetTestOrgFromEnv(t) - sinkName := "tf-test-sink-" + RandString(t, 10) - bucketName := "tf-test-sink-bucket-" + RandString(t, 10) - folderName := "tf-test-folder-" + RandString(t, 10) + sinkName := "tf-test-sink-" + acctest.RandString(t, 10) + bucketName := "tf-test-sink-bucket-" + acctest.RandString(t, 10) + folderName := "tf-test-folder-" + acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckLoggingFolderSinkDestroyProducer(t), Steps: []resource.TestStep{ { @@ -72,13 +72,13 @@ func TestAccLoggingFolderSink_disabled(t *testing.T) { t.Parallel() org := envvar.GetTestOrgFromEnv(t) - sinkName := "tf-test-sink-" + RandString(t, 10) - bucketName := "tf-test-sink-bucket-" + RandString(t, 10) - folderName := "tf-test-folder-" + RandString(t, 10) + sinkName := "tf-test-sink-" + acctest.RandString(t, 10) + bucketName := "tf-test-sink-bucket-" + acctest.RandString(t, 10) + folderName := "tf-test-folder-" + acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckLoggingFolderSinkDestroyProducer(t), Steps: []resource.TestStep{ { @@ -96,13 +96,13 @@ func TestAccLoggingFolderSink_removeOptionals(t *testing.T) { t.Parallel() org := envvar.GetTestOrgFromEnv(t) - sinkName := "tf-test-sink-" + RandString(t, 10) - bucketName := "tf-test-sink-bucket-" + RandString(t, 10) - folderName := "tf-test-folder-" + RandString(t, 10) + sinkName := "tf-test-sink-" + acctest.RandString(t, 10) + bucketName := "tf-test-sink-bucket-" + acctest.RandString(t, 10) + folderName := "tf-test-folder-" + acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckLoggingFolderSinkDestroyProducer(t), Steps: []resource.TestStep{ { @@ -129,15 +129,15 @@ func TestAccLoggingFolderSink_folderAcceptsFullFolderPath(t *testing.T) { t.Parallel() org := envvar.GetTestOrgFromEnv(t) - sinkName := "tf-test-sink-" + RandString(t, 10) - bucketName := "tf-test-sink-bucket-" + RandString(t, 10) - folderName := "tf-test-folder-" + RandString(t, 10) + sinkName := "tf-test-sink-" + acctest.RandString(t, 10) + bucketName := "tf-test-sink-bucket-" + acctest.RandString(t, 10) + folderName := "tf-test-folder-" + acctest.RandString(t, 10) var sink logging.LogSink - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckLoggingFolderSinkDestroyProducer(t), Steps: []resource.TestStep{ { @@ -159,17 +159,17 @@ func TestAccLoggingFolderSink_update(t *testing.T) { t.Parallel() org := envvar.GetTestOrgFromEnv(t) - sinkName := "tf-test-sink-" + RandString(t, 10) - bucketName := "tf-test-sink-bucket-" + RandString(t, 10) - updatedBucketName := "tf-test-sink-bucket-" + RandString(t, 10) - folderName := "tf-test-folder-" + RandString(t, 10) + sinkName := "tf-test-sink-" + acctest.RandString(t, 10) + bucketName := "tf-test-sink-bucket-" + acctest.RandString(t, 10) + updatedBucketName := "tf-test-sink-bucket-" + acctest.RandString(t, 10) + folderName := "tf-test-folder-" + acctest.RandString(t, 10) parent := "organizations/" + org var sinkBefore, sinkAfter logging.LogSink - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckLoggingFolderSinkDestroyProducer(t), Steps: []resource.TestStep{ { @@ -206,13 +206,13 @@ func TestAccLoggingFolderSink_updateBigquerySink(t *testing.T) { t.Parallel() org := envvar.GetTestOrgFromEnv(t) - sinkName := "tf-test-sink-" + RandString(t, 10) - bqDatasetID := "tf_test_sink_" + RandString(t, 10) - folderName := "tf-test-folder-" + RandString(t, 10) + sinkName := "tf-test-sink-" + acctest.RandString(t, 10) + bqDatasetID := "tf_test_sink_" + acctest.RandString(t, 10) + folderName := "tf-test-folder-" + acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckLoggingFolderSinkDestroyProducer(t), Steps: []resource.TestStep{ { @@ -239,15 +239,15 @@ func TestAccLoggingFolderSink_heredoc(t *testing.T) { t.Parallel() org := envvar.GetTestOrgFromEnv(t) - sinkName := "tf-test-sink-" + RandString(t, 10) - bucketName := "tf-test-sink-bucket-" + RandString(t, 10) - folderName := "tf-test-folder-" + RandString(t, 10) + sinkName := "tf-test-sink-" + acctest.RandString(t, 10) + bucketName := "tf-test-sink-bucket-" + acctest.RandString(t, 10) + folderName := "tf-test-folder-" + acctest.RandString(t, 10) var sink logging.LogSink - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckLoggingFolderSinkDestroyProducer(t), Steps: []resource.TestStep{ { @@ -267,7 +267,7 @@ func TestAccLoggingFolderSink_heredoc(t *testing.T) { func testAccCheckLoggingFolderSinkDestroyProducer(t *testing.T) func(s *terraform.State) error { return func(s *terraform.State) error { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) for _, rs := range s.RootModule().Resources { if rs.Type != "google_logging_folder_sink" { @@ -292,7 +292,7 @@ func testAccCheckLoggingFolderSinkExists(t *testing.T, n string, sink *logging.L if err != nil { return err } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) si, err := config.NewLoggingClient(config.UserAgent).Folders.Sinks.Get(attributes["id"]).Do() if err != nil { diff --git a/mmv1/third_party/terraform/tests/resource_logging_log_view_test.go b/mmv1/third_party/terraform/tests/resource_logging_log_view_test.go index 22078fe0d692..a3ef671d6fab 100644 --- a/mmv1/third_party/terraform/tests/resource_logging_log_view_test.go +++ b/mmv1/third_party/terraform/tests/resource_logging_log_view_test.go @@ -13,12 +13,12 @@ func TestAccLoggingLogView_loggingLogViewBasicExampleUpdate(t *testing.T) { context := map[string]interface{}{ "project": envvar.GetTestProjectFromEnv(), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckLoggingLogViewDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_logging_metric_test.go b/mmv1/third_party/terraform/tests/resource_logging_metric_test.go index 10e550a2d4c4..5799bad69dba 100644 --- a/mmv1/third_party/terraform/tests/resource_logging_metric_test.go +++ b/mmv1/third_party/terraform/tests/resource_logging_metric_test.go @@ -12,13 +12,13 @@ import ( func TestAccLoggingMetric_update(t *testing.T) { t.Parallel() - suffix := RandString(t, 10) + suffix := acctest.RandString(t, 10) filter := "resource.type=gae_app AND severity>=ERROR" updatedFilter := "resource.type=gae_app AND severity=ERROR" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckLoggingMetricDestroyProducer(t), Steps: []resource.TestStep{ { @@ -44,12 +44,12 @@ func TestAccLoggingMetric_update(t *testing.T) { func TestAccLoggingMetric_explicitBucket(t *testing.T) { t.Parallel() - suffix := RandString(t, 10) + suffix := acctest.RandString(t, 10) filter := "resource.type=gae_app AND severity>=ERROR" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckLoggingMetricDestroyProducer(t), Steps: []resource.TestStep{ { @@ -69,11 +69,11 @@ func TestAccLoggingMetric_loggingBucket(t *testing.T) { filter := "resource.type=gae_app AND severity>=ERROR" project_id := envvar.GetTestProjectFromEnv() - suffix := RandString(t, 10) + suffix := acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckLoggingMetricDestroyProducer(t), Steps: []resource.TestStep{ { @@ -107,11 +107,11 @@ func TestAccLoggingMetric_loggingBucket(t *testing.T) { func TestAccLoggingMetric_descriptionUpdated(t *testing.T) { t.Parallel() - suffix := RandString(t, 10) + suffix := acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckLoggingMetricDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_logging_organization_exclusion_test.go b/mmv1/third_party/terraform/tests/resource_logging_organization_exclusion_test.go index 6304fca70fa2..87cd6f09a10c 100644 --- a/mmv1/third_party/terraform/tests/resource_logging_organization_exclusion_test.go +++ b/mmv1/third_party/terraform/tests/resource_logging_organization_exclusion_test.go @@ -34,12 +34,12 @@ func TestAccLoggingOrganizationExclusion(t *testing.T) { func testAccLoggingOrganizationExclusion_basic(t *testing.T) { org := envvar.GetTestOrgFromEnv(t) - exclusionName := "tf-test-exclusion-" + RandString(t, 10) - description := "Description " + RandString(t, 10) + exclusionName := "tf-test-exclusion-" + acctest.RandString(t, 10) + description := "Description " + acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckLoggingOrganizationExclusionDestroyProducer(t), Steps: []resource.TestStep{ { @@ -56,13 +56,13 @@ func testAccLoggingOrganizationExclusion_basic(t *testing.T) { func testAccLoggingOrganizationExclusion_update(t *testing.T) { org := envvar.GetTestOrgFromEnv(t) - exclusionName := "tf-test-exclusion-" + RandString(t, 10) - descriptionBefore := "Basic Organization Logging Exclusion" + RandString(t, 10) - descriptionAfter := "Updated Basic Organization Logging Exclusion" + RandString(t, 10) + exclusionName := "tf-test-exclusion-" + acctest.RandString(t, 10) + descriptionBefore := "Basic Organization Logging Exclusion" + acctest.RandString(t, 10) + descriptionAfter := "Updated Basic Organization Logging Exclusion" + acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckLoggingOrganizationExclusionDestroyProducer(t), Steps: []resource.TestStep{ { @@ -88,13 +88,13 @@ func testAccLoggingOrganizationExclusion_update(t *testing.T) { func testAccLoggingOrganizationExclusion_multiple(t *testing.T) { org := envvar.GetTestOrgFromEnv(t) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckLoggingOrganizationExclusionDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccLoggingOrganizationExclusion_multipleCfg("tf-test-exclusion-"+RandString(t, 10), org), + Config: testAccLoggingOrganizationExclusion_multipleCfg("tf-test-exclusion-"+acctest.RandString(t, 10), org), }, { ResourceName: "google_logging_organization_exclusion.basic0", @@ -117,7 +117,7 @@ func testAccLoggingOrganizationExclusion_multiple(t *testing.T) { func testAccCheckLoggingOrganizationExclusionDestroyProducer(t *testing.T) func(s *terraform.State) error { return func(s *terraform.State) error { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) for _, rs := range s.RootModule().Resources { if rs.Type != "google_logging_organization_exclusion" { diff --git a/mmv1/third_party/terraform/tests/resource_logging_organization_sink_test.go b/mmv1/third_party/terraform/tests/resource_logging_organization_sink_test.go index 3da72edc4581..dd27b39b165b 100644 --- a/mmv1/third_party/terraform/tests/resource_logging_organization_sink_test.go +++ b/mmv1/third_party/terraform/tests/resource_logging_organization_sink_test.go @@ -17,14 +17,14 @@ func TestAccLoggingOrganizationSink_basic(t *testing.T) { t.Parallel() org := envvar.GetTestOrgFromEnv(t) - sinkName := "tf-test-sink-" + RandString(t, 10) - bucketName := "tf-test-sink-bucket-" + RandString(t, 10) + sinkName := "tf-test-sink-" + acctest.RandString(t, 10) + bucketName := "tf-test-sink-bucket-" + acctest.RandString(t, 10) var sink logging.LogSink - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckLoggingOrganizationSinkDestroyProducer(t), Steps: []resource.TestStep{ { @@ -46,15 +46,15 @@ func TestAccLoggingOrganizationSink_update(t *testing.T) { t.Parallel() org := envvar.GetTestOrgFromEnv(t) - sinkName := "tf-test-sink-" + RandString(t, 10) - bucketName := "tf-test-sink-bucket-" + RandString(t, 10) - updatedBucketName := "tf-test-sink-bucket-" + RandString(t, 10) + sinkName := "tf-test-sink-" + acctest.RandString(t, 10) + bucketName := "tf-test-sink-bucket-" + acctest.RandString(t, 10) + updatedBucketName := "tf-test-sink-bucket-" + acctest.RandString(t, 10) var sinkBefore, sinkAfter logging.LogSink - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckLoggingOrganizationSinkDestroyProducer(t), Steps: []resource.TestStep{ { @@ -91,12 +91,12 @@ func TestAccLoggingOrganizationSink_described(t *testing.T) { t.Parallel() org := envvar.GetTestOrgFromEnv(t) - sinkName := "tf-test-sink-" + RandString(t, 10) - bucketName := "tf-test-sink-bucket-" + RandString(t, 10) + sinkName := "tf-test-sink-" + acctest.RandString(t, 10) + bucketName := "tf-test-sink-bucket-" + acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckLoggingOrganizationSinkDestroyProducer(t), Steps: []resource.TestStep{ { @@ -114,12 +114,12 @@ func TestAccLoggingOrganizationSink_disabled(t *testing.T) { t.Parallel() org := envvar.GetTestOrgFromEnv(t) - sinkName := "tf-test-sink-" + RandString(t, 10) - bucketName := "tf-test-sink-bucket-" + RandString(t, 10) + sinkName := "tf-test-sink-" + acctest.RandString(t, 10) + bucketName := "tf-test-sink-bucket-" + acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckLoggingOrganizationSinkDestroyProducer(t), Steps: []resource.TestStep{ { @@ -137,12 +137,12 @@ func TestAccLoggingOrganizationSink_updateBigquerySink(t *testing.T) { t.Parallel() org := envvar.GetTestOrgFromEnv(t) - sinkName := "tf-test-sink-" + RandString(t, 10) - bqDatasetID := "tf_test_sink_" + RandString(t, 10) + sinkName := "tf-test-sink-" + acctest.RandString(t, 10) + bqDatasetID := "tf_test_sink_" + acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckLoggingOrganizationSinkDestroyProducer(t), Steps: []resource.TestStep{ { @@ -169,14 +169,14 @@ func TestAccLoggingOrganizationSink_heredoc(t *testing.T) { t.Parallel() org := envvar.GetTestOrgFromEnv(t) - sinkName := "tf-test-sink-" + RandString(t, 10) - bucketName := "tf-test-sink-bucket-" + RandString(t, 10) + sinkName := "tf-test-sink-" + acctest.RandString(t, 10) + bucketName := "tf-test-sink-bucket-" + acctest.RandString(t, 10) var sink logging.LogSink - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckLoggingOrganizationSinkDestroyProducer(t), Steps: []resource.TestStep{ { @@ -196,7 +196,7 @@ func TestAccLoggingOrganizationSink_heredoc(t *testing.T) { func testAccCheckLoggingOrganizationSinkDestroyProducer(t *testing.T) func(s *terraform.State) error { return func(s *terraform.State) error { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) for _, rs := range s.RootModule().Resources { if rs.Type != "google_logging_organization_sink" { @@ -221,7 +221,7 @@ func testAccCheckLoggingOrganizationSinkExists(t *testing.T, n string, sink *log if err != nil { return err } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) si, err := config.NewLoggingClient(config.UserAgent).Organizations.Sinks.Get(attributes["id"]).Do() if err != nil { diff --git a/mmv1/third_party/terraform/tests/resource_logging_project_exclusion_test.go b/mmv1/third_party/terraform/tests/resource_logging_project_exclusion_test.go index ec3866b2a4d8..ac0e0991d0b5 100644 --- a/mmv1/third_party/terraform/tests/resource_logging_project_exclusion_test.go +++ b/mmv1/third_party/terraform/tests/resource_logging_project_exclusion_test.go @@ -34,11 +34,11 @@ func TestAccLoggingProjectExclusion(t *testing.T) { } func testAccLoggingProjectExclusion_basic(t *testing.T) { - exclusionName := "tf-test-exclusion-" + RandString(t, 10) + exclusionName := "tf-test-exclusion-" + acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckLoggingProjectExclusionDestroyProducer(t), Steps: []resource.TestStep{ { @@ -54,11 +54,11 @@ func testAccLoggingProjectExclusion_basic(t *testing.T) { } func testAccLoggingProjectExclusion_disablePreservesFilter(t *testing.T) { - exclusionName := "tf-test-exclusion-" + RandString(t, 10) + exclusionName := "tf-test-exclusion-" + acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckLoggingProjectExclusionDestroyProducer(t), Steps: []resource.TestStep{ { @@ -82,11 +82,11 @@ func testAccLoggingProjectExclusion_disablePreservesFilter(t *testing.T) { } func testAccLoggingProjectExclusion_update(t *testing.T) { - exclusionName := "tf-test-exclusion-" + RandString(t, 10) + exclusionName := "tf-test-exclusion-" + acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckLoggingProjectExclusionDestroyProducer(t), Steps: []resource.TestStep{ { @@ -110,13 +110,13 @@ func testAccLoggingProjectExclusion_update(t *testing.T) { } func testAccLoggingProjectExclusion_multiple(t *testing.T) { - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckLoggingProjectExclusionDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccLoggingProjectExclusion_multipleCfg("tf-test-exclusion-" + RandString(t, 10)), + Config: testAccLoggingProjectExclusion_multipleCfg("tf-test-exclusion-" + acctest.RandString(t, 10)), }, { ResourceName: "google_logging_project_exclusion.basic0", @@ -139,7 +139,7 @@ func testAccLoggingProjectExclusion_multiple(t *testing.T) { func testAccCheckLoggingProjectExclusionDestroyProducer(t *testing.T) func(s *terraform.State) error { return func(s *terraform.State) error { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) for _, rs := range s.RootModule().Resources { if rs.Type != "google_logging_project_exclusion" { diff --git a/mmv1/third_party/terraform/tests/resource_logging_project_sink_test.go b/mmv1/third_party/terraform/tests/resource_logging_project_sink_test.go index 7cb04f4d5ff2..25f668997b04 100644 --- a/mmv1/third_party/terraform/tests/resource_logging_project_sink_test.go +++ b/mmv1/third_party/terraform/tests/resource_logging_project_sink_test.go @@ -13,12 +13,12 @@ import ( func TestAccLoggingProjectSink_basic(t *testing.T) { t.Parallel() - sinkName := "tf-test-sink-" + RandString(t, 10) - bucketName := "tf-test-sink-bucket-" + RandString(t, 10) + sinkName := "tf-test-sink-" + acctest.RandString(t, 10) + bucketName := "tf-test-sink-bucket-" + acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckLoggingProjectSinkDestroyProducer(t), Steps: []resource.TestStep{ { @@ -36,12 +36,12 @@ func TestAccLoggingProjectSink_basic(t *testing.T) { func TestAccLoggingProjectSink_described(t *testing.T) { t.Parallel() - sinkName := "tf-test-sink-" + RandString(t, 10) - bucketName := "tf-test-sink-bucket-" + RandString(t, 10) + sinkName := "tf-test-sink-" + acctest.RandString(t, 10) + bucketName := "tf-test-sink-bucket-" + acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckLoggingProjectSinkDestroyProducer(t), Steps: []resource.TestStep{ { @@ -59,12 +59,12 @@ func TestAccLoggingProjectSink_described(t *testing.T) { func TestAccLoggingProjectSink_described_update(t *testing.T) { t.Parallel() - sinkName := "tf-test-sink-" + RandString(t, 10) - bucketName := "tf-test-sink-bucket-" + RandString(t, 10) + sinkName := "tf-test-sink-" + acctest.RandString(t, 10) + bucketName := "tf-test-sink-bucket-" + acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckLoggingProjectSinkDestroyProducer(t), Steps: []resource.TestStep{ { @@ -90,12 +90,12 @@ func TestAccLoggingProjectSink_described_update(t *testing.T) { func TestAccLoggingProjectSink_disabled(t *testing.T) { t.Parallel() - sinkName := "tf-test-sink-" + RandString(t, 10) - bucketName := "tf-test-sink-bucket-" + RandString(t, 10) + sinkName := "tf-test-sink-" + acctest.RandString(t, 10) + bucketName := "tf-test-sink-bucket-" + acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckLoggingProjectSinkDestroyProducer(t), Steps: []resource.TestStep{ { @@ -113,13 +113,13 @@ func TestAccLoggingProjectSink_disabled(t *testing.T) { func TestAccLoggingProjectSink_updatePreservesUniqueWriter(t *testing.T) { t.Parallel() - sinkName := "tf-test-sink-" + RandString(t, 10) - bucketName := "tf-test-sink-bucket-" + RandString(t, 10) - updatedBucketName := "tf-test-sink-bucket-" + RandString(t, 10) + sinkName := "tf-test-sink-" + acctest.RandString(t, 10) + bucketName := "tf-test-sink-bucket-" + acctest.RandString(t, 10) + updatedBucketName := "tf-test-sink-bucket-" + acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckLoggingProjectSinkDestroyProducer(t), Steps: []resource.TestStep{ { @@ -145,12 +145,12 @@ func TestAccLoggingProjectSink_updatePreservesUniqueWriter(t *testing.T) { func TestAccLoggingProjectSink_updateBigquerySink(t *testing.T) { t.Parallel() - sinkName := "tf-test-sink-" + RandString(t, 10) - bqDatasetID := "tf_test_sink_" + RandString(t, 10) + sinkName := "tf-test-sink-" + acctest.RandString(t, 10) + bqDatasetID := "tf_test_sink_" + acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckLoggingProjectSinkDestroyProducer(t), Steps: []resource.TestStep{ { @@ -176,12 +176,12 @@ func TestAccLoggingProjectSink_updateBigquerySink(t *testing.T) { func TestAccLoggingProjectSink_heredoc(t *testing.T) { t.Parallel() - sinkName := "tf-test-sink-" + RandString(t, 10) - bucketName := "tf-test-sink-bucket-" + RandString(t, 10) + sinkName := "tf-test-sink-" + acctest.RandString(t, 10) + bucketName := "tf-test-sink-bucket-" + acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckLoggingProjectSinkDestroyProducer(t), Steps: []resource.TestStep{ { @@ -199,11 +199,11 @@ func TestAccLoggingProjectSink_heredoc(t *testing.T) { func TestAccLoggingProjectSink_loggingbucket(t *testing.T) { t.Parallel() - sinkName := "tf-test-sink-" + RandString(t, 10) + sinkName := "tf-test-sink-" + acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckLoggingProjectSinkDestroyProducer(t), Steps: []resource.TestStep{ { @@ -221,12 +221,12 @@ func TestAccLoggingProjectSink_loggingbucket(t *testing.T) { func TestAccLoggingProjectSink_disabled_update(t *testing.T) { t.Parallel() - sinkName := "tf-test-sink-" + RandString(t, 10) - bucketName := "tf-test-sink-bucket-" + RandString(t, 10) + sinkName := "tf-test-sink-" + acctest.RandString(t, 10) + bucketName := "tf-test-sink-bucket-" + acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckLoggingProjectSinkDestroyProducer(t), Steps: []resource.TestStep{ { @@ -268,7 +268,7 @@ func TestAccLoggingProjectSink_disabled_update(t *testing.T) { func testAccCheckLoggingProjectSinkDestroyProducer(t *testing.T) func(s *terraform.State) error { return func(s *terraform.State) error { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) for _, rs := range s.RootModule().Resources { if rs.Type != "google_logging_project_sink" { diff --git a/mmv1/third_party/terraform/tests/resource_memcache_instance_test.go b/mmv1/third_party/terraform/tests/resource_memcache_instance_test.go index dbb111255537..8e1ee626b30d 100644 --- a/mmv1/third_party/terraform/tests/resource_memcache_instance_test.go +++ b/mmv1/third_party/terraform/tests/resource_memcache_instance_test.go @@ -13,13 +13,13 @@ func TestAccMemcacheInstance_update(t *testing.T) { // Temporary as CI has used up servicenetworking quota acctest.SkipIfVcr(t) - prefix := fmt.Sprintf("%d", RandInt(t)) + prefix := fmt.Sprintf("%d", acctest.RandInt(t)) name := fmt.Sprintf("tf-test-%s", prefix) network := acctest.BootstrapSharedTestNetwork(t, "memcache-update") - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckMemcacheInstanceDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_monitoring_alert_policy_test.go b/mmv1/third_party/terraform/tests/resource_monitoring_alert_policy_test.go index 17ced9a72dcf..c9441f0c3fad 100644 --- a/mmv1/third_party/terraform/tests/resource_monitoring_alert_policy_test.go +++ b/mmv1/third_party/terraform/tests/resource_monitoring_alert_policy_test.go @@ -37,13 +37,13 @@ func TestAccMonitoringAlertPolicy(t *testing.T) { func testAccMonitoringAlertPolicy_basic(t *testing.T) { - alertName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - conditionName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + alertName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + conditionName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) filter := `metric.type=\"compute.googleapis.com/instance/disk/write_bytes_count\" AND resource.type=\"gce_instance\"` - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckAlertPolicyDestroyProducer(t), Steps: []resource.TestStep{ { @@ -60,16 +60,16 @@ func testAccMonitoringAlertPolicy_basic(t *testing.T) { func testAccMonitoringAlertPolicy_update(t *testing.T) { - alertName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - conditionName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + alertName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + conditionName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) filter1 := `metric.type=\"compute.googleapis.com/instance/disk/write_bytes_count\" AND resource.type=\"gce_instance\"` aligner1 := "ALIGN_RATE" filter2 := `metric.type=\"compute.googleapis.com/instance/cpu/utilization\" AND resource.type=\"gce_instance\"` aligner2 := "ALIGN_MAX" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckAlertPolicyDestroyProducer(t), Steps: []resource.TestStep{ { @@ -94,13 +94,13 @@ func testAccMonitoringAlertPolicy_update(t *testing.T) { func testAccMonitoringAlertPolicy_full(t *testing.T) { - alertName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - conditionName1 := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - conditionName2 := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + alertName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + conditionName1 := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + conditionName2 := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckAlertPolicyDestroyProducer(t), Steps: []resource.TestStep{ { @@ -117,12 +117,12 @@ func testAccMonitoringAlertPolicy_full(t *testing.T) { func testAccMonitoringAlertPolicy_mql(t *testing.T) { - alertName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - conditionName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + alertName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + conditionName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckAlertPolicyDestroyProducer(t), Steps: []resource.TestStep{ { @@ -139,12 +139,12 @@ func testAccMonitoringAlertPolicy_mql(t *testing.T) { func testAccMonitoringAlertPolicy_log(t *testing.T) { - alertName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - conditionName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + alertName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + conditionName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckAlertPolicyDestroyProducer(t), Steps: []resource.TestStep{ { @@ -161,7 +161,7 @@ func testAccMonitoringAlertPolicy_log(t *testing.T) { func testAccCheckAlertPolicyDestroyProducer(t *testing.T) func(s *terraform.State) error { return func(s *terraform.State) error { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) for _, rs := range s.RootModule().Resources { if rs.Type != "google_monitoring_alert_policy" { @@ -189,13 +189,13 @@ func testAccCheckAlertPolicyDestroyProducer(t *testing.T) func(s *terraform.Stat func testAccMonitoringAlertPolicy_forecast(t *testing.T) { - alertName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - conditionName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + alertName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + conditionName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) filter := `metric.type=\"compute.googleapis.com/instance/disk/write_bytes_count\" AND resource.type=\"gce_instance\"` - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckAlertPolicyDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_monitoring_dashboard_test.go b/mmv1/third_party/terraform/tests/resource_monitoring_dashboard_test.go index 7505a117e89e..5876b7ab6d63 100644 --- a/mmv1/third_party/terraform/tests/resource_monitoring_dashboard_test.go +++ b/mmv1/third_party/terraform/tests/resource_monitoring_dashboard_test.go @@ -16,9 +16,9 @@ import ( func TestAccMonitoringDashboard_basic(t *testing.T) { t.Parallel() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckMonitoringDashboardDestroyProducer(t), Steps: []resource.TestStep{ { @@ -43,9 +43,9 @@ func TestAccMonitoringDashboard_gridLayout(t *testing.T) { t.Skip() t.Parallel() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckMonitoringDashboardDestroyProducer(t), Steps: []resource.TestStep{ { @@ -64,9 +64,9 @@ func TestAccMonitoringDashboard_gridLayout(t *testing.T) { func TestAccMonitoringDashboard_rowLayout(t *testing.T) { t.Parallel() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckMonitoringDashboardDestroyProducer(t), Steps: []resource.TestStep{ { @@ -87,9 +87,9 @@ func TestAccMonitoringDashboard_update(t *testing.T) { t.Skip() t.Parallel() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckMonitoringDashboardDestroyProducer(t), Steps: []resource.TestStep{ { @@ -133,7 +133,7 @@ func testAccCheckMonitoringDashboardDestroyProducer(t *testing.T) func(s *terraf continue } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{MonitoringBasePath}}v1/{{name}}") if err != nil { diff --git a/mmv1/third_party/terraform/tests/resource_monitoring_group_test.go b/mmv1/third_party/terraform/tests/resource_monitoring_group_test.go index ab9068043dc2..9396f5aea57e 100644 --- a/mmv1/third_party/terraform/tests/resource_monitoring_group_test.go +++ b/mmv1/third_party/terraform/tests/resource_monitoring_group_test.go @@ -11,9 +11,9 @@ import ( func TestAccMonitoringGroup_update(t *testing.T) { t.Parallel() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckMonitoringGroupDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_monitoring_metric_descriptor_test.go b/mmv1/third_party/terraform/tests/resource_monitoring_metric_descriptor_test.go index 3a112045ad71..5dba9a0d3e2d 100644 --- a/mmv1/third_party/terraform/tests/resource_monitoring_metric_descriptor_test.go +++ b/mmv1/third_party/terraform/tests/resource_monitoring_metric_descriptor_test.go @@ -13,9 +13,9 @@ func TestAccMonitoringMetricDescriptor_update(t *testing.T) { t.Skip() t.Parallel() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckMonitoringMetricDescriptorDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_monitoring_notification_channel_test.go b/mmv1/third_party/terraform/tests/resource_monitoring_notification_channel_test.go index 74baf0cfbf35..ee2fabad158e 100644 --- a/mmv1/third_party/terraform/tests/resource_monitoring_notification_channel_test.go +++ b/mmv1/third_party/terraform/tests/resource_monitoring_notification_channel_test.go @@ -11,9 +11,9 @@ import ( func TestAccMonitoringNotificationChannel_update(t *testing.T) { t.Parallel() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckMonitoringNotificationChannelDestroyProducer(t), Steps: []resource.TestStep{ { @@ -41,9 +41,9 @@ func TestAccMonitoringNotificationChannel_updateLabels_slack(t *testing.T) { t.Skip() t.Parallel() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckMonitoringNotificationChannelDestroyProducer(t), Steps: []resource.TestStep{ { @@ -62,9 +62,9 @@ func TestAccMonitoringNotificationChannel_updateLabels_slack(t *testing.T) { func TestAccMonitoringNotificationChannel_updateLabels(t *testing.T) { t.Parallel() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckMonitoringNotificationChannelDestroyProducer(t), Steps: []resource.TestStep{ { @@ -91,9 +91,9 @@ func TestAccMonitoringNotificationChannel_updateSensitiveLabels_slack(t *testing t.Skip() t.Parallel() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckMonitoringNotificationChannelDestroyProducer(t), Steps: []resource.TestStep{ { @@ -113,9 +113,9 @@ func TestAccMonitoringNotificationChannel_updateSensitiveLabels_slack(t *testing func TestAccMonitoringNotificationChannel_updateSensitiveLabels(t *testing.T) { t.Parallel() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckMonitoringNotificationChannelDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_monitoring_service_test.go b/mmv1/third_party/terraform/tests/resource_monitoring_service_test.go index c60905bb2677..dc65a5e292c4 100644 --- a/mmv1/third_party/terraform/tests/resource_monitoring_service_test.go +++ b/mmv1/third_party/terraform/tests/resource_monitoring_service_test.go @@ -11,10 +11,10 @@ import ( func TestAccMonitoringService_basic(t *testing.T) { t.Parallel() - randomSuffix := RandString(t, 10) - VcrTest(t, resource.TestCase{ + randomSuffix := acctest.RandString(t, 10) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckMonitoringServiceDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_monitoring_slo_test.go b/mmv1/third_party/terraform/tests/resource_monitoring_slo_test.go index bbd660eb720b..e65294b2d159 100644 --- a/mmv1/third_party/terraform/tests/resource_monitoring_slo_test.go +++ b/mmv1/third_party/terraform/tests/resource_monitoring_slo_test.go @@ -60,9 +60,9 @@ func TestAccMonitoringSlo_basic(t *testing.T) { t.Parallel() var generatedId string - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckMonitoringSloDestroyProducer(t), Steps: []resource.TestStep{ { @@ -95,9 +95,9 @@ func TestAccMonitoringSlo_availabilitySli(t *testing.T) { t.Parallel() var generatedId string - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckMonitoringSloDestroyProducer(t), Steps: []resource.TestStep{ { @@ -128,11 +128,11 @@ func TestAccMonitoringSlo_availabilitySli(t *testing.T) { func TestAccMonitoringSlo_requestBased(t *testing.T) { t.Parallel() - randomSuffix := RandString(t, 10) + randomSuffix := acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckMonitoringSloDestroyProducer(t), Steps: []resource.TestStep{ { @@ -178,11 +178,11 @@ func TestAccMonitoringSlo_requestBased(t *testing.T) { func TestAccMonitoringSlo_windowBased_updateSlis(t *testing.T) { t.Parallel() - randomSuffix := RandString(t, 10) + randomSuffix := acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckMonitoringSloDestroyProducer(t), Steps: []resource.TestStep{ { @@ -244,11 +244,11 @@ func TestAccMonitoringSlo_windowBased_updateSlis(t *testing.T) { func TestAccMonitoringSlo_windowBasedGoodTotalRatioThresholdSlis(t *testing.T) { t.Parallel() - randomSuffix := RandString(t, 10) + randomSuffix := acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckMonitoringSloDestroyProducer(t), Steps: []resource.TestStep{ { @@ -320,11 +320,11 @@ func TestAccMonitoringSlo_windowBasedGoodTotalRatioThresholdSlis(t *testing.T) { func TestAccMonitoringSlo_windowBasedMetricMeanRangeSlis(t *testing.T) { t.Parallel() - randomSuffix := RandString(t, 10) + randomSuffix := acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckMonitoringSloDestroyProducer(t), Steps: []resource.TestStep{ { @@ -360,11 +360,11 @@ func TestAccMonitoringSlo_windowBasedMetricMeanRangeSlis(t *testing.T) { func TestAccMonitoringSlo_windowBasedMetricSumRangeSlis(t *testing.T) { t.Parallel() - randomSuffix := RandString(t, 10) + randomSuffix := acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckMonitoringSloDestroyProducer(t), Steps: []resource.TestStep{ { @@ -400,11 +400,11 @@ func TestAccMonitoringSlo_windowBasedMetricSumRangeSlis(t *testing.T) { func TestAccMonitoringSlo_genericService(t *testing.T) { t.Parallel() - randomSuffix := RandString(t, 10) + randomSuffix := acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckMonitoringSloDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_monitoring_uptime_check_config_test.go b/mmv1/third_party/terraform/tests/resource_monitoring_uptime_check_config_test.go index 77d10e702617..6ad830b7a9e8 100644 --- a/mmv1/third_party/terraform/tests/resource_monitoring_uptime_check_config_test.go +++ b/mmv1/third_party/terraform/tests/resource_monitoring_uptime_check_config_test.go @@ -14,13 +14,13 @@ func TestAccMonitoringUptimeCheckConfig_update(t *testing.T) { project := envvar.GetTestProjectFromEnv() host := "192.168.1.1" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckMonitoringUptimeCheckConfigDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccMonitoringUptimeCheckConfig_update(RandString(t, 4), "mypath", "password1", project, host), + Config: testAccMonitoringUptimeCheckConfig_update(acctest.RandString(t, 4), "mypath", "password1", project, host), }, { ResourceName: "google_monitoring_uptime_check_config.http", @@ -29,7 +29,7 @@ func TestAccMonitoringUptimeCheckConfig_update(t *testing.T) { ImportStateVerifyIgnore: []string{"http_check.0.auth_info.0.password"}, }, { - Config: testAccMonitoringUptimeCheckConfig_update(RandString(t, 4), "", "password2", project, host), + Config: testAccMonitoringUptimeCheckConfig_update(acctest.RandString(t, 4), "", "password2", project, host), }, { ResourceName: "google_monitoring_uptime_check_config.http", @@ -47,13 +47,13 @@ func TestAccMonitoringUptimeCheckConfig_changeNonUpdatableFields(t *testing.T) { t.Parallel() project := envvar.GetTestProjectFromEnv() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckMonitoringUptimeCheckConfigDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccMonitoringUptimeCheckConfig_update(RandString(t, 4), "mypath", "password1", project, "192.168.1.1"), + Config: testAccMonitoringUptimeCheckConfig_update(acctest.RandString(t, 4), "mypath", "password1", project, "192.168.1.1"), }, { ResourceName: "google_monitoring_uptime_check_config.http", @@ -62,7 +62,7 @@ func TestAccMonitoringUptimeCheckConfig_changeNonUpdatableFields(t *testing.T) { ImportStateVerifyIgnore: []string{"http_check.0.auth_info.0.password"}, }, { - Config: testAccMonitoringUptimeCheckConfig_update(RandString(t, 4), "mypath", "password1", project, "192.168.1.2"), + Config: testAccMonitoringUptimeCheckConfig_update(acctest.RandString(t, 4), "mypath", "password1", project, "192.168.1.2"), }, { ResourceName: "google_monitoring_uptime_check_config.http", @@ -71,7 +71,7 @@ func TestAccMonitoringUptimeCheckConfig_changeNonUpdatableFields(t *testing.T) { ImportStateVerifyIgnore: []string{"http_check.0.auth_info.0.password"}, }, { - Config: testAccMonitoringUptimeCheckConfig_update(RandString(t, 4), "mypath", "password2", project, "192.168.1.2"), + Config: testAccMonitoringUptimeCheckConfig_update(acctest.RandString(t, 4), "mypath", "password2", project, "192.168.1.2"), }, { ResourceName: "google_monitoring_uptime_check_config.http", @@ -87,11 +87,11 @@ func TestAccMonitoringUptimeCheckConfig_jsonPathUpdate(t *testing.T) { t.Parallel() project := envvar.GetTestProjectFromEnv() host := "192.168.1.1" - suffix := RandString(t, 4) + suffix := acctest.RandString(t, 4) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckMonitoringUptimeCheckConfigDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_network_management_connectivity_test_resource_test.go b/mmv1/third_party/terraform/tests/resource_network_management_connectivity_test_resource_test.go index 58a0df101cd7..515e640080ef 100644 --- a/mmv1/third_party/terraform/tests/resource_network_management_connectivity_test_resource_test.go +++ b/mmv1/third_party/terraform/tests/resource_network_management_connectivity_test_resource_test.go @@ -12,12 +12,12 @@ func TestAccNetworkManagementConnectivityTest_update(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckNetworkManagementConnectivityTestDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_network_security_address_groups_test.go.erb b/mmv1/third_party/terraform/tests/resource_network_security_address_groups_test.go.erb index 693cebb39f06..2594a163324a 100644 --- a/mmv1/third_party/terraform/tests/resource_network_security_address_groups_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_network_security_address_groups_test.go.erb @@ -13,12 +13,12 @@ import ( func TestAccNetworkSecurityAddressGroups_update(t *testing.T){ t.Parallel() - addressGroupsName := fmt.Sprintf("tf-test-address-group-%s", RandString(t, 10)) + addressGroupsName := fmt.Sprintf("tf-test-address-group-%s", acctest.RandString(t, 10)) projectName := GetTestProjectFromEnv() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckNetworkSecurityAddressGroupDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_network_security_authorization_policy_test.go.erb b/mmv1/third_party/terraform/tests/resource_network_security_authorization_policy_test.go.erb index 86b1c3c714e1..b4c91808253a 100644 --- a/mmv1/third_party/terraform/tests/resource_network_security_authorization_policy_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_network_security_authorization_policy_test.go.erb @@ -7,16 +7,17 @@ import ( "testing" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-provider-google/google/acctest" ) func TestAccNetworkSecurityAuthorizationPolicy_update(t *testing.T) { t.Parallel() - authorizationPolicyName := fmt.Sprintf("tf-test-authorization-policy-%s", RandString(t, 10)) + authorizationPolicyName := fmt.Sprintf("tf-test-authorization-policy-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ - PreCheck: func() { AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + acctest.VcrTest(t, resource.TestCase{ + PreCheck: func() { acctest.AccTestPreCheck(t) }, + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckNetworkSecurityAuthorizationPolicyDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_network_security_client_tls_policy_test.go.erb b/mmv1/third_party/terraform/tests/resource_network_security_client_tls_policy_test.go.erb index 2ba97569323a..c5ce19048f41 100644 --- a/mmv1/third_party/terraform/tests/resource_network_security_client_tls_policy_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_network_security_client_tls_policy_test.go.erb @@ -7,16 +7,17 @@ import ( "testing" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-provider-google/google/acctest" ) func TestAccNetworkSecurityClientTlsPolicy_update(t *testing.T) { t.Parallel() - clientTlsPolicyName := fmt.Sprintf("tf-test-client-tls-policy-%s", RandString(t, 10)) + clientTlsPolicyName := fmt.Sprintf("tf-test-client-tls-policy-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ - PreCheck: func() { AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + acctest.VcrTest(t, resource.TestCase{ + PreCheck: func() { acctest.AccTestPreCheck(t) }, + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckNetworkSecurityClientTlsPolicyDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_network_security_gateway_security_policies_rule_test.go.erb b/mmv1/third_party/terraform/tests/resource_network_security_gateway_security_policies_rule_test.go.erb index d2586846bae5..45252ea227f5 100644 --- a/mmv1/third_party/terraform/tests/resource_network_security_gateway_security_policies_rule_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_network_security_gateway_security_policies_rule_test.go.erb @@ -13,12 +13,12 @@ import ( func TestAccNetworkSecurityGatewaySecurityPolicyRule_update(t *testing.T) { t.Parallel() - gatewaySecurityPolicyName := fmt.Sprintf("tf-test-gateway-sp-%s", RandString(t, 10)) - gatewaySecurityPolicyRuleName := fmt.Sprintf("tf-test-gateway-sp-rule-%s", RandString(t, 10)) + gatewaySecurityPolicyName := fmt.Sprintf("tf-test-gateway-sp-%s", acctest.RandString(t, 10)) + gatewaySecurityPolicyRuleName := fmt.Sprintf("tf-test-gateway-sp-rule-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckNetworkSecurityGatewaySecurityPolicyRuleDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_network_security_gateway_security_policies_test.go.erb b/mmv1/third_party/terraform/tests/resource_network_security_gateway_security_policies_test.go.erb index 11aa9bdfcfe6..dd5e388ad124 100644 --- a/mmv1/third_party/terraform/tests/resource_network_security_gateway_security_policies_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_network_security_gateway_security_policies_test.go.erb @@ -13,11 +13,11 @@ import ( func TestAccNetworkSecurityGatewaySecurityPolicy_update(t *testing.T) { t.Parallel() - gatewaySecurityPolicyName := fmt.Sprintf("tf-test-gateway-sp-%s", RandString(t, 10)) + gatewaySecurityPolicyName := fmt.Sprintf("tf-test-gateway-sp-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckNetworkSecurityGatewaySecurityPolicyDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_network_security_server_tls_policy_test.go.erb b/mmv1/third_party/terraform/tests/resource_network_security_server_tls_policy_test.go.erb index 4a1a75e55609..a211bc2bbaaf 100644 --- a/mmv1/third_party/terraform/tests/resource_network_security_server_tls_policy_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_network_security_server_tls_policy_test.go.erb @@ -7,16 +7,17 @@ import ( "testing" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-provider-google/google/acctest" ) func TestAccNetworkSecurityServerTlsPolicy_update(t *testing.T) { t.Parallel() - serverTlsPolicyName := fmt.Sprintf("tf-test-server-tls-policy-%s", RandString(t, 10)) + serverTlsPolicyName := fmt.Sprintf("tf-test-server-tls-policy-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ - PreCheck: func() { AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + acctest.VcrTest(t, resource.TestCase{ + PreCheck: func() { acctest.AccTestPreCheck(t) }, + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckNetworkSecurityServerTlsPolicyDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_network_security_tls_inspection_policy_test.go.erb b/mmv1/third_party/terraform/tests/resource_network_security_tls_inspection_policy_test.go.erb index e22187a31b55..5c2fed1c8a68 100644 --- a/mmv1/third_party/terraform/tests/resource_network_security_tls_inspection_policy_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_network_security_tls_inspection_policy_test.go.erb @@ -7,18 +7,19 @@ import ( "testing" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-provider-google/google/acctest" ) func TestAccNetworkSecurityTlsInspectionPolicy_update(t *testing.T){ t.Parallel() - tlsInspectionPolicyName := fmt.Sprintf("tf-test-tls-inspection-policy-%s", RandString(t, 10)) - caPoolName := fmt.Sprintf("tf-test-tls-ca-pool-%s", RandString(t, 10)) - certificateAuthorityName := fmt.Sprintf("tf-test-tls-certificate-authority-%s", RandString(t, 10)) + tlsInspectionPolicyName := fmt.Sprintf("tf-test-tls-inspection-policy-%s", acctest.RandString(t, 10)) + caPoolName := fmt.Sprintf("tf-test-tls-ca-pool-%s", acctest.RandString(t, 10)) + certificateAuthorityName := fmt.Sprintf("tf-test-tls-certificate-authority-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ - PreCheck: func() { AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + acctest.VcrTest(t, resource.TestCase{ + PreCheck: func() { acctest.AccTestPreCheck(t) }, + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckNetworkSecurityTlsInspectionPolicyDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_network_security_url_lists_test.go.erb b/mmv1/third_party/terraform/tests/resource_network_security_url_lists_test.go.erb index 3db35ae162b1..011e878fb6c9 100644 --- a/mmv1/third_party/terraform/tests/resource_network_security_url_lists_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_network_security_url_lists_test.go.erb @@ -13,11 +13,11 @@ import ( func TestAccNetworkSecurityUrlLists_update(t *testing.T){ t.Parallel() - urlListsName := fmt.Sprintf("tf-test-url-lists-%s", RandString(t, 10)) + urlListsName := fmt.Sprintf("tf-test-url-lists-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckNetworkSecurityUrlListsDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_network_services_edge_cache_keyset_test.go b/mmv1/third_party/terraform/tests/resource_network_services_edge_cache_keyset_test.go index 4bd1d2148fa0..62c937fcce6b 100644 --- a/mmv1/third_party/terraform/tests/resource_network_services_edge_cache_keyset_test.go +++ b/mmv1/third_party/terraform/tests/resource_network_services_edge_cache_keyset_test.go @@ -11,12 +11,12 @@ func TestAccNetworkServicesEdgeCacheKeyset_update(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckNetworkServicesEdgeCacheKeysetDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_network_services_edge_cache_origin_test.go b/mmv1/third_party/terraform/tests/resource_network_services_edge_cache_origin_test.go index 402fbe0088d9..ba5f64796aa6 100644 --- a/mmv1/third_party/terraform/tests/resource_network_services_edge_cache_origin_test.go +++ b/mmv1/third_party/terraform/tests/resource_network_services_edge_cache_origin_test.go @@ -10,10 +10,10 @@ import ( func TestAccNetworkServicesEdgeCacheOrigin_updateAndImport(t *testing.T) { t.Parallel() - name := "tf-test-origin-" + RandString(t, 10) - VcrTest(t, resource.TestCase{ + name := "tf-test-origin-" + acctest.RandString(t, 10) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckNetworkServicesEdgeCacheOriginDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_network_services_edge_cache_service_test.go b/mmv1/third_party/terraform/tests/resource_network_services_edge_cache_service_test.go index b4b6f2b39caf..a110d96552ba 100644 --- a/mmv1/third_party/terraform/tests/resource_network_services_edge_cache_service_test.go +++ b/mmv1/third_party/terraform/tests/resource_network_services_edge_cache_service_test.go @@ -10,12 +10,12 @@ import ( func TestAccNetworkServicesEdgeCacheService_updateAndImport(t *testing.T) { t.Parallel() - namebkt := "tf-test-bucket-" + RandString(t, 10) - nameorigin := "tf-test-origin-" + RandString(t, 10) - nameservice := "tf-test-service-" + RandString(t, 10) - VcrTest(t, resource.TestCase{ + namebkt := "tf-test-bucket-" + acctest.RandString(t, 10) + nameorigin := "tf-test-origin-" + acctest.RandString(t, 10) + nameservice := "tf-test-service-" + acctest.RandString(t, 10) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckNetworkServicesEdgeCacheServiceDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_network_services_endpoint_policy_test.go.erb b/mmv1/third_party/terraform/tests/resource_network_services_endpoint_policy_test.go.erb index cfe9e2b12a91..146d7a3fd991 100644 --- a/mmv1/third_party/terraform/tests/resource_network_services_endpoint_policy_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_network_services_endpoint_policy_test.go.erb @@ -13,11 +13,11 @@ import ( func TestAccNetworkServicesEndpointPolicy_update(t *testing.T) { t.Parallel() - endpointPolicyName := fmt.Sprintf("tf-test-endpoint-policy-%s", RandString(t, 10)) + endpointPolicyName := fmt.Sprintf("tf-test-endpoint-policy-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckNetworkServicesEndpointPolicyDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_network_services_gateway_test.go.erb b/mmv1/third_party/terraform/tests/resource_network_services_gateway_test.go.erb index d001f4033ad0..ef460ed39f06 100644 --- a/mmv1/third_party/terraform/tests/resource_network_services_gateway_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_network_services_gateway_test.go.erb @@ -13,11 +13,11 @@ import ( func TestAccNetworkServicesGateway_update(t *testing.T) { t.Parallel() - gatewayName := fmt.Sprintf("tf-test-gateway-%s", RandString(t, 10)) + gatewayName := fmt.Sprintf("tf-test-gateway-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckNetworkServicesGatewayDestroyProducer(t), Steps: []resource.TestStep{ { @@ -69,22 +69,22 @@ resource "google_network_services_gateway" "foobar" { // TODO(#14600): Enable the test once the api allows to update the fields for secure web gateway type. //func TestAccNetworkServicesGateway_updateSwp(t *testing.T) { -//cmName := fmt.Sprintf("tf-test-gateway-swp-cm-%s", RandString(t, 10)) -// netName := fmt.Sprintf("tf-test-gateway-swp-net-%s", RandString(t, 10)) -// subnetName := fmt.Sprintf("tf-test-gateway-swp-subnet-%s", RandString(t, 10)) -// pSubnetName := fmt.Sprintf("tf-test-gateway-swp-proxyonly-%s", RandString(t, 10)) -// policyName := fmt.Sprintf("tf-test-gateway-swp-policy-%s", RandString(t, 10)) -// ruleName := fmt.Sprintf("tf-test-gateway-swp-rule-%s", RandString(t, 10)) -// gatewayScope := fmt.Sprintf("tf-test-gateway-swp-scope-%s", RandString(t, 10)) -// gatewayName := fmt.Sprintf("tf-test-gateway-swp-%s", RandString(t, 10)) +//cmName := fmt.Sprintf("tf-test-gateway-swp-cm-%s", acctest.RandString(t, 10)) +// netName := fmt.Sprintf("tf-test-gateway-swp-net-%s", acctest.RandString(t, 10)) +// subnetName := fmt.Sprintf("tf-test-gateway-swp-subnet-%s", acctest.RandString(t, 10)) +// pSubnetName := fmt.Sprintf("tf-test-gateway-swp-proxyonly-%s", acctest.RandString(t, 10)) +// policyName := fmt.Sprintf("tf-test-gateway-swp-policy-%s", acctest.RandString(t, 10)) +// ruleName := fmt.Sprintf("tf-test-gateway-swp-rule-%s", acctest.RandString(t, 10)) +// gatewayScope := fmt.Sprintf("tf-test-gateway-swp-scope-%s", acctest.RandString(t, 10)) +// gatewayName := fmt.Sprintf("tf-test-gateway-swp-%s", acctest.RandString(t, 10)) // // updates -// newCmName := fmt.Sprintf("tf-test-gateway-swp-newcm-%s", RandString(t, 10)) -// newPolicyName := fmt.Sprintf("tf-test-gateway-swp-newpolicy-%s", RandString(t, 10)) -// newRuleName := fmt.Sprintf("tf-test-gateway-swp-newrule-%s", RandString(t, 10)) +// newCmName := fmt.Sprintf("tf-test-gateway-swp-newcm-%s", acctest.RandString(t, 10)) +// newPolicyName := fmt.Sprintf("tf-test-gateway-swp-newpolicy-%s", acctest.RandString(t, 10)) +// newRuleName := fmt.Sprintf("tf-test-gateway-swp-newrule-%s", acctest.RandString(t, 10)) // -// VcrTest(t, resource.TestCase{ +// acctest.VcrTest(t, resource.TestCase{ // PreCheck: func() { acctest.AccTestPreCheck(t) }, -// ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), +// ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), // CheckDestroy: testAccCheckNetworkServicesGatewayDestroyProducer(t), // Steps: []resource.TestStep{ // { @@ -275,21 +275,21 @@ resource "google_network_services_gateway" "foobar" { //} func TestAccNetworkServicesGateway_multipleSwpGatewaysDifferentSubnetwork(t *testing.T) { - cmName := fmt.Sprintf("tf-test-gateway-multiswp-cm-%s", RandString(t, 10)) - netName := fmt.Sprintf("tf-test-gateway-multiswp-net-%s", RandString(t, 10)) - subnetName := fmt.Sprintf("tf-test-gateway-multiswp-subnet-%s", RandString(t, 10)) - pSubnetName := fmt.Sprintf("tf-test-gateway-multiswp-proxyonly-%s", RandString(t, 10)) - policyName := fmt.Sprintf("tf-test-gateway-multiswp-policy-%s", RandString(t, 10)) - ruleName := fmt.Sprintf("tf-test-gateway-multiswp-rule-%s", RandString(t, 10)) - gatewayScope := fmt.Sprintf("tf-test-gateway-multiswp-scope-%s", RandString(t, 10)) - gatewayName := fmt.Sprintf("tf-test-gateway-multiswp-%s", RandString(t, 10)) - subnet2Name := fmt.Sprintf("tf-test-gateway-multiswp-subnet2-%s", RandString(t, 10)) - gateway2Name := fmt.Sprintf("tf-test-gateway-multiswp2-%s", RandString(t, 10)) - gateway2Scope := fmt.Sprintf("tf-test-gateway-multiswp-scope2-%s", RandString(t, 10)) - - VcrTest(t, resource.TestCase{ + cmName := fmt.Sprintf("tf-test-gateway-multiswp-cm-%s", acctest.RandString(t, 10)) + netName := fmt.Sprintf("tf-test-gateway-multiswp-net-%s", acctest.RandString(t, 10)) + subnetName := fmt.Sprintf("tf-test-gateway-multiswp-subnet-%s", acctest.RandString(t, 10)) + pSubnetName := fmt.Sprintf("tf-test-gateway-multiswp-proxyonly-%s", acctest.RandString(t, 10)) + policyName := fmt.Sprintf("tf-test-gateway-multiswp-policy-%s", acctest.RandString(t, 10)) + ruleName := fmt.Sprintf("tf-test-gateway-multiswp-rule-%s", acctest.RandString(t, 10)) + gatewayScope := fmt.Sprintf("tf-test-gateway-multiswp-scope-%s", acctest.RandString(t, 10)) + gatewayName := fmt.Sprintf("tf-test-gateway-multiswp-%s", acctest.RandString(t, 10)) + subnet2Name := fmt.Sprintf("tf-test-gateway-multiswp-subnet2-%s", acctest.RandString(t, 10)) + gateway2Name := fmt.Sprintf("tf-test-gateway-multiswp2-%s", acctest.RandString(t, 10)) + gateway2Scope := fmt.Sprintf("tf-test-gateway-multiswp-scope2-%s", acctest.RandString(t, 10)) + + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckNetworkServicesGatewayDestroyProducer(t), Steps: []resource.TestStep{ { @@ -489,23 +489,23 @@ resource "google_compute_subnetwork" "subnet2" { } func TestAccNetworkServicesGateway_multipleSwpGatewaysDifferentNetwork(t *testing.T) { - cmName := fmt.Sprintf("tf-test-gateway-diffswp-cm-%s", RandString(t, 10)) - netName := fmt.Sprintf("tf-test-gateway-diffswp-net-%s", RandString(t, 10)) - subnetName := fmt.Sprintf("tf-test-gateway-diffswp-subnet-%s", RandString(t, 10)) - pSubnetName := fmt.Sprintf("tf-test-gateway-diffswp-proxyonly-%s", RandString(t, 10)) - policyName := fmt.Sprintf("tf-test-gateway-diffswp-policy-%s", RandString(t, 10)) - ruleName := fmt.Sprintf("tf-test-gateway-diffswp-rule-%s", RandString(t, 10)) - gatewayName := fmt.Sprintf("tf-test-gateway-diffswp-%s", RandString(t, 10)) - gatewayScope := fmt.Sprintf("tf-test-gateway-diffswp-scope-%s", RandString(t, 10)) - net2Name := fmt.Sprintf("tf-test-gateway-diffswp-net2-%s", RandString(t, 10)) - subnet2Name := fmt.Sprintf("tf-test-gateway-diffswp-subnet2-%s", RandString(t, 10)) - pSubnet2Name := fmt.Sprintf("tf-test-gateway-diffswp-proxyonly2-%s", RandString(t, 10)) - gateway2Name := fmt.Sprintf("tf-test-gateway-diffswp2-%s", RandString(t, 10)) - gateway2Scope := fmt.Sprintf("tf-test-gateway-diffswp-scope2-%s", RandString(t, 10)) - - VcrTest(t, resource.TestCase{ + cmName := fmt.Sprintf("tf-test-gateway-diffswp-cm-%s", acctest.RandString(t, 10)) + netName := fmt.Sprintf("tf-test-gateway-diffswp-net-%s", acctest.RandString(t, 10)) + subnetName := fmt.Sprintf("tf-test-gateway-diffswp-subnet-%s", acctest.RandString(t, 10)) + pSubnetName := fmt.Sprintf("tf-test-gateway-diffswp-proxyonly-%s", acctest.RandString(t, 10)) + policyName := fmt.Sprintf("tf-test-gateway-diffswp-policy-%s", acctest.RandString(t, 10)) + ruleName := fmt.Sprintf("tf-test-gateway-diffswp-rule-%s", acctest.RandString(t, 10)) + gatewayName := fmt.Sprintf("tf-test-gateway-diffswp-%s", acctest.RandString(t, 10)) + gatewayScope := fmt.Sprintf("tf-test-gateway-diffswp-scope-%s", acctest.RandString(t, 10)) + net2Name := fmt.Sprintf("tf-test-gateway-diffswp-net2-%s", acctest.RandString(t, 10)) + subnet2Name := fmt.Sprintf("tf-test-gateway-diffswp-subnet2-%s", acctest.RandString(t, 10)) + pSubnet2Name := fmt.Sprintf("tf-test-gateway-diffswp-proxyonly2-%s", acctest.RandString(t, 10)) + gateway2Name := fmt.Sprintf("tf-test-gateway-diffswp2-%s", acctest.RandString(t, 10)) + gateway2Scope := fmt.Sprintf("tf-test-gateway-diffswp-scope2-%s", acctest.RandString(t, 10)) + + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckNetworkServicesGatewayDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_network_services_grpc_route_test.go.erb b/mmv1/third_party/terraform/tests/resource_network_services_grpc_route_test.go.erb index a9ca016cf8d1..2e15468c69af 100644 --- a/mmv1/third_party/terraform/tests/resource_network_services_grpc_route_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_network_services_grpc_route_test.go.erb @@ -7,16 +7,17 @@ import ( "testing" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-provider-google/google/acctest" ) func TestAccNetworkServicesGrpcRoute_update(t *testing.T) { t.Parallel() - grpcRouteName := fmt.Sprintf("tf-test-grpc-route-%s", RandString(t, 10)) + grpcRouteName := fmt.Sprintf("tf-test-grpc-route-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ - PreCheck: func() { AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + acctest.VcrTest(t, resource.TestCase{ + PreCheck: func() { acctest.AccTestPreCheck(t) }, + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckNetworkServicesGrpcRouteDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_network_services_http_route_test.go.erb b/mmv1/third_party/terraform/tests/resource_network_services_http_route_test.go.erb index f1c5c78bfdff..74a33113f231 100644 --- a/mmv1/third_party/terraform/tests/resource_network_services_http_route_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_network_services_http_route_test.go.erb @@ -13,11 +13,11 @@ import ( func TestAccNetworkServicesHttpRoute_update(t *testing.T) { t.Parallel() - httpRouteName := fmt.Sprintf("tf-test-http-route-%s", RandString(t, 10)) + httpRouteName := fmt.Sprintf("tf-test-http-route-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckNetworkServicesHttpRouteDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_network_services_mesh_test.go.erb b/mmv1/third_party/terraform/tests/resource_network_services_mesh_test.go.erb index d5e1e044658d..913f56a9ba01 100644 --- a/mmv1/third_party/terraform/tests/resource_network_services_mesh_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_network_services_mesh_test.go.erb @@ -13,11 +13,11 @@ import ( func TestAccNetworkServicesMesh_update(t *testing.T) { t.Parallel() - meshName := fmt.Sprintf("tf-test-mesh-%s", RandString(t, 10)) + meshName := fmt.Sprintf("tf-test-mesh-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckNetworkServicesMeshDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_network_services_service_binding_test.go.erb b/mmv1/third_party/terraform/tests/resource_network_services_service_binding_test.go.erb index 35696bcb319c..6396e8245ac4 100644 --- a/mmv1/third_party/terraform/tests/resource_network_services_service_binding_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_network_services_service_binding_test.go.erb @@ -13,13 +13,13 @@ import ( func TestAccNetworkServicesServiceBinding_update(t *testing.T) { t.Parallel() - serviceNamespace := fmt.Sprintf("tf-test-service-namespace-%s", RandString(t, 10)) - serviceName := fmt.Sprintf("tf-test-service-%s", RandString(t, 10)) - serviceBindingName := fmt.Sprintf("tf-test-service-binding-%s", RandString(t, 10)) + serviceNamespace := fmt.Sprintf("tf-test-service-namespace-%s", acctest.RandString(t, 10)) + serviceName := fmt.Sprintf("tf-test-service-%s", acctest.RandString(t, 10)) + serviceBindingName := fmt.Sprintf("tf-test-service-binding-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckNetworkServicesServiceBindingDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_network_services_tcp_route_test.go.erb b/mmv1/third_party/terraform/tests/resource_network_services_tcp_route_test.go.erb index d86d6fe9ba3b..ec1f5d411cef 100644 --- a/mmv1/third_party/terraform/tests/resource_network_services_tcp_route_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_network_services_tcp_route_test.go.erb @@ -13,13 +13,13 @@ import ( func TestAccNetworkServicesTcpRoute_update(t *testing.T) { t.Parallel() - tcpServiceName := fmt.Sprintf("tf-test-tcp-service-%s", RandString(t, 10)) - tcpHealthCheckName := fmt.Sprintf("tf-test-tcp-healthcheck-%s", RandString(t, 10)) - tcpRouteName := fmt.Sprintf("tf-test-tcp-route-%s", RandString(t, 10)) + tcpServiceName := fmt.Sprintf("tf-test-tcp-service-%s", acctest.RandString(t, 10)) + tcpHealthCheckName := fmt.Sprintf("tf-test-tcp-healthcheck-%s", acctest.RandString(t, 10)) + tcpRouteName := fmt.Sprintf("tf-test-tcp-route-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckNetworkServicesTcpRouteDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_network_services_tls_route_test.go.erb b/mmv1/third_party/terraform/tests/resource_network_services_tls_route_test.go.erb index 157bde6130a0..541402ceaf70 100644 --- a/mmv1/third_party/terraform/tests/resource_network_services_tls_route_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_network_services_tls_route_test.go.erb @@ -13,13 +13,13 @@ import ( func TestAccNetworkServicesTlsRoute_update(t *testing.T) { t.Parallel() - tlsServiceName := fmt.Sprintf("tf-test-tls-service-%s", RandString(t, 10)) - tlsHealthCheckName := fmt.Sprintf("tf-test-tls-healthcheck-%s", RandString(t, 10)) - tlsRouteName := fmt.Sprintf("tf-test-tls-route-%s", RandString(t, 10)) + tlsServiceName := fmt.Sprintf("tf-test-tls-service-%s", acctest.RandString(t, 10)) + tlsHealthCheckName := fmt.Sprintf("tf-test-tls-healthcheck-%s", acctest.RandString(t, 10)) + tlsRouteName := fmt.Sprintf("tf-test-tls-route-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckNetworkServicesTlsRouteDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_notebooks_environment_test.go.erb b/mmv1/third_party/terraform/tests/resource_notebooks_environment_test.go.erb index e77cf41e9ceb..d4c694b14489 100644 --- a/mmv1/third_party/terraform/tests/resource_notebooks_environment_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_notebooks_environment_test.go.erb @@ -7,16 +7,17 @@ import ( "testing" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-provider-google/google/acctest" ) func TestAccNotebooksEnvironment_create(t *testing.T) { t.Parallel() - prefix := fmt.Sprintf("%d", RandInt(t)) + prefix := fmt.Sprintf("%d", acctest.RandInt(t)) name := fmt.Sprintf("tf-env-%s", prefix) - VcrTest(t, resource.TestCase{ - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + acctest.VcrTest(t, resource.TestCase{ + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccNotebooksEnvironment_create(name), diff --git a/mmv1/third_party/terraform/tests/resource_notebooks_instance_container_test.go.erb b/mmv1/third_party/terraform/tests/resource_notebooks_instance_container_test.go.erb index 917cc87dda17..169d6da716da 100644 --- a/mmv1/third_party/terraform/tests/resource_notebooks_instance_container_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_notebooks_instance_container_test.go.erb @@ -7,16 +7,17 @@ import ( "testing" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-provider-google/google/acctest" ) func TestAccNotebooksInstance_create_container(t *testing.T) { t.Parallel() - prefix := fmt.Sprintf("%d", RandInt(t)) + prefix := fmt.Sprintf("%d", acctest.RandInt(t)) name := fmt.Sprintf("tf-%s", prefix) - VcrTest(t, resource.TestCase{ - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + acctest.VcrTest(t, resource.TestCase{ + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccNotebooksInstance_create_container(name), diff --git a/mmv1/third_party/terraform/tests/resource_notebooks_instance_gpu_test.go.erb b/mmv1/third_party/terraform/tests/resource_notebooks_instance_gpu_test.go.erb index 26c63c2ef37d..71eaab37708a 100644 --- a/mmv1/third_party/terraform/tests/resource_notebooks_instance_gpu_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_notebooks_instance_gpu_test.go.erb @@ -7,16 +7,17 @@ import ( "testing" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-provider-google/google/acctest" ) func TestAccNotebooksInstance_create_gpu(t *testing.T) { t.Parallel() - prefix := fmt.Sprintf("%d", RandInt(t)) + prefix := fmt.Sprintf("%d", acctest.RandInt(t)) name := fmt.Sprintf("tf-%s", prefix) - VcrTest(t, resource.TestCase{ - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + acctest.VcrTest(t, resource.TestCase{ + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccNotebooksInstance_create_gpu(name), diff --git a/mmv1/third_party/terraform/tests/resource_notebooks_instance_test.go.erb b/mmv1/third_party/terraform/tests/resource_notebooks_instance_test.go.erb index e28c8192c17e..a3165ffa39a6 100644 --- a/mmv1/third_party/terraform/tests/resource_notebooks_instance_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_notebooks_instance_test.go.erb @@ -13,11 +13,11 @@ import ( func TestAccNotebooksInstance_create_vm_image(t *testing.T) { t.Parallel() - prefix := fmt.Sprintf("%d", RandInt(t)) + prefix := fmt.Sprintf("%d", acctest.RandInt(t)) name := fmt.Sprintf("tf-%s", prefix) - VcrTest(t, resource.TestCase{ - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + acctest.VcrTest(t, resource.TestCase{ + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccNotebooksInstance_create_vm_image(name), @@ -34,11 +34,11 @@ func TestAccNotebooksInstance_create_vm_image(t *testing.T) { func TestAccNotebooksInstance_update(t *testing.T) { context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + acctest.VcrTest(t, resource.TestCase{ + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccNotebooksInstance_basic(context), diff --git a/mmv1/third_party/terraform/tests/resource_notebooks_runtime_test.go.erb b/mmv1/third_party/terraform/tests/resource_notebooks_runtime_test.go.erb index 5d6351bfa1e1..d3f59104a6c0 100644 --- a/mmv1/third_party/terraform/tests/resource_notebooks_runtime_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_notebooks_runtime_test.go.erb @@ -10,12 +10,12 @@ import ( func TestAccNotebooksRuntime_update(t *testing.T) { context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckNotebooksRuntimeDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_org_policy_custom_constraint_test.go.erb b/mmv1/third_party/terraform/tests/resource_org_policy_custom_constraint_test.go.erb index af45a6f5ccce..d2ae568c67e9 100644 --- a/mmv1/third_party/terraform/tests/resource_org_policy_custom_constraint_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_org_policy_custom_constraint_test.go.erb @@ -15,12 +15,12 @@ func TestAccOrgPolicyCustomConstraint_update(t *testing.T) { context := map[string]interface{}{ "org_id": envvar.GetTestOrgFromEnv(t), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckOrgPolicyCustomConstraintDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_os_config_os_policy_assignment_test.go.erb b/mmv1/third_party/terraform/tests/resource_os_config_os_policy_assignment_test.go.erb index 53f0ab927853..10a347b0eee2 100644 --- a/mmv1/third_party/terraform/tests/resource_os_config_os_policy_assignment_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_os_config_os_policy_assignment_test.go.erb @@ -17,12 +17,12 @@ func TestAccOSConfigOSPolicyAssignment_basic(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckOSConfigOSPolicyAssignmentDestroyProducer(t), Steps: []resource.TestStep{ { @@ -226,7 +226,7 @@ func testAccCheckOSConfigOSPolicyAssignmentDestroyProducer(t *testing.T) func(s continue } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) url, err := replaceVarsForTest(config, rs, "{{OSConfigBasePath}}projects/{{project}}/locations/{{location}}/osPolicyAssignments/{{name}}") if err != nil { diff --git a/mmv1/third_party/terraform/tests/resource_os_login_ssh_public_key_test.go b/mmv1/third_party/terraform/tests/resource_os_login_ssh_public_key_test.go index d9884d51b630..247a82d1e2a1 100644 --- a/mmv1/third_party/terraform/tests/resource_os_login_ssh_public_key_test.go +++ b/mmv1/third_party/terraform/tests/resource_os_login_ssh_public_key_test.go @@ -14,14 +14,14 @@ func TestAccOSLoginSSHPublicKey_osLoginSshKeyExpiry(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), "org_id": envvar.GetTestOrgFromEnv(t), "billing_account": envvar.GetTestBillingAccountFromEnv(t), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), ExternalProviders: map[string]resource.ExternalProvider{ "time": {}, }, diff --git a/mmv1/third_party/terraform/tests/resource_privateca_ca_pool_iam_test.go b/mmv1/third_party/terraform/tests/resource_privateca_ca_pool_iam_test.go index 31a0f42b1e91..27bb57725de7 100644 --- a/mmv1/third_party/terraform/tests/resource_privateca_ca_pool_iam_test.go +++ b/mmv1/third_party/terraform/tests/resource_privateca_ca_pool_iam_test.go @@ -17,13 +17,13 @@ import ( func TestAccPrivatecaCaPoolIamMemberAllAuthenticatedUsersCasing(t *testing.T) { t.Parallel() - capool := "tf-test-pool-iam-" + RandString(t, 10) + capool := "tf-test-pool-iam-" + acctest.RandString(t, 10) project := envvar.GetTestProjectFromEnv() region := envvar.GetTestRegionFromEnv() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccPrivatecaCaPoolIamMember_allAuthenticatedUsers(capool, region, project), @@ -46,7 +46,7 @@ func testAccCheckPrivatecaCaPoolIam(t *testing.T, capool, region, project, role }, } u := &privateca.PrivatecaCaPoolIamUpdater{ - Config: GoogleProviderConfig(t), + Config: acctest.GoogleProviderConfig(t), } u.SetProject(project) u.SetLocation(region) diff --git a/mmv1/third_party/terraform/tests/resource_privateca_ca_pool_test.go b/mmv1/third_party/terraform/tests/resource_privateca_ca_pool_test.go index 6bf37924cf70..10dfe5401e1a 100644 --- a/mmv1/third_party/terraform/tests/resource_privateca_ca_pool_test.go +++ b/mmv1/third_party/terraform/tests/resource_privateca_ca_pool_test.go @@ -11,12 +11,12 @@ func TestAccPrivatecaCaPool_privatecaCapoolUpdate(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckPrivatecaCaPoolDestroyProducer(t), Steps: []resource.TestStep{ { @@ -218,12 +218,12 @@ func TestAccPrivatecaCaPool_privatecaCapoolEmptyBaseline(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckPrivatecaCaPoolDestroyProducer(t), Steps: []resource.TestStep{ { @@ -282,12 +282,12 @@ func TestAccPrivatecaCaPool_privatecaCapoolEmptyPublishingOptions(t *testing.T) t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckPrivatecaCaPoolDestroyProducer(t), Steps: []resource.TestStep{ { @@ -324,12 +324,12 @@ func TestAccPrivatecaCaPool_updateCaOption(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckPrivatecaCaPoolDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_privateca_certificate_authority_test.go b/mmv1/third_party/terraform/tests/resource_privateca_certificate_authority_test.go index 79cce329ec8d..ba538fce5151 100644 --- a/mmv1/third_party/terraform/tests/resource_privateca_certificate_authority_test.go +++ b/mmv1/third_party/terraform/tests/resource_privateca_certificate_authority_test.go @@ -14,12 +14,12 @@ func TestAccPrivatecaCertificateAuthority_privatecaCertificateAuthorityUpdate(t "pool_name": acctest.BootstrapSharedCaPoolInLocation(t, "us-central1"), "pool_location": "us-central1", "deletion_protection": false, - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckPrivatecaCertificateAuthorityDestroyProducer(t), Steps: []resource.TestStep{ { @@ -61,7 +61,7 @@ func TestAccPrivatecaCertificateAuthority_privatecaCertificateAuthorityUpdate(t func TestAccPrivatecaCertificateAuthority_rootCaManageDesiredState(t *testing.T) { t.Parallel() - random_suffix := RandString(t, 10) + random_suffix := acctest.RandString(t, 10) context_staged := map[string]interface{}{ "pool_name": acctest.BootstrapSharedCaPoolInLocation(t, "us-central1"), "pool_location": "us-central1", @@ -87,9 +87,9 @@ func TestAccPrivatecaCertificateAuthority_rootCaManageDesiredState(t *testing.T) } resourceName := "google_privateca_certificate_authority.default" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckPrivatecaCertificateAuthorityDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_privateca_certificate_test.go b/mmv1/third_party/terraform/tests/resource_privateca_certificate_test.go index e7742e9cba85..ae44f81d21cb 100644 --- a/mmv1/third_party/terraform/tests/resource_privateca_certificate_test.go +++ b/mmv1/third_party/terraform/tests/resource_privateca_certificate_test.go @@ -12,12 +12,12 @@ func TestAccPrivatecaCertificate_privatecaCertificateUpdate(t *testing.T) { context := map[string]interface{}{ "deletion_protection": false, - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckPrivatecaCertificateDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_project_service_identity_test.go.erb b/mmv1/third_party/terraform/tests/resource_project_service_identity_test.go.erb index ea3e9d15ea54..663e2c918c73 100644 --- a/mmv1/third_party/terraform/tests/resource_project_service_identity_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_project_service_identity_test.go.erb @@ -12,9 +12,9 @@ import ( func TestAccProjectServiceIdentity_basic(t *testing.T) { t.Parallel() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testGoogleProjectServiceIdentity_basic(), diff --git a/mmv1/third_party/terraform/tests/resource_pubsub_lite_subscription_test.go b/mmv1/third_party/terraform/tests/resource_pubsub_lite_subscription_test.go index bcf7cc969e1c..d9c22dcaddba 100644 --- a/mmv1/third_party/terraform/tests/resource_pubsub_lite_subscription_test.go +++ b/mmv1/third_party/terraform/tests/resource_pubsub_lite_subscription_test.go @@ -11,12 +11,12 @@ import ( func TestAccPubsubLiteSubscription_pubsubLiteSubscription_deliveryRequirement_update(t *testing.T) { t.Parallel() - topic := fmt.Sprintf("tf-test-topic-foo-%s", RandString(t, 10)) - subscription := fmt.Sprintf("tf-test-topic-foo-%s", RandString(t, 10)) + topic := fmt.Sprintf("tf-test-topic-foo-%s", acctest.RandString(t, 10)) + subscription := fmt.Sprintf("tf-test-topic-foo-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckPubsubLiteSubscriptionDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_pubsub_lite_topic_test.go b/mmv1/third_party/terraform/tests/resource_pubsub_lite_topic_test.go index be8bc67e503d..d4817aaaf423 100644 --- a/mmv1/third_party/terraform/tests/resource_pubsub_lite_topic_test.go +++ b/mmv1/third_party/terraform/tests/resource_pubsub_lite_topic_test.go @@ -11,11 +11,11 @@ import ( func TestAccPubsubLiteTopic_pubsubLiteTopic_count_update(t *testing.T) { t.Parallel() - topic := fmt.Sprintf("tf-test-topic-foo-%s", RandString(t, 10)) + topic := fmt.Sprintf("tf-test-topic-foo-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckPubsubLiteTopicDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_pubsub_schema_test.go b/mmv1/third_party/terraform/tests/resource_pubsub_schema_test.go index e8131d5cf080..7d4403af9bb6 100644 --- a/mmv1/third_party/terraform/tests/resource_pubsub_schema_test.go +++ b/mmv1/third_party/terraform/tests/resource_pubsub_schema_test.go @@ -11,11 +11,11 @@ import ( func TestAccPubsubSchema_update(t *testing.T) { t.Parallel() - schema := fmt.Sprintf("tf-test-schema-%s", RandString(t, 10)) + schema := fmt.Sprintf("tf-test-schema-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckPubsubSubscriptionDestroyProducer(t), ExternalProviders: map[string]resource.ExternalProvider{ "time": {}, diff --git a/mmv1/third_party/terraform/tests/resource_pubsub_subscription_iam_test.go b/mmv1/third_party/terraform/tests/resource_pubsub_subscription_iam_test.go index 712a44f581a5..d5841be373a7 100644 --- a/mmv1/third_party/terraform/tests/resource_pubsub_subscription_iam_test.go +++ b/mmv1/third_party/terraform/tests/resource_pubsub_subscription_iam_test.go @@ -17,13 +17,13 @@ import ( func TestAccPubsubSubscriptionIamBinding(t *testing.T) { t.Parallel() - topic := "tf-test-topic-iam-" + RandString(t, 10) - subscription := "tf-test-sub-iam-" + RandString(t, 10) - account := "tf-test-iam-" + RandString(t, 10) + topic := "tf-test-topic-iam-" + acctest.RandString(t, 10) + subscription := "tf-test-sub-iam-" + acctest.RandString(t, 10) + account := "tf-test-iam-" + acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { // Test IAM Binding creation @@ -53,14 +53,14 @@ func TestAccPubsubSubscriptionIamBinding(t *testing.T) { func TestAccPubsubSubscriptionIamMember(t *testing.T) { t.Parallel() - topic := "tf-test-topic-iam-" + RandString(t, 10) - subscription := "tf-test-sub-iam-" + RandString(t, 10) - account := "tf-test-iam-" + RandString(t, 10) + topic := "tf-test-topic-iam-" + acctest.RandString(t, 10) + subscription := "tf-test-sub-iam-" + acctest.RandString(t, 10) + account := "tf-test-iam-" + acctest.RandString(t, 10) accountEmail := fmt.Sprintf("%s@%s.iam.gserviceaccount.com", account, envvar.GetTestProjectFromEnv()) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { // Test Iam Member creation (no update for member, no need to test) @@ -82,13 +82,13 @@ func TestAccPubsubSubscriptionIamMember(t *testing.T) { func TestAccPubsubSubscriptionIamPolicy(t *testing.T) { t.Parallel() - topic := "tf-test-topic-iam-" + RandString(t, 10) - subscription := "tf-test-sub-iam-" + RandString(t, 10) - account := "tf-test-iam-" + RandString(t, 10) + topic := "tf-test-topic-iam-" + acctest.RandString(t, 10) + subscription := "tf-test-sub-iam-" + acctest.RandString(t, 10) + account := "tf-test-iam-" + acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccPubsubSubscriptionIamPolicy_basic(subscription, topic, account, "roles/pubsub.subscriber"), @@ -117,7 +117,7 @@ func TestAccPubsubSubscriptionIamPolicy(t *testing.T) { func testAccCheckPubsubSubscriptionIam(t *testing.T, subscription, role string, members []string) resource.TestCheckFunc { return func(s *terraform.State) error { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) p, err := config.NewPubsubClient(config.UserAgent).Projects.Subscriptions.GetIamPolicy(pubsub.GetComputedSubscriptionName(envvar.GetTestProjectFromEnv(), subscription)).Do() if err != nil { return err diff --git a/mmv1/third_party/terraform/tests/resource_pubsub_subscription_test.go b/mmv1/third_party/terraform/tests/resource_pubsub_subscription_test.go index 77ad78260296..15e54e5f9807 100644 --- a/mmv1/third_party/terraform/tests/resource_pubsub_subscription_test.go +++ b/mmv1/third_party/terraform/tests/resource_pubsub_subscription_test.go @@ -15,12 +15,12 @@ import ( func TestAccPubsubSubscription_emptyTTL(t *testing.T) { t.Parallel() - topic := fmt.Sprintf("tf-test-topic-%s", RandString(t, 10)) - subscription := fmt.Sprintf("tf-test-sub-%s", RandString(t, 10)) + topic := fmt.Sprintf("tf-test-topic-%s", acctest.RandString(t, 10)) + subscription := fmt.Sprintf("tf-test-sub-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckPubsubSubscriptionDestroyProducer(t), Steps: []resource.TestStep{ { @@ -39,12 +39,12 @@ func TestAccPubsubSubscription_emptyTTL(t *testing.T) { func TestAccPubsubSubscription_basic(t *testing.T) { t.Parallel() - topic := fmt.Sprintf("tf-test-topic-%s", RandString(t, 10)) - subscription := fmt.Sprintf("tf-test-sub-%s", RandString(t, 10)) + topic := fmt.Sprintf("tf-test-topic-%s", acctest.RandString(t, 10)) + subscription := fmt.Sprintf("tf-test-sub-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckPubsubSubscriptionDestroyProducer(t), Steps: []resource.TestStep{ { @@ -63,12 +63,12 @@ func TestAccPubsubSubscription_basic(t *testing.T) { func TestAccPubsubSubscription_update(t *testing.T) { t.Parallel() - topic := fmt.Sprintf("tf-test-topic-%s", RandString(t, 10)) - subscriptionShort := fmt.Sprintf("tf-test-sub-%s", RandString(t, 10)) + topic := fmt.Sprintf("tf-test-topic-%s", acctest.RandString(t, 10)) + subscriptionShort := fmt.Sprintf("tf-test-sub-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckPubsubSubscriptionDestroyProducer(t), Steps: []resource.TestStep{ { @@ -96,13 +96,13 @@ func TestAccPubsubSubscription_update(t *testing.T) { func TestAccPubsubSubscription_push(t *testing.T) { t.Parallel() - topicFoo := fmt.Sprintf("tf-test-topic-foo-%s", RandString(t, 10)) - subscription := fmt.Sprintf("tf-test-sub-foo-%s", RandString(t, 10)) - saAccount := fmt.Sprintf("tf-test-pubsub-%s", RandString(t, 10)) + topicFoo := fmt.Sprintf("tf-test-topic-foo-%s", acctest.RandString(t, 10)) + subscription := fmt.Sprintf("tf-test-sub-foo-%s", acctest.RandString(t, 10)) + saAccount := fmt.Sprintf("tf-test-pubsub-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckPubsubSubscriptionDestroyProducer(t), Steps: []resource.TestStep{ { @@ -125,12 +125,12 @@ func TestAccPubsubSubscription_push(t *testing.T) { func TestAccPubsubSubscription_pollOnCreate(t *testing.T) { t.Parallel() - topic := fmt.Sprintf("tf-test-topic-foo-%s", RandString(t, 10)) - subscription := fmt.Sprintf("tf-test-topic-foo-%s", RandString(t, 10)) + topic := fmt.Sprintf("tf-test-topic-foo-%s", acctest.RandString(t, 10)) + subscription := fmt.Sprintf("tf-test-topic-foo-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckPubsubSubscriptionDestroyProducer(t), Steps: []resource.TestStep{ { @@ -286,7 +286,7 @@ func TestGetComputedTopicName(t *testing.T) { func testAccCheckPubsubSubscriptionCache404(t *testing.T, subName string) resource.TestCheckFunc { return func(s *terraform.State) error { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) url := fmt.Sprintf("%sprojects/%s/subscriptions/%s", config.PubsubBasePath, envvar.GetTestProjectFromEnv(), subName) resp, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ Config: config, diff --git a/mmv1/third_party/terraform/tests/resource_pubsub_topic_iam_test.go b/mmv1/third_party/terraform/tests/resource_pubsub_topic_iam_test.go index f9823d607f19..51435b8a9bf6 100644 --- a/mmv1/third_party/terraform/tests/resource_pubsub_topic_iam_test.go +++ b/mmv1/third_party/terraform/tests/resource_pubsub_topic_iam_test.go @@ -17,12 +17,12 @@ import ( func TestAccPubsubTopicIamBinding(t *testing.T) { t.Parallel() - topic := "tf-test-topic-iam-" + RandString(t, 10) - account := "tf-test-topic-iam-" + RandString(t, 10) + topic := "tf-test-topic-iam-" + acctest.RandString(t, 10) + account := "tf-test-topic-iam-" + acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { // Test IAM Binding creation @@ -58,12 +58,12 @@ func TestAccPubsubTopicIamBinding(t *testing.T) { func TestAccPubsubTopicIamBinding_topicName(t *testing.T) { t.Parallel() - topic := "tf-test-topic-iam-" + RandString(t, 10) - account := "tf-test-topic-iam-" + RandString(t, 10) + topic := "tf-test-topic-iam-" + acctest.RandString(t, 10) + account := "tf-test-topic-iam-" + acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { // Test IAM Binding creation @@ -80,13 +80,13 @@ func TestAccPubsubTopicIamBinding_topicName(t *testing.T) { func TestAccPubsubTopicIamMember(t *testing.T) { t.Parallel() - topic := "tf-test-topic-iam-" + RandString(t, 10) - account := "tf-test-topic-iam-" + RandString(t, 10) + topic := "tf-test-topic-iam-" + acctest.RandString(t, 10) + account := "tf-test-topic-iam-" + acctest.RandString(t, 10) accountEmail := fmt.Sprintf("%s@%s.iam.gserviceaccount.com", account, envvar.GetTestProjectFromEnv()) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { // Test Iam Member creation (no update for member, no need to test) @@ -108,12 +108,12 @@ func TestAccPubsubTopicIamMember(t *testing.T) { func TestAccPubsubTopicIamPolicy(t *testing.T) { t.Parallel() - topic := "tf-test-topic-iam-" + RandString(t, 10) - account := "tf-test-topic-iam-" + RandString(t, 10) + topic := "tf-test-topic-iam-" + acctest.RandString(t, 10) + account := "tf-test-topic-iam-" + acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccPubsubTopicIamPolicy_basic(topic, account, "roles/pubsub.publisher"), @@ -139,7 +139,7 @@ func TestAccPubsubTopicIamPolicy(t *testing.T) { func testAccCheckPubsubTopicIam(t *testing.T, topic, role string, members []string) resource.TestCheckFunc { return func(s *terraform.State) error { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) p, err := config.NewPubsubClient(config.UserAgent).Projects.Topics.GetIamPolicy(pubsub.GetComputedTopicName(envvar.GetTestProjectFromEnv(), topic)).Do() if err != nil { return err diff --git a/mmv1/third_party/terraform/tests/resource_pubsub_topic_test.go b/mmv1/third_party/terraform/tests/resource_pubsub_topic_test.go index 58e632a42cbb..302e31e5edf7 100644 --- a/mmv1/third_party/terraform/tests/resource_pubsub_topic_test.go +++ b/mmv1/third_party/terraform/tests/resource_pubsub_topic_test.go @@ -11,11 +11,11 @@ import ( func TestAccPubsubTopic_update(t *testing.T) { t.Parallel() - topic := fmt.Sprintf("tf-test-topic-%s", RandString(t, 10)) + topic := fmt.Sprintf("tf-test-topic-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckPubsubTopicDestroyProducer(t), Steps: []resource.TestStep{ { @@ -44,15 +44,15 @@ func TestAccPubsubTopic_cmek(t *testing.T) { t.Parallel() kms := acctest.BootstrapKMSKey(t) - topicName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + topicName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) if acctest.BootstrapPSARole(t, "service-", "gcp-sa-pubsub", "roles/cloudkms.cryptoKeyEncrypterDecrypter") { t.Fatal("Stopping the test because a role was added to the policy.") } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckPubsubTopicDestroyProducer(t), Steps: []resource.TestStep{ { @@ -70,13 +70,13 @@ func TestAccPubsubTopic_cmek(t *testing.T) { func TestAccPubsubTopic_schema(t *testing.T) { t.Parallel() - schema1 := fmt.Sprintf("tf-test-schema-%s", RandString(t, 10)) - schema2 := fmt.Sprintf("tf-test-schema-%s", RandString(t, 10)) - topic := fmt.Sprintf("tf-test-topic-%s", RandString(t, 10)) + schema1 := fmt.Sprintf("tf-test-schema-%s", acctest.RandString(t, 10)) + schema2 := fmt.Sprintf("tf-test-schema-%s", acctest.RandString(t, 10)) + topic := fmt.Sprintf("tf-test-topic-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckPubsubTopicDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_redis_instance_test.go b/mmv1/third_party/terraform/tests/resource_redis_instance_test.go index a631a7ea4902..483dccb24c6c 100644 --- a/mmv1/third_party/terraform/tests/resource_redis_instance_test.go +++ b/mmv1/third_party/terraform/tests/resource_redis_instance_test.go @@ -12,11 +12,11 @@ import ( func TestAccRedisInstance_update(t *testing.T) { t.Parallel() - name := fmt.Sprintf("tf-test-%d", RandInt(t)) + name := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckRedisInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -46,11 +46,11 @@ func TestAccRedisInstance_update(t *testing.T) { func TestAccRedisInstance_updateReadReplicasMode(t *testing.T) { t.Parallel() - name := fmt.Sprintf("tf-test-%d", RandInt(t)) + name := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckRedisInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -81,11 +81,11 @@ func TestAccRedisInstance_updateReadReplicasMode(t *testing.T) { func TestAccRedisInstance_updateReadReplicasModeWithAutoSecondaryIp(t *testing.T) { t.Parallel() - name := fmt.Sprintf("tf-test-%d", RandInt(t)) + name := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckRedisInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -190,7 +190,7 @@ resource "google_redis_instance" "test" { func TestAccRedisInstance_regionFromLocation(t *testing.T) { t.Parallel() - name := fmt.Sprintf("tf-test-%d", RandInt(t)) + name := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) // Pick a zone that isn't in the provider-specified region so we know we // didn't fall back to that one. @@ -201,9 +201,9 @@ func TestAccRedisInstance_regionFromLocation(t *testing.T) { zone = "us-central1-a" } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckRedisInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -223,12 +223,12 @@ func TestAccRedisInstance_redisInstanceAuthEnabled(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckRedisInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -256,11 +256,11 @@ func TestAccRedisInstance_redisInstanceAuthEnabled(t *testing.T) { func TestAccRedisInstance_downgradeRedisVersion(t *testing.T) { t.Parallel() - name := fmt.Sprintf("tf-test-%d", RandInt(t)) + name := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckRedisInstanceDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_resourcemanager_lien_test.go b/mmv1/third_party/terraform/tests/resource_resourcemanager_lien_test.go index 2d22c581f930..d153d27abe30 100644 --- a/mmv1/third_party/terraform/tests/resource_resourcemanager_lien_test.go +++ b/mmv1/third_party/terraform/tests/resource_resourcemanager_lien_test.go @@ -16,13 +16,13 @@ import ( func TestAccResourceManagerLien_basic(t *testing.T) { t.Parallel() - projectName := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + projectName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) org := envvar.GetTestOrgFromEnv(t) var lien resourceManager.Lien - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckResourceManagerLienDestroyProducer(t), Steps: []resource.TestStep{ { @@ -59,7 +59,7 @@ func testAccCheckResourceManagerLienExists(t *testing.T, n, projectName string, return fmt.Errorf("No ID is set") } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) found, err := config.NewResourceManagerClient(config.UserAgent).Liens.List().Parent(fmt.Sprintf("projects/%s", projectName)).Do() if err != nil { @@ -77,7 +77,7 @@ func testAccCheckResourceManagerLienExists(t *testing.T, n, projectName string, func testAccCheckResourceManagerLienDestroyProducer(t *testing.T) func(s *terraform.State) error { return func(s *terraform.State) error { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) for _, rs := range s.RootModule().Resources { if rs.Type != "google_resource_manager_lien" { diff --git a/mmv1/third_party/terraform/tests/resource_scc_notification_config_test.go b/mmv1/third_party/terraform/tests/resource_scc_notification_config_test.go index 93902a2e007f..66a2f16c50b2 100644 --- a/mmv1/third_party/terraform/tests/resource_scc_notification_config_test.go +++ b/mmv1/third_party/terraform/tests/resource_scc_notification_config_test.go @@ -13,12 +13,12 @@ func TestAccSecurityCenterNotificationConfig_updateStreamingConfigFilter(t *test context := map[string]interface{}{ "org_id": envvar.GetTestOrgFromEnv(t), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckSecurityCenterNotificationConfigDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_secret_manager_secret_test.go.erb b/mmv1/third_party/terraform/tests/resource_secret_manager_secret_test.go.erb index e3093cfd896f..eb6a59b37fc0 100644 --- a/mmv1/third_party/terraform/tests/resource_secret_manager_secret_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_secret_manager_secret_test.go.erb @@ -14,12 +14,12 @@ func TestAccSecretManagerSecret_import(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckSecretManagerSecretDestroyProducer(t), Steps: []resource.TestStep{ { @@ -42,13 +42,13 @@ func TestAccSecretManagerSecret_cmek(t *testing.T) { kmseast := acctest.BootstrapKMSKeyInLocation(t, "us-east1") context1 := map[string]interface{}{ "pid": envvar.GetTestProjectFromEnv(), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), "kms_key_name_central": kmscentral.CryptoKey.Name, "kms_key_name_east": kmseast.CryptoKey.Name, } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckSecretManagerSecretDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_secret_manager_secret_version_test.go.erb b/mmv1/third_party/terraform/tests/resource_secret_manager_secret_version_test.go.erb index 3f1d8ba6ebb0..400d7a41fc9d 100644 --- a/mmv1/third_party/terraform/tests/resource_secret_manager_secret_version_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_secret_manager_secret_version_test.go.erb @@ -12,12 +12,12 @@ func TestAccSecretManagerSecretVersion_update(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckSecretManagerSecretVersionDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_security_center_source_test.go b/mmv1/third_party/terraform/tests/resource_security_center_source_test.go index d35cdbe8cf26..e08605323b3b 100644 --- a/mmv1/third_party/terraform/tests/resource_security_center_source_test.go +++ b/mmv1/third_party/terraform/tests/resource_security_center_source_test.go @@ -13,11 +13,11 @@ func TestAccSecurityCenterSource_basic(t *testing.T) { t.Parallel() orgId := envvar.GetTestOrgFromEnv(t) - suffix := RandString(t, 10) + suffix := acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccSecurityCenterSource_sccSourceBasicExample(orgId, suffix, "My description"), diff --git a/mmv1/third_party/terraform/tests/resource_service_directory_endpoint_test.go.erb b/mmv1/third_party/terraform/tests/resource_service_directory_endpoint_test.go.erb index 1a3af205e77f..9111d4396762 100644 --- a/mmv1/third_party/terraform/tests/resource_service_directory_endpoint_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_service_directory_endpoint_test.go.erb @@ -17,11 +17,11 @@ func TestAccServiceDirectoryEndpoint_serviceDirectoryEndpointUpdateExample(t *te project := envvar.GetTestProjectFromEnv() location := "us-central1" - testId := fmt.Sprintf("tf-test-example-endpoint%s", RandString(t, 10)) + testId := fmt.Sprintf("tf-test-example-endpoint%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckServiceDirectoryEndpointDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_service_directory_namespace_test.go.erb b/mmv1/third_party/terraform/tests/resource_service_directory_namespace_test.go.erb index 1cc9b4bed954..18b71b0e4f0a 100644 --- a/mmv1/third_party/terraform/tests/resource_service_directory_namespace_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_service_directory_namespace_test.go.erb @@ -17,11 +17,11 @@ func TestAccServiceDirectoryNamespace_serviceDirectoryNamespaceUpdateExample(t * project := envvar.GetTestProjectFromEnv() location := "us-central1" - testId := fmt.Sprintf("tf-test-example-namespace%s", RandString(t, 10)) + testId := fmt.Sprintf("tf-test-example-namespace%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckServiceDirectoryNamespaceDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_service_directory_service_test.go.erb b/mmv1/third_party/terraform/tests/resource_service_directory_service_test.go.erb index 58deee3d1e89..04a4b541093a 100644 --- a/mmv1/third_party/terraform/tests/resource_service_directory_service_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_service_directory_service_test.go.erb @@ -17,11 +17,11 @@ func TestAccServiceDirectoryService_serviceDirectoryServiceUpdateExample(t *test project := envvar.GetTestProjectFromEnv() location := "us-central1" - testId := fmt.Sprintf("tf-test-example-service%s", RandString(t, 10)) + testId := fmt.Sprintf("tf-test-example-service%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckServiceDirectoryServiceDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_service_networking_connection_test.go b/mmv1/third_party/terraform/tests/resource_service_networking_connection_test.go index 92f9bab6faab..efc3c99aa6cc 100644 --- a/mmv1/third_party/terraform/tests/resource_service_networking_connection_test.go +++ b/mmv1/third_party/terraform/tests/resource_service_networking_connection_test.go @@ -14,12 +14,12 @@ func TestAccServiceNetworkingConnection_create(t *testing.T) { t.Parallel() network := acctest.BootstrapSharedTestNetwork(t, "service-networking-connection-create") - addr := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + addr := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) service := "servicenetworking.googleapis.com" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testServiceNetworkingConnectionDestroy(t, service, network), Steps: []resource.TestStep{ { @@ -38,13 +38,13 @@ func TestAccServiceNetworkingConnection_update(t *testing.T) { t.Parallel() network := acctest.BootstrapSharedTestNetwork(t, "service-networking-connection-update") - addr1 := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - addr2 := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + addr1 := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + addr2 := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) service := "servicenetworking.googleapis.com" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testServiceNetworkingConnectionDestroy(t, service, network), Steps: []resource.TestStep{ { @@ -70,7 +70,7 @@ func TestAccServiceNetworkingConnection_update(t *testing.T) { func testServiceNetworkingConnectionDestroy(t *testing.T, parent, network string) resource.TestCheckFunc { return func(s *terraform.State) error { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) parentService := "services/" + parent networkName := fmt.Sprintf("projects/%s/global/networks/%s", envvar.GetTestProjectFromEnv(), network) listCall := config.NewServiceNetworkingClient(config.UserAgent).Services.Connections.List(parentService).Network(networkName) diff --git a/mmv1/third_party/terraform/tests/resource_sourcerepo_repository_test.go b/mmv1/third_party/terraform/tests/resource_sourcerepo_repository_test.go index 384b07d0c8f9..b1975d17c65b 100644 --- a/mmv1/third_party/terraform/tests/resource_sourcerepo_repository_test.go +++ b/mmv1/third_party/terraform/tests/resource_sourcerepo_repository_test.go @@ -11,10 +11,10 @@ import ( func TestAccSourceRepoRepository_basic(t *testing.T) { t.Parallel() - repositoryName := fmt.Sprintf("source-repo-repository-test-%s", RandString(t, 10)) - VcrTest(t, resource.TestCase{ + repositoryName := fmt.Sprintf("source-repo-repository-test-%s", acctest.RandString(t, 10)) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckSourceRepoRepositoryDestroyProducer(t), Steps: []resource.TestStep{ { @@ -32,12 +32,12 @@ func TestAccSourceRepoRepository_basic(t *testing.T) { func TestAccSourceRepoRepository_update(t *testing.T) { t.Parallel() - repositoryName := fmt.Sprintf("source-repo-repository-test-%s", RandString(t, 10)) - accountId := fmt.Sprintf("account-id-%s", RandString(t, 10)) - topicName := fmt.Sprintf("topic-name-%s", RandString(t, 10)) - VcrTest(t, resource.TestCase{ + repositoryName := fmt.Sprintf("source-repo-repository-test-%s", acctest.RandString(t, 10)) + accountId := fmt.Sprintf("account-id-%s", acctest.RandString(t, 10)) + topicName := fmt.Sprintf("topic-name-%s", acctest.RandString(t, 10)) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckSourceRepoRepositoryDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_spanner_database_iam_test.go b/mmv1/third_party/terraform/tests/resource_spanner_database_iam_test.go index 9294c4a6ce39..aab552a3afb6 100644 --- a/mmv1/third_party/terraform/tests/resource_spanner_database_iam_test.go +++ b/mmv1/third_party/terraform/tests/resource_spanner_database_iam_test.go @@ -13,15 +13,15 @@ import ( func TestAccSpannerDatabaseIamBinding(t *testing.T) { t.Parallel() - account := fmt.Sprintf("tf-test-%d", RandInt(t)) + account := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) role := "roles/spanner.databaseAdmin" project := envvar.GetTestProjectFromEnv() - database := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - instance := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + database := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + instance := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccSpannerDatabaseIamBinding_basic(account, instance, database, role), @@ -58,15 +58,15 @@ func TestAccSpannerDatabaseIamMember(t *testing.T) { t.Parallel() project := envvar.GetTestProjectFromEnv() - account := fmt.Sprintf("tf-test-%d", RandInt(t)) + account := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) role := "roles/spanner.databaseAdmin" - database := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - instance := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + database := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + instance := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) conditionTitle := "Access only database one" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { // Test Iam Member creation (no update for member, no need to test) @@ -90,14 +90,14 @@ func TestAccSpannerDatabaseIamPolicy(t *testing.T) { t.Parallel() project := envvar.GetTestProjectFromEnv() - account := fmt.Sprintf("tf-test-%d", RandInt(t)) + account := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) role := "roles/spanner.databaseAdmin" - database := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - instance := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + database := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + instance := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccSpannerDatabaseIamPolicy_basic(account, instance, database, role), diff --git a/mmv1/third_party/terraform/tests/resource_spanner_database_test.go.erb b/mmv1/third_party/terraform/tests/resource_spanner_database_test.go.erb index 12760c1565a2..3fbe56788368 100644 --- a/mmv1/third_party/terraform/tests/resource_spanner_database_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_spanner_database_test.go.erb @@ -16,13 +16,13 @@ func TestAccSpannerDatabase_basic(t *testing.T) { t.Parallel() project := envvar.GetTestProjectFromEnv() - rnd := RandString(t, 10) + rnd := acctest.RandString(t, 10) instanceName := fmt.Sprintf("tf-test-%s", rnd) databaseName := fmt.Sprintf("tfgen_%s", rnd) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckSpannerDatabaseDestroyProducer(t), Steps: []resource.TestStep{ { @@ -154,13 +154,13 @@ resource "google_spanner_database" "basic" { func TestAccSpannerDatabase_postgres(t *testing.T) { t.Parallel() - rnd := RandString(t, 10) + rnd := acctest.RandString(t, 10) instanceName := fmt.Sprintf("tf-test-%s", rnd) databaseName := fmt.Sprintf("tfgen_%s", rnd) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckSpannerDatabaseDestroyProducer(t), Steps: []resource.TestStep{ { @@ -243,13 +243,13 @@ resource "google_spanner_database" "basic_spangres" { func TestAccSpannerDatabase_versionRetentionPeriod(t *testing.T) { t.Parallel() - rnd := RandString(t, 10) + rnd := acctest.RandString(t, 10) instanceName := fmt.Sprintf("tf-test-%s", rnd) databaseName := fmt.Sprintf("tfgen_%s", rnd) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckSpannerDatabaseDestroyProducer(t), Steps: []resource.TestStep{ { @@ -466,12 +466,12 @@ func TestAccSpannerDatabase_deletionProtection(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckSpannerDatabaseDestroyProducer(t), Steps: []resource.TestStep{ { @@ -521,12 +521,12 @@ func TestAccSpannerDatabase_cmek(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderBetaFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), CheckDestroy: testAccCheckSpannerDatabaseDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_spanner_instance_iam_test.go b/mmv1/third_party/terraform/tests/resource_spanner_instance_iam_test.go index 69491790171a..4d3e15c62619 100644 --- a/mmv1/third_party/terraform/tests/resource_spanner_instance_iam_test.go +++ b/mmv1/third_party/terraform/tests/resource_spanner_instance_iam_test.go @@ -13,14 +13,14 @@ import ( func TestAccSpannerInstanceIamBinding(t *testing.T) { t.Parallel() - account := fmt.Sprintf("tf-test-%d", RandInt(t)) + account := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) role := "roles/spanner.databaseAdmin" project := envvar.GetTestProjectFromEnv() - instance := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + instance := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccSpannerInstanceIamBinding_basic(account, instance, role), @@ -55,14 +55,14 @@ func TestAccSpannerInstanceIamMember(t *testing.T) { t.Parallel() project := envvar.GetTestProjectFromEnv() - account := fmt.Sprintf("tf-test-%d", RandInt(t)) + account := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) role := "roles/spanner.databaseAdmin" - instance := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + instance := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) conditionTitle := "Access only database one" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { // Test Iam Member creation (no update for member, no need to test) @@ -85,13 +85,13 @@ func TestAccSpannerInstanceIamPolicy(t *testing.T) { t.Parallel() project := envvar.GetTestProjectFromEnv() - account := fmt.Sprintf("tf-test-%d", RandInt(t)) + account := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) role := "roles/spanner.databaseAdmin" - instance := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + instance := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccSpannerInstanceIamPolicy_basic(account, instance, role), diff --git a/mmv1/third_party/terraform/tests/resource_spanner_instance_test.go b/mmv1/third_party/terraform/tests/resource_spanner_instance_test.go index e506af47f952..9e6d11f0cfca 100644 --- a/mmv1/third_party/terraform/tests/resource_spanner_instance_test.go +++ b/mmv1/third_party/terraform/tests/resource_spanner_instance_test.go @@ -15,10 +15,10 @@ import ( func TestAccSpannerInstance_basic(t *testing.T) { t.Parallel() - idName := fmt.Sprintf("spanner-test-%s", RandString(t, 10)) - VcrTest(t, resource.TestCase{ + idName := fmt.Sprintf("spanner-test-%s", acctest.RandString(t, 10)) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckSpannerInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -39,10 +39,10 @@ func TestAccSpannerInstance_basic(t *testing.T) { func TestAccSpannerInstance_noNodeCountSpecified(t *testing.T) { t.Parallel() - idName := fmt.Sprintf("spanner-test-%s", RandString(t, 10)) - VcrTest(t, resource.TestCase{ + idName := fmt.Sprintf("spanner-test-%s", acctest.RandString(t, 10)) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckSpannerInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -58,10 +58,10 @@ func TestAccSpannerInstance_basicWithAutogenName(t *testing.T) { acctest.SkipIfVcr(t) t.Parallel() - displayName := fmt.Sprintf("spanner-test-%s-dname", RandString(t, 10)) - VcrTest(t, resource.TestCase{ + displayName := fmt.Sprintf("spanner-test-%s-dname", acctest.RandString(t, 10)) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckSpannerInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -84,11 +84,11 @@ func TestAccSpannerInstance_update(t *testing.T) { acctest.SkipIfVcr(t) t.Parallel() - dName1 := fmt.Sprintf("spanner-dname1-%s", RandString(t, 10)) - dName2 := fmt.Sprintf("spanner-dname2-%s", RandString(t, 10)) - VcrTest(t, resource.TestCase{ + dName1 := fmt.Sprintf("spanner-dname1-%s", acctest.RandString(t, 10)) + dName2 := fmt.Sprintf("spanner-dname2-%s", acctest.RandString(t, 10)) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckSpannerInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -116,10 +116,10 @@ func TestAccSpannerInstance_virtualUpdate(t *testing.T) { acctest.SkipIfVcr(t) t.Parallel() - dName := fmt.Sprintf("spanner-dname1-%s", RandString(t, 10)) - VcrTest(t, resource.TestCase{ + dName := fmt.Sprintf("spanner-dname1-%s", acctest.RandString(t, 10)) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckSpannerInstanceDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_sql_database_instance_test.go b/mmv1/third_party/terraform/tests/resource_sql_database_instance_test.go index 135010977665..48c9b46d9440 100644 --- a/mmv1/third_party/terraform/tests/resource_sql_database_instance_test.go +++ b/mmv1/third_party/terraform/tests/resource_sql_database_instance_test.go @@ -35,9 +35,9 @@ func TestAccSqlDatabaseInstance_basicInferredName(t *testing.T) { acctest.SkipIfVcr(t) t.Parallel() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccSqlDatabaseInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -59,11 +59,11 @@ func TestAccSqlDatabaseInstance_basicInferredName(t *testing.T) { func TestAccSqlDatabaseInstance_basicSecondGen(t *testing.T) { t.Parallel() - databaseName := "tf-test-" + RandString(t, 10) + databaseName := "tf-test-" + acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccSqlDatabaseInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -84,12 +84,12 @@ func TestAccSqlDatabaseInstance_basicSecondGen(t *testing.T) { func TestAccSqlDatabaseInstance_basicMSSQL(t *testing.T) { t.Parallel() - databaseName := "tf-test-" + RandString(t, 10) - rootPassword := RandString(t, 15) + databaseName := "tf-test-" + acctest.RandString(t, 10) + rootPassword := acctest.RandString(t, 15) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccSqlDatabaseInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -119,15 +119,15 @@ func TestAccSqlDatabaseInstance_basicMSSQL(t *testing.T) { func TestAccSqlDatabaseInstance_dontDeleteDefaultUserOnReplica(t *testing.T) { t.Parallel() - databaseName := "sql-instance-test-" + RandString(t, 10) - failoverName := "sql-instance-test-failover-" + RandString(t, 10) + databaseName := "sql-instance-test-" + acctest.RandString(t, 10) + failoverName := "sql-instance-test-failover-" + acctest.RandString(t, 10) // 1. Create an instance. // 2. Add a root@'%' user. // 3. Create a replica and assert it succeeds (it'll fail if we try to delete the root user thinking it's a // default user) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccSqlDatabaseInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -142,11 +142,11 @@ func TestAccSqlDatabaseInstance_dontDeleteDefaultUserOnReplica(t *testing.T) { { PreConfig: func() { // Add a root user - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) user := sqladmin.User{ Name: "root", Host: "%", - Password: RandString(t, 26), + Password: acctest.RandString(t, 26), } op, err := config.NewSqlAdminClient(config.UserAgent).Users.Insert(config.Project, databaseName, &user).Do() if err != nil { @@ -176,17 +176,17 @@ func TestAccSqlDatabaseInstance_deleteDefaultUserBeforeSubsequentApiCalls(t *tes acctest.SkipIfVcr(t) t.Parallel() - databaseName := "tf-test-" + RandString(t, 10) - addressName := "tf-test-" + RandString(t, 10) + databaseName := "tf-test-" + acctest.RandString(t, 10) + addressName := "tf-test-" + acctest.RandString(t, 10) networkName := acctest.BootstrapSharedTestNetwork(t, "sql-instance-private-clone-2") // 1. Create an instance. // 2. Add a root@'%' user. // 3. Create a clone with settings and assert it fails after the instance creation API call. // 4. Check root user was deleted. - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccSqlDatabaseInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -195,11 +195,11 @@ func TestAccSqlDatabaseInstance_deleteDefaultUserBeforeSubsequentApiCalls(t *tes { PreConfig: func() { // Add a root user - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) user := sqladmin.User{ Name: "root", Host: "%", - Password: RandString(t, 26), + Password: acctest.RandString(t, 26), } op, err := config.NewSqlAdminClient(config.UserAgent).Users.Insert(config.Project, databaseName, &user).Do() if err != nil { @@ -235,11 +235,11 @@ func TestAccSqlDatabaseInstance_deleteDefaultUserBeforeSubsequentApiCalls(t *tes func TestAccSqlDatabaseInstance_settings_basic(t *testing.T) { t.Parallel() - databaseName := "tf-test-" + RandString(t, 10) + databaseName := "tf-test-" + acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccSqlDatabaseInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -259,11 +259,11 @@ func TestAccSqlDatabaseInstance_settings_basic(t *testing.T) { func TestAccSqlDatabaseInstance_settings_secondary(t *testing.T) { t.Parallel() - databaseName := "tf-test-" + RandString(t, 10) + databaseName := "tf-test-" + acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccSqlDatabaseInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -283,11 +283,11 @@ func TestAccSqlDatabaseInstance_settings_secondary(t *testing.T) { func TestAccSqlDatabaseInstance_settings_deletionProtection(t *testing.T) { t.Parallel() - databaseName := "tf-test-" + RandString(t, 10) + databaseName := "tf-test-" + acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccSqlDatabaseInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -317,11 +317,11 @@ func TestAccSqlDatabaseInstance_settings_deletionProtection(t *testing.T) { func TestAccSqlDatabaseInstance_maintenanceVersion(t *testing.T) { t.Parallel() - databaseName := "tf-test-" + RandString(t, 10) + databaseName := "tf-test-" + acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccSqlDatabaseInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -357,11 +357,11 @@ func TestAccSqlDatabaseInstance_maintenanceVersion(t *testing.T) { func TestAccSqlDatabaseInstance_settings_deletionProtectionEnabled(t *testing.T) { t.Parallel() - databaseName := "tf-test-" + RandString(t, 10) + databaseName := "tf-test-" + acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccSqlDatabaseInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -397,11 +397,11 @@ func TestAccSqlDatabaseInstance_settings_deletionProtectionEnabled(t *testing.T) func TestAccSqlDatabaseInstance_settings_checkServiceNetworking(t *testing.T) { t.Parallel() - databaseName := "tf-test-" + RandString(t, 10) + databaseName := "tf-test-" + acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccSqlDatabaseInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -416,11 +416,11 @@ func TestAccSqlDatabaseInstance_settings_checkServiceNetworking(t *testing.T) { func TestAccSqlDatabaseInstance_replica(t *testing.T) { t.Parallel() - databaseID := RandInt(t) + databaseID := acctest.RandInt(t) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccSqlDatabaseInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -457,12 +457,12 @@ func TestAccSqlDatabaseInstance_replica(t *testing.T) { func TestAccSqlDatabaseInstance_slave(t *testing.T) { t.Parallel() - masterID := RandInt(t) - slaveID := RandInt(t) + masterID := acctest.RandInt(t) + slaveID := acctest.RandInt(t) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccSqlDatabaseInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -488,11 +488,11 @@ func TestAccSqlDatabaseInstance_slave(t *testing.T) { func TestAccSqlDatabaseInstance_highAvailability(t *testing.T) { t.Parallel() - instanceID := RandInt(t) + instanceID := acctest.RandInt(t) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccSqlDatabaseInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -512,11 +512,11 @@ func TestAccSqlDatabaseInstance_highAvailability(t *testing.T) { func TestAccSqlDatabaseInstance_diskspecs(t *testing.T) { t.Parallel() - masterID := RandInt(t) + masterID := acctest.RandInt(t) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccSqlDatabaseInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -536,11 +536,11 @@ func TestAccSqlDatabaseInstance_diskspecs(t *testing.T) { func TestAccSqlDatabaseInstance_maintenance(t *testing.T) { t.Parallel() - masterID := RandInt(t) + masterID := acctest.RandInt(t) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccSqlDatabaseInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -560,11 +560,11 @@ func TestAccSqlDatabaseInstance_maintenance(t *testing.T) { func TestAccSqlDatabaseInstance_settings_upgrade(t *testing.T) { t.Parallel() - databaseName := "tf-test-" + RandString(t, 10) + databaseName := "tf-test-" + acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccSqlDatabaseInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -594,11 +594,11 @@ func TestAccSqlDatabaseInstance_settings_upgrade(t *testing.T) { func TestAccSqlDatabaseInstance_settingsDowngrade(t *testing.T) { t.Parallel() - databaseName := "tf-test-" + RandString(t, 10) + databaseName := "tf-test-" + acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccSqlDatabaseInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -629,11 +629,11 @@ func TestAccSqlDatabaseInstance_settingsDowngrade(t *testing.T) { func TestAccSqlDatabaseInstance_authNets(t *testing.T) { t.Parallel() - databaseID := RandInt(t) + databaseID := acctest.RandInt(t) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccSqlDatabaseInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -675,11 +675,11 @@ func TestAccSqlDatabaseInstance_authNets(t *testing.T) { func TestAccSqlDatabaseInstance_multipleOperations(t *testing.T) { t.Parallel() - databaseID, instanceID, userID := RandString(t, 8), RandString(t, 8), RandString(t, 8) + databaseID, instanceID, userID := acctest.RandString(t, 8), acctest.RandString(t, 8), acctest.RandString(t, 8) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccSqlDatabaseInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -699,11 +699,11 @@ func TestAccSqlDatabaseInstance_multipleOperations(t *testing.T) { func TestAccSqlDatabaseInstance_basic_with_user_labels(t *testing.T) { t.Parallel() - databaseName := "tf-test-" + RandString(t, 10) + databaseName := "tf-test-" + acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccSqlDatabaseInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -734,13 +734,13 @@ func TestAccSqlDatabaseInstance_basic_with_user_labels(t *testing.T) { func TestAccSqlDatabaseInstance_withPrivateNetwork_withoutAllocatedIpRange(t *testing.T) { t.Parallel() - databaseName := "tf-test-" + RandString(t, 10) - addressName := "tf-test-" + RandString(t, 10) + databaseName := "tf-test-" + acctest.RandString(t, 10) + addressName := "tf-test-" + acctest.RandString(t, 10) networkName := acctest.BootstrapSharedTestNetwork(t, "sql-instance-private") - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccSqlDatabaseInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -788,15 +788,15 @@ func TestAccSqlDatabaseInstance_withPrivateNetwork_withAllocatedIpRange(t *testi acctest.SkipIfVcr(t) t.Parallel() - databaseName := "tf-test-" + RandString(t, 10) - addressName := "tf-test-" + RandString(t, 10) + databaseName := "tf-test-" + acctest.RandString(t, 10) + addressName := "tf-test-" + acctest.RandString(t, 10) networkName := acctest.BootstrapSharedTestNetwork(t, "sql-instance-private-allocated-ip-range") - addressName_update := "tf-test-" + RandString(t, 10) + "update" + addressName_update := "tf-test-" + acctest.RandString(t, 10) + "update" networkName_update := acctest.BootstrapSharedTestNetwork(t, "sql-instance-private-allocated-ip-range-update") - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccSqlDatabaseInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -826,13 +826,13 @@ func TestAccSqlDatabaseInstance_withPrivateNetwork_withAllocatedIpRangeReplica(t acctest.SkipIfVcr(t) t.Parallel() - databaseName := "tf-test-" + RandString(t, 10) - addressName := "tf-test-" + RandString(t, 10) + databaseName := "tf-test-" + acctest.RandString(t, 10) + addressName := "tf-test-" + acctest.RandString(t, 10) networkName := acctest.BootstrapSharedTestNetwork(t, "sql-instance-private-replica") - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccSqlDatabaseInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -859,13 +859,13 @@ func TestAccSqlDatabaseInstance_withPrivateNetwork_withAllocatedIpRangeClone(t * acctest.SkipIfVcr(t) t.Parallel() - databaseName := "tf-test-" + RandString(t, 10) - addressName := "tf-test-" + RandString(t, 10) + databaseName := "tf-test-" + acctest.RandString(t, 10) + addressName := "tf-test-" + acctest.RandString(t, 10) networkName := acctest.BootstrapSharedTestNetwork(t, "sql-instance-private-clone") - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccSqlDatabaseInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -893,13 +893,13 @@ func TestAccSqlDatabaseInstance_createFromBackup(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), "original_db_name": acctest.BootstrapSharedSQLInstanceBackupRun(t), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccSqlDatabaseInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -921,13 +921,13 @@ func TestAccSqlDatabaseInstance_backupUpdate(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), "original_db_name": acctest.BootstrapSharedSQLInstanceBackupRun(t), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccSqlDatabaseInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -958,13 +958,13 @@ func TestAccSqlDatabaseInstance_basicClone(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), "original_db_name": acctest.BootstrapSharedSQLInstanceBackupRun(t), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccSqlDatabaseInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -986,13 +986,13 @@ func TestAccSqlDatabaseInstance_cloneWithSettings(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), "original_db_name": acctest.BootstrapSharedSQLInstanceBackupRun(t), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccSqlDatabaseInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -1014,13 +1014,13 @@ func TestAccSqlDatabaseInstance_cloneWithDatabaseNames(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), "original_db_name": acctest.BootstrapSharedSQLInstanceBackupRun(t), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccSqlDatabaseInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -1039,7 +1039,7 @@ func TestAccSqlDatabaseInstance_cloneWithDatabaseNames(t *testing.T) { func testAccSqlDatabaseInstanceDestroyProducer(t *testing.T) func(s *terraform.State) error { return func(s *terraform.State) error { for _, rs := range s.RootModule().Resources { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) if rs.Type != "google_sql_database_instance" { continue } @@ -1057,7 +1057,7 @@ func testAccSqlDatabaseInstanceDestroyProducer(t *testing.T) func(s *terraform.S func testAccCheckGoogleSqlDatabaseRootUserDoesNotExist(t *testing.T, instance string) resource.TestCheckFunc { return func(s *terraform.State) error { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) users, err := config.NewSqlAdminClient(config.UserAgent).Users.List(config.Project, instance).Do() @@ -1078,11 +1078,11 @@ func testAccCheckGoogleSqlDatabaseRootUserDoesNotExist(t *testing.T, instance st func TestAccSqlDatabaseInstance_BackupRetention(t *testing.T) { t.Parallel() - masterID := RandInt(t) + masterID := acctest.RandInt(t) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccSqlDatabaseInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -1101,11 +1101,11 @@ func TestAccSqlDatabaseInstance_BackupRetention(t *testing.T) { func TestAccSqlDatabaseInstance_PointInTimeRecoveryEnabled(t *testing.T) { t.Parallel() - masterID := RandInt(t) + masterID := acctest.RandInt(t) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccSqlDatabaseInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -1133,11 +1133,11 @@ func TestAccSqlDatabaseInstance_PointInTimeRecoveryEnabled(t *testing.T) { func TestAccSqlDatabaseInstance_PointInTimeRecoveryEnabledForSqlServer(t *testing.T) { t.Parallel() - masterID := RandInt(t) + masterID := acctest.RandInt(t) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccSqlDatabaseInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -1165,11 +1165,11 @@ func TestAccSqlDatabaseInstance_PointInTimeRecoveryEnabledForSqlServer(t *testin func TestAccSqlDatabaseInstance_insights(t *testing.T) { t.Parallel() - masterID := RandInt(t) + masterID := acctest.RandInt(t) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccSqlDatabaseInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -1191,13 +1191,13 @@ func TestAccSqlDatabaseInstance_encryptionKey(t *testing.T) { context := map[string]interface{}{ "project_id": envvar.GetTestProjectFromEnv(), - "key_name": "tf-test-key-" + RandString(t, 10), - "instance_name": "tf-test-sql-" + RandString(t, 10), + "key_name": "tf-test-key-" + acctest.RandString(t, 10), + "instance_name": "tf-test-sql-" + acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccSqlDatabaseInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -1225,13 +1225,13 @@ func TestAccSqlDatabaseInstance_encryptionKey_replicaInDifferentRegion(t *testin context := map[string]interface{}{ "project_id": envvar.GetTestProjectFromEnv(), - "key_name": "tf-test-key-" + RandString(t, 10), - "instance_name": "tf-test-sql-" + RandString(t, 10), + "key_name": "tf-test-key-" + acctest.RandString(t, 10), + "instance_name": "tf-test-sql-" + acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccSqlDatabaseInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -1260,15 +1260,15 @@ func TestAccSqlDatabaseInstance_ActiveDirectory(t *testing.T) { t.Skip() t.Parallel() - databaseName := "tf-test-" + RandString(t, 10) + databaseName := "tf-test-" + acctest.RandString(t, 10) networkName := acctest.BootstrapSharedTestNetwork(t, "sql-instance-private-test-ad") - addressName := "tf-test-" + RandString(t, 10) - rootPassword := RandString(t, 15) + addressName := "tf-test-" + acctest.RandString(t, 10) + rootPassword := acctest.RandString(t, 15) adDomainName := acctest.BootstrapSharedTestADDomain(t, "test-domain", networkName) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccSqlDatabaseInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -1286,13 +1286,13 @@ func TestAccSqlDatabaseInstance_ActiveDirectory(t *testing.T) { func TestAccSQLDatabaseInstance_DenyMaintenancePeriod(t *testing.T) { t.Parallel() - databaseName := "tf-test-" + RandString(t, 10) + databaseName := "tf-test-" + acctest.RandString(t, 10) endDate := "2022-12-5" startDate := "2022-10-5" time := "00:00:00" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccSqlDatabaseInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -1312,18 +1312,18 @@ func TestAccSqlDatabaseInstance_SqlServerAuditConfig(t *testing.T) { // Service Networking acctest.SkipIfVcr(t) t.Parallel() - databaseName := "tf-test-" + RandString(t, 10) - rootPassword := RandString(t, 15) - bucketName := fmt.Sprintf("%s-%d", "tf-test-bucket", RandInt(t)) + databaseName := "tf-test-" + acctest.RandString(t, 10) + rootPassword := acctest.RandString(t, 15) + bucketName := fmt.Sprintf("%s-%d", "tf-test-bucket", acctest.RandInt(t)) uploadInterval := "900s" retentionInterval := "86400s" - bucketNameUpdate := fmt.Sprintf("%s-%d", "tf-test-bucket", RandInt(t)) + "update" + bucketNameUpdate := fmt.Sprintf("%s-%d", "tf-test-bucket", acctest.RandInt(t)) + "update" uploadIntervalUpdate := "1200s" retentionIntervalUpdate := "172800s" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccSqlDatabaseInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -1350,14 +1350,14 @@ func TestAccSqlDatabaseInstance_SqlServerAuditConfig(t *testing.T) { func TestAccSqlDatabaseInstance_SqlServerAuditOptionalBucket(t *testing.T) { t.Parallel() - databaseName := "tf-test-" + RandString(t, 10) - rootPassword := RandString(t, 15) + databaseName := "tf-test-" + acctest.RandString(t, 10) + rootPassword := acctest.RandString(t, 15) uploadInterval := "900s" retentionInterval := "86400s" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccSqlDatabaseInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -1376,12 +1376,12 @@ func TestAccSqlDatabaseInstance_SqlServerAuditOptionalBucket(t *testing.T) { func TestAccSqlDatabaseInstance_Smt(t *testing.T) { t.Parallel() - databaseName := "tf-test-" + RandString(t, 10) - rootPassword := RandString(t, 15) + databaseName := "tf-test-" + acctest.RandString(t, 10) + rootPassword := acctest.RandString(t, 15) - VcrTest(t, resource.TestCase{ - PreCheck: func() { AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + acctest.VcrTest(t, resource.TestCase{ + PreCheck: func() { acctest.AccTestPreCheck(t) }, + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccSqlDatabaseInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -1418,12 +1418,12 @@ func TestAccSqlDatabaseInstance_Smt(t *testing.T) { func TestAccSqlDatabaseInstance_Timezone(t *testing.T) { t.Parallel() - databaseName := "tf-test-" + RandString(t, 10) - rootPassword := RandString(t, 15) + databaseName := "tf-test-" + acctest.RandString(t, 10) + rootPassword := acctest.RandString(t, 15) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccSqlDatabaseInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -1444,12 +1444,12 @@ func TestAccSqlDatabaseInstance_sqlMysqlInstancePvpExample(t *testing.T) { context := map[string]interface{}{ "deletion_protection": false, - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccSqlDatabaseInstance_sqlMysqlInstancePvpExample(context), @@ -1467,11 +1467,11 @@ func TestAccSqlDatabaseInstance_sqlMysqlInstancePvpExample(t *testing.T) { func TestAccSqlDatabaseInstance_updateReadReplicaWithBinaryLogEnabled(t *testing.T) { t.Parallel() - instance := "tf-test-" + RandString(t, 10) + instance := "tf-test-" + acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccSqlDatabaseInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -1499,14 +1499,14 @@ func TestAccSqlDatabaseInstance_updateReadReplicaWithBinaryLogEnabled(t *testing func TestAccSqlDatabaseInstance_rootPasswordShouldBeUpdatable(t *testing.T) { t.Parallel() - databaseName := "tf-test-" + RandString(t, 10) - rootPwd := "rootPassword-1-" + RandString(t, 10) - newRootPwd := "rootPassword-2-" + RandString(t, 10) + databaseName := "tf-test-" + acctest.RandString(t, 10) + rootPwd := "rootPassword-1-" + acctest.RandString(t, 10) + newRootPwd := "rootPassword-2-" + acctest.RandString(t, 10) databaseVersion := "SQLSERVER_2017_STANDARD" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccSqlDatabaseInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -1539,11 +1539,11 @@ func TestAccSqlDatabaseInstance_rootPasswordShouldBeUpdatable(t *testing.T) { func TestAccSqlDatabaseInstance_activationPolicy(t *testing.T) { t.Parallel() - instanceName := "tf-test-" + RandString(t, 10) + instanceName := "tf-test-" + acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccSqlDatabaseInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -1598,11 +1598,11 @@ func TestAccSqlDatabaseInstance_activationPolicy(t *testing.T) { func TestAccSqlDatabaseInstance_ReplicaPromoteSuccessful(t *testing.T) { t.Parallel() - databaseName := "sql-instance-test-" + RandString(t, 10) - failoverName := "sql-instance-test-failover-" + RandString(t, 10) - VcrTest(t, resource.TestCase{ + databaseName := "sql-instance-test-" + acctest.RandString(t, 10) + failoverName := "sql-instance-test-failover-" + acctest.RandString(t, 10) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccSqlDatabaseInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -1642,11 +1642,11 @@ func TestAccSqlDatabaseInstance_ReplicaPromoteSuccessful(t *testing.T) { func TestAccSqlDatabaseInstance_ReplicaPromoteFailedWithMasterInstanceNamePresent(t *testing.T) { t.Parallel() - databaseName := "sql-instance-test-" + RandString(t, 10) - failoverName := "sql-instance-test-failover-" + RandString(t, 10) - VcrTest(t, resource.TestCase{ + databaseName := "sql-instance-test-" + acctest.RandString(t, 10) + failoverName := "sql-instance-test-failover-" + acctest.RandString(t, 10) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccSqlDatabaseInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -1688,11 +1688,11 @@ func TestAccSqlDatabaseInstance_ReplicaPromoteFailedWithMasterInstanceNamePresen func TestAccSqlDatabaseInstance_ReplicaPromoteFailedWithReplicaConfigurationPresent(t *testing.T) { t.Parallel() - databaseName := "sql-instance-test-" + RandString(t, 10) - failoverName := "sql-instance-test-failover-" + RandString(t, 10) - VcrTest(t, resource.TestCase{ + databaseName := "sql-instance-test-" + acctest.RandString(t, 10) + failoverName := "sql-instance-test-failover-" + acctest.RandString(t, 10) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccSqlDatabaseInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -1734,11 +1734,11 @@ func TestAccSqlDatabaseInstance_ReplicaPromoteFailedWithReplicaConfigurationPres func TestAccSqlDatabaseInstance_ReplicaPromoteFailedWithMasterInstanceNameAndReplicaConfigurationPresent(t *testing.T) { t.Parallel() - databaseName := "sql-instance-test-" + RandString(t, 10) - failoverName := "sql-instance-test-failover-" + RandString(t, 10) - VcrTest(t, resource.TestCase{ + databaseName := "sql-instance-test-" + acctest.RandString(t, 10) + failoverName := "sql-instance-test-failover-" + acctest.RandString(t, 10) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccSqlDatabaseInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -1779,11 +1779,11 @@ func TestAccSqlDatabaseInstance_ReplicaPromoteFailedWithMasterInstanceNameAndRep func TestAccSqlDatabaseInstance_ReplicaPromoteSkippedWithNoMasterInstanceNameAndNoReplicaConfigurationPresent(t *testing.T) { t.Parallel() - databaseName := "sql-instance-test-" + RandString(t, 10) - failoverName := "sql-instance-test-failover-" + RandString(t, 10) - VcrTest(t, resource.TestCase{ + databaseName := "sql-instance-test-" + acctest.RandString(t, 10) + failoverName := "sql-instance-test-failover-" + acctest.RandString(t, 10) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccSqlDatabaseInstanceDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_sql_database_test.go b/mmv1/third_party/terraform/tests/resource_sql_database_test.go index cfc3dcab8d78..044eb42c9589 100644 --- a/mmv1/third_party/terraform/tests/resource_sql_database_test.go +++ b/mmv1/third_party/terraform/tests/resource_sql_database_test.go @@ -18,12 +18,12 @@ func TestAccSqlDatabase_basic(t *testing.T) { var database sqladmin.Database resourceName := "google_sql_database.database" - instanceName := fmt.Sprintf("tf-test-%d", RandInt(t)) - dbName := fmt.Sprintf("tf-test-%d", RandInt(t)) + instanceName := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) + dbName := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccSqlDatabaseDestroyProducer(t), Steps: []resource.TestStep{ { @@ -74,12 +74,12 @@ func TestAccSqlDatabase_update(t *testing.T) { var database sqladmin.Database - instance_name := fmt.Sprintf("tf-test-%d", RandInt(t)) - database_name := fmt.Sprintf("tf-test-%d", RandInt(t)) + instance_name := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) + database_name := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccSqlDatabaseDestroyProducer(t), Steps: []resource.TestStep{ { @@ -140,7 +140,7 @@ func testAccCheckGoogleSqlDatabaseEquals(n string, database *sqladmin.Database) func testAccCheckGoogleSqlDatabaseExists(t *testing.T, n string, database *sqladmin.Database) resource.TestCheckFunc { return func(s *terraform.State) error { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) rs, ok := s.RootModule().Resources[n] if !ok { return fmt.Errorf("Resource not found: %s", n) @@ -164,7 +164,7 @@ func testAccCheckGoogleSqlDatabaseExists(t *testing.T, n string, database *sqlad func testAccSqlDatabaseDestroyProducer(t *testing.T) func(s *terraform.State) error { return func(s *terraform.State) error { for _, rs := range s.RootModule().Resources { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) if rs.Type != "google_sql_database" { continue } diff --git a/mmv1/third_party/terraform/tests/resource_sql_ssl_cert_test.go b/mmv1/third_party/terraform/tests/resource_sql_ssl_cert_test.go index 447430acb70a..d456f78c2175 100644 --- a/mmv1/third_party/terraform/tests/resource_sql_ssl_cert_test.go +++ b/mmv1/third_party/terraform/tests/resource_sql_ssl_cert_test.go @@ -12,10 +12,10 @@ import ( func TestAccSqlClientCert_mysql(t *testing.T) { t.Parallel() - instance := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - VcrTest(t, resource.TestCase{ + instance := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccSqlClientCertDestroyProducer(t), Steps: []resource.TestStep{ { @@ -32,10 +32,10 @@ func TestAccSqlClientCert_mysql(t *testing.T) { func TestAccSqlClientCert_postgres(t *testing.T) { t.Parallel() - instance := fmt.Sprintf("tf-test-%s", RandString(t, 10)) - VcrTest(t, resource.TestCase{ + instance := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccSqlClientCertDestroyProducer(t), Steps: []resource.TestStep{ { @@ -50,7 +50,7 @@ func TestAccSqlClientCert_postgres(t *testing.T) { func testAccCheckGoogleSqlClientCertExists(t *testing.T, n string) resource.TestCheckFunc { return func(s *terraform.State) error { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) rs, ok := s.RootModule().Resources[n] if !ok { return fmt.Errorf("Resource not found: %s", n) @@ -75,7 +75,7 @@ func testAccCheckGoogleSqlClientCertExists(t *testing.T, n string) resource.Test func testAccSqlClientCertDestroyProducer(t *testing.T) func(s *terraform.State) error { return func(s *terraform.State) error { for _, rs := range s.RootModule().Resources { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) if rs.Type != "google_sql_ssl_cert" { continue } diff --git a/mmv1/third_party/terraform/tests/resource_sql_user_test.go b/mmv1/third_party/terraform/tests/resource_sql_user_test.go index 2cdab50750db..7672a71530cc 100644 --- a/mmv1/third_party/terraform/tests/resource_sql_user_test.go +++ b/mmv1/third_party/terraform/tests/resource_sql_user_test.go @@ -15,10 +15,10 @@ func TestAccSqlUser_mysql(t *testing.T) { acctest.SkipIfVcr(t) t.Parallel() - instance := fmt.Sprintf("tf-test-%d", RandInt(t)) - VcrTest(t, resource.TestCase{ + instance := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccSqlUserDestroyProducer(t), Steps: []resource.TestStep{ { @@ -52,10 +52,10 @@ func TestAccSqlUser_iamUser(t *testing.T) { acctest.SkipIfVcr(t) t.Parallel() - instance := fmt.Sprintf("tf-test-%d", RandInt(t)) - VcrTest(t, resource.TestCase{ + instance := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccSqlUserDestroyProducer(t), Steps: []resource.TestStep{ { @@ -77,10 +77,10 @@ func TestAccSqlUser_iamUser(t *testing.T) { func TestAccSqlUser_postgres(t *testing.T) { t.Parallel() - instance := fmt.Sprintf("tf-test-%d", RandInt(t)) - VcrTest(t, resource.TestCase{ + instance := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccSqlUserDestroyProducer(t), Steps: []resource.TestStep{ { @@ -110,10 +110,10 @@ func TestAccSqlUser_postgres(t *testing.T) { func TestAccSqlUser_postgresIAM(t *testing.T) { t.Parallel() - instance := fmt.Sprintf("tf-test-%d", RandInt(t)) - VcrTest(t, resource.TestCase{ + instance := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), ExternalProviders: map[string]resource.ExternalProvider{ "time": {}, }, @@ -139,11 +139,11 @@ func TestAccSqlUser_postgresIAM(t *testing.T) { func TestAccSqlUser_postgresAbandon(t *testing.T) { t.Parallel() - instance := fmt.Sprintf("tf-test-%d", RandInt(t)) + instance := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) userName := "admin" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccSqlUserDestroyProducer(t), Steps: []resource.TestStep{ { @@ -172,7 +172,7 @@ func TestAccSqlUser_postgresAbandon(t *testing.T) { func testAccCheckGoogleSqlUserExists(t *testing.T, n string) resource.TestCheckFunc { return func(s *terraform.State) error { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) rs, ok := s.RootModule().Resources[n] if !ok { return fmt.Errorf("Resource not found: %s", n) @@ -200,7 +200,7 @@ func testAccCheckGoogleSqlUserExists(t *testing.T, n string) resource.TestCheckF func testAccCheckGoogleSqlUserExistsWithName(t *testing.T, instance, name string) resource.TestCheckFunc { return func(s *terraform.State) error { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) users, err := config.NewSqlAdminClient(config.UserAgent).Users.List(config.Project, instance).Do() @@ -222,7 +222,7 @@ func testAccCheckGoogleSqlUserExistsWithName(t *testing.T, instance, name string func testAccSqlUserDestroyProducer(t *testing.T) func(s *terraform.State) error { return func(s *terraform.State) error { for _, rs := range s.RootModule().Resources { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) if rs.Type != "google_sql_database" { continue } @@ -255,10 +255,10 @@ func TestAccSqlUser_mysqlPasswordPolicy(t *testing.T) { acctest.SkipIfVcr(t) t.Parallel() - instance := fmt.Sprintf("tf-test-i%d", RandInt(t)) - VcrTest(t, resource.TestCase{ + instance := fmt.Sprintf("tf-test-i%d", acctest.RandInt(t)) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccSqlUserDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_storage_bucket_access_control_test.go b/mmv1/third_party/terraform/tests/resource_storage_bucket_access_control_test.go index a41c4252e780..d23526e63873 100644 --- a/mmv1/third_party/terraform/tests/resource_storage_bucket_access_control_test.go +++ b/mmv1/third_party/terraform/tests/resource_storage_bucket_access_control_test.go @@ -12,14 +12,14 @@ func TestAccStorageBucketAccessControl_update(t *testing.T) { t.Parallel() bucketName := testBucketName(t) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { if errObjectAcl != nil { panic(errObjectAcl) } acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckStorageObjectAccessControlDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_storage_bucket_acl_test.go b/mmv1/third_party/terraform/tests/resource_storage_bucket_acl_test.go index 86c48fb00b7a..9aed68f93dfd 100644 --- a/mmv1/third_party/terraform/tests/resource_storage_bucket_acl_test.go +++ b/mmv1/third_party/terraform/tests/resource_storage_bucket_acl_test.go @@ -29,9 +29,9 @@ func TestAccStorageBucketAcl_basic(t *testing.T) { bucketName := testBucketName(t) acctest.SkipIfEnvNotSet(t, "GOOGLE_PROJECT_NUMBER") - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccStorageBucketAclDestroyProducer(t), Steps: []resource.TestStep{ { @@ -50,9 +50,9 @@ func TestAccStorageBucketAcl_upgrade(t *testing.T) { bucketName := testBucketName(t) acctest.SkipIfEnvNotSet(t, "GOOGLE_PROJECT_NUMBER") - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccStorageBucketAclDestroyProducer(t), Steps: []resource.TestStep{ { @@ -88,9 +88,9 @@ func TestAccStorageBucketAcl_upgradeSingleUser(t *testing.T) { bucketName := testBucketName(t) acctest.SkipIfEnvNotSet(t, "GOOGLE_PROJECT_NUMBER") - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccStorageBucketAclDestroyProducer(t), Steps: []resource.TestStep{ { @@ -126,9 +126,9 @@ func TestAccStorageBucketAcl_downgrade(t *testing.T) { bucketName := testBucketName(t) acctest.SkipIfEnvNotSet(t, "GOOGLE_PROJECT_NUMBER") - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccStorageBucketAclDestroyProducer(t), Steps: []resource.TestStep{ { @@ -163,9 +163,9 @@ func TestAccStorageBucketAcl_predefined(t *testing.T) { t.Parallel() bucketName := testBucketName(t) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccStorageBucketAclDestroyProducer(t), Steps: []resource.TestStep{ { @@ -181,9 +181,9 @@ func TestAccStorageBucketAcl_unordered(t *testing.T) { bucketName := testBucketName(t) acctest.SkipIfEnvNotSet(t, "GOOGLE_PROJECT_NUMBER") - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccStorageBucketAclDestroyProducer(t), Steps: []resource.TestStep{ { @@ -198,9 +198,9 @@ func TestAccStorageBucketAcl_RemoveOwner(t *testing.T) { t.Parallel() bucketName := testBucketName(t) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccStorageBucketAclDestroyProducer(t), Steps: []resource.TestStep{ { @@ -213,7 +213,7 @@ func TestAccStorageBucketAcl_RemoveOwner(t *testing.T) { func testAccCheckGoogleStorageBucketAclDelete(t *testing.T, bucket, roleEntityS string) resource.TestCheckFunc { return func(s *terraform.State) error { roleEntity, _ := storage.GetRoleEntityPair(roleEntityS) - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) _, err := config.NewStorageClient(config.UserAgent).BucketAccessControls.Get(bucket, roleEntity.Entity).Do() @@ -228,7 +228,7 @@ func testAccCheckGoogleStorageBucketAclDelete(t *testing.T, bucket, roleEntityS func testAccCheckGoogleStorageBucketAcl(t *testing.T, bucket, roleEntityS string) resource.TestCheckFunc { return func(s *terraform.State) error { roleEntity, _ := storage.GetRoleEntityPair(roleEntityS) - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) res, err := config.NewStorageClient(config.UserAgent).BucketAccessControls.Get(bucket, roleEntity.Entity).Do() @@ -246,7 +246,7 @@ func testAccCheckGoogleStorageBucketAcl(t *testing.T, bucket, roleEntityS string func testAccStorageBucketAclDestroyProducer(t *testing.T) func(s *terraform.State) error { return func(s *terraform.State) error { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) for _, rs := range s.RootModule().Resources { if rs.Type != "google_storage_bucket_acl" { diff --git a/mmv1/third_party/terraform/tests/resource_storage_bucket_iam_test.go b/mmv1/third_party/terraform/tests/resource_storage_bucket_iam_test.go index adb86fcdb5d8..87a7a2909500 100644 --- a/mmv1/third_party/terraform/tests/resource_storage_bucket_iam_test.go +++ b/mmv1/third_party/terraform/tests/resource_storage_bucket_iam_test.go @@ -13,12 +13,12 @@ func TestAccStorageBucketIamPolicy(t *testing.T) { t.Parallel() serviceAcct := envvar.GetTestServiceAccountFromEnv(t) - bucket := fmt.Sprintf("tf-test-%d", RandInt(t)) - account := fmt.Sprintf("tf-test-%d", RandInt(t)) + bucket := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) + account := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { // Test IAM Policy creation diff --git a/mmv1/third_party/terraform/tests/resource_storage_bucket_object_test.go b/mmv1/third_party/terraform/tests/resource_storage_bucket_object_test.go index 98bb97312fe4..de14913f76d1 100644 --- a/mmv1/third_party/terraform/tests/resource_storage_bucket_object_test.go +++ b/mmv1/third_party/terraform/tests/resource_storage_bucket_object_test.go @@ -38,9 +38,9 @@ func TestAccStorageObject_basic(t *testing.T) { if err := ioutil.WriteFile(testFile.Name(), data, 0644); err != nil { t.Errorf("error writing file: %v", err) } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccStorageObjectDestroyProducer(t), Steps: []resource.TestStep{ { @@ -73,9 +73,9 @@ func TestAccStorageObject_recreate(t *testing.T) { updatedName := testFile.Name() + ".update" updatedDataMd5 := writeFile(updatedName, []byte("datum")) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccStorageObjectDestroyProducer(t), Steps: []resource.TestStep{ { @@ -111,9 +111,9 @@ func TestAccStorageObject_content(t *testing.T) { if err := ioutil.WriteFile(testFile.Name(), data, 0644); err != nil { t.Errorf("error writing file: %v", err) } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccStorageObjectDestroyProducer(t), Steps: []resource.TestStep{ { @@ -135,9 +135,9 @@ func TestAccStorageObject_folder(t *testing.T) { bucketName := testBucketName(t) folderName := "tf-gce-folder-test/" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccStorageObjectDestroyProducer(t), Steps: []resource.TestStep{ { @@ -166,9 +166,9 @@ func TestAccStorageObject_withContentCharacteristics(t *testing.T) { } disposition, encoding, language, content_type := "inline", "compress", "en", "binary/octet-stream" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccStorageObjectDestroyProducer(t), Steps: []resource.TestStep{ { @@ -193,9 +193,9 @@ func TestAccStorageObject_withContentCharacteristics(t *testing.T) { func TestAccStorageObject_dynamicContent(t *testing.T) { t.Parallel() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccStorageObjectDestroyProducer(t), Steps: []resource.TestStep{ { @@ -227,9 +227,9 @@ func TestAccStorageObject_cacheControl(t *testing.T) { } cacheControl := "private" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccStorageObjectDestroyProducer(t), Steps: []resource.TestStep{ { @@ -260,9 +260,9 @@ func TestAccStorageObject_storageClass(t *testing.T) { } storageClass := "MULTI_REGIONAL" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccStorageObjectDestroyProducer(t), Steps: []resource.TestStep{ { @@ -292,9 +292,9 @@ func TestAccStorageObject_metadata(t *testing.T) { t.Errorf("error writing file: %v", err) } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccStorageObjectDestroyProducer(t), Steps: []resource.TestStep{ { @@ -325,9 +325,9 @@ func TestAccStorageObjectKms(t *testing.T) { if err := ioutil.WriteFile(testFile.Name(), data, 0644); err != nil { t.Errorf("error writing file: %v", err) } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccStorageObjectDestroyProducer(t), Steps: []resource.TestStep{ { @@ -354,9 +354,9 @@ func TestAccStorageObject_customerEncryption(t *testing.T) { } customerEncryptionKey := "qI6+xvCZE9jUm94nJWIulFc8rthN64ybkGCsLUY9Do4=" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccStorageObjectDestroyProducer(t), Steps: []resource.TestStep{ { @@ -386,9 +386,9 @@ func TestAccStorageObject_holds(t *testing.T) { t.Errorf("error writing file: %v", err) } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccStorageObjectDestroyProducer(t), Steps: []resource.TestStep{ { @@ -421,7 +421,7 @@ func testAccCheckGoogleStorageObject(t *testing.T, bucket, object, md5 string) r func testAccCheckGoogleStorageObjectWithEncryption(t *testing.T, bucket, object, md5 string, customerEncryptionKey string) resource.TestCheckFunc { return func(s *terraform.State) error { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) objectsService := storage.NewObjectsService(config.NewStorageClient(config.UserAgent)) @@ -450,7 +450,7 @@ func testAccCheckGoogleStorageObjectWithEncryption(t *testing.T, bucket, object, func testAccCheckGoogleStorageFolder(t *testing.T, bucket, folderName string) resource.TestCheckFunc { return func(s *terraform.State) error { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) objectsService := storage.NewObjectsService(config.NewStorageClient(config.UserAgent)) @@ -471,7 +471,7 @@ func testAccCheckGoogleStorageFolder(t *testing.T, bucket, folderName string) re func testAccStorageObjectDestroyProducer(t *testing.T) func(s *terraform.State) error { return func(s *terraform.State) error { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) for _, rs := range s.RootModule().Resources { if rs.Type != "google_storage_bucket_object" { diff --git a/mmv1/third_party/terraform/tests/resource_storage_bucket_test.go.erb b/mmv1/third_party/terraform/tests/resource_storage_bucket_test.go.erb index 5ee1ddf1268f..656c5e4aaedf 100644 --- a/mmv1/third_party/terraform/tests/resource_storage_bucket_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_storage_bucket_test.go.erb @@ -20,7 +20,7 @@ import ( ) func testBucketName(t *testing.T) string { - return fmt.Sprintf("%s-%d", "tf-test-bucket", RandInt(t)) + return fmt.Sprintf("%s-%d", "tf-test-bucket", acctest.RandInt(t)) } func TestAccStorageBucket_basic(t *testing.T) { @@ -28,9 +28,9 @@ func TestAccStorageBucket_basic(t *testing.T) { bucketName := testBucketName(t) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccStorageBucketDestroyProducer(t), Steps: []resource.TestStep{ { @@ -62,9 +62,9 @@ func TestAccStorageBucket_basicWithAutoclass(t *testing.T) { bucketName := testBucketName(t) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccStorageBucketDestroyProducer(t), Steps: []resource.TestStep{ { @@ -101,11 +101,11 @@ func TestAccStorageBucket_basicWithAutoclass(t *testing.T) { func TestAccStorageBucket_requesterPays(t *testing.T) { t.Parallel() - bucketName := fmt.Sprintf("tf-test-requester-bucket-%d", RandInt(t)) + bucketName := fmt.Sprintf("tf-test-requester-bucket-%d", acctest.RandInt(t)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccStorageBucketDestroyProducer(t), Steps: []resource.TestStep{ { @@ -130,9 +130,9 @@ func TestAccStorageBucket_lowercaseLocation(t *testing.T) { bucketName := testBucketName(t) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccStorageBucketDestroyProducer(t), Steps: []resource.TestStep{ { @@ -153,9 +153,9 @@ func TestAccStorageBucket_dualLocation(t *testing.T) { bucketName := testBucketName(t) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccStorageBucketDestroyProducer(t), Steps: []resource.TestStep{ { @@ -176,9 +176,9 @@ func TestAccStorageBucket_customAttributes(t *testing.T) { bucketName := testBucketName(t) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccStorageBucketDestroyProducer(t), Steps: []resource.TestStep{ { @@ -203,10 +203,10 @@ func TestAccStorageBucket_lifecycleRulesMultiple(t *testing.T) { acctest.SkipIfVcr(t) t.Parallel() - bucketName := fmt.Sprintf("tf-test-acc-bucket-%d", RandInt(t)) - VcrTest(t, resource.TestCase{ + bucketName := fmt.Sprintf("tf-test-acc-bucket-%d", acctest.RandInt(t)) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccStorageBucketDestroyProducer(t), Steps: []resource.TestStep{ { @@ -235,11 +235,11 @@ func TestAccStorageBucket_lifecycleRuleStateLive(t *testing.T) { t.Parallel() var bucket storage.Bucket - bucketName := fmt.Sprintf("tf-test-acc-bucket-%d", RandInt(t)) + bucketName := fmt.Sprintf("tf-test-acc-bucket-%d", acctest.RandInt(t)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccStorageBucketDestroyProducer(t), Steps: []resource.TestStep{ { @@ -264,11 +264,11 @@ func TestAccStorageBucket_lifecycleRuleStateArchived(t *testing.T) { t.Parallel() var bucket storage.Bucket - bucketName := fmt.Sprintf("tf-test-acc-bucket-%d", RandInt(t)) + bucketName := fmt.Sprintf("tf-test-acc-bucket-%d", acctest.RandInt(t)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccStorageBucketDestroyProducer(t), Steps: []resource.TestStep{ { @@ -307,11 +307,11 @@ func TestAccStorageBucket_lifecycleRuleStateAny(t *testing.T) { t.Parallel() var bucket storage.Bucket - bucketName := fmt.Sprintf("tf-test-acc-bucket-%d", RandInt(t)) + bucketName := fmt.Sprintf("tf-test-acc-bucket-%d", acctest.RandInt(t)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccStorageBucketDestroyProducer(t), Steps: []resource.TestStep{ { @@ -379,11 +379,11 @@ func TestAccStorageBucket_storageClass(t *testing.T) { var bucket storage.Bucket var updated storage.Bucket - bucketName := fmt.Sprintf("tf-test-acc-bucket-%d", RandInt(t)) + bucketName := fmt.Sprintf("tf-test-acc-bucket-%d", acctest.RandInt(t)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccStorageBucketDestroyProducer(t), Steps: []resource.TestStep{ { @@ -438,11 +438,11 @@ func TestAccStorageBucket_update_requesterPays(t *testing.T) { var bucket storage.Bucket var updated storage.Bucket - bucketName := fmt.Sprintf("tf-test-requester-bucket-%d", RandInt(t)) + bucketName := fmt.Sprintf("tf-test-requester-bucket-%d", acctest.RandInt(t)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccStorageBucketDestroyProducer(t), Steps: []resource.TestStep{ { @@ -482,11 +482,11 @@ func TestAccStorageBucket_update(t *testing.T) { var bucket storage.Bucket var recreated storage.Bucket var updated storage.Bucket - bucketName := fmt.Sprintf("tf-test-acl-bucket-%d", RandInt(t)) + bucketName := fmt.Sprintf("tf-test-acl-bucket-%d", acctest.RandInt(t)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccStorageBucketDestroyProducer(t), Steps: []resource.TestStep{ { @@ -592,11 +592,11 @@ func TestAccStorageBucket_forceDestroy(t *testing.T) { t.Parallel() var bucket storage.Bucket - bucketName := fmt.Sprintf("tf-test-acl-bucket-%d", RandInt(t)) + bucketName := fmt.Sprintf("tf-test-acl-bucket-%d", acctest.RandInt(t)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccStorageBucketDestroyProducer(t), Steps: []resource.TestStep{ { @@ -613,7 +613,7 @@ func TestAccStorageBucket_forceDestroy(t *testing.T) { ), }, { - Config: testAccStorageBucket_customAttributes(fmt.Sprintf("tf-test-acl-bucket-%d", RandInt(t))), + Config: testAccStorageBucket_customAttributes(fmt.Sprintf("tf-test-acl-bucket-%d", acctest.RandInt(t))), Check: resource.ComposeTestCheckFunc( testAccCheckStorageBucketMissing(t, bucketName), ), @@ -626,11 +626,11 @@ func TestAccStorageBucket_forceDestroyWithVersioning(t *testing.T) { t.Parallel() var bucket storage.Bucket - bucketName := fmt.Sprintf("tf-test-acc-bucket-%d", RandInt(t)) + bucketName := fmt.Sprintf("tf-test-acc-bucket-%d", acctest.RandInt(t)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccStorageBucketDestroyProducer(t), Steps: []resource.TestStep{ { @@ -659,11 +659,11 @@ func TestAccStorageBucket_forceDestroyWithVersioning(t *testing.T) { func TestAccStorageBucket_forceDestroyObjectDeleteError(t *testing.T) { t.Parallel() - bucketName := fmt.Sprintf("tf-test-acl-bucket-%d", RandInt(t)) + bucketName := fmt.Sprintf("tf-test-acl-bucket-%d", acctest.RandInt(t)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccStorageBucketDestroyProducer(t), Steps: []resource.TestStep{ { @@ -688,11 +688,11 @@ func TestAccStorageBucket_versioning(t *testing.T) { t.Parallel() var bucket storage.Bucket - bucketName := fmt.Sprintf("tf-test-acl-bucket-%d", RandInt(t)) + bucketName := fmt.Sprintf("tf-test-acl-bucket-%d", acctest.RandInt(t)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccStorageBucketDestroyProducer(t), Steps: []resource.TestStep{ { @@ -770,10 +770,10 @@ func TestAccStorageBucket_versioning(t *testing.T) { func TestAccStorageBucket_logging(t *testing.T) { t.Parallel() - bucketName := fmt.Sprintf("tf-test-acl-bucket-%d", RandInt(t)) - VcrTest(t, resource.TestCase{ + bucketName := fmt.Sprintf("tf-test-acl-bucket-%d", acctest.RandInt(t)) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccStorageBucketDestroyProducer(t), Steps: []resource.TestStep{ { @@ -830,11 +830,11 @@ func TestAccStorageBucket_logging(t *testing.T) { func TestAccStorageBucket_cors(t *testing.T) { t.Parallel() - bucketName := fmt.Sprintf("tf-test-acl-bucket-%d", RandInt(t)) + bucketName := fmt.Sprintf("tf-test-acl-bucket-%d", acctest.RandInt(t)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccStorageBucketDestroyProducer(t), Steps: []resource.TestStep{ { @@ -862,11 +862,11 @@ func TestAccStorageBucket_cors(t *testing.T) { func TestAccStorageBucket_defaultEventBasedHold(t *testing.T) { t.Parallel() - bucketName := fmt.Sprintf("tf-test-acl-bucket-%d", RandInt(t)) + bucketName := fmt.Sprintf("tf-test-acl-bucket-%d", acctest.RandInt(t)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccStorageBucketDestroyProducer(t), Steps: []resource.TestStep{ { @@ -890,13 +890,13 @@ func TestAccStorageBucket_encryption(t *testing.T) { context := map[string]interface{}{ "organization": envvar.GetTestOrgFromEnv(t), "billing_account": envvar.GetTestBillingAccountFromEnv(t), - "random_suffix": RandString(t, 10), - "random_int": RandInt(t), + "random_suffix": acctest.RandString(t, 10), + "random_int": acctest.RandInt(t), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccStorageBucket_encryption(context), @@ -914,11 +914,11 @@ func TestAccStorageBucket_encryption(t *testing.T) { func TestAccStorageBucket_publicAccessPrevention(t *testing.T) { t.Parallel() - bucketName := fmt.Sprintf("tf-test-acl-bucket-%d", RandInt(t)) + bucketName := fmt.Sprintf("tf-test-acl-bucket-%d", acctest.RandInt(t)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccStorageBucket_publicAccessPrevention(bucketName, "enforced"), @@ -936,11 +936,11 @@ func TestAccStorageBucket_publicAccessPrevention(t *testing.T) { func TestAccStorageBucket_uniformBucketAccessOnly(t *testing.T) { t.Parallel() - bucketName := fmt.Sprintf("tf-test-acl-bucket-%d", RandInt(t)) + bucketName := fmt.Sprintf("tf-test-acl-bucket-%d", acctest.RandInt(t)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccStorageBucket_uniformBucketAccessOnly(bucketName, true), @@ -967,11 +967,11 @@ func TestAccStorageBucket_uniformBucketAccessOnly(t *testing.T) { func TestAccStorageBucket_labels(t *testing.T) { t.Parallel() - bucketName := fmt.Sprintf("tf-test-acl-bucket-%d", RandInt(t)) + bucketName := fmt.Sprintf("tf-test-acl-bucket-%d", acctest.RandInt(t)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccStorageBucketDestroyProducer(t), Steps: []resource.TestStep{ // Going from two labels @@ -1012,11 +1012,11 @@ func TestAccStorageBucket_retentionPolicy(t *testing.T) { t.Parallel() var bucket storage.Bucket - bucketName := fmt.Sprintf("tf-test-acc-bucket-%d", RandInt(t)) + bucketName := fmt.Sprintf("tf-test-acc-bucket-%d", acctest.RandInt(t)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccStorageBucketDestroyProducer(t), Steps: []resource.TestStep{ { @@ -1040,12 +1040,12 @@ func TestAccStorageBucket_retentionPolicy(t *testing.T) { func TestAccStorageBucket_website(t *testing.T) { t.Parallel() - bucketSuffix := fmt.Sprintf("tf-website-test-%d", RandInt(t)) + bucketSuffix := fmt.Sprintf("tf-website-test-%d", acctest.RandInt(t)) errRe := regexp.MustCompile("one of\n`website.0.main_page_suffix,website.0.not_found_page` must be specified") - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccStorageBucketDestroyProducer(t), Steps: []resource.TestStep{ { @@ -1097,11 +1097,11 @@ func TestAccStorageBucket_retentionPolicyLocked(t *testing.T) { var bucket storage.Bucket var newBucket storage.Bucket - bucketName := fmt.Sprintf("tf-test-acc-bucket-%d", RandInt(t)) + bucketName := fmt.Sprintf("tf-test-acc-bucket-%d", acctest.RandInt(t)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccStorageBucketDestroyProducer(t), Steps: []resource.TestStep{ { @@ -1141,7 +1141,7 @@ func testAccCheckStorageBucketExists(t *testing.T, n string, bucketName string, return fmt.Errorf("No Project_ID is set") } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) found, err := config.NewStorageClient(config.UserAgent).Buckets.Get(rs.Primary.ID).Do() if err != nil { @@ -1181,7 +1181,7 @@ func testAccCheckStorageBucketWasRecreated(newBucket *storage.Bucket, b *storage func testAccCheckStorageBucketPutItem(t *testing.T, bucketName string) resource.TestCheckFunc { return func(s *terraform.State) error { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) data := bytes.NewBufferString("test") dataReader := bytes.NewReader(data.Bytes()) @@ -1200,7 +1200,7 @@ func testAccCheckStorageBucketPutItem(t *testing.T, bucketName string) resource. func testAccCheckStorageBucketRetentionPolicy(t *testing.T, bucketName string) resource.TestCheckFunc { return func(s *terraform.State) error { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) data := bytes.NewBufferString("test") dataReader := bytes.NewReader(data.Bytes()) @@ -1233,7 +1233,7 @@ func testAccCheckStorageBucketRetentionPolicy(t *testing.T, bucketName string) r func testAccCheckStorageBucketMissing(t *testing.T, bucketName string) resource.TestCheckFunc { return func(s *terraform.State) error { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) _, err := config.NewStorageClient(config.UserAgent).Buckets.Get(bucketName).Do() if err == nil { @@ -1269,7 +1269,7 @@ func testAccCheckStorageBucketLifecycleConditionState(expected *bool, b *storage func testAccStorageBucketDestroyProducer(t *testing.T) func(s *terraform.State) error { return func(s *terraform.State) error { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) for _, rs := range s.RootModule().Resources { if rs.Type != "google_storage_bucket" { diff --git a/mmv1/third_party/terraform/tests/resource_storage_default_object_access_control_test.go b/mmv1/third_party/terraform/tests/resource_storage_default_object_access_control_test.go index e18dc588f1b2..6fef97febc7d 100644 --- a/mmv1/third_party/terraform/tests/resource_storage_default_object_access_control_test.go +++ b/mmv1/third_party/terraform/tests/resource_storage_default_object_access_control_test.go @@ -12,14 +12,14 @@ func TestAccStorageDefaultObjectAccessControl_update(t *testing.T) { t.Parallel() bucketName := testBucketName(t) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { if errObjectAcl != nil { panic(errObjectAcl) } acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckStorageDefaultObjectAccessControlDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_storage_default_object_acl_test.go b/mmv1/third_party/terraform/tests/resource_storage_default_object_acl_test.go index bfd60757454e..0bdbdc31f3ff 100644 --- a/mmv1/third_party/terraform/tests/resource_storage_default_object_acl_test.go +++ b/mmv1/third_party/terraform/tests/resource_storage_default_object_acl_test.go @@ -14,9 +14,9 @@ func TestAccStorageDefaultObjectAcl_basic(t *testing.T) { t.Parallel() bucketName := testBucketName(t) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccStorageDefaultObjectAclDestroyProducer(t), Steps: []resource.TestStep{ { @@ -34,9 +34,9 @@ func TestAccStorageDefaultObjectAcl_noRoleEntity(t *testing.T) { t.Parallel() bucketName := testBucketName(t) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccStorageDefaultObjectAclDestroyProducer(t), Steps: []resource.TestStep{ { @@ -51,9 +51,9 @@ func TestAccStorageDefaultObjectAcl_upgrade(t *testing.T) { bucketName := testBucketName(t) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccStorageDefaultObjectAclDestroyProducer(t), Steps: []resource.TestStep{ { @@ -89,9 +89,9 @@ func TestAccStorageDefaultObjectAcl_downgrade(t *testing.T) { bucketName := testBucketName(t) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccStorageDefaultObjectAclDestroyProducer(t), Steps: []resource.TestStep{ { @@ -128,9 +128,9 @@ func TestAccStorageDefaultObjectAcl_unordered(t *testing.T) { bucketName := testBucketName(t) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccStorageDefaultObjectAclDestroyProducer(t), Steps: []resource.TestStep{ { @@ -143,7 +143,7 @@ func TestAccStorageDefaultObjectAcl_unordered(t *testing.T) { func testAccCheckGoogleStorageDefaultObjectAcl(t *testing.T, bucket, roleEntityS string) resource.TestCheckFunc { return func(s *terraform.State) error { roleEntity, _ := storage.GetRoleEntityPair(roleEntityS) - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) res, err := config.NewStorageClient(config.UserAgent).DefaultObjectAccessControls.Get(bucket, roleEntity.Entity).Do() @@ -162,7 +162,7 @@ func testAccCheckGoogleStorageDefaultObjectAcl(t *testing.T, bucket, roleEntityS func testAccStorageDefaultObjectAclDestroyProducer(t *testing.T) func(s *terraform.State) error { return func(s *terraform.State) error { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) for _, rs := range s.RootModule().Resources { @@ -184,7 +184,7 @@ func testAccStorageDefaultObjectAclDestroyProducer(t *testing.T) func(s *terrafo func testAccCheckGoogleStorageDefaultObjectAclDelete(t *testing.T, bucket, roleEntityS string) resource.TestCheckFunc { return func(s *terraform.State) error { roleEntity, _ := storage.GetRoleEntityPair(roleEntityS) - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) _, err := config.NewStorageClient(config.UserAgent).DefaultObjectAccessControls.Get(bucket, roleEntity.Entity).Do() diff --git a/mmv1/third_party/terraform/tests/resource_storage_hmac_key_test.go b/mmv1/third_party/terraform/tests/resource_storage_hmac_key_test.go index 2db01f81851b..b7066be74d53 100644 --- a/mmv1/third_party/terraform/tests/resource_storage_hmac_key_test.go +++ b/mmv1/third_party/terraform/tests/resource_storage_hmac_key_test.go @@ -11,10 +11,10 @@ import ( func TestAccStorageHmacKey_update(t *testing.T) { t.Parallel() - saName := fmt.Sprintf("%v%v", "service-account", RandString(t, 10)) - VcrTest(t, resource.TestCase{ + saName := fmt.Sprintf("%v%v", "service-account", acctest.RandString(t, 10)) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckStorageHmacKeyDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_storage_notification_test.go b/mmv1/third_party/terraform/tests/resource_storage_notification_test.go index 61bbc72279c5..36d555458084 100644 --- a/mmv1/third_party/terraform/tests/resource_storage_notification_test.go +++ b/mmv1/third_party/terraform/tests/resource_storage_notification_test.go @@ -25,12 +25,12 @@ func TestAccStorageNotification_basic(t *testing.T) { var notification storage.Notification bucketName := testBucketName(t) - topicName := fmt.Sprintf("tf-pstopic-test-%d", RandInt(t)) + topicName := fmt.Sprintf("tf-pstopic-test-%d", acctest.RandInt(t)) topic := fmt.Sprintf("//pubsub.googleapis.com/projects/%s/topics/%s", os.Getenv("GOOGLE_PROJECT"), topicName) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccStorageNotificationDestroyProducer(t), Steps: []resource.TestStep{ { @@ -69,14 +69,14 @@ func TestAccStorageNotification_withEventsAndAttributes(t *testing.T) { var notification storage.Notification bucketName := testBucketName(t) - topicName := fmt.Sprintf("tf-pstopic-test-%d", RandInt(t)) + topicName := fmt.Sprintf("tf-pstopic-test-%d", acctest.RandInt(t)) topic := fmt.Sprintf("//pubsub.googleapis.com/projects/%s/topics/%s", os.Getenv("GOOGLE_PROJECT"), topicName) eventType1 := "OBJECT_FINALIZE" eventType2 := "OBJECT_ARCHIVE" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccStorageNotificationDestroyProducer(t), Steps: []resource.TestStep{ { @@ -107,7 +107,7 @@ func TestAccStorageNotification_withEventsAndAttributes(t *testing.T) { func testAccStorageNotificationDestroyProducer(t *testing.T) func(s *terraform.State) error { return func(s *terraform.State) error { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) for _, rs := range s.RootModule().Resources { if rs.Type != "google_storage_notification" { @@ -137,7 +137,7 @@ func testAccCheckStorageNotificationExists(t *testing.T, resource string, notifi return fmt.Errorf("No ID is set") } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) bucket, notificationID := tpgstorage.ResourceStorageNotificationParseID(rs.Primary.ID) diff --git a/mmv1/third_party/terraform/tests/resource_storage_object_access_control_test.go b/mmv1/third_party/terraform/tests/resource_storage_object_access_control_test.go index 38f59e7ee595..9cd14ef878fd 100644 --- a/mmv1/third_party/terraform/tests/resource_storage_object_access_control_test.go +++ b/mmv1/third_party/terraform/tests/resource_storage_object_access_control_test.go @@ -14,19 +14,19 @@ func TestAccStorageObjectAccessControl_update(t *testing.T) { t.Parallel() bucketName := testBucketName(t) - objectName := fmt.Sprintf("%s-%d", "tf-test-acl-object", RandInt(t)) + objectName := fmt.Sprintf("%s-%d", "tf-test-acl-object", acctest.RandInt(t)) objectData := []byte("data data data") if err := ioutil.WriteFile(tfObjectAcl.Name(), objectData, 0644); err != nil { t.Errorf("error writing file: %v", err) } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { if errObjectAcl != nil { panic(errObjectAcl) } acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckStorageObjectAccessControlDestroyProducer(t), Steps: []resource.TestStep{ { @@ -53,19 +53,19 @@ func TestAccStorageObjectAccessControl_updateWithSlashes(t *testing.T) { t.Parallel() bucketName := testBucketName(t) - objectName := fmt.Sprintf("%s-%d", "tf-test/acl/object", RandInt(t)) + objectName := fmt.Sprintf("%s-%d", "tf-test/acl/object", acctest.RandInt(t)) objectData := []byte("data data data") if err := ioutil.WriteFile(tfObjectAcl.Name(), objectData, 0644); err != nil { t.Errorf("error writing file: %v", err) } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { if errObjectAcl != nil { panic(errObjectAcl) } acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckStorageObjectAccessControlDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_storage_object_acl_test.go b/mmv1/third_party/terraform/tests/resource_storage_object_acl_test.go index 59256d171a90..92a9aecd98ce 100644 --- a/mmv1/third_party/terraform/tests/resource_storage_object_acl_test.go +++ b/mmv1/third_party/terraform/tests/resource_storage_object_acl_test.go @@ -24,7 +24,7 @@ import ( var tfObjectAcl, errObjectAcl = ioutil.TempFile("", "tf-gce-test") func testAclObjectName(t *testing.T) string { - return fmt.Sprintf("%s-%d", "tf-test-acl-object", RandInt(t)) + return fmt.Sprintf("%s-%d", "tf-test-acl-object", acctest.RandInt(t)) } func TestAccStorageObjectAcl_basic(t *testing.T) { @@ -36,14 +36,14 @@ func TestAccStorageObjectAcl_basic(t *testing.T) { if err := ioutil.WriteFile(tfObjectAcl.Name(), objectData, 0644); err != nil { t.Errorf("error writing file: %v", err) } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { if errObjectAcl != nil { panic(errObjectAcl) } acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testGoogleStorageObjectsAclBasic1(bucketName, objectName), @@ -67,14 +67,14 @@ func TestAccStorageObjectAcl_upgrade(t *testing.T) { if err := ioutil.WriteFile(tfObjectAcl.Name(), objectData, 0644); err != nil { t.Errorf("error writing file: %v", err) } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { if errObjectAcl != nil { panic(errObjectAcl) } acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccStorageObjectAclDestroyProducer(t), Steps: []resource.TestStep{ { @@ -121,14 +121,14 @@ func TestAccStorageObjectAcl_downgrade(t *testing.T) { if err := ioutil.WriteFile(tfObjectAcl.Name(), objectData, 0644); err != nil { t.Errorf("error writing file: %v", err) } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { if errObjectAcl != nil { panic(errObjectAcl) } acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccStorageObjectAclDestroyProducer(t), Steps: []resource.TestStep{ { @@ -175,14 +175,14 @@ func TestAccStorageObjectAcl_predefined(t *testing.T) { if err := ioutil.WriteFile(tfObjectAcl.Name(), objectData, 0644); err != nil { t.Errorf("error writing file: %v", err) } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { if errObjectAcl != nil { panic(errObjectAcl) } acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccStorageObjectAclDestroyProducer(t), Steps: []resource.TestStep{ { @@ -201,14 +201,14 @@ func TestAccStorageObjectAcl_predefinedToExplicit(t *testing.T) { if err := ioutil.WriteFile(tfObjectAcl.Name(), objectData, 0644); err != nil { t.Errorf("error writing file: %v", err) } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { if errObjectAcl != nil { panic(errObjectAcl) } acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccStorageObjectAclDestroyProducer(t), Steps: []resource.TestStep{ { @@ -236,14 +236,14 @@ func TestAccStorageObjectAcl_explicitToPredefined(t *testing.T) { if err := ioutil.WriteFile(tfObjectAcl.Name(), objectData, 0644); err != nil { t.Errorf("error writing file: %v", err) } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { if errObjectAcl != nil { panic(errObjectAcl) } acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccStorageObjectAclDestroyProducer(t), Steps: []resource.TestStep{ { @@ -272,14 +272,14 @@ func TestAccStorageObjectAcl_unordered(t *testing.T) { if err := ioutil.WriteFile(tfObjectAcl.Name(), objectData, 0644); err != nil { t.Errorf("error writing file: %v", err) } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { if errObjectAcl != nil { panic(errObjectAcl) } acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccStorageObjectAclDestroyProducer(t), Steps: []resource.TestStep{ { @@ -354,7 +354,7 @@ func TestAccStorageObjectAcl_noOwner(t *testing.T) { providers := map[string]*schema.Provider{ "google": provider, } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { if errObjectAcl != nil { panic(errObjectAcl) @@ -374,7 +374,7 @@ func TestAccStorageObjectAcl_noOwner(t *testing.T) { func testAccCheckGoogleStorageObjectAcl(t *testing.T, bucket, object, roleEntityS string) resource.TestCheckFunc { return func(s *terraform.State) error { roleEntity, _ := storage.GetRoleEntityPair(roleEntityS) - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) res, err := config.NewStorageClient(config.UserAgent).ObjectAccessControls.Get(bucket, object, roleEntity.Entity).Do() @@ -394,7 +394,7 @@ func testAccCheckGoogleStorageObjectAcl(t *testing.T, bucket, object, roleEntity func testAccCheckGoogleStorageObjectAclDelete(t *testing.T, bucket, object, roleEntityS string) resource.TestCheckFunc { return func(s *terraform.State) error { roleEntity, _ := storage.GetRoleEntityPair(roleEntityS) - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) _, err := config.NewStorageClient(config.UserAgent).ObjectAccessControls.Get(bucket, object, roleEntity.Entity).Do() @@ -409,7 +409,7 @@ func testAccCheckGoogleStorageObjectAclDelete(t *testing.T, bucket, object, role func testAccStorageObjectAclDestroyProducer(t *testing.T) func(s *terraform.State) error { return func(s *terraform.State) error { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) for _, rs := range s.RootModule().Resources { if rs.Type != "google_storage_bucket_acl" { diff --git a/mmv1/third_party/terraform/tests/resource_storage_transfer_agent_pool_test.go b/mmv1/third_party/terraform/tests/resource_storage_transfer_agent_pool_test.go index 8fa7c1cad1dc..458337675cf3 100644 --- a/mmv1/third_party/terraform/tests/resource_storage_transfer_agent_pool_test.go +++ b/mmv1/third_party/terraform/tests/resource_storage_transfer_agent_pool_test.go @@ -17,13 +17,13 @@ import ( func TestAccStorageTransferAgentPool_agentPoolUpdate(t *testing.T) { t.Parallel() - agentPoolName := fmt.Sprintf("tf-test-agent-pool-%s", RandString(t, 10)) - displayName := fmt.Sprintf("tf-test-display-name-%s", RandString(t, 10)) - displayNameUpdate := fmt.Sprintf("tf-test-display-name-%s", RandString(t, 10)) + agentPoolName := fmt.Sprintf("tf-test-agent-pool-%s", acctest.RandString(t, 10)) + displayName := fmt.Sprintf("tf-test-display-name-%s", acctest.RandString(t, 10)) + displayNameUpdate := fmt.Sprintf("tf-test-display-name-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckStorageTransferAgentPoolDestroyProducer(t), Steps: []resource.TestStep{ { @@ -172,7 +172,7 @@ func testAccCheckStorageTransferAgentPoolDestroyProducer(t *testing.T) func(s *t continue } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{StorageTransferBasePath}}projects/{{project}}/agentPools/{{name}}") if err != nil { diff --git a/mmv1/third_party/terraform/tests/resource_storage_transfer_job_test.go b/mmv1/third_party/terraform/tests/resource_storage_transfer_job_test.go index 9756865313aa..6d43b2571914 100644 --- a/mmv1/third_party/terraform/tests/resource_storage_transfer_job_test.go +++ b/mmv1/third_party/terraform/tests/resource_storage_transfer_job_test.go @@ -13,17 +13,17 @@ import ( func TestAccStorageTransferJob_basic(t *testing.T) { t.Parallel() - testDataSourceBucketName := RandString(t, 10) - testDataSinkName := RandString(t, 10) - testTransferJobDescription := RandString(t, 10) - testUpdatedDataSourceBucketName := RandString(t, 10) - testUpdatedDataSinkBucketName := RandString(t, 10) - testUpdatedTransferJobDescription := RandString(t, 10) - testPubSubTopicName := fmt.Sprintf("tf-test-topic-%s", RandString(t, 10)) - - VcrTest(t, resource.TestCase{ + testDataSourceBucketName := acctest.RandString(t, 10) + testDataSinkName := acctest.RandString(t, 10) + testTransferJobDescription := acctest.RandString(t, 10) + testUpdatedDataSourceBucketName := acctest.RandString(t, 10) + testUpdatedDataSinkBucketName := acctest.RandString(t, 10) + testUpdatedTransferJobDescription := acctest.RandString(t, 10) + testPubSubTopicName := fmt.Sprintf("tf-test-topic-%s", acctest.RandString(t, 10)) + + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccStorageTransferJobDestroyProducer(t), Steps: []resource.TestStep{ { @@ -81,13 +81,13 @@ func TestAccStorageTransferJob_basic(t *testing.T) { func TestAccStorageTransferJob_omitScheduleEndDate(t *testing.T) { t.Parallel() - testDataSourceBucketName := RandString(t, 10) - testDataSinkName := RandString(t, 10) - testTransferJobDescription := RandString(t, 10) + testDataSourceBucketName := acctest.RandString(t, 10) + testDataSinkName := acctest.RandString(t, 10) + testTransferJobDescription := acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccStorageTransferJobDestroyProducer(t), Steps: []resource.TestStep{ { @@ -105,13 +105,13 @@ func TestAccStorageTransferJob_omitScheduleEndDate(t *testing.T) { func TestAccStorageTransferJob_posixSource(t *testing.T) { t.Parallel() - testDataSinkName := RandString(t, 10) - testTransferJobDescription := RandString(t, 10) - testSourceAgentPoolName := fmt.Sprintf("tf-test-source-agent-pool-%s", RandString(t, 10)) + testDataSinkName := acctest.RandString(t, 10) + testTransferJobDescription := acctest.RandString(t, 10) + testSourceAgentPoolName := fmt.Sprintf("tf-test-source-agent-pool-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccStorageTransferJobDestroyProducer(t), Steps: []resource.TestStep{ { @@ -128,13 +128,13 @@ func TestAccStorageTransferJob_posixSource(t *testing.T) { func TestAccStorageTransferJob_posixSink(t *testing.T) { t.Parallel() - testDataSourceName := RandString(t, 10) - testTransferJobDescription := RandString(t, 10) - testSinkAgentPoolName := fmt.Sprintf("tf-test-sink-agent-pool-%s", RandString(t, 10)) + testDataSourceName := acctest.RandString(t, 10) + testTransferJobDescription := acctest.RandString(t, 10) + testSinkAgentPoolName := fmt.Sprintf("tf-test-sink-agent-pool-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccStorageTransferJobDestroyProducer(t), Steps: []resource.TestStep{ { @@ -152,15 +152,15 @@ func TestAccStorageTransferJob_posixSink(t *testing.T) { func TestAccStorageTransferJob_transferOptions(t *testing.T) { t.Parallel() - testDataSourceBucketName := RandString(t, 10) - testDataSinkName := RandString(t, 10) - testTransferJobDescription := RandString(t, 10) + testDataSourceBucketName := acctest.RandString(t, 10) + testDataSinkName := acctest.RandString(t, 10) + testTransferJobDescription := acctest.RandString(t, 10) testOverwriteWhen := []string{"ALWAYS", "NEVER", "DIFFERENT"} - testPubSubTopicName := fmt.Sprintf("tf-test-topic-%s", RandString(t, 10)) + testPubSubTopicName := fmt.Sprintf("tf-test-topic-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccStorageTransferJobDestroyProducer(t), Steps: []resource.TestStep{ { @@ -202,14 +202,14 @@ func TestAccStorageTransferJob_transferOptions(t *testing.T) { func TestAccStorageTransferJob_objectConditions(t *testing.T) { t.Parallel() - testDataSourceBucketName := RandString(t, 10) - testDataSinkName := RandString(t, 10) - testTransferJobDescription := RandString(t, 10) - testPubSubTopicName := fmt.Sprintf("tf-test-topic-%s", RandString(t, 10)) + testDataSourceBucketName := acctest.RandString(t, 10) + testDataSinkName := acctest.RandString(t, 10) + testTransferJobDescription := acctest.RandString(t, 10) + testPubSubTopicName := fmt.Sprintf("tf-test-topic-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccStorageTransferJobDestroyProducer(t), Steps: []resource.TestStep{ { @@ -235,16 +235,16 @@ func TestAccStorageTransferJob_objectConditions(t *testing.T) { func TestAccStorageTransferJob_notificationConfig(t *testing.T) { t.Parallel() - testDataSourceBucketName := RandString(t, 10) - testDataSinkName := RandString(t, 10) - testTransferJobDescription := RandString(t, 10) + testDataSourceBucketName := acctest.RandString(t, 10) + testDataSinkName := acctest.RandString(t, 10) + testTransferJobDescription := acctest.RandString(t, 10) noneNotificationConfigPayloadFormat := "NONE" - testPubSubTopicName := fmt.Sprintf("tf-test-topic-%s", RandString(t, 10)) - testPubSubTopicNameUpdate := fmt.Sprintf("tf-test-topic-%s", RandString(t, 10)) + testPubSubTopicName := fmt.Sprintf("tf-test-topic-%s", acctest.RandString(t, 10)) + testPubSubTopicNameUpdate := fmt.Sprintf("tf-test-topic-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccStorageTransferJobDestroyProducer(t), Steps: []resource.TestStep{ { @@ -293,7 +293,7 @@ func TestAccStorageTransferJob_notificationConfig(t *testing.T) { func testAccStorageTransferJobDestroyProducer(t *testing.T) func(s *terraform.State) error { return func(s *terraform.State) error { - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) for _, rs := range s.RootModule().Resources { if rs.Type != "google_storage_transfer_job" { diff --git a/mmv1/third_party/terraform/tests/resource_tags_test.go b/mmv1/third_party/terraform/tests/resource_tags_test.go index 316c1f7f9bee..a13059c10759 100644 --- a/mmv1/third_party/terraform/tests/resource_tags_test.go +++ b/mmv1/third_party/terraform/tests/resource_tags_test.go @@ -50,12 +50,12 @@ func TestAccTags(t *testing.T) { func testAccTagsTagKey_tagKeyBasic(t *testing.T) { context := map[string]interface{}{ "org_id": envvar.GetTestOrgFromEnv(t), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckTagsTagKeyDestroyProducer(t), Steps: []resource.TestStep{ { @@ -79,12 +79,12 @@ resource "google_tags_tag_key" "key" { func testAccTagsTagKey_tagKeyBasicWithPurposeGceFirewall(t *testing.T) { context := map[string]interface{}{ "org_id": envvar.GetTestOrgFromEnv(t), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckTagsTagKeyDestroyProducer(t), Steps: []resource.TestStep{ { @@ -117,12 +117,12 @@ resource "google_tags_tag_key" "key" { func testAccTagsTagKey_tagKeyUpdate(t *testing.T) { context := map[string]interface{}{ "org_id": envvar.GetTestOrgFromEnv(t), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckTagsTagKeyDestroyProducer(t), Steps: []resource.TestStep{ { @@ -177,7 +177,7 @@ func testAccCheckTagsTagKeyDestroyProducer(t *testing.T) func(s *terraform.State continue } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{TagsBasePath}}tagKeys/{{name}}") if err != nil { @@ -209,12 +209,12 @@ func testAccCheckTagsTagKeyDestroyProducer(t *testing.T) func(s *terraform.State func testAccTagsTagValue_tagValueBasic(t *testing.T) { context := map[string]interface{}{ "org_id": envvar.GetTestOrgFromEnv(t), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckTagsTagValueDestroyProducer(t), Steps: []resource.TestStep{ { @@ -245,12 +245,12 @@ resource "google_tags_tag_value" "value" { func testAccTagsTagValue_tagValueUpdate(t *testing.T) { context := map[string]interface{}{ "org_id": envvar.GetTestOrgFromEnv(t), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckTagsTagValueDestroyProducer(t), Steps: []resource.TestStep{ { @@ -319,7 +319,7 @@ func testAccCheckTagsTagValueDestroyProducer(t *testing.T) func(s *terraform.Sta continue } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{TagsBasePath}}tagValues/{{name}}") if err != nil { @@ -353,13 +353,13 @@ func testAccTagsTagBinding_tagBindingBasic(t *testing.T) { context := map[string]interface{}{ "org_id": envvar.GetTestOrgFromEnv(t), - "project_id": "tf-test-" + RandString(t, 10), - "random_suffix": RandString(t, 10), + "project_id": "tf-test-" + acctest.RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), ExternalProviders: map[string]resource.ExternalProvider{ "random": {}, }, @@ -409,7 +409,7 @@ func testAccCheckTagsTagBindingDestroyProducer(t *testing.T) func(s *terraform.S continue } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{TagsBasePath}}tagBindings/{{name}}") if err != nil { @@ -442,16 +442,16 @@ func testAccTagsTagKeyIamBinding(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), "role": "roles/viewer", "org_id": envvar.GetTestOrgFromEnv(t), - "short_name": "tf-test-key-" + RandString(t, 10), + "short_name": "tf-test-key-" + acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccTagsTagKeyIamBinding_basicGenerated(context), @@ -468,16 +468,16 @@ func testAccTagsTagKeyIamMember(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), "role": "roles/viewer", "org_id": envvar.GetTestOrgFromEnv(t), - "short_name": "tf-test-key-" + RandString(t, 10), + "short_name": "tf-test-key-" + acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { // Test Iam Member creation (no update for member, no need to test) @@ -491,16 +491,16 @@ func testAccTagsTagKeyIamPolicy(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), "role": "roles/viewer", "org_id": envvar.GetTestOrgFromEnv(t), - "short_name": "tf-test-key-" + RandString(t, 10), + "short_name": "tf-test-key-" + acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccTagsTagKeyIamPolicy_basicGenerated(context), @@ -609,17 +609,17 @@ func testAccTagsTagValueIamBinding(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), "role": "roles/viewer", "org_id": envvar.GetTestOrgFromEnv(t), - "key_short_name": "tf-test-key-" + RandString(t, 10), - "value_short_name": "tf-test-value-" + RandString(t, 10), + "key_short_name": "tf-test-key-" + acctest.RandString(t, 10), + "value_short_name": "tf-test-value-" + acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccTagsTagValueIamBinding_basicGenerated(context), @@ -636,17 +636,17 @@ func testAccTagsTagValueIamMember(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), "role": "roles/viewer", "org_id": envvar.GetTestOrgFromEnv(t), - "key_short_name": "tf-test-key-" + RandString(t, 10), - "value_short_name": "tf-test-value-" + RandString(t, 10), + "key_short_name": "tf-test-key-" + acctest.RandString(t, 10), + "value_short_name": "tf-test-value-" + acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { // Test Iam Member creation (no update for member, no need to test) @@ -660,17 +660,17 @@ func testAccTagsTagValueIamPolicy(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), "role": "roles/viewer", "org_id": envvar.GetTestOrgFromEnv(t), - "key_short_name": "tf-test-key-" + RandString(t, 10), - "value_short_name": "tf-test-value-" + RandString(t, 10), + "key_short_name": "tf-test-key-" + acctest.RandString(t, 10), + "value_short_name": "tf-test-value-" + acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccTagsTagValueIamPolicy_basicGenerated(context), @@ -805,13 +805,13 @@ func testAccTagsLocationTagBinding_locationTagBindingbasic(t *testing.T) { context := map[string]interface{}{ // "org_id": envvar.GetTestOrgFromEnv(t), - // "project_id": "tf-test-" + RandString(t, 10), - "random_suffix": RandString(t, 10), + // "project_id": "tf-test-" + acctest.RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), ExternalProviders: map[string]resource.ExternalProvider{ "random": {}, }, @@ -882,7 +882,7 @@ func testAccCheckTagsLocationTagBindingDestroyProducer(t *testing.T) func(s *ter continue } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{TagsLocationBasePath}}{{name}}") if err != nil { @@ -915,12 +915,12 @@ func TestAccTagsLocationTagBinding_locationTagBindingzonal(t *testing.T) { context := map[string]interface{}{ "org_id": envvar.GetTestOrgFromEnv(t), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), ExternalProviders: map[string]resource.ExternalProvider{ "random": {}, }, diff --git a/mmv1/third_party/terraform/tests/resource_tpu_node_test.go b/mmv1/third_party/terraform/tests/resource_tpu_node_test.go index 291ab2df75b9..4843186633bc 100644 --- a/mmv1/third_party/terraform/tests/resource_tpu_node_test.go +++ b/mmv1/third_party/terraform/tests/resource_tpu_node_test.go @@ -13,11 +13,11 @@ import ( func TestAccTPUNode_tpuNodeBUpdateTensorFlowVersion(t *testing.T) { t.Parallel() - nodeId := fmt.Sprintf("tf-test-%d", RandInt(t)) + nodeId := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckTPUNodeDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_usage_export_bucket_test.go b/mmv1/third_party/terraform/tests/resource_usage_export_bucket_test.go index 5cef89bb3364..ee53b66e4f53 100644 --- a/mmv1/third_party/terraform/tests/resource_usage_export_bucket_test.go +++ b/mmv1/third_party/terraform/tests/resource_usage_export_bucket_test.go @@ -13,11 +13,11 @@ func TestAccComputeResourceUsageExportBucket(t *testing.T) { org := envvar.GetTestOrgFromEnv(t) billingId := envvar.GetTestBillingAccountFromEnv(t) - baseProject := fmt.Sprintf("tf-test-%d", RandInt(t)) + baseProject := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccResourceUsageExportBucket(baseProject, org, billingId), diff --git a/mmv1/third_party/terraform/tests/resource_vertex_ai_endpoint_test.go b/mmv1/third_party/terraform/tests/resource_vertex_ai_endpoint_test.go index 161298c3a762..46ee9ae869a1 100644 --- a/mmv1/third_party/terraform/tests/resource_vertex_ai_endpoint_test.go +++ b/mmv1/third_party/terraform/tests/resource_vertex_ai_endpoint_test.go @@ -16,15 +16,15 @@ func TestAccVertexAIEndpoint_vertexAiEndpointNetwork(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "endpoint_name": fmt.Sprint(RandInt(t) % 9999999999), + "endpoint_name": fmt.Sprint(acctest.RandInt(t) % 9999999999), "kms_key_name": acctest.BootstrapKMSKeyInLocation(t, "us-central1").CryptoKey.Name, "network_name": acctest.BootstrapSharedTestNetwork(t, "vertex-ai-endpoint-update"), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckVertexAIEndpointDestroyProducer(t), Steps: []resource.TestStep{ { @@ -155,7 +155,7 @@ func testAccCheckVertexAIEndpointDestroyProducer(t *testing.T) func(s *terraform continue } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{VertexAIBasePath}}projects/{{project}}/locations/{{location}}/endpoints/{{name}}") if err != nil { diff --git a/mmv1/third_party/terraform/tests/resource_vertex_ai_index_endpoint_test.go b/mmv1/third_party/terraform/tests/resource_vertex_ai_index_endpoint_test.go index ae850eaab65a..3dfa51d954d3 100644 --- a/mmv1/third_party/terraform/tests/resource_vertex_ai_index_endpoint_test.go +++ b/mmv1/third_party/terraform/tests/resource_vertex_ai_index_endpoint_test.go @@ -13,12 +13,12 @@ func TestAccVertexAIIndexEndpoint_updated(t *testing.T) { context := map[string]interface{}{ "network_name": acctest.BootstrapSharedTestNetwork(t, "vertex-ai-index-endpoint-update"), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckVertexAIIndexEndpointDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_vertex_ai_index_test.go b/mmv1/third_party/terraform/tests/resource_vertex_ai_index_test.go index 95e85a93637c..b896ff0fe563 100644 --- a/mmv1/third_party/terraform/tests/resource_vertex_ai_index_test.go +++ b/mmv1/third_party/terraform/tests/resource_vertex_ai_index_test.go @@ -19,12 +19,12 @@ func TestAccVertexAIIndex_updated(t *testing.T) { context := map[string]interface{}{ "project": envvar.GetTestProjectFromEnv(), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckVertexAIIndexDestroyProducer_basic(t), Steps: []resource.TestStep{ { @@ -169,7 +169,7 @@ func testAccCheckVertexAIIndexDestroyProducer_basic(t *testing.T) func(s *terraf continue } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{VertexAIBasePath}}projects/{{project}}/locations/{{region}}/indexes/{{name}}") if err != nil { diff --git a/mmv1/third_party/terraform/tests/resource_vertex_ai_metadata_store_test.go.erb b/mmv1/third_party/terraform/tests/resource_vertex_ai_metadata_store_test.go.erb index b35a31777424..a8df5f425bf7 100644 --- a/mmv1/third_party/terraform/tests/resource_vertex_ai_metadata_store_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_vertex_ai_metadata_store_test.go.erb @@ -18,11 +18,11 @@ func TestAccVertexAIMetadataStore_vertexAiMetadataStoreExample(t *testing.T) { t.Parallel() kms := acctest.BootstrapKMSKeyInLocation(t, "us-central1") - name := fmt.Sprintf("tf-test-%s", RandString(t, 10)) + name := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckVertexAIMetadataStoreDestroyProducer(t), Steps: []resource.TestStep{ { @@ -61,7 +61,7 @@ func testAccCheckVertexAIMetadataStoreDestroyProducer(t *testing.T) func(s *terr continue } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{VertexAIBasePath}}{{name}}") if err != nil { diff --git a/mmv1/third_party/terraform/tests/resource_vertex_ai_tensorboard_test.go b/mmv1/third_party/terraform/tests/resource_vertex_ai_tensorboard_test.go index 99fe83109a3b..85e55a4a6800 100644 --- a/mmv1/third_party/terraform/tests/resource_vertex_ai_tensorboard_test.go +++ b/mmv1/third_party/terraform/tests/resource_vertex_ai_tensorboard_test.go @@ -11,11 +11,11 @@ import ( func TestAccVertexAITensorboard_Update(t *testing.T) { t.Parallel() - random_suffix := "tf-test-" + RandString(t, 10) + random_suffix := "tf-test-" + acctest.RandString(t, 10) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckVertexAITensorboardDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_vmwareengine_cluster_test.go.erb b/mmv1/third_party/terraform/tests/resource_vmwareengine_cluster_test.go.erb index cc04441f5944..5f45350bdf4d 100644 --- a/mmv1/third_party/terraform/tests/resource_vmwareengine_cluster_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_vmwareengine_cluster_test.go.erb @@ -23,12 +23,12 @@ func TestAccVmwareengineCluster_vmwareEngineClusterUpdate(t *testing.T) { "region": "southamerica-west1", // using region with low node utilization. "org_id": envvar.GetTestOrgFromEnv(t), "billing_account": envvar.GetTestBillingAccountFromEnv(t), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderBetaFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), CheckDestroy: testAccCheckVmwareengineClusterDestroyProducer(t), Steps: []resource.TestStep{ { @@ -140,7 +140,7 @@ func testAccCheckVmwareengineClusterDestroyProducer(t *testing.T) func(s *terraf continue } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{VmwareengineBasePath}}{{parent}}/clusters/{{name}}") if err != nil { diff --git a/mmv1/third_party/terraform/tests/resource_vmwareengine_network_test.go.erb b/mmv1/third_party/terraform/tests/resource_vmwareengine_network_test.go.erb index 43cbae395c85..fb14c2c69a00 100644 --- a/mmv1/third_party/terraform/tests/resource_vmwareengine_network_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_vmwareengine_network_test.go.erb @@ -16,15 +16,15 @@ func TestAccVmwareengineNetwork_vmwareEngineNetworkUpdate(t *testing.T) { t.Parallel() context := map[string]interface{}{ "region": envvar.GetTestRegionFromEnv(), - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), "organization": envvar.GetTestOrgFromEnv(t), "billing_account": envvar.GetTestBillingAccountFromEnv(t), } configTemplate := vmwareEngineNetworkConfigTemplate(context) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderBetaFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), CheckDestroy: testAccCheckVmwareengineNetworkDestroyProducer(t), ExternalProviders: map[string]resource.ExternalProvider{ "random": {}, diff --git a/mmv1/third_party/terraform/tests/resource_vmwareengine_private_cloud_test.go.erb b/mmv1/third_party/terraform/tests/resource_vmwareengine_private_cloud_test.go.erb index c45e4ab7f397..ac4aed6b6b51 100644 --- a/mmv1/third_party/terraform/tests/resource_vmwareengine_private_cloud_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_vmwareengine_private_cloud_test.go.erb @@ -20,13 +20,13 @@ func TestAccVmwareenginePrivateCloud_vmwareEnginePrivateCloudUpdate(t *testing.T t.Parallel() context := map[string]interface{}{ "region": "southamerica-west1", // using region with low node utilization. - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), "organization": envvar.GetTestOrgFromEnv(t), "billing_account": envvar.GetTestBillingAccountFromEnv(t), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderBetaFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), CheckDestroy: testAccCheckVmwareenginePrivateCloudDestroyProducer(t), ExternalProviders: map[string]resource.ExternalProvider { "time": {}, @@ -131,7 +131,7 @@ func testAccCheckVmwareenginePrivateCloudDestroyProducer(t *testing.T) func(s *t if strings.HasPrefix(name, "data.") { continue } - config := GoogleProviderConfig(t) + config := acctest.GoogleProviderConfig(t) url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{VmwareengineBasePath}}projects/{{project}}/locations/{{location}}/privateClouds/{{name}}") if err != nil { return err diff --git a/mmv1/third_party/terraform/tests/resource_vpc_access_connector_test.go b/mmv1/third_party/terraform/tests/resource_vpc_access_connector_test.go index de42251884ed..f7104c6d8227 100644 --- a/mmv1/third_party/terraform/tests/resource_vpc_access_connector_test.go +++ b/mmv1/third_party/terraform/tests/resource_vpc_access_connector_test.go @@ -11,12 +11,12 @@ func TestAccVPCAccessConnector_vpcAccessConnectorThroughput(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckVPCAccessConnectorDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_workflows_workflow_test.go b/mmv1/third_party/terraform/tests/resource_workflows_workflow_test.go index d45d75660e4d..b5830cf2da00 100644 --- a/mmv1/third_party/terraform/tests/resource_workflows_workflow_test.go +++ b/mmv1/third_party/terraform/tests/resource_workflows_workflow_test.go @@ -16,11 +16,11 @@ func TestAccWorkflowsWorkflow_Update(t *testing.T) { // Custom test written to test diffs t.Parallel() - workflowName := fmt.Sprintf("tf-test-acc-workflow-%d", RandInt(t)) + workflowName := fmt.Sprintf("tf-test-acc-workflow-%d", acctest.RandInt(t)) - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckWorkflowsWorkflowDestroyProducer(t), Steps: []resource.TestStep{ { @@ -156,15 +156,15 @@ func TestAccWorkflowsWorkflow_CMEK(t *testing.T) { // Custom test written to test diffs t.Parallel() - workflowName := fmt.Sprintf("tf-test-acc-workflow-%d", RandInt(t)) + workflowName := fmt.Sprintf("tf-test-acc-workflow-%d", acctest.RandInt(t)) kms := acctest.BootstrapKMSKeyInLocation(t, "us-central1") if acctest.BootstrapPSARole(t, "service-", "gcp-sa-workflows", "roles/cloudkms.cryptoKeyEncrypterDecrypter") { t.Fatal("Stopping the test because a role was added to the policy.") } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckWorkflowsWorkflowDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_workstations_workstation_cluster_test.go.erb b/mmv1/third_party/terraform/tests/resource_workstations_workstation_cluster_test.go.erb index f10a84fbafd2..8c33b2f3d015 100644 --- a/mmv1/third_party/terraform/tests/resource_workstations_workstation_cluster_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_workstations_workstation_cluster_test.go.erb @@ -13,12 +13,12 @@ func TestAccWorkstationsWorkstationCluster_update(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderBetaFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), CheckDestroy: testAccCheckWorkstationsWorkstationClusterDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_workstations_workstation_config_test.go.erb b/mmv1/third_party/terraform/tests/resource_workstations_workstation_config_test.go.erb index 34d938753877..a76822dada5a 100644 --- a/mmv1/third_party/terraform/tests/resource_workstations_workstation_config_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_workstations_workstation_config_test.go.erb @@ -13,12 +13,12 @@ func TestAccWorkstationsWorkstationConfig_basic(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderBetaFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), CheckDestroy: testAccCheckWorkstationsWorkstationConfigDestroyProducer(t), Steps: []resource.TestStep{ { @@ -79,13 +79,13 @@ func TestAccWorkstationsWorkstationConfig_displayName(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), "display_name": "Display Name N", } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderBetaFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), CheckDestroy: testAccCheckWorkstationsWorkstationConfigDestroyProducer(t), Steps: []resource.TestStep{ { @@ -157,12 +157,12 @@ func TestAccWorkstationsWorkstationConfig_persistentDirectories(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderBetaFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), CheckDestroy: testAccCheckWorkstationsWorkstationConfigDestroyProducer(t), Steps: []resource.TestStep{ { @@ -227,12 +227,12 @@ func TestAccWorkstationsWorkstationConfig_update(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderBetaFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), CheckDestroy: testAccCheckWorkstationsWorkstationConfigDestroyProducer(t), Steps: []resource.TestStep{ { @@ -310,12 +310,12 @@ func TestAccWorkstationsWorkstationConfig_updateHostDetails(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ - PreCheck: func() { AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderBetaFactories(t), + acctest.VcrTest(t, resource.TestCase{ + PreCheck: func() { acctest.AccTestPreCheck(t) }, + ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), CheckDestroy: testAccCheckWorkstationsWorkstationConfigDestroyProducer(t), Steps: []resource.TestStep{ { @@ -507,12 +507,12 @@ func TestAccWorkstationsWorkstationConfig_updateWorkingDir(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ - PreCheck: func() { AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderBetaFactories(t), + acctest.VcrTest(t, resource.TestCase{ + PreCheck: func() { acctest.AccTestPreCheck(t) }, + ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), CheckDestroy: testAccCheckWorkstationsWorkstationConfigDestroyProducer(t), Steps: []resource.TestStep{ { @@ -616,12 +616,12 @@ func TestAccWorkstationsWorkstationConfig_updatePersistentDirectorySourceSnapsho t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ - PreCheck: func() { AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderBetaFactories(t), + acctest.VcrTest(t, resource.TestCase{ + PreCheck: func() { acctest.AccTestPreCheck(t) }, + ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), CheckDestroy: testAccCheckWorkstationsWorkstationConfigDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/tests/resource_workstations_workstation_test.go.erb b/mmv1/third_party/terraform/tests/resource_workstations_workstation_test.go.erb index 1938bcfd7ffc..faa5bcbf4420 100644 --- a/mmv1/third_party/terraform/tests/resource_workstations_workstation_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_workstations_workstation_test.go.erb @@ -13,12 +13,12 @@ func TestAccWorkstationsWorkstation_update(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "random_suffix": RandString(t, 10), + "random_suffix": acctest.RandString(t, 10), } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckWorkstationsWorkstationDestroyProducer(t), Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/utils/provider_test.go.erb b/mmv1/third_party/terraform/utils/provider_test.go.erb index 2ed6270c9a6c..bafdc4ebff6a 100644 --- a/mmv1/third_party/terraform/utils/provider_test.go.erb +++ b/mmv1/third_party/terraform/utils/provider_test.go.erb @@ -42,13 +42,13 @@ func TestProvider_noDuplicatesInDatasourceMap(t *testing.T) { func TestAccProviderBasePath_setBasePath(t *testing.T) { t.Parallel() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeAddressDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccProviderBasePath_setBasePath("https://www.googleapis.com/compute/beta/", RandString(t, 10)), + Config: testAccProviderBasePath_setBasePath("https://www.googleapis.com/compute/beta/", acctest.RandString(t, 10)), }, { ResourceName: "google_compute_address.default", @@ -62,13 +62,13 @@ func TestAccProviderBasePath_setBasePath(t *testing.T) { func TestAccProviderBasePath_setInvalidBasePath(t *testing.T) { t.Parallel() - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeAddressDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccProviderBasePath_setBasePath("https://www.example.com/compute/beta/", RandString(t, 10)), + Config: testAccProviderBasePath_setBasePath("https://www.example.com/compute/beta/", acctest.RandString(t, 10)), ExpectError: regexp.MustCompile("got HTTP response code 404 with body"), }, }, @@ -79,13 +79,13 @@ func TestAccProviderMeta_setModuleName(t *testing.T) { t.Parallel() moduleName := "my-module" - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeAddressDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccProviderMeta_setModuleName(moduleName, RandString(t, 10)), + Config: testAccProviderMeta_setModuleName(moduleName, acctest.RandString(t, 10)), }, { ResourceName: "google_compute_address.default", @@ -103,8 +103,8 @@ func TestAccProviderUserProjectOverride(t *testing.T) { org := envvar.GetTestOrgFromEnv(t) billing := envvar.GetTestBillingAccountFromEnv(t) - pid := "tf-test-" + RandString(t, 10) - topicName := "tf-test-topic-" + RandString(t, 10) + pid := "tf-test-" + acctest.RandString(t, 10) + topicName := "tf-test-topic-" + acctest.RandString(t, 10) config := acctest.BootstrapConfig(t) accessToken, err := acctest.SetupProjectsAndGetAccessToken(org, billing, pid, "pubsub", config) @@ -112,9 +112,9 @@ func TestAccProviderUserProjectOverride(t *testing.T) { t.Error(err) } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), // No TestDestroy since that's not really the point of this test Steps: []resource.TestStep{ { @@ -145,7 +145,7 @@ func TestAccProviderIndirectUserProjectOverride(t *testing.T) { org := envvar.GetTestOrgFromEnv(t) billing := envvar.GetTestBillingAccountFromEnv(t) - pid := "tf-test-" + RandString(t, 10) + pid := "tf-test-" + acctest.RandString(t, 10) config := acctest.BootstrapConfig(t) accessToken, err := setupProjectsAndGetAccessToken(org, billing, pid, "cloudkms", config) @@ -153,9 +153,9 @@ func TestAccProviderIndirectUserProjectOverride(t *testing.T) { t.Error(err) } - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), // No TestDestroy since that's not really the point of this test Steps: []resource.TestStep{ { diff --git a/mmv1/third_party/terraform/utils/utils_test.go b/mmv1/third_party/terraform/utils/utils_test.go index 1e86c9ee6e76..fb821a7fd49b 100644 --- a/mmv1/third_party/terraform/utils/utils_test.go +++ b/mmv1/third_party/terraform/utils/utils_test.go @@ -4,11 +4,12 @@ import ( "fmt" "testing" + "github.com/hashicorp/terraform-provider-google/google/acctest" "github.com/hashicorp/terraform-provider-google/google/tpgresource" ) func TestCheckGCSName(t *testing.T) { - valid63 := RandString(t, 63) + valid63 := acctest.RandString(t, 63) cases := map[string]bool{ // Valid "foobar": true, @@ -25,16 +26,16 @@ func TestCheckGCSName(t *testing.T) { fmt.Sprintf("%s.%s.%s", valid63, valid63, valid63): true, // Invalid - "goog-foobar": false, - "foobar-google": false, - "-foobar": false, - "foobar-": false, - "_foobar": false, - "foobar_": false, - "fo": false, - "foo$bar": false, - "foo..bar": false, - RandString(t, 64): false, + "goog-foobar": false, + "foobar-google": false, + "-foobar": false, + "foobar-": false, + "_foobar": false, + "foobar_": false, + "fo": false, + "foo$bar": false, + "foo..bar": false, + acctest.RandString(t, 64): false, fmt.Sprintf("%s.%s.%s.%s", valid63, valid63, valid63, valid63): false, } From e7c0378d99306b1bed0761df2ccda0b6ee3af288 Mon Sep 17 00:00:00 2001 From: Riley Karson Date: Wed, 5 Jul 2023 15:16:53 -0700 Subject: [PATCH 35/55] Remove megan07 from reviewers' list (#8270) --- .ci/containers/membership-checker/membership.go | 1 - 1 file changed, 1 deletion(-) diff --git a/.ci/containers/membership-checker/membership.go b/.ci/containers/membership-checker/membership.go index 3809970cf027..4c3999e50d4b 100644 --- a/.ci/containers/membership-checker/membership.go +++ b/.ci/containers/membership-checker/membership.go @@ -11,7 +11,6 @@ import ( var ( // This is for the random-assignee rotation. reviewerRotation = []string{ - "megan07", "slevenick", "c2thorn", "rileykarson", From c29318f7ade792c05befd77090eae6401c350c7a Mon Sep 17 00:00:00 2001 From: vicpadilla <84111680+vicpadilla@users.noreply.github.com> Date: Wed, 5 Jul 2023 18:51:09 -0400 Subject: [PATCH 36/55] Upgrade to DCL Version 1.44.0; add cloudbuildv2 gitlab_config samples (#8242) * Upgrade to DCL Version 1.44.0; add cloudbuildv2 gitlab_config samples * adjust gitlab examples to succeed import step --- mmv1/third_party/terraform/go.mod.erb | 2 +- mmv1/third_party/terraform/go.sum | 4 +-- .../samples/gitlab.connection.json | 14 ++++++++++ .../samples/gitlab.repository.json | 10 +++++++ .../samples/gitlab_connection.yaml | 24 ++++++++++++++++ .../samples/gitlab_repository.yaml | 28 +++++++++++++++++++ .../cloudbuildv2/samples/gle.connection.json | 15 ++++++++++ .../cloudbuildv2/samples/gle.repository.json | 10 +++++++ .../cloudbuildv2/samples/gle_connection.yaml | 27 ++++++++++++++++++ .../samples/gle_old.connection.json | 15 ++++++++++ .../samples/gle_old_connection.yaml | 27 ++++++++++++++++++ .../samples/gle_priv.connection.json | 19 +++++++++++++ .../samples/gle_priv_connection.yaml | 24 ++++++++++++++++ .../samples/gle_priv_update_connection.yaml | 27 ++++++++++++++++++ .../cloudbuildv2/samples/gle_repository.yaml | 28 +++++++++++++++++++ .../samples/gle_update.connection.json | 13 +++++++++ tpgtools/go.mod | 2 +- tpgtools/go.sum | 4 +-- .../cloudbuildv2/beta/repository.yaml | 13 +++++++++ .../cloudbuildv2/samples/connection/meta.yaml | 5 ++++ .../cloudbuildv2/samples/repository/meta.yaml | 2 ++ 21 files changed, 307 insertions(+), 6 deletions(-) create mode 100755 tpgtools/api/cloudbuildv2/samples/gitlab.connection.json create mode 100755 tpgtools/api/cloudbuildv2/samples/gitlab.repository.json create mode 100755 tpgtools/api/cloudbuildv2/samples/gitlab_connection.yaml create mode 100755 tpgtools/api/cloudbuildv2/samples/gitlab_repository.yaml create mode 100755 tpgtools/api/cloudbuildv2/samples/gle.connection.json create mode 100755 tpgtools/api/cloudbuildv2/samples/gle.repository.json create mode 100755 tpgtools/api/cloudbuildv2/samples/gle_connection.yaml create mode 100755 tpgtools/api/cloudbuildv2/samples/gle_old.connection.json create mode 100755 tpgtools/api/cloudbuildv2/samples/gle_old_connection.yaml create mode 100755 tpgtools/api/cloudbuildv2/samples/gle_priv.connection.json create mode 100755 tpgtools/api/cloudbuildv2/samples/gle_priv_connection.yaml create mode 100755 tpgtools/api/cloudbuildv2/samples/gle_priv_update_connection.yaml create mode 100755 tpgtools/api/cloudbuildv2/samples/gle_repository.yaml create mode 100755 tpgtools/api/cloudbuildv2/samples/gle_update.connection.json diff --git a/mmv1/third_party/terraform/go.mod.erb b/mmv1/third_party/terraform/go.mod.erb index e053f77ff225..592b44785bf7 100644 --- a/mmv1/third_party/terraform/go.mod.erb +++ b/mmv1/third_party/terraform/go.mod.erb @@ -5,7 +5,7 @@ go 1.19 require ( cloud.google.com/go/bigtable v1.17.0 - github.com/GoogleCloudPlatform/declarative-resource-client-library v1.42.0 + github.com/GoogleCloudPlatform/declarative-resource-client-library v1.44.0 github.com/apparentlymart/go-cidr v1.1.0 github.com/davecgh/go-spew v1.1.1 github.com/dnaeon/go-vcr v1.0.1 diff --git a/mmv1/third_party/terraform/go.sum b/mmv1/third_party/terraform/go.sum index bfa7c2bfb58e..5a92ab6038cc 100644 --- a/mmv1/third_party/terraform/go.sum +++ b/mmv1/third_party/terraform/go.sum @@ -15,8 +15,8 @@ cloud.google.com/go/iam v0.13.0/go.mod h1:ljOg+rcNfzZ5d6f1nAUJ8ZIxOaZUVoS14bKCta cloud.google.com/go/longrunning v0.4.1 h1:v+yFJOfKC3yZdY6ZUI933pIYdhyhV8S3NpWrXWmg7jM= cloud.google.com/go/longrunning v0.4.1/go.mod h1:4iWDqhBZ70CvZ6BfETbvam3T8FMvLK+eFj0E6AaRQTo= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/GoogleCloudPlatform/declarative-resource-client-library v1.42.0 h1:ClnwLCqnr8/exvPWhBLJOj16oa8bvw8Fhu45wCjvQbU= -github.com/GoogleCloudPlatform/declarative-resource-client-library v1.42.0/go.mod h1:pL2Qt5HT+x6xrTd806oMiM3awW6kNIXB/iiuClz6m6k= +github.com/GoogleCloudPlatform/declarative-resource-client-library v1.44.0 h1:hASUAck0/5j84kejIHGJjipjUzFHiN5edNMobKwj2HA= +github.com/GoogleCloudPlatform/declarative-resource-client-library v1.44.0/go.mod h1:pL2Qt5HT+x6xrTd806oMiM3awW6kNIXB/iiuClz6m6k= github.com/Microsoft/go-winio v0.4.14/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jBhyzoq1bpyYA= github.com/Microsoft/go-winio v0.4.16 h1:FtSW/jqD+l4ba5iPBj9CODVtgfYAD8w2wS923g/cFDk= github.com/Microsoft/go-winio v0.4.16/go.mod h1:XB6nPKklQyQ7GC9LdcBEcBl8PF76WugXOPRXwdLnMv0= diff --git a/tpgtools/api/cloudbuildv2/samples/gitlab.connection.json b/tpgtools/api/cloudbuildv2/samples/gitlab.connection.json new file mode 100755 index 000000000000..6c64584d8859 --- /dev/null +++ b/tpgtools/api/cloudbuildv2/samples/gitlab.connection.json @@ -0,0 +1,14 @@ +{ + "name": "{{connection}}", + "gitlabConfig": { + "authorizerCredential": { + "userTokenSecretVersion": "projects/407304063574/secrets/gitlab-api-pat/versions/latest" + }, + "readAuthorizerCredential": { + "userTokenSecretVersion": "projects/407304063574/secrets/gitlab-read-pat/versions/latest" + }, + "webhookSecretSecretVersion":"projects/407304063574/secrets/gle-webhook-secret/versions/latest" + }, + "project": "{{project}}", + "location": "us-west1" +} diff --git a/tpgtools/api/cloudbuildv2/samples/gitlab.repository.json b/tpgtools/api/cloudbuildv2/samples/gitlab.repository.json new file mode 100755 index 000000000000..83d58f1e374c --- /dev/null +++ b/tpgtools/api/cloudbuildv2/samples/gitlab.repository.json @@ -0,0 +1,10 @@ +{ + "project": "{{project}}", + "location": "us-west1", + "connection": "{{ref:gitlab.connection.json:name}}", + "name": "{{repository}}", + "remoteUri": "https://gitlab.com/proctor-eng-team/terraform-testing.git", + "annotations": { + "some-key": "some-value" + } +} diff --git a/tpgtools/api/cloudbuildv2/samples/gitlab_connection.yaml b/tpgtools/api/cloudbuildv2/samples/gitlab_connection.yaml new file mode 100755 index 000000000000..c8166cc58374 --- /dev/null +++ b/tpgtools/api/cloudbuildv2/samples/gitlab_connection.yaml @@ -0,0 +1,24 @@ +# Copyright 2023 Google LLC. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +name: gitlab_connection +description: Creates a gitlab.com connection. +type: connection +versions: +- beta +resource: samples/gitlab.connection.json +variables: +- name: connection + type: resource_name +- name: project + type: project diff --git a/tpgtools/api/cloudbuildv2/samples/gitlab_repository.yaml b/tpgtools/api/cloudbuildv2/samples/gitlab_repository.yaml new file mode 100755 index 000000000000..26a3a0186cbe --- /dev/null +++ b/tpgtools/api/cloudbuildv2/samples/gitlab_repository.yaml @@ -0,0 +1,28 @@ +# Copyright 2023 Google LLC. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +name: gitlab_repository +description: Creates a gitlab repository. +type: repository +versions: +- beta +resource: samples/gitlab.repository.json +dependencies: +- samples/gitlab.connection.json +variables: +- name: connection + type: resource_name +- name: project + type: project +- name: repository + type: resource_name diff --git a/tpgtools/api/cloudbuildv2/samples/gle.connection.json b/tpgtools/api/cloudbuildv2/samples/gle.connection.json new file mode 100755 index 000000000000..b12e32c9eb29 --- /dev/null +++ b/tpgtools/api/cloudbuildv2/samples/gle.connection.json @@ -0,0 +1,15 @@ +{ + "name": "{{connection}}", + "gitlabConfig": { + "hostUri": "https://gle-us-central1.gcb-test.com", + "authorizerCredential": { + "userTokenSecretVersion": "projects/407304063574/secrets/gle-api-token/versions/latest" + }, + "readAuthorizerCredential": { + "userTokenSecretVersion": "projects/407304063574/secrets/gle-read-token/versions/latest" + }, + "webhookSecretSecretVersion":"projects/407304063574/secrets/gle-webhook-secret/versions/latest" + }, + "project": "{{project}}", + "location": "us-west1" +} diff --git a/tpgtools/api/cloudbuildv2/samples/gle.repository.json b/tpgtools/api/cloudbuildv2/samples/gle.repository.json new file mode 100755 index 000000000000..0f04872dd47f --- /dev/null +++ b/tpgtools/api/cloudbuildv2/samples/gle.repository.json @@ -0,0 +1,10 @@ +{ + "project": "{{project}}", + "location": "us-west1", + "connection": "{{ref:gle.connection.json:name}}", + "name": "{{repository}}", + "remoteUri": "https://gle-us-central1.gcb-test.com/proctor-test/smoketest.git", + "annotations": { + "some-key": "some-value" + } +} diff --git a/tpgtools/api/cloudbuildv2/samples/gle_connection.yaml b/tpgtools/api/cloudbuildv2/samples/gle_connection.yaml new file mode 100755 index 000000000000..0d45649824db --- /dev/null +++ b/tpgtools/api/cloudbuildv2/samples/gle_connection.yaml @@ -0,0 +1,27 @@ +# Copyright 2023 Google LLC. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +name: gle_connection +description: Creates a GLE connection then update to an older version. +type: connection +versions: +- beta +resource: samples/gle.connection.json +updates: +- resource: samples/gle_old.connection.json + dependencies: [] +variables: +- name: connection + type: resource_name +- name: project + type: project diff --git a/tpgtools/api/cloudbuildv2/samples/gle_old.connection.json b/tpgtools/api/cloudbuildv2/samples/gle_old.connection.json new file mode 100755 index 000000000000..fe441053ea8a --- /dev/null +++ b/tpgtools/api/cloudbuildv2/samples/gle_old.connection.json @@ -0,0 +1,15 @@ +{ + "name": "{{connection}}", + "gitlabConfig": { + "hostUri": "https://gle-old.gcb-test.com", + "authorizerCredential": { + "userTokenSecretVersion": "projects/407304063574/secrets/gle-old-api-token/versions/2" + }, + "readAuthorizerCredential": { + "userTokenSecretVersion": "projects/407304063574/secrets/gle-old-read-token/versions/3" + }, + "webhookSecretSecretVersion":"projects/407304063574/secrets/gle-webhook-secret/versions/latest" + }, + "project": "{{project}}", + "location": "us-west1" +} diff --git a/tpgtools/api/cloudbuildv2/samples/gle_old_connection.yaml b/tpgtools/api/cloudbuildv2/samples/gle_old_connection.yaml new file mode 100755 index 000000000000..6740f3309535 --- /dev/null +++ b/tpgtools/api/cloudbuildv2/samples/gle_old_connection.yaml @@ -0,0 +1,27 @@ +# Copyright 2023 Google LLC. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +name: gle_old_connection +description: Creates a GLE connection on an old version then update to a newer version. +type: connection +versions: +- beta +resource: samples/gle_old.connection.json +updates: +- resource: samples/gle.connection.json + dependencies: [] +variables: +- name: connection + type: resource_name +- name: project + type: project diff --git a/tpgtools/api/cloudbuildv2/samples/gle_priv.connection.json b/tpgtools/api/cloudbuildv2/samples/gle_priv.connection.json new file mode 100755 index 000000000000..8c716bd7e24b --- /dev/null +++ b/tpgtools/api/cloudbuildv2/samples/gle_priv.connection.json @@ -0,0 +1,19 @@ +{ + "name": "{{connection}}", + "gitlabConfig": { + "hostUri": "https://gle-test.proctor-staging-test.com", + "serviceDirectoryConfig": { + "service": "projects/proctor-gitlab-enterprise/locations/us-west1/namespaces/gle-uw-1/services/private-smoketest" + }, + "sslCa": "-----BEGIN CERTIFICATE-----\nMIIDajCCAlKgAwIBAgIUedXFQAw0eUDTe6gmPKVyRvBlDi8wDQYJKoZIhvcNAQEL\nBQAwVjELMAkGA1UEBhMCVVMxGzAZBgNVBAoMEkdvb2dsZSBDbG91ZCBCdWlsZDEq\nMCgGA1UEAwwhZ2xlLXRlc3QucHJvY3Rvci1zdGFnaW5nLXRlc3QuY29tMB4XDTIy\nMDcyNTE3Mzg0MFoXDTIzMDcyNTE3Mzg0MFowVjELMAkGA1UEBhMCVVMxGzAZBgNV\nBAoMEkdvb2dsZSBDbG91ZCBCdWlsZDEqMCgGA1UEAwwhZ2xlLXRlc3QucHJvY3Rv\nci1zdGFnaW5nLXRlc3QuY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKC\nAQEAr7H0J4nZBL0ed3duVDbOdlnqJuLHZVBWIOp0DBVWPzdx+4eDCi86czxzXmVG\nuZXSpvg3az4QHGWs2HwlBCDk6tp2QT6F1gR6TE8S2yp+04BDhtg1DUopWY+f+Xi7\ni1tXQG7OTDByez3V6MR0t0bVv/LOJlvOngWbJ32qZqfbj5W8MACR/3u7KBjGs/bm\nrbDMga3YOOIa+DVLdLCwzc7kFlM9W7sezkUM/FhhellaxLu4i5O86sywJYMEo7VG\nj3FUS3XiDyKW68xOpE4svW7LiZEAnnLSsPdELO2bzhR/md84Jjvm99i6yP0StrMB\n+X2EwPYmTLMktdJyMUn/vhFYzQIDAQABozAwLjAsBgNVHREEJTAjgiFnbGUtdGVz\ndC5wcm9jdG9yLXN0YWdpbmctdGVzdC5jb20wDQYJKoZIhvcNAQELBQADggEBAJ+6\nH7WI9+hqrT4zpyc/CpH6VuviYezo1qd4/6M496dKlrHd11+xAXkBRZ4FFyoDFMgz\nO7YihNTBuONwiv21YN3OV9xoTExGx/IIkHNaueL2ZPkbVcJWQEWtEITp9Mo0qDIj\nkKjEQ5A+I4T4CiQ/OAhqtN8gR8ZUKGRJw+s2sE+yCIvRfoeJ4YU7NfUL1vSXxKfy\nHz3awR7t5qnCsvcShZtmiZ4xsc6o/tKqL5nAwNk1M6rPMY/+/PY70juLf1GNNDoZ\nA2Co+g6uI/FwAFAO5ZYKRLlstgNcPXerNdxXhpRZKMxGj8WfQ3z0Eu4cGtTUmDz5\npTam4bqToj22/MN2IhA=\n-----END CERTIFICATE-----\n", + "authorizerCredential": { + "userTokenSecretVersion": "projects/407304063574/secrets/gle-api-token/versions/latest" + }, + "readAuthorizerCredential": { + "userTokenSecretVersion": "projects/407304063574/secrets/gle-read-token/versions/latest" + }, + "webhookSecretSecretVersion":"projects/407304063574/secrets/gle-webhook-secret/versions/latest" + }, + "project": "{{project}}", + "location": "us-west1" +} diff --git a/tpgtools/api/cloudbuildv2/samples/gle_priv_connection.yaml b/tpgtools/api/cloudbuildv2/samples/gle_priv_connection.yaml new file mode 100755 index 000000000000..32e4621b4d6c --- /dev/null +++ b/tpgtools/api/cloudbuildv2/samples/gle_priv_connection.yaml @@ -0,0 +1,24 @@ +# Copyright 2023 Google LLC. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +name: gle_priv_connection +description: Creates a connection to a private server using Service Directory. +type: connection +versions: +- beta +resource: samples/gle_priv.connection.json +variables: +- name: connection + type: resource_name +- name: project + type: project diff --git a/tpgtools/api/cloudbuildv2/samples/gle_priv_update_connection.yaml b/tpgtools/api/cloudbuildv2/samples/gle_priv_update_connection.yaml new file mode 100755 index 000000000000..4e3cb5fe727d --- /dev/null +++ b/tpgtools/api/cloudbuildv2/samples/gle_priv_update_connection.yaml @@ -0,0 +1,27 @@ +# Copyright 2023 Google LLC. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +name: gle_priv_update_connection +description: Creates and updates a connection to a private server using Service Directory. +type: connection +versions: +- beta +resource: samples/gle.connection.json +updates: +- resource: samples/gle_priv.connection.json + dependencies: [] +variables: +- name: connection + type: resource_name +- name: project + type: project diff --git a/tpgtools/api/cloudbuildv2/samples/gle_repository.yaml b/tpgtools/api/cloudbuildv2/samples/gle_repository.yaml new file mode 100755 index 000000000000..a3b581e2a3d5 --- /dev/null +++ b/tpgtools/api/cloudbuildv2/samples/gle_repository.yaml @@ -0,0 +1,28 @@ +# Copyright 2023 Google LLC. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +name: gle_repository +description: Creates a GLE repository. +type: repository +versions: +- beta +resource: samples/gle.repository.json +dependencies: +- samples/gle.connection.json +variables: +- name: connection + type: resource_name +- name: project + type: project +- name: repository + type: resource_name diff --git a/tpgtools/api/cloudbuildv2/samples/gle_update.connection.json b/tpgtools/api/cloudbuildv2/samples/gle_update.connection.json new file mode 100755 index 000000000000..2a77427c701a --- /dev/null +++ b/tpgtools/api/cloudbuildv2/samples/gle_update.connection.json @@ -0,0 +1,13 @@ +{ + "name": "{{connection}}", + "gitlabConfig": { + "hostUri": "https://gle-us-central1.gcb-test.com", + "authorizerCredential": { + "userTokenSecretVersion": "projects/212465313333/secrets/proctor-repo-gle-api-token/versions/latest" + }, + "webhookSecretSecretVersion":"projects/407304063574/secrets/gle-webhook-secret/versions/latest" + }, + "project": "{{project}}", + "annotations": {"somekey": "somevalue"}, + "location": "{{region}}" +} diff --git a/tpgtools/go.mod b/tpgtools/go.mod index 36404b1e5ac7..8def4087e6a0 100644 --- a/tpgtools/go.mod +++ b/tpgtools/go.mod @@ -4,7 +4,7 @@ go 1.19 require ( bitbucket.org/creachadair/stringset v0.0.9 - github.com/GoogleCloudPlatform/declarative-resource-client-library v1.42.0 + github.com/GoogleCloudPlatform/declarative-resource-client-library v1.44.0 github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b github.com/hashicorp/errwrap v1.0.0 github.com/hashicorp/hcl v1.0.0 diff --git a/tpgtools/go.sum b/tpgtools/go.sum index a8d4fd23fc34..f88c1e9faba9 100644 --- a/tpgtools/go.sum +++ b/tpgtools/go.sum @@ -35,8 +35,8 @@ cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9 dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= -github.com/GoogleCloudPlatform/declarative-resource-client-library v1.42.0 h1:ClnwLCqnr8/exvPWhBLJOj16oa8bvw8Fhu45wCjvQbU= -github.com/GoogleCloudPlatform/declarative-resource-client-library v1.42.0/go.mod h1:pL2Qt5HT+x6xrTd806oMiM3awW6kNIXB/iiuClz6m6k= +github.com/GoogleCloudPlatform/declarative-resource-client-library v1.44.0 h1:hASUAck0/5j84kejIHGJjipjUzFHiN5edNMobKwj2HA= +github.com/GoogleCloudPlatform/declarative-resource-client-library v1.44.0/go.mod h1:pL2Qt5HT+x6xrTd806oMiM3awW6kNIXB/iiuClz6m6k= github.com/agext/levenshtein v1.2.1/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558= github.com/agext/levenshtein v1.2.2 h1:0S/Yg6LYmFJ5stwQeRp6EeOcCbj7xiqQSdNelsXvaqE= github.com/agext/levenshtein v1.2.2/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558= diff --git a/tpgtools/overrides/cloudbuildv2/beta/repository.yaml b/tpgtools/overrides/cloudbuildv2/beta/repository.yaml index b44f1dc06a7a..01ea7c579c97 100644 --- a/tpgtools/overrides/cloudbuildv2/beta/repository.yaml +++ b/tpgtools/overrides/cloudbuildv2/beta/repository.yaml @@ -3,3 +3,16 @@ field: connection details: name: parent_connection +# TODO: remove once DCL is updpated to not have these fields required. +- type: CUSTOM_SCHEMA_VALUES + field: project + details: + required: false + optional: true + computed: true +- type: CUSTOM_SCHEMA_VALUES + field: location + details: + required: false + optional: true + computed: true diff --git a/tpgtools/overrides/cloudbuildv2/samples/connection/meta.yaml b/tpgtools/overrides/cloudbuildv2/samples/connection/meta.yaml index 10347c1459b2..5703e8f9d682 100644 --- a/tpgtools/overrides/cloudbuildv2/samples/connection/meta.yaml +++ b/tpgtools/overrides/cloudbuildv2/samples/connection/meta.yaml @@ -13,3 +13,8 @@ doc_hide: - ghe_complete_connection.yaml - ghe_priv_connection.yaml - ghe_priv_update_connection.yaml +- gitlab_connection.yaml +- gle_connection.yaml +- gle_old_connection.yaml +- gle_priv_connection.yaml +- gle_priv_update_connection.yaml diff --git a/tpgtools/overrides/cloudbuildv2/samples/repository/meta.yaml b/tpgtools/overrides/cloudbuildv2/samples/repository/meta.yaml index 2885ff87a7db..1a51b02776d5 100644 --- a/tpgtools/overrides/cloudbuildv2/samples/repository/meta.yaml +++ b/tpgtools/overrides/cloudbuildv2/samples/repository/meta.yaml @@ -10,3 +10,5 @@ doc_hide: # to show them in the docs. - ghe_repository.yaml - github_repository.yaml +- gitlab_repository.yaml +- gle_repository.yaml From cafdd6022fcdbc1a2e64ce0ab82a9ba1130a6bdf Mon Sep 17 00:00:00 2001 From: Sean Milligan Date: Wed, 5 Jul 2023 16:48:10 -0700 Subject: [PATCH 37/55] Prioritize disk.DiskSizeGb over disk.InitializeParams.DiskSizeGb (#8246) * Add and prefer AttachedDisk.DiskSizeGb over AttachedDisk.InitializeParams.DiskSizeGb * Fix a paren out of place * Add DiskSizeGb outside InitializeParams as a separate field. * Undo unnecessary changes * use one field instead of two * use one field instead of two --- .../resource_compute_instance_template.go.erb | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_instance_template.go.erb b/mmv1/third_party/terraform/services/compute/resource_compute_instance_template.go.erb index 8c1ac952c861..6b01a2147217 100644 --- a/mmv1/third_party/terraform/services/compute/resource_compute_instance_template.go.erb +++ b/mmv1/third_party/terraform/services/compute/resource_compute_instance_template.go.erb @@ -1061,7 +1061,10 @@ func buildDisks(d *schema.ResourceData, config *transport_tpg.Config) ([]*comput disk.DiskEncryptionKey.KmsKeyName = v.(string) } } - + // Assign disk.DiskSizeGb and disk.InitializeParams.DiskSizeGb the same value + if v, ok := d.GetOk(prefix + ".disk_size_gb"); ok { + disk.DiskSizeGb = int64(v.(int)) + } if v, ok := d.GetOk(prefix + ".source"); ok { disk.Source = v.(string) conflicts := []string{"disk_size_gb", "disk_name", "disk_type", "source_image", "source_snapshot", "labels"} @@ -1076,6 +1079,7 @@ func buildDisks(d *schema.ResourceData, config *transport_tpg.Config) ([]*comput if v, ok := d.GetOk(prefix + ".disk_name"); ok { disk.InitializeParams.DiskName = v.(string) } + // Assign disk.DiskSizeGb and disk.InitializeParams.DiskSizeGb the same value if v, ok := d.GetOk(prefix + ".disk_size_gb"); ok { disk.InitializeParams.DiskSizeGb = int64(v.(int)) } @@ -1341,10 +1345,13 @@ func flattenDisk(disk *compute.AttachedDisk, configDisk map[string]any, defaultP diskMap["disk_type"] = disk.InitializeParams.DiskType diskMap["disk_name"] = disk.InitializeParams.DiskName diskMap["labels"] = disk.InitializeParams.Labels - // The API does not return a disk size value for scratch disks. They can only be one size, - // so we can assume that size here. - if disk.InitializeParams.DiskSizeGb == 0 && disk.Type == "SCRATCH" { + // The API does not return a disk size value for scratch disks. They are largely only one size, + // so we can assume that size here. Prefer disk.DiskSizeGb over the deprecated + // disk.InitializeParams.DiskSizeGb. + if disk.DiskSizeGb == 0 && disk.InitializeParams.DiskSizeGb == 0 && disk.Type == "SCRATCH" { diskMap["disk_size_gb"] = DEFAULT_SCRATCH_DISK_SIZE_GB + } else if disk.DiskSizeGb != 0 { + diskMap["disk_size_gb"] = disk.DiskSizeGb } else { diskMap["disk_size_gb"] = disk.InitializeParams.DiskSizeGb } From 43baafded93a5af2e8fc30dc8d5ae78d014cfde2 Mon Sep 17 00:00:00 2001 From: Riley Karson Date: Thu, 6 Jul 2023 02:15:42 -0700 Subject: [PATCH 38/55] Fix private-ip-alloc names in tests (#8237) --- mmv1/products/cloudbuild/BitbucketServerConfig.yaml | 1 + .../databasemigrationservice/connectionprofile.yaml | 2 ++ ...cloudbuild_bitbucket_server_config_peered_network.tf.erb | 2 +- ...base_migration_service_connection_profile_alloydb.tf.erb | 6 +++--- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/mmv1/products/cloudbuild/BitbucketServerConfig.yaml b/mmv1/products/cloudbuild/BitbucketServerConfig.yaml index dd00668201ff..d8b2f2763209 100644 --- a/mmv1/products/cloudbuild/BitbucketServerConfig.yaml +++ b/mmv1/products/cloudbuild/BitbucketServerConfig.yaml @@ -63,6 +63,7 @@ examples: vars: config_id: 'bbs-config' network_name: 'vpc-network' + global_address_name: 'private-ip-alloc' test_vars_overrides: network_name: 'acctest.BootstrapSharedTestNetwork(t, "peered-network")' custom_code: !ruby/object:Provider::Terraform::CustomCode diff --git a/mmv1/products/databasemigrationservice/connectionprofile.yaml b/mmv1/products/databasemigrationservice/connectionprofile.yaml index 9ffe767f98dd..2e6de7032da0 100644 --- a/mmv1/products/databasemigrationservice/connectionprofile.yaml +++ b/mmv1/products/databasemigrationservice/connectionprofile.yaml @@ -85,6 +85,8 @@ examples: - 'alloydb.0.settings.0.initial_user.0.password' vars: profile: 'my-profileid' + global_address_name: 'private-ip-alloc' + network_name: 'vpc-network' parameters: - !ruby/object:Api::Type::String name: 'connectionProfileId' diff --git a/mmv1/templates/terraform/examples/cloudbuild_bitbucket_server_config_peered_network.tf.erb b/mmv1/templates/terraform/examples/cloudbuild_bitbucket_server_config_peered_network.tf.erb index 416b54983ddc..f59bc3278d77 100644 --- a/mmv1/templates/terraform/examples/cloudbuild_bitbucket_server_config_peered_network.tf.erb +++ b/mmv1/templates/terraform/examples/cloudbuild_bitbucket_server_config_peered_network.tf.erb @@ -11,7 +11,7 @@ data "google_compute_network" "vpc_network" { } resource "google_compute_global_address" "private_ip_alloc" { - name = "private-ip-alloc" + name = "<%= ctx[:vars]['global_address_name'] %>" purpose = "VPC_PEERING" address_type = "INTERNAL" prefix_length = 16 diff --git a/mmv1/templates/terraform/examples/database_migration_service_connection_profile_alloydb.tf.erb b/mmv1/templates/terraform/examples/database_migration_service_connection_profile_alloydb.tf.erb index 0a08c8f02f04..51421f2466c3 100644 --- a/mmv1/templates/terraform/examples/database_migration_service_connection_profile_alloydb.tf.erb +++ b/mmv1/templates/terraform/examples/database_migration_service_connection_profile_alloydb.tf.erb @@ -2,11 +2,11 @@ data "google_project" "project" { } resource "google_compute_network" "default" { - name = "tf-test-alloydb-cp%{random_suffix}" + name = "<%= ctx[:vars]['network_name'] %>" } resource "google_compute_global_address" "private_ip_alloc" { - name = "private-ip-alloc%{random_suffix}" + name = "<%= ctx[:vars]['global_address_name'] %>" address_type = "INTERNAL" purpose = "VPC_PEERING" prefix_length = 16 @@ -57,4 +57,4 @@ resource "google_database_migration_service_connection_profile" "<%= ctx[:primar } depends_on = [google_service_networking_connection.vpc_connection] -} \ No newline at end of file +} From 499e9487546f0926a6c364afb509d8bad4fc9a32 Mon Sep 17 00:00:00 2001 From: Ruben de Vries Date: Thu, 6 Jul 2023 19:52:15 +0200 Subject: [PATCH 39/55] mark redis instance maintenancePolicy block as output only (#8261) --- mmv1/products/redis/Instance.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/mmv1/products/redis/Instance.yaml b/mmv1/products/redis/Instance.yaml index 127c32b2a757..1365eaa908fa 100644 --- a/mmv1/products/redis/Instance.yaml +++ b/mmv1/products/redis/Instance.yaml @@ -336,6 +336,7 @@ properties: function: 'validation.IntBetween(0,999999999)' - !ruby/object:Api::Type::NestedObject name: maintenanceSchedule + output: true description: Upcoming maintenance schedule. properties: - !ruby/object:Api::Type::String From 83af5da1fcfb411f3c306fd06709052e1fc1e69b Mon Sep 17 00:00:00 2001 From: misterpoe Date: Thu, 6 Jul 2023 17:36:50 -0400 Subject: [PATCH 40/55] Add OIDC code flow fields to WorkforcePoolProvider. (#8212) * Add OIDC code flow fields to WorkforcePoolProvider. * Add ignore_read_extra for client secret plaintext to bypass ImportStateVerify check. * Use server-provided to correct external drift for client secret. * Handle nil return values from d.Get. * Validate that client secret plain_text is non-empty to ensure that clearing plain_text on thumbprint change always triggers a diff. --- .../WorkforcePoolProvider.yaml | 38 +++++++++++ ...l_provider_oidc_client_secret_value.go.erb | 31 +++++++++ ..._workforce_pool_provider_oidc_basic.tf.erb | 9 ++- ...m_workforce_pool_provider_oidc_full.tf.erb | 9 ++- .../iam_workforce_pool_provider.go.erb | 17 +++++ .../iam_workforce_pool_provider.go.erb | 19 ++++++ ...e_pool_workforce_pool_provider_test.go.erb | 65 +++++++++++++++++-- 7 files changed, 180 insertions(+), 8 deletions(-) create mode 100644 mmv1/templates/terraform/custom_flatten/iam_workforce_pool_provider_oidc_client_secret_value.go.erb create mode 100644 mmv1/templates/terraform/post_create/iam_workforce_pool_provider.go.erb create mode 100644 mmv1/templates/terraform/post_update/iam_workforce_pool_provider.go.erb diff --git a/mmv1/products/iamworkforcepool/WorkforcePoolProvider.yaml b/mmv1/products/iamworkforcepool/WorkforcePoolProvider.yaml index 13e19af8fd78..221019f14a47 100644 --- a/mmv1/products/iamworkforcepool/WorkforcePoolProvider.yaml +++ b/mmv1/products/iamworkforcepool/WorkforcePoolProvider.yaml @@ -58,6 +58,8 @@ examples: provider_id: 'example-prvdr' test_env_vars: org_id: :ORG_ID + ignore_read_extra: + - 'oidc.0.client_secret.0.value.0.plain_text' - !ruby/object:Provider::Terraform::Examples name: 'iam_workforce_pool_provider_oidc_full' primary_resource_id: 'example' @@ -66,9 +68,13 @@ examples: provider_id: 'example-prvdr' test_env_vars: org_id: :ORG_ID + ignore_read_extra: + - 'oidc.0.client_secret.0.value.0.plain_text' custom_code: !ruby/object:Provider::Terraform::CustomCode constants: templates/terraform/constants/iam_workforce_pool_provider.go.erb decoder: templates/terraform/decoders/treat_deleted_state_as_gone.go.erb + post_create: templates/terraform/post_create/iam_workforce_pool_provider.go.erb + post_update: templates/terraform/post_update/iam_workforce_pool_provider.go.erb properties: - !ruby/object:Api::Type::String name: 'location' @@ -252,6 +258,32 @@ properties: The client ID. Must match the audience claim of the JWT issued by the identity provider. required: true + - !ruby/object:Api::Type::NestedObject + name: 'clientSecret' + description: | + The optional client secret. Required to enable Authorization Code flow for web sign-in. + properties: + - !ruby/object:Api::Type::NestedObject + name: 'value' + exactly_one_of: + - oidc.0.client_secret.0.value + description: | + The value of the client secret. + custom_flatten: templates/terraform/custom_flatten/iam_workforce_pool_provider_oidc_client_secret_value.go.erb + properties: + - !ruby/object:Api::Type::String + name: 'plainText' + description: | + The plain text of the client secret value. + sensitive: true + required: true + validation: !ruby/object:Provider::Terraform::Validation + function: 'validation.StringIsNotEmpty' + - !ruby/object:Api::Type::String + name: 'thumbprint' + description: | + A thumbprint to represent the current client secret value. + output: true - !ruby/object:Api::Type::NestedObject name: 'webSsoConfig' description: | @@ -262,15 +294,21 @@ properties: name: 'responseType' description: | The Response Type to request for in the OIDC Authorization Request for web sign-in. + + The `CODE` Response Type is recommended to avoid the Implicit Flow, for security reasons. + * CODE: The `response_type=code` selection uses the Authorization Code Flow for web sign-in. Requires a configured client secret. * ID_TOKEN: The `response_type=id_token` selection uses the Implicit Flow for web sign-in. required: true values: + - :CODE - :ID_TOKEN - !ruby/object:Api::Type::Enum name: assertionClaimsBehavior description: | The behavior for how OIDC Claims are included in the `assertion` object used for attribute mapping and attribute condition. + * MERGE_USER_INFO_OVER_ID_TOKEN_CLAIMS: Merge the UserInfo Endpoint Claims with ID Token Claims, preferring UserInfo Claim Values for the same Claim Name. This option is available only for the Authorization Code Flow. * ONLY_ID_TOKEN_CLAIMS: Only include ID Token Claims. required: true values: + - :MERGE_USER_INFO_OVER_ID_TOKEN_CLAIMS - :ONLY_ID_TOKEN_CLAIMS diff --git a/mmv1/templates/terraform/custom_flatten/iam_workforce_pool_provider_oidc_client_secret_value.go.erb b/mmv1/templates/terraform/custom_flatten/iam_workforce_pool_provider_oidc_client_secret_value.go.erb new file mode 100644 index 000000000000..23cb2279fa8d --- /dev/null +++ b/mmv1/templates/terraform/custom_flatten/iam_workforce_pool_provider_oidc_client_secret_value.go.erb @@ -0,0 +1,31 @@ +<%# The license inside this block applies to this file. + # Copyright 2023 Google Inc. + # Licensed under the Apache License, Version 2.0 (the "License"); + # you may not use this file except in compliance with the License. + # You may obtain a copy of the License at + # + # http://www.apache.org/licenses/LICENSE-2.0 + # + # Unless required by applicable law or agreed to in writing, software + # distributed under the License is distributed on an "AS IS" BASIS, + # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + # See the License for the specific language governing permissions and + # limitations under the License. +-%> +func flatten<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { + if v == nil { + return nil + } + original := v.(map[string]interface{}) + if len(original) == 0 { + return nil + } + transformed := make(map[string]interface{}) + transformed["thumbprint"] = original["thumbprint"] + // Trigger a diff based on the plain_text if there is no change in the thumbprint, + // otherwise leave plain_text empty to always trigger a diff. + if original["thumbprint"].(string) == d.Get("oidc.0.client_secret.0.value.0.thumbprint").(string) { + transformed["plain_text"] = d.Get("oidc.0.client_secret.0.value.0.plain_text") + } + return []interface{}{transformed} +} diff --git a/mmv1/templates/terraform/examples/iam_workforce_pool_provider_oidc_basic.tf.erb b/mmv1/templates/terraform/examples/iam_workforce_pool_provider_oidc_basic.tf.erb index 8683d745880f..a5adf114df0f 100644 --- a/mmv1/templates/terraform/examples/iam_workforce_pool_provider_oidc_basic.tf.erb +++ b/mmv1/templates/terraform/examples/iam_workforce_pool_provider_oidc_basic.tf.erb @@ -14,9 +14,14 @@ resource "google_iam_workforce_pool_provider" "<%= ctx[:primary_resource_id] %>" oidc { issuer_uri = "https://accounts.thirdparty.com" client_id = "client-id" + client_secret { + value { + plain_text = "client-secret" + } + } web_sso_config { - response_type = "ID_TOKEN" - assertion_claims_behavior = "ONLY_ID_TOKEN_CLAIMS" + response_type = "CODE" + assertion_claims_behavior = "MERGE_USER_INFO_OVER_ID_TOKEN_CLAIMS" } } } diff --git a/mmv1/templates/terraform/examples/iam_workforce_pool_provider_oidc_full.tf.erb b/mmv1/templates/terraform/examples/iam_workforce_pool_provider_oidc_full.tf.erb index 760cf4521230..a3d99681b821 100644 --- a/mmv1/templates/terraform/examples/iam_workforce_pool_provider_oidc_full.tf.erb +++ b/mmv1/templates/terraform/examples/iam_workforce_pool_provider_oidc_full.tf.erb @@ -14,9 +14,14 @@ resource "google_iam_workforce_pool_provider" "<%= ctx[:primary_resource_id] %>" oidc { issuer_uri = "https://accounts.thirdparty.com" client_id = "client-id" + client_secret { + value { + plain_text = "client-secret" + } + } web_sso_config { - response_type = "ID_TOKEN" - assertion_claims_behavior = "ONLY_ID_TOKEN_CLAIMS" + response_type = "CODE" + assertion_claims_behavior = "MERGE_USER_INFO_OVER_ID_TOKEN_CLAIMS" } } display_name = "Display name" diff --git a/mmv1/templates/terraform/post_create/iam_workforce_pool_provider.go.erb b/mmv1/templates/terraform/post_create/iam_workforce_pool_provider.go.erb new file mode 100644 index 000000000000..25aaf9eb73b5 --- /dev/null +++ b/mmv1/templates/terraform/post_create/iam_workforce_pool_provider.go.erb @@ -0,0 +1,17 @@ +createdClientSecret := d.Get("oidc.0.client_secret.0.value.0.plain_text") +if createdClientSecret != nil && createdClientSecret != "" { + // After the create, reading from the API returns a new thumbprint + // for the client secret value, which clears the plain_text. We set the plain_text since + // this case should not warrant a diff. + if err := resourceIAMWorkforcePoolWorkforcePoolProviderRead(d, meta); err != nil { + return err + } + oidc := d.Get("oidc") + clientSecret := oidc.([]interface{})[0].(map[string]interface{})["client_secret"] + clientSecretValue := clientSecret.([]interface{})[0].(map[string]interface{})["value"] + clientSecretValue.([]interface{})[0].(map[string]interface{})["plain_text"] = createdClientSecret + if err := d.Set("oidc", oidc); err != nil { + return err + } + return nil +} diff --git a/mmv1/templates/terraform/post_update/iam_workforce_pool_provider.go.erb b/mmv1/templates/terraform/post_update/iam_workforce_pool_provider.go.erb new file mode 100644 index 000000000000..f82d1d27a253 --- /dev/null +++ b/mmv1/templates/terraform/post_update/iam_workforce_pool_provider.go.erb @@ -0,0 +1,19 @@ +if d.HasChange("oidc") { + updatedClientSecret := d.Get("oidc.0.client_secret.0.value.0.plain_text") + if updatedClientSecret != nil && updatedClientSecret != "" { + // After the update, reading from the API returns a different thumbprint + // for the client secret value, which clears the plain_text. We set the plain_text since + // this case should not warrant a diff. + if err := resourceIAMWorkforcePoolWorkforcePoolProviderRead(d, meta); err != nil { + return err + } + oidc := d.Get("oidc") + clientSecret := oidc.([]interface{})[0].(map[string]interface{})["client_secret"] + clientSecretValue := clientSecret.([]interface{})[0].(map[string]interface{})["value"] + clientSecretValue.([]interface{})[0].(map[string]interface{})["plain_text"] = updatedClientSecret + if err := d.Set("oidc", oidc); err != nil { + return err + } + return nil + } +} diff --git a/mmv1/third_party/terraform/tests/resource_iam_workforce_pool_workforce_pool_provider_test.go.erb b/mmv1/third_party/terraform/tests/resource_iam_workforce_pool_workforce_pool_provider_test.go.erb index 4bcb3d0cf0d1..1a1153dc7728 100644 --- a/mmv1/third_party/terraform/tests/resource_iam_workforce_pool_workforce_pool_provider_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_iam_workforce_pool_workforce_pool_provider_test.go.erb @@ -35,10 +35,20 @@ func TestAccIAMWorkforcePoolWorkforcePoolProvider_oidc(t *testing.T) { ResourceName: "google_iam_workforce_pool_provider.my_provider", ImportState: true, ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"oidc.0.client_secret.0.value.0.plain_text"}, }, { Config: testAccIAMWorkforcePoolWorkforcePoolProvider_oidc_update(context), }, + { + ResourceName: "google_iam_workforce_pool_provider.my_provider", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"oidc.0.client_secret.0.value.0.plain_text"}, + }, + { + Config: testAccIAMWorkforcePoolWorkforcePoolProvider_oidc_update_clearClientSecret(context), + }, { ResourceName: "google_iam_workforce_pool_provider.my_provider", ImportState: true, @@ -51,6 +61,7 @@ func TestAccIAMWorkforcePoolWorkforcePoolProvider_oidc(t *testing.T) { ResourceName: "google_iam_workforce_pool_provider.my_provider", ImportState: true, ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"oidc.0.client_secret.0.value.0.plain_text"}, }, { Config: testAccIAMWorkforcePoolWorkforcePoolProvider_destroy(context), @@ -161,9 +172,14 @@ resource "google_iam_workforce_pool_provider" "my_provider" { oidc { issuer_uri = "https://accounts.thirdparty.com" client_id = "client-id" + client_secret { + value { + plain_text = "client-secret" + } + } web_sso_config { - response_type = "ID_TOKEN" - assertion_claims_behavior = "ONLY_ID_TOKEN_CLAIMS" + response_type = "CODE" + assertion_claims_behavior = "MERGE_USER_INFO_OVER_ID_TOKEN_CLAIMS" } } display_name = "Display name" @@ -182,6 +198,42 @@ resource "google_iam_workforce_pool" "my_pool" { location = "global" } +resource "google_iam_workforce_pool_provider" "my_provider" { + workforce_pool_id = google_iam_workforce_pool.my_pool.workforce_pool_id + location = google_iam_workforce_pool.my_pool.location + provider_id = "my-provider-%{random_suffix}" + attribute_mapping = { + "google.subject" = "false" + } + oidc { + issuer_uri = "https://test.thirdparty.com" + client_id = "new-client-id" + client_secret { + value { + plain_text = "new-client-secret" + } + } + web_sso_config { + response_type = "ID_TOKEN" + assertion_claims_behavior = "ONLY_ID_TOKEN_CLAIMS" + } + } + display_name = "New Display name" + description = "A sample OIDC workforce pool provider with updated description." + disabled = true + attribute_condition = "false" +} +`, context) +} + +func testAccIAMWorkforcePoolWorkforcePoolProvider_oidc_update_clearClientSecret(context map[string]interface{}) string { + return Nprintf(` +resource "google_iam_workforce_pool" "my_pool" { + workforce_pool_id = "my-pool-%{random_suffix}" + parent = "organizations/%{org_id}" + location = "global" +} + resource "google_iam_workforce_pool_provider" "my_provider" { workforce_pool_id = google_iam_workforce_pool.my_pool.workforce_pool_id location = google_iam_workforce_pool.my_pool.location @@ -223,9 +275,14 @@ resource "google_iam_workforce_pool_provider" "my_provider" { oidc { issuer_uri = "https://accounts.thirdparty.com" client_id = "client-id" + client_secret { + value { + plain_text = "client-secret" + } + } web_sso_config { - response_type = "ID_TOKEN" - assertion_claims_behavior = "ONLY_ID_TOKEN_CLAIMS" + response_type = "CODE" + assertion_claims_behavior = "MERGE_USER_INFO_OVER_ID_TOKEN_CLAIMS" } } } From 32122b788d80255d0e55d8462decf5d321ec5c2f Mon Sep 17 00:00:00 2001 From: Scott Suarez Date: Thu, 6 Jul 2023 14:56:06 -0700 Subject: [PATCH 41/55] Pin Hugo version to 0.115.0 (#8253) --- .github/workflows/gh-pages.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml index f0d4728c2809..f313889879c6 100644 --- a/.github/workflows/gh-pages.yml +++ b/.github/workflows/gh-pages.yml @@ -18,7 +18,7 @@ jobs: - name: Setup Hugo uses: peaceiris/actions-hugo@16361eb4acea8698b220b76c0d4e84e1fd22c61d # v2.6.0 with: - hugo-version: 'latest' + hugo-version: '0.115.0' extended: true - name: Build From 5d72c6a91165e5e8f0274a5efe1fbf346494c12a Mon Sep 17 00:00:00 2001 From: Riley Karson Date: Thu, 6 Jul 2023 16:15:32 -0700 Subject: [PATCH 42/55] Add minor note on rbenv installs (#8284) --- docs/content/get-started/generate-providers.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/content/get-started/generate-providers.md b/docs/content/get-started/generate-providers.md index 1c2153afbda1..c1aea1bbf696 100644 --- a/docs/content/get-started/generate-providers.md +++ b/docs/content/get-started/generate-providers.md @@ -30,7 +30,7 @@ If you are familiar with Docker or Podman, you may want to use the experimental {{< /hint >}} 1. [Install git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) -1. [Install rbenv](https://github.com/rbenv/rbenv#installation) +1. [Install rbenv](https://github.com/rbenv/rbenv#installation), ensuring you follow **both** steps 1 and 2. 1. Use rbenv to install ruby 3.1.0 ```bash rbenv install 3.1.0 From 95f97fd5b436b8f0f3e154e89823d9a092afb752 Mon Sep 17 00:00:00 2001 From: "Stephen Lewis (Burrows)" Date: Fri, 7 Jul 2023 12:44:22 -0700 Subject: [PATCH 43/55] Marked google_compute_router_peer.peer_ip_address as default from api (#8256) --- mmv1/products/compute/RouterBgpPeer.yaml | 4 ++-- .../terraform/examples/router_peer_basic.tf.erb | 1 - .../tests/resource_compute_router_bgp_peer_test.go | 9 --------- 3 files changed, 2 insertions(+), 12 deletions(-) diff --git a/mmv1/products/compute/RouterBgpPeer.yaml b/mmv1/products/compute/RouterBgpPeer.yaml index cd292a7afddd..adce7a08a834 100644 --- a/mmv1/products/compute/RouterBgpPeer.yaml +++ b/mmv1/products/compute/RouterBgpPeer.yaml @@ -142,8 +142,8 @@ properties: name: 'peerIpAddress' description: | IP address of the BGP interface outside Google Cloud Platform. - Only IPv4 is supported. - required: true + Only IPv4 is supported. Required if `ip_address` is set. + default_from_api: true - !ruby/object:Api::Type::Integer name: 'peerAsn' description: | diff --git a/mmv1/templates/terraform/examples/router_peer_basic.tf.erb b/mmv1/templates/terraform/examples/router_peer_basic.tf.erb index b17f3331acbf..b63b6d195d60 100644 --- a/mmv1/templates/terraform/examples/router_peer_basic.tf.erb +++ b/mmv1/templates/terraform/examples/router_peer_basic.tf.erb @@ -2,7 +2,6 @@ resource "google_compute_router_peer" "<%= ctx[:primary_resource_id] %>" { name = "<%= ctx[:vars]['peer_name'] %>" router = "<%= ctx[:vars]['router_name'] %>" region = "us-central1" - peer_ip_address = "169.254.1.2" peer_asn = 65513 advertised_route_priority = 100 interface = "interface-1" diff --git a/mmv1/third_party/terraform/tests/resource_compute_router_bgp_peer_test.go b/mmv1/third_party/terraform/tests/resource_compute_router_bgp_peer_test.go index 41bd0e16efcf..de9e2eb70463 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_router_bgp_peer_test.go +++ b/mmv1/third_party/terraform/tests/resource_compute_router_bgp_peer_test.go @@ -480,7 +480,6 @@ resource "google_compute_router_interface" "foobar" { name = "%s" router = google_compute_router.foobar.name region = google_compute_router.foobar.region - ip_range = "169.254.3.1/30" vpn_tunnel = google_compute_vpn_tunnel.foobar.name } @@ -488,8 +487,6 @@ resource "google_compute_router_peer" "foobar" { name = "%s" router = google_compute_router.foobar.name region = google_compute_router.foobar.region - ip_address = "169.254.3.1" - peer_ip_address = "169.254.3.2" peer_asn = 65515 advertised_route_priority = 100 interface = google_compute_router_interface.foobar.name @@ -556,7 +553,6 @@ resource "google_compute_router_interface" "foobar" { name = "%s" router = google_compute_router.foobar.name region = google_compute_router.foobar.region - ip_range = "169.254.3.1/30" vpn_tunnel = google_compute_vpn_tunnel.foobar.name } `, routerName, routerName, routerName, routerName, routerName, routerName, routerName, routerName) @@ -886,7 +882,6 @@ resource "google_compute_router_interface" "foobar" { name = "%s" router = google_compute_router.foobar.name region = google_compute_router.foobar.region - ip_range = "169.254.3.1/30" vpn_tunnel = google_compute_vpn_tunnel.foobar.name } @@ -894,7 +889,6 @@ resource "google_compute_router_peer" "foobar" { name = "%s" router = google_compute_router.foobar.name region = google_compute_router.foobar.region - peer_ip_address = "169.254.3.2" peer_asn = 65515 advertised_route_priority = 100 interface = google_compute_router_interface.foobar.name @@ -962,7 +956,6 @@ resource "google_compute_router_interface" "foobar" { name = "%s" router = google_compute_router.foobar.name region = google_compute_router.foobar.region - ip_range = "169.254.3.1/30" vpn_tunnel = google_compute_vpn_tunnel.foobar.name } @@ -970,8 +963,6 @@ resource "google_compute_router_peer" "foobar" { name = "%s" router = google_compute_router.foobar.name region = google_compute_router.foobar.region - ip_address = "169.254.3.1" - peer_ip_address = "169.254.3.2" peer_asn = 65515 advertised_route_priority = 100 interface = google_compute_router_interface.foobar.name From b433f1d8bc018f11898a903fe62533f09beb1495 Mon Sep 17 00:00:00 2001 From: Thomas Rodgers Date: Fri, 7 Jul 2023 13:30:56 -0700 Subject: [PATCH 44/55] Add issue labeler tool (#8269) * Add issue labeler tool * Add test --- tools/issue-labeler/enrolled_teams.yaml | 112 ++++++++++++++++++++++++ tools/issue-labeler/go.mod | 10 +++ tools/issue-labeler/go.sum | 12 +++ tools/issue-labeler/labels.go | 30 +++++++ tools/issue-labeler/labels_test.go | 42 +++++++++ tools/issue-labeler/main.go | 23 +++++ 6 files changed, 229 insertions(+) create mode 100755 tools/issue-labeler/enrolled_teams.yaml create mode 100644 tools/issue-labeler/go.mod create mode 100644 tools/issue-labeler/go.sum create mode 100644 tools/issue-labeler/labels.go create mode 100644 tools/issue-labeler/labels_test.go create mode 100644 tools/issue-labeler/main.go diff --git a/tools/issue-labeler/enrolled_teams.yaml b/tools/issue-labeler/enrolled_teams.yaml new file mode 100755 index 000000000000..88bb6997b58a --- /dev/null +++ b/tools/issue-labeler/enrolled_teams.yaml @@ -0,0 +1,112 @@ +services/accesscontextmanager: +- google_access_context_manager_ +services/alloydb: +- google_alloydb_ +services/apigateway: +- google_api_gateway_ +services/apigee: +- google_apigee_ +services/artifactregistry: +- google_artifact_registry_ +services/beyondcorp: +- google_beyondcorp_ +services/bigquery: +- google_bigquery_ +services/bigtableadmin: +- google_bigtable_ +services/cloudbuild: +- google_cloudbuild_ +- google_cloudbuildv2_ +services/cloudfunctions: +- google_cloudfunctions_ +- google_cloudfunctions2_ +services/cloudkms: +- google_kms_ +services/cloudscheduler: +- google_cloud_scheduler_ +services/cloudtasks: +- google_cloud_tasks_ +services/composer: +- google_composer_ +services/compute-nat: +- google_compute_router_nat +services/dataproc: +- google_dataproc_cluster +- google_dataproc_autoscaling_policy +- google_dataproc_job +- google_dataproc_workflow_template +- google_dataproc_batch +services/dlp: +- google_data_loss_prevention_ +services/eventarc: +- google_eventarc_ +services/filestore: +- google_filestore_ +services/firebase: +- google_firebase_ +- google_firebaserules_ +services/firestore-controlplane: +- google_firestore_database +services/firestore-dataplane: +- google_firestore_document +- google_firestore_index +- google_firestore_ttl +services/gkebackup: +- google_gke_backup_ +services/gkehub: +- google_gke_hub_ +services/gkeonprem: +- google_gkeonprem_ +services/iam-core: +- google_organization_iam_custom_role +- google_project_iam_custom_role +- google_iam_deny_policy +- google_iam_policy +- google_iam_role +- google_iam_testable_permissions +services/iam-serviceaccount: +- google_service_account +services/iam-wlid: +- google_iam_access_boundary_policy +- google_iam_workload_identity_pool +- google_iam_workload_identity_pool_provider +services/iam-workforce: +- google_iam_workforce_pool +services/identitytoolkit: +- google_identity_platform_ +services/ids: +- google_cloud_ids_ +services/logging: +- google_logging_ +services/looker-core: +- google_looker_instance +services/monitoring-alerting: +- google_monitoring_notification_channel +- google_monitoring_alert_policy +services/monitoring-services: +- google_monitoring_custom_service +- google_monitoring_dashboard +- google_monitoring_monitored_project +- google_monitoring_service_ +- google_monitoring_slo +- google_monitoring_istio_canonical_service +services/orgpolicy: +- google_org_policy_ +services/privateca: +- google_privateca_ +services/run: +- google_cloud_run_ +- google_cloud_run_v2_ +services/secretmanager: +- google_secret_manager_ +services/spanner: +- google_spanner_ +services/sqladmin: +- google_sql_ +services/storage: +- google_storage_bucket_ +- google_storage_default_object_ +- google_storage_hmac_key +- google_storage_notification +- google_storage_object_ +- google_storage_project_service_account diff --git a/tools/issue-labeler/go.mod b/tools/issue-labeler/go.mod new file mode 100644 index 000000000000..4e8c39c87b0f --- /dev/null +++ b/tools/issue-labeler/go.mod @@ -0,0 +1,10 @@ +module github.com/trodge/magic-modules/issue-labeler/tools/issue-labeler + +go 1.19 + +require ( + github.com/golang/glog v1.1.1 + gopkg.in/yaml.v2 v2.4.0 +) + +require gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect diff --git a/tools/issue-labeler/go.sum b/tools/issue-labeler/go.sum new file mode 100644 index 000000000000..0a5a64b09c47 --- /dev/null +++ b/tools/issue-labeler/go.sum @@ -0,0 +1,12 @@ +github.com/golang/glog v1.1.1 h1:jxpi2eWoU84wbX9iIEyAeeoac3FLuifZpY9tcNUD9kw= +github.com/golang/glog v1.1.1/go.mod h1:zR+okUeTbrL6EL3xHUDxZuEtGv04p5shwip1+mL/rLQ= +github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI= +github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= diff --git a/tools/issue-labeler/labels.go b/tools/issue-labeler/labels.go new file mode 100644 index 000000000000..b15414c04494 --- /dev/null +++ b/tools/issue-labeler/labels.go @@ -0,0 +1,30 @@ +package main + +import ( + "regexp" + "sort" + "strings" + + "github.com/golang/glog" +) + +func labels(issueBody string, enrolledTeams map[string][]string) string { + sectionRegexp := regexp.MustCompile(`### (New or )?Affected Resource\(s\)[^#]+`) + affectedResources := sectionRegexp.FindString(issueBody) + var labels []string + for label, resources := range enrolledTeams { + for _, resource := range resources { + if strings.Contains(affectedResources, resource) { + glog.Infof("found resource %q, applying label %q", resource, label) + labels = append(labels, "\""+label+"\"") + break + } + } + } + + if len(labels) > 0 { + sort.Strings(labels) + return "[" + strings.Join(labels, ", ") + "]" + } + return "" +} diff --git a/tools/issue-labeler/labels_test.go b/tools/issue-labeler/labels_test.go new file mode 100644 index 000000000000..20481b1841c6 --- /dev/null +++ b/tools/issue-labeler/labels_test.go @@ -0,0 +1,42 @@ +package main + +import ( + "os" + "testing" + + "github.com/golang/glog" + "gopkg.in/yaml.v2" +) + +func TestLabels(t *testing.T) { + file, err := os.ReadFile("enrolled_teams.yaml") + if err != nil { + glog.Exitf("Error reading enrolled teams yaml: %v", err) + } + enrolledTeams := make(map[string][]string) + err = yaml.Unmarshal(file, &enrolledTeams) + if err != nil { + glog.Exitf("Error unmarshalling enrolled teams yaml: %v", err) + } + for _, tc := range []struct { + issueBody string + expectedLabels string + }{ + { + issueBody: `### New or Affected Resource(s): + google_gke_hub_feature + google_storage_hmac_key + #`, + expectedLabels: `["services/gkehub", "services/storage"]`, + }, + { + issueBody: `### New or Affected Resource(s): + #`, + expectedLabels: "", + }, + } { + if actualLabels := labels(tc.issueBody, enrolledTeams); actualLabels != tc.expectedLabels { + t.Errorf("unexpected labels for issue body %s: %s, expected %s", tc.issueBody, actualLabels, tc.expectedLabels) + } + } +} diff --git a/tools/issue-labeler/main.go b/tools/issue-labeler/main.go new file mode 100644 index 000000000000..3034c2bb33ae --- /dev/null +++ b/tools/issue-labeler/main.go @@ -0,0 +1,23 @@ +package main + +import ( + "fmt" + "os" + + "github.com/golang/glog" + "gopkg.in/yaml.v2" +) + +func main() { + issueBody := os.Getenv("ISSUE_BODY") + file, err := os.ReadFile("enrolled_teams.yaml") + if err != nil { + glog.Exitf("Error reading enrolled teams yaml: %v", err) + } + enrolledTeams := make(map[string][]string) + err = yaml.Unmarshal(file, &enrolledTeams) + if err != nil { + glog.Exitf("Error unmarshalling enrolled teams yaml: %v", err) + } + fmt.Println(labels(issueBody, enrolledTeams)) +} From 6349dc39a37ad99f09c26e68eee13799d715603a Mon Sep 17 00:00:00 2001 From: Ilia Lazebnik Date: Fri, 7 Jul 2023 23:54:25 +0300 Subject: [PATCH 45/55] Bigquery table - object table arg (#7128) * add args * docs and conflict * object table * add test for metadata_cache_mode * add field update * rebase * rebase --- .../bigquery/resource_bigquery_table.go | 27 +++- .../tests/resource_bigquery_table_test.go | 137 ++++++++++++++++++ .../docs/r/bigquery_table.html.markdown | 6 +- 3 files changed, 168 insertions(+), 2 deletions(-) diff --git a/mmv1/third_party/terraform/services/bigquery/resource_bigquery_table.go b/mmv1/third_party/terraform/services/bigquery/resource_bigquery_table.go index a91dc70c2ad1..e8cac881fc55 100644 --- a/mmv1/third_party/terraform/services/bigquery/resource_bigquery_table.go +++ b/mmv1/third_party/terraform/services/bigquery/resource_bigquery_table.go @@ -442,7 +442,7 @@ func ResourceBigQueryTable() *schema.Resource { // SourceFormat [Required] The data format. "source_format": { Type: schema.TypeString, - Required: true, + Optional: true, Description: ` Please see sourceFormat under ExternalDataConfiguration in Bigquery's public API documentation (https://cloud.google.com/bigquery/docs/reference/rest/v2/tables#externaldataconfiguration) for supported formats. To use "GOOGLE_SHEETS" the scopes must include "googleapis.com/auth/drive.readonly".`, ValidateFunc: validation.StringInSlice([]string{ "CSV", "GOOGLE_SHEETS", "NEWLINE_DELIMITED_JSON", "AVRO", "ICEBERG", "DATASTORE_BACKUP", "PARQUET", "ORC", "BIGTABLE", @@ -658,6 +658,18 @@ func ResourceBigQueryTable() *schema.Resource { Optional: true, Description: `When creating an external table, the user can provide a reference file with the table schema. This is enabled for the following formats: AVRO, PARQUET, ORC.`, }, + "metadata_cache_mode": { + Type: schema.TypeString, + Optional: true, + Description: `Metadata Cache Mode for the table. Set this to enable caching of metadata from external data source.`, + ValidateFunc: validation.StringInSlice([]string{"AUTOMATIC", "MANUAL"}, false), + }, + "object_metadata": { + Type: schema.TypeString, + Optional: true, + Description: `Object Metadata is used to create Object Tables. Object Tables contain a listing of objects (with their metadata) found at the sourceUris. If ObjectMetadata is set, sourceFormat should be omitted.`, + ConflictsWith: []string{"external_data_configuration.0.source_format"}, + }, }, }, }, @@ -1392,6 +1404,12 @@ func expandExternalDataConfiguration(cfg interface{}) (*bigquery.ExternalDataCon if v, ok := raw["reference_file_schema_uri"]; ok { edc.ReferenceFileSchemaUri = v.(string) } + if v, ok := raw["metadata_cache_mode"]; ok { + edc.MetadataCacheMode = v.(string) + } + if v, ok := raw["object_metadata"]; ok { + edc.ObjectMetadata = v.(string) + } return edc, nil @@ -1441,6 +1459,13 @@ func flattenExternalDataConfiguration(edc *bigquery.ExternalDataConfiguration) ( if edc.ReferenceFileSchemaUri != "" { result["reference_file_schema_uri"] = edc.ReferenceFileSchemaUri } + if edc.MetadataCacheMode != "" { + result["metadata_cache_mode"] = edc.MetadataCacheMode + } + + if edc.ObjectMetadata != "" { + result["object_metadata"] = edc.ObjectMetadata + } return []map[string]interface{}{result}, nil } diff --git a/mmv1/third_party/terraform/tests/resource_bigquery_table_test.go b/mmv1/third_party/terraform/tests/resource_bigquery_table_test.go index 798e8cc253c6..64dce7c324fb 100644 --- a/mmv1/third_party/terraform/tests/resource_bigquery_table_test.go +++ b/mmv1/third_party/terraform/tests/resource_bigquery_table_test.go @@ -480,6 +480,34 @@ func TestAccBigQueryExternalDataTable_parquet(t *testing.T) { }) } +func TestAccBigQueryExternalDataTable_objectTable(t *testing.T) { + t.Parallel() + + bucketName := testBucketName(t) + objectName := fmt.Sprintf("tf_test_%s.csv", RandString(t, 10)) + + datasetID := fmt.Sprintf("tf_test_%s", RandString(t, 10)) + tableID := fmt.Sprintf("tf_test_%s", RandString(t, 10)) + connectionID := fmt.Sprintf("tf_test_%s", RandString(t, 10)) + + VcrTest(t, resource.TestCase{ + PreCheck: func() { acctest.AccTestPreCheck(t) }, + ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + CheckDestroy: testAccCheckBigQueryTableDestroyProducer(t), + Steps: []resource.TestStep{ + { + Config: testAccBigQueryTableFromGCSObjectTable(connectionID, datasetID, tableID, bucketName, objectName), + }, + { + Config: testAccBigQueryTableFromGCSObjectTableMetadata(connectionID, datasetID, tableID, bucketName, objectName), + }, + { + Config: testAccBigQueryTableFromGCSObjectTable(connectionID, datasetID, tableID, bucketName, objectName), + }, + }, + }) +} + func TestAccBigQueryExternalDataTable_CSV(t *testing.T) { t.Parallel() @@ -1553,6 +1581,115 @@ resource "google_bigquery_table" "test" { `, datasetID, bucketName, objectName, tableID) } +func testAccBigQueryTableFromGCSObjectTable(connectionID, datasetID, tableID, bucketName, objectName string) string { + return fmt.Sprintf(` +resource "google_bigquery_connection" "test" { + connection_id = "%s" + location = "US" + cloud_resource {} +} + +locals { + connection_id_split = split("/", google_bigquery_connection.test.name) + connection_id_reformatted = "${local.connection_id_split[1]}.${local.connection_id_split[3]}.${local.connection_id_split[5]}" +} + +data "google_project" "project" {} + +resource "google_project_iam_member" "test" { + role = "roles/storage.objectViewer" + project = data.google_project.project.id + member = "serviceAccount:${google_bigquery_connection.test.cloud_resource[0].service_account_id}" +} + +resource "google_bigquery_dataset" "test" { + dataset_id = "%s" +} + +resource "google_storage_bucket" "test" { + name = "%s" + location = "US" + force_destroy = true +} + +resource "google_storage_bucket_object" "test" { + name = "%s" + source = "./test-fixtures/bigquerytable/test.parquet.gzip" + bucket = google_storage_bucket.test.name +} + +resource "google_bigquery_table" "test" { + deletion_protection = false + table_id = "%s" + dataset_id = google_bigquery_dataset.test.dataset_id + external_data_configuration { + connection_id = local.connection_id_reformatted + autodetect = false + object_metadata = "SIMPLE" + + source_uris = [ + "gs://${google_storage_bucket.test.name}/*", + ] + } +} +`, connectionID, datasetID, bucketName, objectName, tableID) +} + +func testAccBigQueryTableFromGCSObjectTableMetadata(connectionID, datasetID, tableID, bucketName, objectName string) string { + return fmt.Sprintf(` +resource "google_bigquery_connection" "test" { + connection_id = "%s" + location = "US" + cloud_resource {} +} + +locals { + connection_id_split = split("/", google_bigquery_connection.test.name) + connection_id_reformatted = "${local.connection_id_split[1]}.${local.connection_id_split[3]}.${local.connection_id_split[5]}" +} + +data "google_project" "project" {} + +resource "google_project_iam_member" "test" { + role = "roles/storage.objectViewer" + project = data.google_project.project.id + member = "serviceAccount:${google_bigquery_connection.test.cloud_resource[0].service_account_id}" +} + +resource "google_bigquery_dataset" "test" { + dataset_id = "%s" +} + +resource "google_storage_bucket" "test" { + name = "%s" + location = "US" + force_destroy = true +} + +resource "google_storage_bucket_object" "test" { + name = "%s" + source = "./test-fixtures/bigquerytable/test.parquet.gzip" + bucket = google_storage_bucket.test.name +} + +resource "google_bigquery_table" "test" { + deletion_protection = false + table_id = "%s" + dataset_id = google_bigquery_dataset.test.dataset_id + external_data_configuration { + connection_id = local.connection_id_reformatted + autodetect = false + object_metadata = "SIMPLE" + metadata_cache_mode = "MANUAL" + + source_uris = [ + "gs://${google_storage_bucket.test.name}/*", + ] + } +} +`, connectionID, datasetID, bucketName, objectName, tableID) +} + func testAccBigQueryTableFromGCSWithSchemaWithConnectionId(datasetID, tableID, connectionID, projectID, bucketName, objectName, content, schema string) string { return fmt.Sprintf(` resource "google_bigquery_dataset" "test" { diff --git a/mmv1/third_party/terraform/website/docs/r/bigquery_table.html.markdown b/mmv1/third_party/terraform/website/docs/r/bigquery_table.html.markdown index e0f551b0f46a..557680aab8d9 100644 --- a/mmv1/third_party/terraform/website/docs/r/bigquery_table.html.markdown +++ b/mmv1/third_party/terraform/website/docs/r/bigquery_table.html.markdown @@ -195,7 +195,7 @@ in Terraform state, a `terraform destroy` or `terraform apply` that would delete datasource, after creation the computed schema will be stored in `google_bigquery_table.schema` -* `source_format` (Required) - The data format. Please see sourceFormat under +* `source_format` (Optional) - The data format. Please see sourceFormat under [ExternalDataConfiguration](https://cloud.google.com/bigquery/docs/reference/rest/v2/tables#externaldataconfiguration) in Bigquery's public API documentation for supported formats. To use "GOOGLE_SHEETS" the `scopes` must include "https://www.googleapis.com/auth/drive.readonly". @@ -205,6 +205,10 @@ in Terraform state, a `terraform destroy` or `terraform apply` that would delete * `reference_file_schema_uri` - (Optional) When creating an external table, the user can provide a reference file with the table schema. This is enabled for the following formats: AVRO, PARQUET, ORC. +* `metadata_cache_mode` - (Optional) Metadata Cache Mode for the table. Set this to enable caching of metadata from external data source. Valid values are `AUTOMATIC` and `MANUAL`. + +* `object_metadata` - (Optional) Object Metadata is used to create Object Tables. Object Tables contain a listing of objects (with their metadata) found at the sourceUris. If `object_metadata` is set, `source_format` should be omitted. + The `csv_options` block supports: * `quote` (Required) - The value that is used to quote data sections in a From 222ff03472eec9c9fe2cc514a7003d39eaf4cd8e Mon Sep 17 00:00:00 2001 From: vicpadilla <84111680+vicpadilla@users.noreply.github.com> Date: Fri, 7 Jul 2023 18:43:46 -0400 Subject: [PATCH 46/55] Promote cloudbuildv2_connection and cloudbuildv2_repository to GA (#8278) * Promote google_cloudbuildv2_connection and google_cloudbuildv2_repository to GA * remove beta entry from cloudbuild and cloudbuildv2 product.yaml --- mmv1/products/cloudbuild/Trigger.yaml | 5 ----- mmv1/products/cloudbuild/product.yaml | 3 --- mmv1/products/cloudbuildv2/Connection.yaml | 3 --- mmv1/products/cloudbuildv2/product.yaml | 2 +- .../cloudbuild_trigger_pubsub_with_repo.tf.erb | 4 ---- .../examples/cloudbuild_trigger_repo.tf.erb | 3 --- .../examples/cloudbuildv2_connection.tf.erb | 1 - .../samples/ghe_complete_connection.yaml | 2 +- .../cloudbuildv2/samples/ghe_connection.yaml | 2 +- .../samples/ghe_priv_connection.yaml | 2 +- .../samples/ghe_priv_update_connection.yaml | 2 +- .../cloudbuildv2/samples/ghe_repository.yaml | 2 +- .../samples/github_connection.yaml | 2 +- .../samples/github_repository.yaml | 2 +- .../samples/gitlab_connection.yaml | 2 +- .../samples/gitlab_repository.yaml | 2 +- .../cloudbuildv2/samples/gle_connection.yaml | 2 +- .../samples/gle_old_connection.yaml | 2 +- .../samples/gle_priv_connection.yaml | 2 +- .../samples/gle_priv_update_connection.yaml | 2 +- .../cloudbuildv2/samples/gle_repository.yaml | 2 +- .../overrides/cloudbuildv2/connection.yaml | 0 .../overrides/cloudbuildv2/repository.yaml | 18 ++++++++++++++++++ .../samples/connection/ghe.tf.tmpl | 8 -------- .../samples/connection/github.tf.tmpl | 5 ----- .../samples/repository/ghe.tf.tmpl | 9 --------- .../samples/repository/github.tf.tmpl | 6 ------ .../cloudbuildv2/tpgtools_product.yaml | 9 +++++++++ 28 files changed, 42 insertions(+), 62 deletions(-) create mode 100644 tpgtools/overrides/cloudbuildv2/connection.yaml create mode 100644 tpgtools/overrides/cloudbuildv2/repository.yaml create mode 100644 tpgtools/overrides/cloudbuildv2/tpgtools_product.yaml diff --git a/mmv1/products/cloudbuild/Trigger.yaml b/mmv1/products/cloudbuild/Trigger.yaml index 5c4e533f7876..4ca2f4ed6b9c 100644 --- a/mmv1/products/cloudbuild/Trigger.yaml +++ b/mmv1/products/cloudbuild/Trigger.yaml @@ -64,7 +64,6 @@ examples: skip_test: true - !ruby/object:Provider::Terraform::Examples name: 'cloudbuild_trigger_repo' - min_version: beta primary_resource_id: 'repo-trigger' vars: installation_id: '123123' @@ -92,7 +91,6 @@ examples: primary_resource_id: 'allow-exit-codes-trigger' - !ruby/object:Provider::Terraform::Examples name: "cloudbuild_trigger_pubsub_with_repo" - min_version: beta primary_resource_id: "pubsub-with-repo-trigger" vars: installation_id: "123123" @@ -209,7 +207,6 @@ properties: invocation originated is assumed to be the repo from which to read the specified path. - !ruby/object:Api::Type::String name: 'repository' - min_version: beta description: | The fully qualified resource name of the Repo API repository. The fully qualified resource name of the Repo API repository. If unspecified, the repo from which the trigger invocation originated is assumed to be the repo from which to read the specified path. @@ -237,7 +234,6 @@ properties: Format: projects/{project}/locations/{location}/githubEnterpriseConfigs/{id}. projects/{project}/githubEnterpriseConfigs/{id}. - !ruby/object:Api::Type::NestedObject name: 'repositoryEventConfig' - min_version: beta description: | The configuration of a trigger that creates a build whenever an event from Repo API is received. at_least_one_of: @@ -338,7 +334,6 @@ properties: The URI of the repo. - !ruby/object:Api::Type::String name: 'repository' - min_version: beta description: | The qualified resource name of the Repo API repository. Either uri or repository can be specified and is required. diff --git a/mmv1/products/cloudbuild/product.yaml b/mmv1/products/cloudbuild/product.yaml index 9a0d41e5a65b..b7d86da1f056 100644 --- a/mmv1/products/cloudbuild/product.yaml +++ b/mmv1/products/cloudbuild/product.yaml @@ -19,9 +19,6 @@ versions: - !ruby/object:Api::Product::Version name: ga base_url: https://cloudbuild.googleapis.com/v1/ - - !ruby/object:Api::Product::Version - name: beta - base_url: https://cloudbuild.googleapis.com/v1/ scopes: - https://www.googleapis.com/auth/cloud-platform apis_required: diff --git a/mmv1/products/cloudbuildv2/Connection.yaml b/mmv1/products/cloudbuildv2/Connection.yaml index c4937e86e07a..c7196a9ae98e 100644 --- a/mmv1/products/cloudbuildv2/Connection.yaml +++ b/mmv1/products/cloudbuildv2/Connection.yaml @@ -15,14 +15,12 @@ name: 'Connection' base_url: projects/{{project}}/locations/{{location}}/connections self_link: projects/{{project}}/locations/{{location}}/connections/{{name}} -min_version: beta exclude_resource: true description: | Only used to generate IAM resources. exclude_validator: true iam_policy: !ruby/object:Api::Resource::IamPolicy skip_import_test: true - min_version: beta method_name_separator: ':' fetch_iam_policy_verb: :GET allowed_iam_role: 'roles/cloudbuild.connectionViewer' @@ -36,7 +34,6 @@ import_format: examples: - !ruby/object:Provider::Terraform::Examples name: 'cloudbuildv2_connection' - min_version: beta primary_resource_id: 'my-connection' primary_resource_name: "fmt.Sprintf(\"tf-test-connection%s\", context[\"random_suffix\"\ diff --git a/mmv1/products/cloudbuildv2/product.yaml b/mmv1/products/cloudbuildv2/product.yaml index 918ca57de200..863190a0f4b7 100644 --- a/mmv1/products/cloudbuildv2/product.yaml +++ b/mmv1/products/cloudbuildv2/product.yaml @@ -16,7 +16,7 @@ name: Cloudbuildv2 display_name: Cloud Build v2 versions: - !ruby/object:Api::Product::Version - name: beta + name: ga base_url: https://cloudbuild.googleapis.com/v2/ scopes: - https://www.googleapis.com/auth/cloud-platform diff --git a/mmv1/templates/terraform/examples/cloudbuild_trigger_pubsub_with_repo.tf.erb b/mmv1/templates/terraform/examples/cloudbuild_trigger_pubsub_with_repo.tf.erb index b97450090aff..23bc2500e22f 100644 --- a/mmv1/templates/terraform/examples/cloudbuild_trigger_pubsub_with_repo.tf.erb +++ b/mmv1/templates/terraform/examples/cloudbuild_trigger_pubsub_with_repo.tf.erb @@ -1,5 +1,4 @@ resource "google_cloudbuildv2_connection" "my-connection" { - provider = google-beta location = "us-central1" name = "my-connection" @@ -12,19 +11,16 @@ resource "google_cloudbuildv2_connection" "my-connection" { } resource "google_cloudbuildv2_repository" "my-repository" { - provider = google-beta name = "my-repo" parent_connection = google_cloudbuildv2_connection.my-connection.id remote_uri = "<%= ctx[:vars]['repo_uri'] %>" } resource "google_pubsub_topic" "mytopic" { - provider = google-beta name = "mytopic" } resource "google_cloudbuild_trigger" "<%= ctx[:primary_resource_id] %>" { - provider = google-beta name = "pubsub-with-repo-trigger" location = "us-central1" diff --git a/mmv1/templates/terraform/examples/cloudbuild_trigger_repo.tf.erb b/mmv1/templates/terraform/examples/cloudbuild_trigger_repo.tf.erb index e2a2a1396a42..bea577a37ccc 100644 --- a/mmv1/templates/terraform/examples/cloudbuild_trigger_repo.tf.erb +++ b/mmv1/templates/terraform/examples/cloudbuild_trigger_repo.tf.erb @@ -1,5 +1,4 @@ resource "google_cloudbuildv2_connection" "my-connection" { - provider = google-beta location = "us-central1" name = "my-connection" @@ -12,14 +11,12 @@ resource "google_cloudbuildv2_connection" "my-connection" { } resource "google_cloudbuildv2_repository" "my-repository" { - provider = google-beta name = "my-repo" parent_connection = google_cloudbuildv2_connection.my-connection.id remote_uri = "<%= ctx[:vars]['repo_uri'] %>" } resource "google_cloudbuild_trigger" "<%= ctx[:primary_resource_id] %>" { - provider = google-beta location = "us-central1" repository_event_config { diff --git a/mmv1/templates/terraform/examples/cloudbuildv2_connection.tf.erb b/mmv1/templates/terraform/examples/cloudbuildv2_connection.tf.erb index 601fdaa3d70b..041bbf4587e2 100644 --- a/mmv1/templates/terraform/examples/cloudbuildv2_connection.tf.erb +++ b/mmv1/templates/terraform/examples/cloudbuildv2_connection.tf.erb @@ -1,5 +1,4 @@ resource "google_cloudbuildv2_connection" "<%= ctx[:primary_resource_id] %>" { - provider = google-beta location = "us-central1" name = "<%= ctx[:vars]['connection_name'] %>" diff --git a/tpgtools/api/cloudbuildv2/samples/ghe_complete_connection.yaml b/tpgtools/api/cloudbuildv2/samples/ghe_complete_connection.yaml index 00c64c708a45..aa8975d661d7 100755 --- a/tpgtools/api/cloudbuildv2/samples/ghe_complete_connection.yaml +++ b/tpgtools/api/cloudbuildv2/samples/ghe_complete_connection.yaml @@ -15,7 +15,7 @@ name: ghe_complete_connection description: Creates a GitHub Enterprise connection. type: connection versions: -- beta +- ga resource: samples/ghe_complete.connection.json variables: - name: connection diff --git a/tpgtools/api/cloudbuildv2/samples/ghe_connection.yaml b/tpgtools/api/cloudbuildv2/samples/ghe_connection.yaml index 437c30c77a9b..87f8316550a8 100755 --- a/tpgtools/api/cloudbuildv2/samples/ghe_connection.yaml +++ b/tpgtools/api/cloudbuildv2/samples/ghe_connection.yaml @@ -15,7 +15,7 @@ name: ghe_connection description: Creates and updates a GitHub Enterprise connection. type: connection versions: -- beta +- ga resource: samples/ghe_initial.connection.json updates: - resource: samples/ghe_complete.connection.json diff --git a/tpgtools/api/cloudbuildv2/samples/ghe_priv_connection.yaml b/tpgtools/api/cloudbuildv2/samples/ghe_priv_connection.yaml index a8af9551288a..73025a7cf763 100755 --- a/tpgtools/api/cloudbuildv2/samples/ghe_priv_connection.yaml +++ b/tpgtools/api/cloudbuildv2/samples/ghe_priv_connection.yaml @@ -15,7 +15,7 @@ name: ghe_priv_connection description: Creates a connection to a private server using Service Directory. type: connection versions: -- beta +- ga resource: samples/ghe_priv.connection.json variables: - name: connection diff --git a/tpgtools/api/cloudbuildv2/samples/ghe_priv_update_connection.yaml b/tpgtools/api/cloudbuildv2/samples/ghe_priv_update_connection.yaml index ffbbb7aa9a11..5e12dbf3d70e 100755 --- a/tpgtools/api/cloudbuildv2/samples/ghe_priv_update_connection.yaml +++ b/tpgtools/api/cloudbuildv2/samples/ghe_priv_update_connection.yaml @@ -15,7 +15,7 @@ name: ghe_priv_update_connection description: Creates and updates a connection to a private server using Service Directory. type: connection versions: -- beta +- ga resource: samples/ghe_initial.connection.json updates: - resource: samples/ghe_priv.connection.json diff --git a/tpgtools/api/cloudbuildv2/samples/ghe_repository.yaml b/tpgtools/api/cloudbuildv2/samples/ghe_repository.yaml index 0785ed6f383f..0e457ebaa459 100755 --- a/tpgtools/api/cloudbuildv2/samples/ghe_repository.yaml +++ b/tpgtools/api/cloudbuildv2/samples/ghe_repository.yaml @@ -15,7 +15,7 @@ name: ghe_repository description: Creates a GitHub repository. type: repository versions: -- beta +- ga resource: samples/ghe.repository.json dependencies: - samples/ghe_complete.connection.json diff --git a/tpgtools/api/cloudbuildv2/samples/github_connection.yaml b/tpgtools/api/cloudbuildv2/samples/github_connection.yaml index 3e78df4eed30..f96c3d242533 100755 --- a/tpgtools/api/cloudbuildv2/samples/github_connection.yaml +++ b/tpgtools/api/cloudbuildv2/samples/github_connection.yaml @@ -15,7 +15,7 @@ name: github_connection description: Creates and updates a GitHub connection. type: connection versions: -- beta +- ga resource: samples/github_initial.connection.json updates: - resource: samples/github_update.connection.json diff --git a/tpgtools/api/cloudbuildv2/samples/github_repository.yaml b/tpgtools/api/cloudbuildv2/samples/github_repository.yaml index 8e5f5f998670..416dc48815f9 100755 --- a/tpgtools/api/cloudbuildv2/samples/github_repository.yaml +++ b/tpgtools/api/cloudbuildv2/samples/github_repository.yaml @@ -15,7 +15,7 @@ name: github_repository description: Creates a GitHub repository. type: repository versions: -- beta +- ga resource: samples/github.repository.json dependencies: - samples/github_update.connection.json diff --git a/tpgtools/api/cloudbuildv2/samples/gitlab_connection.yaml b/tpgtools/api/cloudbuildv2/samples/gitlab_connection.yaml index c8166cc58374..af304f627f0f 100755 --- a/tpgtools/api/cloudbuildv2/samples/gitlab_connection.yaml +++ b/tpgtools/api/cloudbuildv2/samples/gitlab_connection.yaml @@ -15,7 +15,7 @@ name: gitlab_connection description: Creates a gitlab.com connection. type: connection versions: -- beta +- ga resource: samples/gitlab.connection.json variables: - name: connection diff --git a/tpgtools/api/cloudbuildv2/samples/gitlab_repository.yaml b/tpgtools/api/cloudbuildv2/samples/gitlab_repository.yaml index 26a3a0186cbe..8c6ec92cff67 100755 --- a/tpgtools/api/cloudbuildv2/samples/gitlab_repository.yaml +++ b/tpgtools/api/cloudbuildv2/samples/gitlab_repository.yaml @@ -15,7 +15,7 @@ name: gitlab_repository description: Creates a gitlab repository. type: repository versions: -- beta +- ga resource: samples/gitlab.repository.json dependencies: - samples/gitlab.connection.json diff --git a/tpgtools/api/cloudbuildv2/samples/gle_connection.yaml b/tpgtools/api/cloudbuildv2/samples/gle_connection.yaml index 0d45649824db..08c141636bb1 100755 --- a/tpgtools/api/cloudbuildv2/samples/gle_connection.yaml +++ b/tpgtools/api/cloudbuildv2/samples/gle_connection.yaml @@ -15,7 +15,7 @@ name: gle_connection description: Creates a GLE connection then update to an older version. type: connection versions: -- beta +- ga resource: samples/gle.connection.json updates: - resource: samples/gle_old.connection.json diff --git a/tpgtools/api/cloudbuildv2/samples/gle_old_connection.yaml b/tpgtools/api/cloudbuildv2/samples/gle_old_connection.yaml index 6740f3309535..ba81509db2c7 100755 --- a/tpgtools/api/cloudbuildv2/samples/gle_old_connection.yaml +++ b/tpgtools/api/cloudbuildv2/samples/gle_old_connection.yaml @@ -15,7 +15,7 @@ name: gle_old_connection description: Creates a GLE connection on an old version then update to a newer version. type: connection versions: -- beta +- ga resource: samples/gle_old.connection.json updates: - resource: samples/gle.connection.json diff --git a/tpgtools/api/cloudbuildv2/samples/gle_priv_connection.yaml b/tpgtools/api/cloudbuildv2/samples/gle_priv_connection.yaml index 32e4621b4d6c..9a416479ae7b 100755 --- a/tpgtools/api/cloudbuildv2/samples/gle_priv_connection.yaml +++ b/tpgtools/api/cloudbuildv2/samples/gle_priv_connection.yaml @@ -15,7 +15,7 @@ name: gle_priv_connection description: Creates a connection to a private server using Service Directory. type: connection versions: -- beta +- ga resource: samples/gle_priv.connection.json variables: - name: connection diff --git a/tpgtools/api/cloudbuildv2/samples/gle_priv_update_connection.yaml b/tpgtools/api/cloudbuildv2/samples/gle_priv_update_connection.yaml index 4e3cb5fe727d..d38c63343248 100755 --- a/tpgtools/api/cloudbuildv2/samples/gle_priv_update_connection.yaml +++ b/tpgtools/api/cloudbuildv2/samples/gle_priv_update_connection.yaml @@ -15,7 +15,7 @@ name: gle_priv_update_connection description: Creates and updates a connection to a private server using Service Directory. type: connection versions: -- beta +- ga resource: samples/gle.connection.json updates: - resource: samples/gle_priv.connection.json diff --git a/tpgtools/api/cloudbuildv2/samples/gle_repository.yaml b/tpgtools/api/cloudbuildv2/samples/gle_repository.yaml index a3b581e2a3d5..11997f3a30e2 100755 --- a/tpgtools/api/cloudbuildv2/samples/gle_repository.yaml +++ b/tpgtools/api/cloudbuildv2/samples/gle_repository.yaml @@ -15,7 +15,7 @@ name: gle_repository description: Creates a GLE repository. type: repository versions: -- beta +- ga resource: samples/gle.repository.json dependencies: - samples/gle.connection.json diff --git a/tpgtools/overrides/cloudbuildv2/connection.yaml b/tpgtools/overrides/cloudbuildv2/connection.yaml new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tpgtools/overrides/cloudbuildv2/repository.yaml b/tpgtools/overrides/cloudbuildv2/repository.yaml new file mode 100644 index 000000000000..01ea7c579c97 --- /dev/null +++ b/tpgtools/overrides/cloudbuildv2/repository.yaml @@ -0,0 +1,18 @@ +- type: CUSTOM_NAME + # Rename to parent_connection as connection is a reserved word in terraform. + field: connection + details: + name: parent_connection +# TODO: remove once DCL is updpated to not have these fields required. +- type: CUSTOM_SCHEMA_VALUES + field: project + details: + required: false + optional: true + computed: true +- type: CUSTOM_SCHEMA_VALUES + field: location + details: + required: false + optional: true + computed: true diff --git a/tpgtools/overrides/cloudbuildv2/samples/connection/ghe.tf.tmpl b/tpgtools/overrides/cloudbuildv2/samples/connection/ghe.tf.tmpl index a95002cc17d1..2aece6005734 100644 --- a/tpgtools/overrides/cloudbuildv2/samples/connection/ghe.tf.tmpl +++ b/tpgtools/overrides/cloudbuildv2/samples/connection/ghe.tf.tmpl @@ -1,5 +1,4 @@ resource "google_secret_manager_secret" "private-key-secret" { - provider = google-beta secret_id = "ghe-pk-secret" replication { @@ -8,13 +7,11 @@ resource "google_secret_manager_secret" "private-key-secret" { } resource "google_secret_manager_secret_version" "private-key-secret-version" { - provider = google-beta secret = google_secret_manager_secret.private-key-secret.id secret_data = file("private-key.pem") } resource "google_secret_manager_secret" "webhook-secret-secret" { - provider = google-beta secret_id = "github-token-secret" replication { @@ -23,13 +20,11 @@ resource "google_secret_manager_secret" "webhook-secret-secret" { } resource "google_secret_manager_secret_version" "webhook-secret-secret-version" { - provider = google-beta secret = google_secret_manager_secret.webhook-secret-secret.id secret_data = "" } data "google_iam_policy" "p4sa-secretAccessor" { - provider = google-beta binding { role = "roles/secretmanager.secretAccessor" // Here, 123456789 is the Google Cloud project number for the project that contains the connection. @@ -38,19 +33,16 @@ data "google_iam_policy" "p4sa-secretAccessor" { } resource "google_secret_manager_secret_iam_policy" "policy-pk" { - provider = google-beta secret_id = google_secret_manager_secret.private-key-secret.secret_id policy_data = data.google_iam_policy.p4sa-secretAccessor.policy_data } resource "google_secret_manager_secret_iam_policy" "policy-whs" { - provider = google-beta secret_id = google_secret_manager_secret.webhook-secret-secret.secret_id policy_data = data.google_iam_policy.p4sa-secretAccessor.policy_data } resource "google_cloudbuildv2_connection" "my-connection" { - provider = google-beta location = "us-central1" name = "my-terraform-ghe-connection" diff --git a/tpgtools/overrides/cloudbuildv2/samples/connection/github.tf.tmpl b/tpgtools/overrides/cloudbuildv2/samples/connection/github.tf.tmpl index 240ea8bc054d..f25048ef1443 100644 --- a/tpgtools/overrides/cloudbuildv2/samples/connection/github.tf.tmpl +++ b/tpgtools/overrides/cloudbuildv2/samples/connection/github.tf.tmpl @@ -1,5 +1,4 @@ resource "google_secret_manager_secret" "github-token-secret" { - provider = google-beta secret_id = "github-token-secret" replication { @@ -8,13 +7,11 @@ resource "google_secret_manager_secret" "github-token-secret" { } resource "google_secret_manager_secret_version" "github-token-secret-version" { - provider = google-beta secret = google_secret_manager_secret.github-token-secret.id secret_data = file("my-github-token.txt") } data "google_iam_policy" "p4sa-secretAccessor" { - provider = google-beta binding { role = "roles/secretmanager.secretAccessor" // Here, {{projectNum}} is the Google Cloud project number for {{project}}. @@ -23,13 +20,11 @@ data "google_iam_policy" "p4sa-secretAccessor" { } resource "google_secret_manager_secret_iam_policy" "policy" { - provider = google-beta secret_id = google_secret_manager_secret.github-token-secret.secret_id policy_data = data.google_iam_policy.p4sa-secretAccessor.policy_data } resource "google_cloudbuildv2_connection" "my-connection" { - provider = google-beta location = "{{region}}" name = "my-connection" diff --git a/tpgtools/overrides/cloudbuildv2/samples/repository/ghe.tf.tmpl b/tpgtools/overrides/cloudbuildv2/samples/repository/ghe.tf.tmpl index 1a0143511e9b..3f6ec4778b26 100644 --- a/tpgtools/overrides/cloudbuildv2/samples/repository/ghe.tf.tmpl +++ b/tpgtools/overrides/cloudbuildv2/samples/repository/ghe.tf.tmpl @@ -1,5 +1,4 @@ resource "google_secret_manager_secret" "private-key-secret" { - provider = google-beta secret_id = "ghe-pk-secret" replication { @@ -8,13 +7,11 @@ resource "google_secret_manager_secret" "private-key-secret" { } resource "google_secret_manager_secret_version" "private-key-secret-version" { - provider = google-beta secret = google_secret_manager_secret.private-key-secret.id secret_data = file("private-key.pem") } resource "google_secret_manager_secret" "webhook-secret-secret" { - provider = google-beta secret_id = "github-token-secret" replication { @@ -23,13 +20,11 @@ resource "google_secret_manager_secret" "webhook-secret-secret" { } resource "google_secret_manager_secret_version" "webhook-secret-secret-version" { - provider = google-beta secret = google_secret_manager_secret.webhook-secret-secret.id secret_data = "" } data "google_iam_policy" "p4sa-secretAccessor" { - provider = google-beta binding { role = "roles/secretmanager.secretAccessor" // Here, 123456789 is the Google Cloud project number for the project that contains the connection. @@ -38,19 +33,16 @@ data "google_iam_policy" "p4sa-secretAccessor" { } resource "google_secret_manager_secret_iam_policy" "policy-pk" { - provider = google-beta secret_id = google_secret_manager_secret.private-key-secret.secret_id policy_data = data.google_iam_policy.p4sa-secretAccessor.policy_data } resource "google_secret_manager_secret_iam_policy" "policy-whs" { - provider = google-beta secret_id = google_secret_manager_secret.webhook-secret-secret.secret_id policy_data = data.google_iam_policy.p4sa-secretAccessor.policy_data } resource "google_cloudbuildv2_connection" "my-connection" { - provider = google-beta location = "us-central1" name = "my-terraform-ghe-connection" @@ -70,7 +62,6 @@ resource "google_cloudbuildv2_connection" "my-connection" { } resource "google_cloudbuildv2_repository" "my-repository" { - provider = google-beta name = "my-terraform-ghe-repo" location = "us-central1" parent_connection = google_cloudbuildv2_connection.my-connection.id diff --git a/tpgtools/overrides/cloudbuildv2/samples/repository/github.tf.tmpl b/tpgtools/overrides/cloudbuildv2/samples/repository/github.tf.tmpl index 06a29ecfc84e..3058a12649d1 100644 --- a/tpgtools/overrides/cloudbuildv2/samples/repository/github.tf.tmpl +++ b/tpgtools/overrides/cloudbuildv2/samples/repository/github.tf.tmpl @@ -1,5 +1,4 @@ resource "google_secret_manager_secret" "github-token-secret" { - provider = google-beta secret_id = "github-token-secret" replication { @@ -8,13 +7,11 @@ resource "google_secret_manager_secret" "github-token-secret" { } resource "google_secret_manager_secret_version" "github-token-secret-version" { - provider = google-beta secret = google_secret_manager_secret.github-token-secret.id secret_data = file("my-github-token.txt") } data "google_iam_policy" "p4sa-secretAccessor" { - provider = google-beta binding { role = "roles/secretmanager.secretAccessor" // Here, {{projectNum}} is the Google Cloud project number for {{project}}. @@ -23,13 +20,11 @@ data "google_iam_policy" "p4sa-secretAccessor" { } resource "google_secret_manager_secret_iam_policy" "policy" { - provider = google-beta secret_id = google_secret_manager_secret.github-token-secret.secret_id policy_data = data.google_iam_policy.p4sa-secretAccessor.policy_data } resource "google_cloudbuildv2_connection" "my-connection" { - provider = google-beta location = "{{region}}" name = "my-connection" @@ -42,7 +37,6 @@ resource "google_cloudbuildv2_connection" "my-connection" { } resource "google_cloudbuildv2_repository" "my-repository" { - provider = google-beta location = "{{region}}" name = "my-repo" parent_connection = google_cloudbuildv2_connection.my-connection.name diff --git a/tpgtools/overrides/cloudbuildv2/tpgtools_product.yaml b/tpgtools/overrides/cloudbuildv2/tpgtools_product.yaml new file mode 100644 index 000000000000..dd8f9eabb9de --- /dev/null +++ b/tpgtools/overrides/cloudbuildv2/tpgtools_product.yaml @@ -0,0 +1,9 @@ +## product level overrides + +- type: PRODUCT_DOCS_SECTION + details: + docssection: Cloud Build v2 + +- type: PRODUCT_BASE_PATH + details: + skip: true From 469d18c69be936184c6e3bcee7900b0f83b75b2e Mon Sep 17 00:00:00 2001 From: Naitian Liu <83430653+naitianliu-google@users.noreply.github.com> Date: Fri, 7 Jul 2023 16:17:00 -0700 Subject: [PATCH 47/55] feat: add google_gkeonprem_bare_metal_admin_cluster resource (#8142) * add bare_metal_admin_cluster resource * correct create verb * Correct create url * Add test example covering all fields * revert unintended changes in vmware cluster * Add newline at end of file --------- Co-authored-by: Thomas Rodgers --- .../gkeonprem/BareMetalAdminCluster.yaml | 562 ++++++++++++++++++ ...prem_bare_metal_admin_cluster_basic.tf.erb | 59 ++ ...nprem_bare_metal_admin_cluster_full.tf.erb | 90 +++ 3 files changed, 711 insertions(+) create mode 100644 mmv1/products/gkeonprem/BareMetalAdminCluster.yaml create mode 100644 mmv1/templates/terraform/examples/gkeonprem_bare_metal_admin_cluster_basic.tf.erb create mode 100644 mmv1/templates/terraform/examples/gkeonprem_bare_metal_admin_cluster_full.tf.erb diff --git a/mmv1/products/gkeonprem/BareMetalAdminCluster.yaml b/mmv1/products/gkeonprem/BareMetalAdminCluster.yaml new file mode 100644 index 000000000000..288463c685db --- /dev/null +++ b/mmv1/products/gkeonprem/BareMetalAdminCluster.yaml @@ -0,0 +1,562 @@ +# Copyright 2023 Google Inc. +# Licensed under the Apache License, Version 2.0 (the License); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +--- !ruby/object:Api::Resource +name: "BareMetalAdminCluster" +min_version: beta +base_url: "projects/{{project}}/locations/{{location}}/bareMetalAdminClusters" +create_url: "projects/{{project}}/locations/{{location}}/bareMetalAdminClusters?bare_metal_admin_cluster_id={{name}}" +update_url: "projects/{{project}}/locations/{{location}}/bareMetalAdminClusters/{{name}}" +delete_url: "projects/{{project}}/locations/{{location}}/bareMetalAdminClusters/{{name}}:unenroll" +self_link: "projects/{{project}}/locations/{{location}}/bareMetalAdminClusters/{{name}}" +update_verb: :PATCH +update_mask: true +autogen_async: false +id_format: "projects/{{project}}/locations/{{location}}/bareMetalAdminClusters/{{name}}" +import_format: ["projects/{{project}}/locations/{{location}}/bareMetalAdminClusters/{{name}}"] +description: "A Google Bare Metal Admin Cluster." +examples: + - !ruby/object:Provider::Terraform::Examples + name: "gkeonprem_bare_metal_admin_cluster_basic" + min_version: beta + primary_resource_id: "admin-cluster-basic" + vars: + name: "basic" + test_env_vars: + project: "fake-backend-360322" + - !ruby/object:Provider::Terraform::Examples + name: "gkeonprem_bare_metal_admin_cluster_full" + min_version: beta + primary_resource_id: "admin-cluster-basic" + vars: + name: "basic" + test_env_vars: + project: "fake-backend-360322" +parameters: + - !ruby/object:Api::Type::String + name: "name" + description: The bare metal admin cluster name. + immutable: true + url_param_only: true + required: true + - !ruby/object:Api::Type::String + name: "location" + description: The location of the resource. + immutable: true + url_param_only: true + required: true +properties: + - !ruby/object:Api::Type::String + name: "description" + description: | + A human readable description of this Bare Metal Admin Cluster. + - !ruby/object:Api::Type::String + name: "bareMetalVersion" + description: | + A human readable description of this Bare Metal Admin Cluster. + - !ruby/object:Api::Type::String + name: "uid" + description: | + The unique identifier of the Bare Metal Admin Cluster. + output: true + - !ruby/object:Api::Type::Enum + name: "state" + description: The current state of this cluster. + output: true + values: + - STATE_UNSPECIFIED + - PROVISIONING + - RUNNING + - RECONCILING + - STOPPING + - ERROR + - DEGRADED + - !ruby/object:Api::Type::String + name: "endpoint" + description: | + The IP address name of Bare Metal Admin Cluster's API server. + output: true + - !ruby/object:Api::Type::Boolean + name: "reconciling" + description: | + If set, there are currently changes in flight to the Bare Metal Admin Cluster. + output: true + - !ruby/object:Api::Type::Time + name: "createTime" + description: | + The time the cluster was created, in RFC3339 text format. + output: true + - !ruby/object:Api::Type::Time + name: "updateTime" + description: | + The time the cluster was last updated, in RFC3339 text format. + output: true + - !ruby/object:Api::Type::Time + name: "deleteTime" + description: | + The time the cluster was deleted, in RFC3339 text format. + output: true + - !ruby/object:Api::Type::String + name: "localName" + description: | + The object name of the Bare Metal Admin Cluster custom resource on the + associated admin cluster. This field is used to support conflicting + names when enrolling existing clusters to the API. When used as a part of + cluster enrollment, this field will differ from the ID in the resource + name. For new clusters, this field will match the user provided cluster ID + and be visible in the last component of the resource name. It is not + modifiable. + All users should use this name to access their cluster using gkectl or + kubectl and should expect to see the local name when viewing admin + cluster controller logs. + output: true + - !ruby/object:Api::Type::String + name: "etag" + description: | + This checksum is computed by the server based on the value of other + fields, and may be sent on update and delete requests to ensure the + client has an up-to-date value before proceeding. + Allows clients to perform consistent read-modify-writes + through optimistic concurrency control. + output: true + - !ruby/object:Api::Type::KeyValuePairs + name: "annotations" + description: | + Annotations on the Bare Metal Admin Cluster. + This field has the same restrictions as Kubernetes annotations. + The total size of all keys and values combined is limited to 256k. + Key can have 2 segments: prefix (optional) and name (required), + separated by a slash (/). + Prefix must be a DNS subdomain. + Name must be 63 characters or less, begin and end with alphanumerics, + with dashes (-), underscores (_), dots (.), and alphanumerics between. + - !ruby/object:Api::Type::NestedObject + name: "networkConfig" + description: | + Network configuration. + properties: + - !ruby/object:Api::Type::NestedObject + name: "islandModeCidr" + exactly_one_of: + - network_config.0.island_mode_cidr + properties: + - !ruby/object:Api::Type::Array + name: "serviceAddressCidrBlocks" + item_type: Api::Type::String + required: true + description: | + All services in the cluster are assigned an RFC1918 IPv4 address from these ranges. This field cannot be changed after creation. + - !ruby/object:Api::Type::Array + name: "podAddressCidrBlocks" + item_type: Api::Type::String + required: true + description: | + All pods in the cluster are assigned an RFC1918 IPv4 address from these ranges. This field cannot be changed after creation. + - !ruby/object:Api::Type::NestedObject + name: "controlPlane" + description: | + Specifies the control plane configuration. + properties: + - !ruby/object:Api::Type::NestedObject + name: "controlPlaneNodePoolConfig" + required: true + description: | + Configures the node pool running the control plane. If specified the corresponding NodePool will be created for the cluster's control plane. The NodePool will have the same name and namespace as the cluster. + properties: + - !ruby/object:Api::Type::NestedObject + name: "nodePoolConfig" + required: true + description: | + The generic configuration for a node pool running the control plane. + properties: + - !ruby/object:Api::Type::Array + name: "nodeConfigs" + description: The list of machine addresses in the Bare Metal Node Pool. + item_type: !ruby/object:Api::Type::NestedObject + properties: + - !ruby/object:Api::Type::String + name: "nodeIp" + description: | + The default IPv4 address for SSH access and Kubernetes node. + Example: 192.168.0.1 + - !ruby/object:Api::Type::KeyValuePairs + name: "labels" + description: | + The map of Kubernetes labels (key/value pairs) to be applied to + each node. These will added in addition to any default label(s) + that Kubernetes may apply to the node. In case of conflict in + label keys, the applied set may differ depending on the Kubernetes + version -- it's best to assume the behavior is undefined and + conflicts should be avoided. For more information, including usage + and the valid values, see: + http://kubernetes.io/v1.1/docs/user-guide/labels.html + An object containing a list of "key": value pairs. + Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }. + - !ruby/object:Api::Type::String + name: "operatingSystem" + description: | + Specifies the nodes operating system (default: LINUX). + - !ruby/object:Api::Type::Array + name: "taints" + description: | + The initial taints assigned to nodes of this node pool. + item_type: !ruby/object:Api::Type::NestedObject + properties: + - !ruby/object:Api::Type::String + name: "key" + description: | + Key associated with the effect. + - !ruby/object:Api::Type::String + name: "value" + description: | + Value associated with the effect. + - !ruby/object:Api::Type::Enum + name: "effect" + description: | + Specifies the nodes operating system (default: LINUX). + values: + - EFFECT_UNSPECIFIED + - PREFER_NO_SCHEDULE + - NO_EXECUTE + - !ruby/object:Api::Type::KeyValuePairs + name: "labels" + description: | + The map of Kubernetes labels (key/value pairs) to be applied to + each node. These will added in addition to any default label(s) + that Kubernetes may apply to the node. In case of conflict in + label keys, the applied set may differ depending on the Kubernetes + version -- it's best to assume the behavior is undefined and + conflicts should be avoided. For more information, including usage + and the valid values, see: + http://kubernetes.io/v1.1/docs/user-guide/labels.html + An object containing a list of "key": value pairs. + Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }. + - !ruby/object:Api::Type::Array + name: "apiServerArgs" + description: | + Customizes the default API server args. Only a subset of + customized flags are supported. Please refer to the API server + documentation below to know the exact format: + https://kubernetes.io/docs/reference/command-line-tools-reference/kube-apiserver/ + item_type: !ruby/object:Api::Type::NestedObject + properties: + - !ruby/object:Api::Type::String + name: "argument" + required: true + description: | + The argument name as it appears on the API Server command line please make sure to remove the leading dashes. + - !ruby/object:Api::Type::String + name: "value" + required: true + description: | + The value of the arg as it will be passed to the API Server command line. + - !ruby/object:Api::Type::NestedObject + name: "loadBalancer" + description: | + Specifies the load balancer configuration. + properties: + - !ruby/object:Api::Type::NestedObject + name: "vipConfig" + required: true + description: | + Specified the Bare Metal Load Balancer Config + properties: + - !ruby/object:Api::Type::String + name: "controlPlaneVip" + required: true + description: The VIP which you previously set aside for the Kubernetes API of this Bare Metal Admin Cluster. + - !ruby/object:Api::Type::NestedObject + name: "portConfig" + required: true + description: | + Specifies the load balancer ports. + properties: + - !ruby/object:Api::Type::Integer + name: "controlPlaneLoadBalancerPort" + required: true + description: | + The port that control plane hosted load balancers will listen on. + - !ruby/object:Api::Type::NestedObject + name: "manualLbConfig" + properties: + - !ruby/object:Api::Type::Boolean + name: "enabled" + required: true + description: | + Whether manual load balancing is enabled. + - !ruby/object:Api::Type::NestedObject + name: "storage" + description: | + Specifies the cluster storage configuration. + properties: + - !ruby/object:Api::Type::NestedObject + name: "lvpShareConfig" + required: true + description: | + Specifies the config for local PersistentVolumes backed by + subdirectories in a shared filesystem. These subdirectores are + automatically created during cluster creation. + properties: + - !ruby/object:Api::Type::NestedObject + name: "lvpConfig" + required: true + description: | + Defines the machine path and storage class for the LVP Share. + properties: + - !ruby/object:Api::Type::String + name: "path" + required: true + description: | + The host machine path. + - !ruby/object:Api::Type::String + name: "storageClass" + required: true + description: | + The StorageClass name that PVs will be created with. + - !ruby/object:Api::Type::Integer + name: "sharedPathPvCount" + description: | + The number of subdirectories to create under path. + - !ruby/object:Api::Type::NestedObject + name: "lvpNodeMountsConfig" + required: true + description: | + Specifies the config for local PersistentVolumes backed + by mounted node disks. These disks need to be formatted and mounted by the + user, which can be done before or after cluster creation. + properties: + - !ruby/object:Api::Type::String + name: "path" + required: true + description: | + The host machine path. + - !ruby/object:Api::Type::String + name: "storageClass" + required: true + description: | + The StorageClass name that PVs will be created with. + - !ruby/object:Api::Type::NestedObject + name: "proxy" + description: | + Specifies the cluster proxy configuration. + properties: + - !ruby/object:Api::Type::String + name: "uri" + required: true + description: | + Specifies the address of your proxy server. + Examples: http://domain + WARNING: Do not provide credentials in the format + http://(username:password@)domain these will be rejected by the server. + - !ruby/object:Api::Type::Array + name: "noProxy" + item_type: Api::Type::String + description: | + A list of IPs, hostnames, and domains that should skip the proxy. + Examples: ["127.0.0.1", "example.com", ".corp", "localhost"]. + - !ruby/object:Api::Type::NestedObject + name: "clusterOperations" + description: | + Specifies the Admin Cluster's observability infrastructure. + properties: + - !ruby/object:Api::Type::Boolean + name: "enableApplicationLogs" + description: | + Whether collection of application logs/metrics should be enabled (in addition to system logs/metrics). + - !ruby/object:Api::Type::NestedObject + name: "maintenanceConfig" + description: | + Specifies the workload node configurations. + properties: + - !ruby/object:Api::Type::Array + name: "maintenanceAddressCidrBlocks" + required: true + item_type: Api::Type::String + description: | + All IPv4 address from these ranges will be placed into maintenance mode. + Nodes in maintenance mode will be cordoned and drained. When both of these + are true, the "baremetal.cluster.gke.io/maintenance" annotation will be set + on the node resource. + - !ruby/object:Api::Type::NestedObject + name: "nodeConfig" + description: | + Specifies the workload node configurations. + properties: + - !ruby/object:Api::Type::Integer + name: "maxPodsPerNode" + description: | + The maximum number of pods a node can run. The size of the CIDR range + assigned to the node will be derived from this parameter. + - !ruby/object:Api::Type::NestedObject + name: "fleet" + output: true + description: | + Fleet related configuration. + Fleets are a Google Cloud concept for logically organizing clusters, + letting you use and manage multi-cluster capabilities and apply + consistent policies across your systems. + See [Anthos Fleets](https://cloud.google.com/anthos/multicluster-management/fleets) for + more details on Anthos multi-cluster capabilities using Fleets. + properties: + - !ruby/object:Api::Type::String + name: "membership" + description: | + The name of the managed Hub Membership resource associated to this cluster. + Membership names are formatted as + `projects//locations//memberships/`. + output: true + - !ruby/object:Api::Type::NestedObject + name: "status" + output: true + description: | + Specifies detailed cluster status. + properties: + - !ruby/object:Api::Type::String + name: "errorMessage" + description: | + Human-friendly representation of the error message from the admin cluster + controller. The error message can be temporary as the admin cluster + controller creates a cluster or node pool. If the error message persists + for a longer period of time, it can be used to surface error message to + indicate real problems requiring user intervention. + output: true + - !ruby/object:Api::Type::Array + name: "conditions" + description: | + ResourceConditions provide a standard mechanism for higher-level status reporting from admin cluster controller. + output: true + item_type: !ruby/object:Api::Type::NestedObject + properties: + - !ruby/object:Api::Type::String + name: "type" + description: | + Type of the condition. + (e.g., ClusterRunning, NodePoolRunning or ServerSidePreflightReady) + - !ruby/object:Api::Type::String + name: "reason" + description: | + Machine-readable message indicating details about last transition. + - !ruby/object:Api::Type::String + name: "message" + description: | + Human-readable message indicating details about last transition. + - !ruby/object:Api::Type::Time + name: "lastTransitionTime" + description: | + Last time the condition transit from one status to another. + output: true + - !ruby/object:Api::Type::Enum + name: "state" + description: The lifecycle state of the condition. + output: true + values: + - STATE_UNSPECIFIED + - STATE_TRUE + - STATE_FALSE + - STATE_UNKNOWN + - !ruby/object:Api::Type::NestedObject + name: "validationCheck" + output: true + description: | + Specifies the security related settings for the Bare Metal Admin Cluster. + properties: + - !ruby/object:Api::Type::Enum + name: "options" + description: Options used for the validation check. + output: true + values: + - OPTIONS_UNSPECIFIED + - SKIP_VALIDATION_CHECK_BLOCKING + - SKIP_VALIDATION_ALL + - !ruby/object:Api::Type::NestedObject + name: "status" + output: true + description: | + Specifies the detailed validation check status + properties: + - !ruby/object:Api::Type::Array + name: "result" + description: Individual checks which failed as part of the Preflight check execution. + output: true + item_type: !ruby/object:Api::Type::NestedObject + properties: + - !ruby/object:Api::Type::Enum + name: "options" + description: Options used for the validation check. + output: true + values: + - STATE_UNKNOWN + - STATE_FAILURE + - STATE_SKIPPED + - STATE_UNKNOWN + - STATE_FATAL + - STATE_WARNING + - !ruby/object:Api::Type::String + name: "description" + description: | + The description of the validation check. + output: true + - !ruby/object:Api::Type::String + name: "category" + description: | + The category of the validation. + output: true + - !ruby/object:Api::Type::String + name: "reason" + description: | + A human-readable message of the check failure. + output: true + - !ruby/object:Api::Type::String + name: "details" + description: | + Detailed failure information, which might be unformatted. + output: true + - !ruby/object:Api::Type::Enum + name: "scenario" + description: The scenario when the preflight checks were run.. + output: true + values: + - SCENARIO_UNSPECIFIED + - CREATE + - UPDATE + - !ruby/object:Api::Type::NestedObject + name: "nodeAccessConfig" + description: | + Specifies the node access related settings for the bare metal user cluster. + properties: + - !ruby/object:Api::Type::String + name: "loginUser" + required: false + description: | + LoginUser is the user name used to access node machines. + It defaults to "root" if not set. + - !ruby/object:Api::Type::NestedObject + name: "securityConfig" + description: | + Specifies the security related settings for the Bare Metal User Cluster. + properties: + - !ruby/object:Api::Type::NestedObject + name: "authorization" + description: | + Configures user access to the Bare Metal User cluster. + properties: + - !ruby/object:Api::Type::Array + name: "adminUsers" + required: true + description: Users that will be granted the cluster-admin role on the cluster, providing full access to the cluster. + item_type: !ruby/object:Api::Type::NestedObject + properties: + - !ruby/object:Api::Type::String + name: "username" + required: true + description: | + The name of the user, e.g. `my-gcp-id@gmail.com`. diff --git a/mmv1/templates/terraform/examples/gkeonprem_bare_metal_admin_cluster_basic.tf.erb b/mmv1/templates/terraform/examples/gkeonprem_bare_metal_admin_cluster_basic.tf.erb new file mode 100644 index 000000000000..af70a9f45935 --- /dev/null +++ b/mmv1/templates/terraform/examples/gkeonprem_bare_metal_admin_cluster_basic.tf.erb @@ -0,0 +1,59 @@ +resource "google_gkeonprem_bare_metal_admin_cluster" "<%= ctx[:primary_resource_id] %>" { + provider = google-beta + name = "<%= ctx[:vars]['name'] %>" + location = "us-west1" + bare_metal_version = "1.13.4" + network_config { + island_mode_cidr { + service_address_cidr_blocks = ["172.26.0.0/16"] + pod_address_cidr_blocks = ["10.240.0.0/13"] + } + } + node_config { + max_pods_per_node = 250 + } + control_plane { + control_plane_node_pool_config { + node_pool_config { + labels = {} + operating_system = "LINUX" + node_configs { + labels = {} + node_ip = "10.200.0.2" + } + node_configs { + labels = {} + node_ip = "10.200.0.3" + } + node_configs { + labels = {} + node_ip = "10.200.0.4" + } + } + } + } + load_balancer { + port_config { + control_plane_load_balancer_port = 443 + } + vip_config { + control_plane_vip = "10.200.0.5" + } + } + storage { + lvp_share_config { + lvp_config { + path = "/mnt/localpv-share" + storage_class = "local-shared" + } + shared_path_pv_count = 5 + } + lvp_node_mounts_config { + path = "/mnt/localpv-disk" + storage_class = "local-disks" + } + } + node_access_config { + login_user = "root" + } +} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/gkeonprem_bare_metal_admin_cluster_full.tf.erb b/mmv1/templates/terraform/examples/gkeonprem_bare_metal_admin_cluster_full.tf.erb new file mode 100644 index 000000000000..58046c4f55cc --- /dev/null +++ b/mmv1/templates/terraform/examples/gkeonprem_bare_metal_admin_cluster_full.tf.erb @@ -0,0 +1,90 @@ +resource "google_gkeonprem_bare_metal_admin_cluster" "<%= ctx[:primary_resource_id] %>" { + provider = google-beta + name = "<%= ctx[:vars]['name'] %>" + location = "us-west1" + description = "test description" + bare_metal_version = "1.13.4" + annotations = {} + network_config { + island_mode_cidr { + service_address_cidr_blocks = ["172.26.0.0/16"] + pod_address_cidr_blocks = ["10.240.0.0/13"] + } + } + node_config { + max_pods_per_node = 250 + } + control_plane { + control_plane_node_pool_config { + node_pool_config { + labels = {} + operating_system = "LINUX" + node_configs { + labels = {} + node_ip = "10.200.0.2" + } + node_configs { + labels = {} + node_ip = "10.200.0.3" + } + node_configs { + labels = {} + node_ip = "10.200.0.4" + } + taints { + key = "test-key" + value = "test-value" + effect = "NO_EXECUTE" + } + } + } + api_server_args { + argument = "test argument" + value = "test value" + } + } + load_balancer { + port_config { + control_plane_load_balancer_port = 443 + } + vip_config { + control_plane_vip = "10.200.0.5" + } + manual_lb_config { + enabled = true + } + } + storage { + lvp_share_config { + lvp_config { + path = "/mnt/localpv-share" + storage_class = "local-shared" + } + shared_path_pv_count = 5 + } + lvp_node_mounts_config { + path = "/mnt/localpv-disk" + storage_class = "local-disks" + } + } + node_access_config { + login_user = "root" + } + security_config { + authorization { + admin_users { + username = "admin@hashicorptest.com" + } + } + } + maintenance_config { + maintenance_address_cidr_blocks = ["10.0.0.1/32", "10.0.0.2/32"] + } + cluster_operations { + enable_application_logs = true + } + proxy { + uri = "test proxy uri" + no_proxy = ["127.0.0.1"] + } +} \ No newline at end of file From 21af8e940ffa2bbc06f85caa36616fc3b05baf38 Mon Sep 17 00:00:00 2001 From: Michael Callahan Date: Fri, 7 Jul 2023 16:25:34 -0700 Subject: [PATCH 48/55] Update Subnetwork.yaml (#8282) --- mmv1/products/compute/Subnetwork.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mmv1/products/compute/Subnetwork.yaml b/mmv1/products/compute/Subnetwork.yaml index d1cc7bfc18b1..6a51e9beecdf 100644 --- a/mmv1/products/compute/Subnetwork.yaml +++ b/mmv1/products/compute/Subnetwork.yaml @@ -164,9 +164,10 @@ properties: name: 'purpose' immutable: true description: | - The purpose of the resource. This field can be either `PRIVATE_RFC_1918`, `INTERNAL_HTTPS_LOAD_BALANCER` or `REGIONAL_MANAGED_PROXY`. + The purpose of the resource. This field can be either `PRIVATE_RFC_1918`, `INTERNAL_HTTPS_LOAD_BALANCER`, `REGIONAL_MANAGED_PROXY`, or `PRIVATE_SERVICE_CONNECT`. A subnetwork with purpose set to `INTERNAL_HTTPS_LOAD_BALANCER` is a user-created subnetwork that is reserved for Internal HTTP(S) Load Balancing. A subnetwork in a given region with purpose set to `REGIONAL_MANAGED_PROXY` is a proxy-only subnet and is shared between all the regional Envoy-based load balancers. + A subnetwork with purpose set to `PRIVATE_SERVICE_CONNECT` reserves the subnet for hosting a Private Service Connect published service. If unspecified, the purpose defaults to `PRIVATE_RFC_1918`. The enableFlowLogs field isn't supported with the purpose field set to `INTERNAL_HTTPS_LOAD_BALANCER`. default_from_api: true From ef3df4ceee09c426d5dbe914c5282316818e0416 Mon Sep 17 00:00:00 2001 From: Hamzawy63 <43001514+Hamzawy63@users.noreply.github.com> Date: Sat, 8 Jul 2023 03:20:18 +0300 Subject: [PATCH 49/55] Add issuanceConfig property to managed certificates (#8276) * Add issuanceConfig property to managed certificates * Remove trailing spaces in Certificate.yaml --------- Co-authored-by: Hamza Hassan --- .../certificatemanager/Certificate.yaml | 23 +++++- ...ger_google_managed_certificate_dns.tf.erb} | 0 ...managed_certificate_issuance_config.tf.erb | 74 +++++++++++++++++++ 3 files changed, 95 insertions(+), 2 deletions(-) rename mmv1/templates/terraform/examples/{certificate_manager_google_managed_certificate.tf.erb => certificate_manager_google_managed_certificate_dns.tf.erb} (100%) create mode 100644 mmv1/templates/terraform/examples/certificate_manager_google_managed_certificate_issuance_config.tf.erb diff --git a/mmv1/products/certificatemanager/Certificate.yaml b/mmv1/products/certificatemanager/Certificate.yaml index 0dcdcd0bd2fc..2fa0442101a9 100644 --- a/mmv1/products/certificatemanager/Certificate.yaml +++ b/mmv1/products/certificatemanager/Certificate.yaml @@ -45,7 +45,7 @@ schema_version: 1 state_upgraders: true examples: - !ruby/object:Provider::Terraform::Examples - name: 'certificate_manager_google_managed_certificate' + name: 'certificate_manager_google_managed_certificate_dns' primary_resource_id: 'default' vars: dns_auth_name: 'dns-auth' @@ -53,6 +53,13 @@ examples: dns_auth_name2: 'dns-auth2' dns_auth_subdomain2: 'subdomain2' cert_name: 'dns-cert' + - !ruby/object:Provider::Terraform::Examples + name: 'certificate_manager_google_managed_certificate_issuance_config' + primary_resource_id: 'default' + vars: + cert_name: 'issuance-config-cert' + ca_name: 'my-ca' + pool_name: 'my-ca-pool' - !ruby/object:Provider::Terraform::Examples name: 'certificate_manager_self_managed_certificate' primary_resource_id: 'default' @@ -178,9 +185,21 @@ properties: name: dnsAuthorizations immutable: true description: | - Authorizations that will be used for performing domain authorization + Authorizations that will be used for performing domain authorization. Either issuanceConfig or dnsAuthorizations should be specificed, but not both. diff_suppress_func: 'tpgresource.ProjectNumberDiffSuppress' item_type: Api::Type::String + - !ruby/object:Api::Type::String + name: issuanceConfig + immutable: true + description: | + The resource name for a CertificateIssuanceConfig used to configure private PKI certificates in the format projects/*/locations/*/certificateIssuanceConfigs/*. + If this field is not set, the certificates will instead be publicly signed as documented at https://cloud.google.com/load-balancing/docs/ssl-certificates/google-managed-certs#caa. + Either issuanceConfig or dnsAuthorizations should be specificed, but not both. + + # when the certificate is created with issuanceConfig in the format "projects/{{project_id}}/locations/global/certificateIssuanceConfigs/{{CICName}}", the + # format changes in the response message to "projects/{{project_number}}/locations/global/certificateIssuanceConfigs/{{CICName}}". That causes the tests to fail + # that's why "tpgresource.CompareResourceNames" is needed. + diff_suppress_func: 'tpgresource.CompareResourceNames' - !ruby/object:Api::Type::String name: 'state' output: true diff --git a/mmv1/templates/terraform/examples/certificate_manager_google_managed_certificate.tf.erb b/mmv1/templates/terraform/examples/certificate_manager_google_managed_certificate_dns.tf.erb similarity index 100% rename from mmv1/templates/terraform/examples/certificate_manager_google_managed_certificate.tf.erb rename to mmv1/templates/terraform/examples/certificate_manager_google_managed_certificate_dns.tf.erb diff --git a/mmv1/templates/terraform/examples/certificate_manager_google_managed_certificate_issuance_config.tf.erb b/mmv1/templates/terraform/examples/certificate_manager_google_managed_certificate_issuance_config.tf.erb new file mode 100644 index 000000000000..e94aebd04367 --- /dev/null +++ b/mmv1/templates/terraform/examples/certificate_manager_google_managed_certificate_issuance_config.tf.erb @@ -0,0 +1,74 @@ +resource "google_certificate_manager_certificate" "<%= ctx[:primary_resource_id] %>" { + name = "<%= ctx[:vars]['cert_name'] %>" + description = "The default cert" + scope = "EDGE_CACHE" + managed { + domains = [ + "terraform.subdomain1.com" + ] + issuance_config = google_certificate_manager_certificate_issuance_config.issuanceconfig.id + } +} + + + +# creating certificate_issuance_config to use it in the managed certificate +resource "google_certificate_manager_certificate_issuance_config" "issuanceconfig" { + name = "issuanceconfigtestterraform" + description = "sample description for the certificate issuanceConfigs" + certificate_authority_config { + certificate_authority_service_config { + ca_pool = google_privateca_ca_pool.pool.id + } + } + lifetime = "1814400s" + rotation_window_percentage = 34 + key_algorithm = "ECDSA_P256" + depends_on=[google_privateca_certificate_authority.ca_authority] +} + +resource "google_privateca_ca_pool" "pool" { + name = "<%= ctx[:vars]["pool_name"] %>" + location = "us-central1" + tier = "ENTERPRISE" +} + +resource "google_privateca_certificate_authority" "ca_authority" { + location = "us-central1" + pool = google_privateca_ca_pool.pool.name + certificate_authority_id = "<%= ctx[:vars]["ca_name"] %>" + config { + subject_config { + subject { + organization = "HashiCorp" + common_name = "my-certificate-authority" + } + subject_alt_name { + dns_names = ["hashicorp.com"] + } + } + x509_config { + ca_options { + is_ca = true + } + key_usage { + base_key_usage { + cert_sign = true + crl_sign = true + } + extended_key_usage { + server_auth = true + } + } + } + } + key_spec { + algorithm = "RSA_PKCS1_4096_SHA256" + } + + // Disable CA deletion related safe checks for easier cleanup. + deletion_protection = false + skip_grace_period = true + ignore_active_certificates_on_deletion = true +} + From 11c2ebe57115a3ef09fc260946b6373452990c31 Mon Sep 17 00:00:00 2001 From: Sarah French <15078782+SarahFrench@users.noreply.github.com> Date: Mon, 10 Jul 2023 11:08:26 +0100 Subject: [PATCH 50/55] Update use-built-provider.md (#8292) --- docs/content/get-started/use-built-provider.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/content/get-started/use-built-provider.md b/docs/content/get-started/use-built-provider.md index 2be83ec3b4ce..633e4790929b 100644 --- a/docs/content/get-started/use-built-provider.md +++ b/docs/content/get-started/use-built-provider.md @@ -143,14 +143,14 @@ make build To make Terraform use the configuration file you created, you need to set the `TF_CLI_CONFIG_FILE` environment variable to be a string containing the path to the configuration file ([see the documentation here](https://developer.hashicorp.com/terraform/cli/config/environment-variables#tf_cli_config_file)). The path can be either a relative or absolute path. -Assuming that a configuration file was created at `~/tf-dev-override.tfrc`, you can either export the environment variable or set it explicitly for each `terraform` command: +Assuming that a configuration file was created at `~/tf-dev-override.tfrc`, you can either export the environment variable or set it explicitly for each `terraform` command. Note that you need to use the full path: ```bash # either export the environment variable for your session -export TF_CLI_CONFIG_FILE="~/tf-dev-override.tfrc" +export TF_CLI_CONFIG_FILE="/Users/MyUserName/tf-dev-override.tfrc" # OR, set the environment variable value per command -TF_CLI_CONFIG_FILE="~/tf-dev-override.tfrc" terraform plan +TF_CLI_CONFIG_FILE="/Users/MyUserName/tf-dev-override.tfrc" terraform plan ``` To check that the developer override is working, run a `terraform plan` command and look for a warning near the start of the terminal output that looks like the example below. It is not necessary to run the terraform init command to use development overrides. From 33c482dbfbe96519bcd2aee49187c40c25166e5d Mon Sep 17 00:00:00 2001 From: Jeff Luo Date: Mon, 10 Jul 2023 06:17:15 -0400 Subject: [PATCH 51/55] Promote fleet observability feature in GKE Hub to GA (#8268) --- mmv1/products/gkehub2/Feature.yaml | 1 - ...rvability_for_both_default_and_scope_logs.tf.erb | 1 - ..._observability_for_default_logs_with_COPY.tf.erb | 1 - ...et_observability_for_scope_logs_with_MOVE.tf.erb | 1 - .../tests/resource_gke_hub_feature_test.go.erb | 13 +++++-------- 5 files changed, 5 insertions(+), 12 deletions(-) diff --git a/mmv1/products/gkehub2/Feature.yaml b/mmv1/products/gkehub2/Feature.yaml index f8f5380c61f2..e2621d30a24c 100644 --- a/mmv1/products/gkehub2/Feature.yaml +++ b/mmv1/products/gkehub2/Feature.yaml @@ -143,7 +143,6 @@ properties: - !ruby/object:Api::Type::NestedObject name: fleetobservability description: Fleet Observability feature spec. - min_version: beta properties: - !ruby/object:Api::Type::NestedObject name: loggingConfig diff --git a/mmv1/templates/terraform/examples/enable_fleet_observability_for_both_default_and_scope_logs.tf.erb b/mmv1/templates/terraform/examples/enable_fleet_observability_for_both_default_and_scope_logs.tf.erb index 4492b62b6f21..003e7cf4c574 100644 --- a/mmv1/templates/terraform/examples/enable_fleet_observability_for_both_default_and_scope_logs.tf.erb +++ b/mmv1/templates/terraform/examples/enable_fleet_observability_for_both_default_and_scope_logs.tf.erb @@ -13,5 +13,4 @@ resource "google_gke_hub_feature" "feature" { } } } - provider = google-beta } diff --git a/mmv1/templates/terraform/examples/enable_fleet_observability_for_default_logs_with_COPY.tf.erb b/mmv1/templates/terraform/examples/enable_fleet_observability_for_default_logs_with_COPY.tf.erb index a1edd040c20f..ce3b2c7ef054 100644 --- a/mmv1/templates/terraform/examples/enable_fleet_observability_for_default_logs_with_COPY.tf.erb +++ b/mmv1/templates/terraform/examples/enable_fleet_observability_for_default_logs_with_COPY.tf.erb @@ -10,5 +10,4 @@ resource "google_gke_hub_feature" "feature" { } } } - provider = google-beta } diff --git a/mmv1/templates/terraform/examples/enable_fleet_observability_for_scope_logs_with_MOVE.tf.erb b/mmv1/templates/terraform/examples/enable_fleet_observability_for_scope_logs_with_MOVE.tf.erb index d65179b16313..1a713fe42fb3 100644 --- a/mmv1/templates/terraform/examples/enable_fleet_observability_for_scope_logs_with_MOVE.tf.erb +++ b/mmv1/templates/terraform/examples/enable_fleet_observability_for_scope_logs_with_MOVE.tf.erb @@ -10,5 +10,4 @@ resource "google_gke_hub_feature" "feature" { } } } - provider = google-beta } diff --git a/mmv1/third_party/terraform/tests/resource_gke_hub_feature_test.go.erb b/mmv1/third_party/terraform/tests/resource_gke_hub_feature_test.go.erb index 9628305e5725..a7dcc1bf37f6 100644 --- a/mmv1/third_party/terraform/tests/resource_gke_hub_feature_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_gke_hub_feature_test.go.erb @@ -15,7 +15,6 @@ import ( transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" ) -<% unless version == 'ga' -%> func TestAccGKEHubFeature_gkehubFeatureFleetObservability(t *testing.T) { // VCR fails to handle batched project services acctest.SkipIfVcr(t) @@ -29,7 +28,7 @@ func TestAccGKEHubFeature_gkehubFeatureFleetObservability(t *testing.T) { acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckGKEHubFeatureDestroyProducer(t), ExternalProviders: map[string]resource.ExternalProvider{ "time": {}, @@ -64,7 +63,7 @@ func TestAccGKEHubFeature_gkehubFeatureFleetObservability(t *testing.T) { } func testAccGKEHubFeature_gkehubFeatureFleetObservability(context map[string]interface{}) string { - return gkeHubFeatureProjectSetup(context) + acctest.Nprintf(` + return gkeHubFeatureProjectSetupForGA(context) + acctest.Nprintf(` resource "time_sleep" "wait_for_gkehub_enablement" { create_duration = "150s" depends_on = [google_project_service.gkehub] @@ -87,13 +86,12 @@ resource "google_gke_hub_feature" "feature" { } } depends_on = [time_sleep.wait_for_gkehub_enablement] - provider = google-beta } `, context) } func testAccGKEHubFeature_gkehubFeatureFleetObservabilityUpdate1(context map[string]interface{}) string { - return gkeHubFeatureProjectSetup(context) + acctest.Nprintf(` + return gkeHubFeatureProjectSetupForGA(context) + acctest.Nprintf(` resource "time_sleep" "wait_for_gkehub_enablement" { create_duration = "150s" depends_on = [google_project_service.gkehub] @@ -113,13 +111,12 @@ resource "google_gke_hub_feature" "feature" { } } depends_on = [time_sleep.wait_for_gkehub_enablement] - provider = google-beta } `, context) } func testAccGKEHubFeature_gkehubFeatureFleetObservabilityUpdate2(context map[string]interface{}) string { - return gkeHubFeatureProjectSetup(context) + acctest.Nprintf(` + return gkeHubFeatureProjectSetupForGA(context) + acctest.Nprintf(` resource "time_sleep" "wait_for_gkehub_enablement" { create_duration = "150s" depends_on = [google_project_service.gkehub] @@ -139,11 +136,11 @@ resource "google_gke_hub_feature" "feature" { } } depends_on = [time_sleep.wait_for_gkehub_enablement] - provider = google-beta } `, context) } +<% unless version == 'ga' -%> func gkeHubFeatureProjectSetup(context map[string]interface{}) string { return acctest.Nprintf(` resource "google_project" "project" { From 936ca4ac5e4717c9095299dada701ce9a147d451 Mon Sep 17 00:00:00 2001 From: NexusNull Date: Mon, 10 Jul 2023 14:01:25 +0200 Subject: [PATCH 52/55] add deletion policy documentation (#8286) --- .../docs/r/compute_shared_vpc_service_project.html.markdown | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mmv1/third_party/terraform/website/docs/r/compute_shared_vpc_service_project.html.markdown b/mmv1/third_party/terraform/website/docs/r/compute_shared_vpc_service_project.html.markdown index a9224491e080..bec341cbe953 100644 --- a/mmv1/third_party/terraform/website/docs/r/compute_shared_vpc_service_project.html.markdown +++ b/mmv1/third_party/terraform/website/docs/r/compute_shared_vpc_service_project.html.markdown @@ -37,6 +37,8 @@ The following arguments are expected: * `service_project` - (Required) The ID of the project that will serve as a Shared VPC service project. +* `deletion_policy` - (Optional) The deletion policy for the shared VPC service. Setting ABANDON allows the resource to be abandoned rather than deleted. Possible values are: "ABANDON". + ## Attributes Reference In addition to the arguments listed above, the following computed attributes are exported: From 5405da5e83618bd9facdc211d2e64abaf2c9c7b7 Mon Sep 17 00:00:00 2001 From: Ryan Sun Date: Mon, 10 Jul 2023 20:30:41 +0800 Subject: [PATCH 53/55] fix osconfig validation func issue (#8274) --- .../osconfig/resource_os_config_os_policy_assignment.go | 4 ++-- .../docs/r/os_config_os_policy_assignment.html.markdown | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/mmv1/third_party/terraform/services/osconfig/resource_os_config_os_policy_assignment.go b/mmv1/third_party/terraform/services/osconfig/resource_os_config_os_policy_assignment.go index ea21d3cf6b31..c3e8e143c89d 100644 --- a/mmv1/third_party/terraform/services/osconfig/resource_os_config_os_policy_assignment.go +++ b/mmv1/third_party/terraform/services/osconfig/resource_os_config_os_policy_assignment.go @@ -379,8 +379,8 @@ Remote: A checksum must be specified. Cloud Storage: An object generation number "state": { Type: schema.TypeString, Required: true, - ValidateFunc: verify.ValidateEnum([]string{"OS_POLICY_COMPLIANCE_STATE_UNSPECIFIED", "COMPLIANT", "NON_COMPLIANT", "UNKNOWN", "NO_OS_POLICIES_APPLICABLE"}), - Description: `Desired state of the file. Possible values: ["OS_POLICY_COMPLIANCE_STATE_UNSPECIFIED", "COMPLIANT", "NON_COMPLIANT", "UNKNOWN", "NO_OS_POLICIES_APPLICABLE"]`, + ValidateFunc: verify.ValidateEnum([]string{"DESIRED_STATE_UNSPECIFIED", "PRESENT", "ABSENT", "CONTENTS_MATCH"}), + Description: `Desired state of the file. Possible values: ["DESIRED_STATE_UNSPECIFIED", "PRESENT", "ABSENT", "CONTENTS_MATCH"]`, }, "content": { Type: schema.TypeString, diff --git a/mmv1/third_party/terraform/website/docs/r/os_config_os_policy_assignment.html.markdown b/mmv1/third_party/terraform/website/docs/r/os_config_os_policy_assignment.html.markdown index 065726040db6..500aee593ad6 100644 --- a/mmv1/third_party/terraform/website/docs/r/os_config_os_policy_assignment.html.markdown +++ b/mmv1/third_party/terraform/website/docs/r/os_config_os_policy_assignment.html.markdown @@ -550,8 +550,8 @@ The following arguments are supported: * `path` - (Required) The absolute path of the file within the VM. * `state` - (Required) Desired state of the file. Possible values are: - `OS_POLICY_COMPLIANCE_STATE_UNSPECIFIED`, `COMPLIANT`, `NON_COMPLIANT`, - `UNKNOWN`, `NO_OS_POLICIES_APPLICABLE`. + `DESIRED_STATE_UNSPECIFIED`, `PRESENT`, `ABSENT`, + `CONTENTS_MATCH`. * `permissions` - (Output) Consists of three octal digits which represent, in order, the permissions of the owner, group, and other users for the file From 0623e2522d733f040200adc9c379e78884b5ce0a Mon Sep 17 00:00:00 2001 From: Rostislav Bobrovsky Date: Mon, 10 Jul 2023 17:20:52 +0200 Subject: [PATCH 54/55] HTTP Keep-alive Timeout: Add httpKeepAliveTimeoutSec to GA provider (#8275) --- mmv1/products/compute/TargetHttpProxy.yaml | 2 -- mmv1/products/compute/TargetHttpsProxy.yaml | 2 -- .../target_http_proxy_http_keep_alive_timeout.tf.erb | 6 +----- .../target_https_proxy_http_keep_alive_timeout.tf.erb | 7 +------ 4 files changed, 2 insertions(+), 15 deletions(-) diff --git a/mmv1/products/compute/TargetHttpProxy.yaml b/mmv1/products/compute/TargetHttpProxy.yaml index 58006c0aea42..5fe03954c19c 100644 --- a/mmv1/products/compute/TargetHttpProxy.yaml +++ b/mmv1/products/compute/TargetHttpProxy.yaml @@ -54,7 +54,6 @@ examples: http_health_check_name: 'http-health-check' - !ruby/object:Provider::Terraform::Examples name: 'target_http_proxy_http_keep_alive_timeout' - min_version: beta primary_resource_id: 'default' vars: target_http_proxy_name: 'test-http-keep-alive-timeout-proxy' @@ -109,7 +108,6 @@ properties: default_from_api: true - !ruby/object:Api::Type::Integer name: 'httpKeepAliveTimeoutSec' - min_version: beta description: | Specifies how long to keep a connection open, after completing a response, while there is no matching traffic (in seconds). If an HTTP keepalive is diff --git a/mmv1/products/compute/TargetHttpsProxy.yaml b/mmv1/products/compute/TargetHttpsProxy.yaml index e105a36d53db..f29c2cf17e5c 100644 --- a/mmv1/products/compute/TargetHttpsProxy.yaml +++ b/mmv1/products/compute/TargetHttpsProxy.yaml @@ -55,7 +55,6 @@ examples: http_health_check_name: 'http-health-check' - !ruby/object:Provider::Terraform::Examples name: 'target_https_proxy_http_keep_alive_timeout' - min_version: beta primary_resource_id: 'default' vars: target_https_proxy_name: 'test-http-keep-alive-timeout-proxy' @@ -153,7 +152,6 @@ properties: default_from_api: true - !ruby/object:Api::Type::Integer name: 'httpKeepAliveTimeoutSec' - min_version: beta description: | Specifies how long to keep a connection open, after completing a response, while there is no matching traffic (in seconds). If an HTTP keepalive is diff --git a/mmv1/templates/terraform/examples/target_http_proxy_http_keep_alive_timeout.tf.erb b/mmv1/templates/terraform/examples/target_http_proxy_http_keep_alive_timeout.tf.erb index b590a318cdb8..de469704cf0d 100644 --- a/mmv1/templates/terraform/examples/target_http_proxy_http_keep_alive_timeout.tf.erb +++ b/mmv1/templates/terraform/examples/target_http_proxy_http_keep_alive_timeout.tf.erb @@ -1,13 +1,11 @@ # [START cloudloadbalancing_target_http_proxy_http_keep_alive_timeout] resource "google_compute_target_http_proxy" "<%= ctx[:primary_resource_id] %>" { - provider = google-beta name = "<%= ctx[:vars]['target_http_proxy_name'] %>" - http_keep_alive_timeout_sec = 120 + http_keep_alive_timeout_sec = 610 url_map = google_compute_url_map.default.id } resource "google_compute_url_map" "default" { - provider = google-beta name = "<%= ctx[:vars]['url_map_name'] %>" default_service = google_compute_backend_service.default.id @@ -28,7 +26,6 @@ resource "google_compute_url_map" "default" { } resource "google_compute_backend_service" "default" { - provider = google-beta name = "<%= ctx[:vars]['backend_service_name'] %>" port_name = "http" protocol = "HTTP" @@ -39,7 +36,6 @@ resource "google_compute_backend_service" "default" { } resource "google_compute_http_health_check" "default" { - provider = google-beta name = "<%= ctx[:vars]['http_health_check_name'] %>" request_path = "/" check_interval_sec = 1 diff --git a/mmv1/templates/terraform/examples/target_https_proxy_http_keep_alive_timeout.tf.erb b/mmv1/templates/terraform/examples/target_https_proxy_http_keep_alive_timeout.tf.erb index f1aed6d90cbc..12a281e6e3af 100644 --- a/mmv1/templates/terraform/examples/target_https_proxy_http_keep_alive_timeout.tf.erb +++ b/mmv1/templates/terraform/examples/target_https_proxy_http_keep_alive_timeout.tf.erb @@ -1,21 +1,18 @@ # [START cloudloadbalancing_target_https_proxy_http_keep_alive_timeout] resource "google_compute_target_https_proxy" "<%= ctx[:primary_resource_id] %>" { - provider = google-beta name = "<%= ctx[:vars]['target_https_proxy_name'] %>" - http_keep_alive_timeout_sec = 120 + http_keep_alive_timeout_sec = 610 url_map = google_compute_url_map.default.id ssl_certificates = [google_compute_ssl_certificate.default.id] } resource "google_compute_ssl_certificate" "default" { - provider = google-beta name = "<%= ctx[:vars]['ssl_certificate_name'] %>" private_key = file("path/to/private.key") certificate = file("path/to/certificate.crt") } resource "google_compute_url_map" "default" { - provider = google-beta name = "<%= ctx[:vars]['url_map_name'] %>" description = "a description" @@ -38,7 +35,6 @@ resource "google_compute_url_map" "default" { } resource "google_compute_backend_service" "default" { - provider = google-beta name = "<%= ctx[:vars]['backend_service_name'] %>" port_name = "http" protocol = "HTTP" @@ -49,7 +45,6 @@ resource "google_compute_backend_service" "default" { } resource "google_compute_http_health_check" "default" { - provider = google-beta name = "<%= ctx[:vars]['http_health_check_name'] %>" request_path = "/" check_interval_sec = 1 From 93a3c7fb2e16fa78bfbe012c2ec0b177ff691ca0 Mon Sep 17 00:00:00 2001 From: "Stephen Lewis (Burrows)" Date: Mon, 10 Jul 2023 09:34:01 -0700 Subject: [PATCH 55/55] Removed melinath from onvacation (#8300) --- .ci/containers/membership-checker/membership.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/containers/membership-checker/membership.go b/.ci/containers/membership-checker/membership.go index 4c3999e50d4b..8cd90ed4d407 100644 --- a/.ci/containers/membership-checker/membership.go +++ b/.ci/containers/membership-checker/membership.go @@ -29,7 +29,7 @@ var ( trustedContributors = []string{} // This is for reviewers who are "on vacation": will not receive new review assignments but will still receive re-requests for assigned PRs. - onVacationReviewers = []string{"melinath"} + onVacationReviewers = []string{} ) // Check if a user is team member to not request a random reviewer