diff --git a/mmv1/third_party/terraform/envvar/envvar_utils.go b/mmv1/third_party/terraform/envvar/envvar_utils.go index aff59b345916..72a7f190ec39 100644 --- a/mmv1/third_party/terraform/envvar/envvar_utils.go +++ b/mmv1/third_party/terraform/envvar/envvar_utils.go @@ -1,6 +1,7 @@ package envvar import ( + "fmt" "log" "os" "testing" @@ -196,3 +197,7 @@ func SkipIfEnvNotSet(t *testing.T, envs ...string) { } } } + +func ServiceAccountCanonicalEmail(account string) string { + return fmt.Sprintf("%s@%s.iam.gserviceaccount.com", account, GetTestProjectFromEnv()) +} diff --git a/mmv1/third_party/terraform/framework_utils/framework_provider_test.go.erb b/mmv1/third_party/terraform/fwprovider/framework_provider_test.go.erb similarity index 60% rename from mmv1/third_party/terraform/framework_utils/framework_provider_test.go.erb rename to mmv1/third_party/terraform/fwprovider/framework_provider_test.go.erb index 76f6c4d0e2be..92130ffb77b4 100644 --- a/mmv1/third_party/terraform/framework_utils/framework_provider_test.go.erb +++ b/mmv1/third_party/terraform/fwprovider/framework_provider_test.go.erb @@ -1,13 +1,19 @@ <% autogen_exception -%> -package google +package fwprovider_test import ( "fmt" "regexp" + "strings" "testing" "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/fwtransport" + "github.com/hashicorp/terraform-provider-google/google/tpgresource" + transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" ) func TestAccFrameworkProviderMeta_setModuleName(t *testing.T) { @@ -170,3 +176,111 @@ resource "google_dns_managed_zone" "foo" { } `, endpoint, name, name) } + + +// Copy the function from the provider_test package to here +// as that function is in the _test.go file and not importable +func testAccProviderBasePath_setBasePath(endpoint, name string) string { + return fmt.Sprintf(` +provider "google" { + alias = "compute_custom_endpoint" + compute_custom_endpoint = "%s" +} + +resource "google_compute_address" "default" { + provider = google.compute_custom_endpoint + name = "tf-test-address-%s" +}`, endpoint, name) +} + +func testAccProviderMeta_setModuleName(key, name string) string { + return fmt.Sprintf(` +terraform { + provider_meta "google" { + module_name = "%s" + } +} + +resource "google_compute_address" "default" { + name = "tf-test-address-%s" +}`, key, name) +} + +// Copy the function testAccCheckComputeAddressDestroyProducer from the dns_test package to here, +// as that function is in the _test.go file and not importable. +// +// testAccCheckDNSManagedZoneDestroyProducerFramework is the framework version of the generated testAccCheckDNSManagedZoneDestroyProducer +// when we automate this, we'll use the automated version and can get rid of this +func testAccCheckDNSManagedZoneDestroyProducerFramework(t *testing.T) func(s *terraform.State) error { + return func(s *terraform.State) error { + for name, rs := range s.RootModule().Resources { + if rs.Type != "google_dns_managed_zone" { + continue + } + if strings.HasPrefix(name, "data.") { + continue + } + + p := acctest.GetFwTestProvider(t) + + url, err := acctest.ReplaceVarsForFrameworkTest(&p.FrameworkProvider.FrameworkProviderConfig, rs, "{{DNSBasePath}}projects/{{project}}/managedZones/{{name}}") + if err != nil { + return err + } + + billingProject := "" + + if !p.BillingProject.IsNull() && p.BillingProject.String() != "" { + billingProject = p.BillingProject.String() + } + + _, diags := fwtransport.SendFrameworkRequest(&p.FrameworkProvider.FrameworkProviderConfig, "GET", billingProject, url, p.UserAgent, nil) + if !diags.HasError() { + return fmt.Errorf("DNSManagedZone still exists at %s", url) + } + } + + return nil + } +} + +// Copy the Mmv1 generated function testAccCheckComputeAddressDestroyProducer from the compute_test package to here, +// as that function is in the _test.go file and not importable. +func testAccCheckComputeAddressDestroyProducer(t *testing.T) func(s *terraform.State) error { + return func(s *terraform.State) error { + for name, rs := range s.RootModule().Resources { + if rs.Type != "google_compute_address" { + continue + } + if strings.HasPrefix(name, "data.") { + continue + } + + config := acctest.GoogleProviderConfig(t) + + url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{ComputeBasePath}}projects/{{project}}/regions/{{region}}/addresses/{{name}}") + if err != nil { + return err + } + + billingProject := "" + + if config.BillingProject != "" { + billingProject = config.BillingProject + } + + _, err = transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ + Config: config, + Method: "GET", + Project: billingProject, + RawURL: url, + UserAgent: config.UserAgent, + }) + if err == nil { + return fmt.Errorf("ComputeAddress still exists at %s", url) + } + } + + return nil + } +} \ No newline at end of file diff --git a/mmv1/third_party/terraform/utils/provider_test.go.erb b/mmv1/third_party/terraform/provider/provider_test.go.erb similarity index 84% rename from mmv1/third_party/terraform/utils/provider_test.go.erb rename to mmv1/third_party/terraform/provider/provider_test.go.erb index bafdc4ebff6a..2406a3969d41 100644 --- a/mmv1/third_party/terraform/utils/provider_test.go.erb +++ b/mmv1/third_party/terraform/provider/provider_test.go.erb @@ -1,17 +1,21 @@ <% autogen_exception -%> -package google +package provider_test import ( "fmt" "regexp" + "strings" "testing" "github.com/hashicorp/terraform-provider-google/google/acctest" "github.com/hashicorp/terraform-provider-google/google/envvar" "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/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" ) func TestProvider(t *testing.T) { @@ -148,7 +152,7 @@ func TestAccProviderIndirectUserProjectOverride(t *testing.T) { pid := "tf-test-" + acctest.RandString(t, 10) config := acctest.BootstrapConfig(t) - accessToken, err := setupProjectsAndGetAccessToken(org, billing, pid, "cloudkms", config) + accessToken, err := acctest.SetupProjectsAndGetAccessToken(org, billing, pid, "cloudkms", config) if err != nil { t.Error(err) } @@ -276,4 +280,45 @@ provider "google" { user_project_override = %v } `, accessToken, override) +} + +// Copy the Mmv1 generated function testAccCheckComputeAddressDestroyProducer from the compute_test package to here, +// as that function is in the _test.go file and not importable. +func testAccCheckComputeAddressDestroyProducer(t *testing.T) func(s *terraform.State) error { + return func(s *terraform.State) error { + for name, rs := range s.RootModule().Resources { + if rs.Type != "google_compute_address" { + continue + } + if strings.HasPrefix(name, "data.") { + continue + } + + config := acctest.GoogleProviderConfig(t) + + url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{ComputeBasePath}}projects/{{project}}/regions/{{region}}/addresses/{{name}}") + if err != nil { + return err + } + + billingProject := "" + + if config.BillingProject != "" { + billingProject = config.BillingProject + } + + _, err = transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ + Config: config, + Method: "GET", + Project: billingProject, + RawURL: url, + UserAgent: config.UserAgent, + }) + if err == nil { + return fmt.Errorf("ComputeAddress still exists at %s", url) + } + } + + return nil + } } \ No newline at end of file diff --git a/mmv1/third_party/terraform/tests/data_source_access_approval_folder_service_account_test.go b/mmv1/third_party/terraform/services/accessapproval/data_source_access_approval_folder_service_account_test.go similarity index 98% rename from mmv1/third_party/terraform/tests/data_source_access_approval_folder_service_account_test.go rename to mmv1/third_party/terraform/services/accessapproval/data_source_access_approval_folder_service_account_test.go index ed6468ebe5e3..46111971b9ac 100644 --- a/mmv1/third_party/terraform/tests/data_source_access_approval_folder_service_account_test.go +++ b/mmv1/third_party/terraform/services/accessapproval/data_source_access_approval_folder_service_account_test.go @@ -1,4 +1,4 @@ -package google +package accessapproval_test import ( "testing" diff --git a/mmv1/third_party/terraform/tests/data_source_access_approval_organization_service_account_test.go b/mmv1/third_party/terraform/services/accessapproval/data_source_access_approval_organization_service_account_test.go similarity index 97% rename from mmv1/third_party/terraform/tests/data_source_access_approval_organization_service_account_test.go rename to mmv1/third_party/terraform/services/accessapproval/data_source_access_approval_organization_service_account_test.go index d62628346e71..c337e51cf4ca 100644 --- a/mmv1/third_party/terraform/tests/data_source_access_approval_organization_service_account_test.go +++ b/mmv1/third_party/terraform/services/accessapproval/data_source_access_approval_organization_service_account_test.go @@ -1,4 +1,4 @@ -package google +package accessapproval_test import ( "testing" diff --git a/mmv1/third_party/terraform/tests/data_source_access_approval_project_service_account_test.go b/mmv1/third_party/terraform/services/accessapproval/data_source_access_approval_project_service_account_test.go similarity index 97% rename from mmv1/third_party/terraform/tests/data_source_access_approval_project_service_account_test.go rename to mmv1/third_party/terraform/services/accessapproval/data_source_access_approval_project_service_account_test.go index 8705b34b3e2f..f7b23570f0c0 100644 --- a/mmv1/third_party/terraform/tests/data_source_access_approval_project_service_account_test.go +++ b/mmv1/third_party/terraform/services/accessapproval/data_source_access_approval_project_service_account_test.go @@ -1,4 +1,4 @@ -package google +package accessapproval_test import ( "testing" diff --git a/mmv1/third_party/terraform/tests/resource_access_approval_folder_settings_test.go b/mmv1/third_party/terraform/services/accessapproval/resource_access_approval_folder_settings_test.go similarity index 99% rename from mmv1/third_party/terraform/tests/resource_access_approval_folder_settings_test.go rename to mmv1/third_party/terraform/services/accessapproval/resource_access_approval_folder_settings_test.go index 97c211cfe28e..352477fd0473 100644 --- a/mmv1/third_party/terraform/tests/resource_access_approval_folder_settings_test.go +++ b/mmv1/third_party/terraform/services/accessapproval/resource_access_approval_folder_settings_test.go @@ -1,4 +1,4 @@ -package google +package accessapproval_test import ( "log" diff --git a/mmv1/third_party/terraform/tests/resource_access_approval_organization_settings_test.go b/mmv1/third_party/terraform/services/accessapproval/resource_access_approval_organization_settings_test.go similarity index 99% rename from mmv1/third_party/terraform/tests/resource_access_approval_organization_settings_test.go rename to mmv1/third_party/terraform/services/accessapproval/resource_access_approval_organization_settings_test.go index f2cfb51e2861..a7b2f44611db 100644 --- a/mmv1/third_party/terraform/tests/resource_access_approval_organization_settings_test.go +++ b/mmv1/third_party/terraform/services/accessapproval/resource_access_approval_organization_settings_test.go @@ -1,4 +1,4 @@ -package google +package accessapproval_test import ( "log" diff --git a/mmv1/third_party/terraform/tests/resource_access_approval_project_settings_test.go b/mmv1/third_party/terraform/services/accessapproval/resource_access_approval_project_settings_test.go similarity index 99% rename from mmv1/third_party/terraform/tests/resource_access_approval_project_settings_test.go rename to mmv1/third_party/terraform/services/accessapproval/resource_access_approval_project_settings_test.go index 2d0381b8bac7..4839af9d5fc6 100644 --- a/mmv1/third_party/terraform/tests/resource_access_approval_project_settings_test.go +++ b/mmv1/third_party/terraform/services/accessapproval/resource_access_approval_project_settings_test.go @@ -1,4 +1,4 @@ -package google +package accessapproval_test import ( "log" diff --git a/mmv1/third_party/terraform/tests/resource_active_directory_domain_trust_test.go b/mmv1/third_party/terraform/services/activedirectory/resource_active_directory_domain_trust_test.go similarity index 99% rename from mmv1/third_party/terraform/tests/resource_active_directory_domain_trust_test.go rename to mmv1/third_party/terraform/services/activedirectory/resource_active_directory_domain_trust_test.go index d8834d24e77c..eacf8b2353d9 100644 --- a/mmv1/third_party/terraform/tests/resource_active_directory_domain_trust_test.go +++ b/mmv1/third_party/terraform/services/activedirectory/resource_active_directory_domain_trust_test.go @@ -1,4 +1,4 @@ -package google +package activedirectory_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/resource_active_directory_domain_update_test.go b/mmv1/third_party/terraform/services/activedirectory/resource_active_directory_domain_update_test.go similarity index 99% rename from mmv1/third_party/terraform/tests/resource_active_directory_domain_update_test.go rename to mmv1/third_party/terraform/services/activedirectory/resource_active_directory_domain_update_test.go index 0c54b37e0e98..f88bc7f5e808 100644 --- a/mmv1/third_party/terraform/tests/resource_active_directory_domain_update_test.go +++ b/mmv1/third_party/terraform/services/activedirectory/resource_active_directory_domain_update_test.go @@ -1,4 +1,4 @@ -package google +package activedirectory_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/data_source_alloydb_supported_database_flags_test.go b/mmv1/third_party/terraform/services/alloydb/data_source_alloydb_supported_database_flags_test.go similarity index 99% rename from mmv1/third_party/terraform/tests/data_source_alloydb_supported_database_flags_test.go rename to mmv1/third_party/terraform/services/alloydb/data_source_alloydb_supported_database_flags_test.go index 468bd0718373..c8b499facb37 100644 --- a/mmv1/third_party/terraform/tests/data_source_alloydb_supported_database_flags_test.go +++ b/mmv1/third_party/terraform/services/alloydb/data_source_alloydb_supported_database_flags_test.go @@ -1,4 +1,4 @@ -package google +package alloydb_test import ( "errors" diff --git a/mmv1/third_party/terraform/tests/resource_apigee_instance_test.go b/mmv1/third_party/terraform/services/apigee/resource_apigee_instance_test.go similarity index 99% rename from mmv1/third_party/terraform/tests/resource_apigee_instance_test.go rename to mmv1/third_party/terraform/services/apigee/resource_apigee_instance_test.go index 15b89ff21592..13b1b5f3fcc6 100644 --- a/mmv1/third_party/terraform/tests/resource_apigee_instance_test.go +++ b/mmv1/third_party/terraform/services/apigee/resource_apigee_instance_test.go @@ -1,4 +1,4 @@ -package google +package apigee_test import ( "testing" diff --git a/mmv1/third_party/terraform/tests/resource_apigee_sync_authorization_test.go b/mmv1/third_party/terraform/services/apigee/resource_apigee_sync_authorization_test.go similarity index 99% rename from mmv1/third_party/terraform/tests/resource_apigee_sync_authorization_test.go rename to mmv1/third_party/terraform/services/apigee/resource_apigee_sync_authorization_test.go index 3954cb2b9875..9b23e9113fc2 100644 --- a/mmv1/third_party/terraform/tests/resource_apigee_sync_authorization_test.go +++ b/mmv1/third_party/terraform/services/apigee/resource_apigee_sync_authorization_test.go @@ -1,4 +1,4 @@ -package google +package apigee_test import ( "testing" diff --git a/mmv1/third_party/terraform/tests/data_source_google_app_engine_default_service_account_test.go b/mmv1/third_party/terraform/services/appengine/data_source_google_app_engine_default_service_account_test.go similarity index 98% rename from mmv1/third_party/terraform/tests/data_source_google_app_engine_default_service_account_test.go rename to mmv1/third_party/terraform/services/appengine/data_source_google_app_engine_default_service_account_test.go index 70b0886246fc..54c83c38f577 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_app_engine_default_service_account_test.go +++ b/mmv1/third_party/terraform/services/appengine/data_source_google_app_engine_default_service_account_test.go @@ -1,4 +1,4 @@ -package google +package appengine_test import ( "testing" diff --git a/mmv1/third_party/terraform/tests/resource_app_engine_application_test.go b/mmv1/third_party/terraform/services/appengine/resource_app_engine_application_test.go similarity index 99% rename from mmv1/third_party/terraform/tests/resource_app_engine_application_test.go rename to mmv1/third_party/terraform/services/appengine/resource_app_engine_application_test.go index 1b5e577d1d57..ecbd4850a27a 100644 --- a/mmv1/third_party/terraform/tests/resource_app_engine_application_test.go +++ b/mmv1/third_party/terraform/services/appengine/resource_app_engine_application_test.go @@ -1,4 +1,4 @@ -package google +package appengine_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/data_source_google_bigquery_default_service_account_test.go b/mmv1/third_party/terraform/services/bigquery/data_source_google_bigquery_default_service_account_test.go similarity index 97% rename from mmv1/third_party/terraform/tests/data_source_google_bigquery_default_service_account_test.go rename to mmv1/third_party/terraform/services/bigquery/data_source_google_bigquery_default_service_account_test.go index aedbb0fdd2c9..e95ef7e5b52f 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_bigquery_default_service_account_test.go +++ b/mmv1/third_party/terraform/services/bigquery/data_source_google_bigquery_default_service_account_test.go @@ -1,4 +1,4 @@ -package google +package bigquery_test import ( "testing" diff --git a/mmv1/third_party/terraform/tests/resource_bigquery_dataset_access_test.go b/mmv1/third_party/terraform/services/bigquery/resource_bigquery_dataset_access_test.go similarity index 99% rename from mmv1/third_party/terraform/tests/resource_bigquery_dataset_access_test.go rename to mmv1/third_party/terraform/services/bigquery/resource_bigquery_dataset_access_test.go index c3061efa6838..9d31032e783e 100644 --- a/mmv1/third_party/terraform/tests/resource_bigquery_dataset_access_test.go +++ b/mmv1/third_party/terraform/services/bigquery/resource_bigquery_dataset_access_test.go @@ -1,4 +1,4 @@ -package google +package bigquery_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/resource_bigquery_dataset_iam_member_test.go b/mmv1/third_party/terraform/services/bigquery/resource_bigquery_dataset_iam_member_test.go similarity index 98% rename from mmv1/third_party/terraform/tests/resource_bigquery_dataset_iam_member_test.go rename to mmv1/third_party/terraform/services/bigquery/resource_bigquery_dataset_iam_member_test.go index c539c71cd19e..d138457f702d 100644 --- a/mmv1/third_party/terraform/tests/resource_bigquery_dataset_iam_member_test.go +++ b/mmv1/third_party/terraform/services/bigquery/resource_bigquery_dataset_iam_member_test.go @@ -1,4 +1,4 @@ -package google +package bigquery_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/resource_bigquery_dataset_iam_test.go b/mmv1/third_party/terraform/services/bigquery/resource_bigquery_dataset_iam_test.go similarity index 97% rename from mmv1/third_party/terraform/tests/resource_bigquery_dataset_iam_test.go rename to mmv1/third_party/terraform/services/bigquery/resource_bigquery_dataset_iam_test.go index 732949478958..0b0cf42067a7 100644 --- a/mmv1/third_party/terraform/tests/resource_bigquery_dataset_iam_test.go +++ b/mmv1/third_party/terraform/services/bigquery/resource_bigquery_dataset_iam_test.go @@ -1,4 +1,4 @@ -package google +package bigquery_test import ( "fmt" @@ -62,7 +62,7 @@ func TestAccBigqueryDatasetIamMember(t *testing.T) { envvar.GetTestProjectFromEnv(), dataset, role, - serviceAccountCanonicalEmail(account)) + envvar.ServiceAccountCanonicalEmail(account)) acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, @@ -75,7 +75,7 @@ func TestAccBigqueryDatasetIamMember(t *testing.T) { resource.TestCheckResourceAttr( "google_bigquery_dataset_iam_member.member", "role", role), resource.TestCheckResourceAttr( - "google_bigquery_dataset_iam_member.member", "member", "serviceAccount:"+serviceAccountCanonicalEmail(account)), + "google_bigquery_dataset_iam_member.member", "member", "serviceAccount:"+envvar.ServiceAccountCanonicalEmail(account)), ), }, { diff --git a/mmv1/third_party/terraform/tests/resource_bigquery_job_test.go b/mmv1/third_party/terraform/services/bigquery/resource_bigquery_job_test.go similarity index 99% rename from mmv1/third_party/terraform/tests/resource_bigquery_job_test.go rename to mmv1/third_party/terraform/services/bigquery/resource_bigquery_job_test.go index a4732e8c075d..9de93bb6a2f7 100644 --- a/mmv1/third_party/terraform/tests/resource_bigquery_job_test.go +++ b/mmv1/third_party/terraform/services/bigquery/resource_bigquery_job_test.go @@ -1,4 +1,4 @@ -package google +package bigquery_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/resource_bigquery_data_transfer_config_test.go b/mmv1/third_party/terraform/services/bigquerydatatransfer/resource_bigquery_data_transfer_config_test.go similarity index 99% rename from mmv1/third_party/terraform/tests/resource_bigquery_data_transfer_config_test.go rename to mmv1/third_party/terraform/services/bigquerydatatransfer/resource_bigquery_data_transfer_config_test.go index 1bba14b45317..ed501b103f39 100644 --- a/mmv1/third_party/terraform/tests/resource_bigquery_data_transfer_config_test.go +++ b/mmv1/third_party/terraform/services/bigquerydatatransfer/resource_bigquery_data_transfer_config_test.go @@ -1,4 +1,4 @@ -package google +package bigquerydatatransfer_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/resource_bigtable_gc_policy_test.go b/mmv1/third_party/terraform/services/bigtable/resource_bigtable_gc_policy_test.go similarity index 99% rename from mmv1/third_party/terraform/tests/resource_bigtable_gc_policy_test.go rename to mmv1/third_party/terraform/services/bigtable/resource_bigtable_gc_policy_test.go index c3cf1b363f4a..5cdc98676238 100644 --- a/mmv1/third_party/terraform/tests/resource_bigtable_gc_policy_test.go +++ b/mmv1/third_party/terraform/services/bigtable/resource_bigtable_gc_policy_test.go @@ -1,4 +1,4 @@ -package google +package bigtable_test import ( "context" diff --git a/mmv1/third_party/terraform/tests/resource_bigtable_instance_iam_test.go b/mmv1/third_party/terraform/services/bigtable/resource_bigtable_instance_iam_test.go similarity index 98% rename from mmv1/third_party/terraform/tests/resource_bigtable_instance_iam_test.go rename to mmv1/third_party/terraform/services/bigtable/resource_bigtable_instance_iam_test.go index 1ed1c524c66f..bdd80fcc2fb0 100644 --- a/mmv1/third_party/terraform/tests/resource_bigtable_instance_iam_test.go +++ b/mmv1/third_party/terraform/services/bigtable/resource_bigtable_instance_iam_test.go @@ -1,4 +1,4 @@ -package google +package bigtable_test import ( "fmt" @@ -68,7 +68,7 @@ func TestAccBigtableInstanceIamMember(t *testing.T) { envvar.GetTestProjectFromEnv(), instance, role, - serviceAccountCanonicalEmail(account)) + envvar.ServiceAccountCanonicalEmail(account)) acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, @@ -81,7 +81,7 @@ func TestAccBigtableInstanceIamMember(t *testing.T) { resource.TestCheckResourceAttr( "google_bigtable_instance_iam_member.member", "role", role), resource.TestCheckResourceAttr( - "google_bigtable_instance_iam_member.member", "member", "serviceAccount:"+serviceAccountCanonicalEmail(account)), + "google_bigtable_instance_iam_member.member", "member", "serviceAccount:"+envvar.ServiceAccountCanonicalEmail(account)), ), }, { diff --git a/mmv1/third_party/terraform/tests/resource_bigtable_instance_test.go b/mmv1/third_party/terraform/services/bigtable/resource_bigtable_instance_test.go similarity index 99% rename from mmv1/third_party/terraform/tests/resource_bigtable_instance_test.go rename to mmv1/third_party/terraform/services/bigtable/resource_bigtable_instance_test.go index 39bcb1391d60..195fbd20549a 100644 --- a/mmv1/third_party/terraform/tests/resource_bigtable_instance_test.go +++ b/mmv1/third_party/terraform/services/bigtable/resource_bigtable_instance_test.go @@ -1,4 +1,4 @@ -package google +package bigtable_test import ( "context" diff --git a/mmv1/third_party/terraform/tests/resource_bigtable_table_iam_test.go b/mmv1/third_party/terraform/services/bigtable/resource_bigtable_table_iam_test.go similarity index 98% rename from mmv1/third_party/terraform/tests/resource_bigtable_table_iam_test.go rename to mmv1/third_party/terraform/services/bigtable/resource_bigtable_table_iam_test.go index ebd52a4c9105..e63f82426a22 100644 --- a/mmv1/third_party/terraform/tests/resource_bigtable_table_iam_test.go +++ b/mmv1/third_party/terraform/services/bigtable/resource_bigtable_table_iam_test.go @@ -1,4 +1,4 @@ -package google +package bigtable_test import ( "fmt" @@ -69,7 +69,7 @@ func TestAccBigtableTableIamMember(t *testing.T) { instance, cluster, role, - serviceAccountCanonicalEmail(account)) + envvar.ServiceAccountCanonicalEmail(account)) acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, @@ -82,7 +82,7 @@ func TestAccBigtableTableIamMember(t *testing.T) { resource.TestCheckResourceAttr( "google_bigtable_table_iam_member.member", "role", role), resource.TestCheckResourceAttr( - "google_bigtable_table_iam_member.member", "member", "serviceAccount:"+serviceAccountCanonicalEmail(account)), + "google_bigtable_table_iam_member.member", "member", "serviceAccount:"+envvar.ServiceAccountCanonicalEmail(account)), ), }, { diff --git a/mmv1/third_party/terraform/tests/resource_bigtable_table_test.go b/mmv1/third_party/terraform/services/bigtable/resource_bigtable_table_test.go similarity index 99% rename from mmv1/third_party/terraform/tests/resource_bigtable_table_test.go rename to mmv1/third_party/terraform/services/bigtable/resource_bigtable_table_test.go index 5a10364c73c5..6f462cd7cd40 100644 --- a/mmv1/third_party/terraform/tests/resource_bigtable_table_test.go +++ b/mmv1/third_party/terraform/services/bigtable/resource_bigtable_table_test.go @@ -1,4 +1,4 @@ -package google +package bigtable_test import ( "context" diff --git a/mmv1/third_party/terraform/tests/data_source_google_billing_account_test.go b/mmv1/third_party/terraform/services/billing/data_source_google_billing_account_test.go similarity index 99% rename from mmv1/third_party/terraform/tests/data_source_google_billing_account_test.go rename to mmv1/third_party/terraform/services/billing/data_source_google_billing_account_test.go index d0265d58470b..248d13ec6aee 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_billing_account_test.go +++ b/mmv1/third_party/terraform/services/billing/data_source_google_billing_account_test.go @@ -1,4 +1,4 @@ -package google +package billing_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/resource_google_billing_account_iam_test.go b/mmv1/third_party/terraform/services/billing/iam_billing_account_test.go similarity index 99% rename from mmv1/third_party/terraform/tests/resource_google_billing_account_iam_test.go rename to mmv1/third_party/terraform/services/billing/iam_billing_account_test.go index 174837ea712a..c09e67852dcd 100644 --- a/mmv1/third_party/terraform/tests/resource_google_billing_account_iam_test.go +++ b/mmv1/third_party/terraform/services/billing/iam_billing_account_test.go @@ -1,4 +1,4 @@ -package google +package billing_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/resource_binary_authorization_policy_test.go.erb b/mmv1/third_party/terraform/services/binaryauthorization/resource_binary_authorization_policy_test.go.erb similarity index 99% rename from mmv1/third_party/terraform/tests/resource_binary_authorization_policy_test.go.erb rename to mmv1/third_party/terraform/services/binaryauthorization/resource_binary_authorization_policy_test.go.erb index aa33b384f58e..de83906bf246 100644 --- a/mmv1/third_party/terraform/tests/resource_binary_authorization_policy_test.go.erb +++ b/mmv1/third_party/terraform/services/binaryauthorization/resource_binary_authorization_policy_test.go.erb @@ -1,5 +1,5 @@ <% autogen_exception -%> -package google +package binaryauthorization_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/data_source_google_cloud_asset_resources_search_all_test.go.erb b/mmv1/third_party/terraform/services/cloudasset/data_source_google_cloud_asset_resources_search_all_test.go.erb similarity index 98% rename from mmv1/third_party/terraform/tests/data_source_google_cloud_asset_resources_search_all_test.go.erb rename to mmv1/third_party/terraform/services/cloudasset/data_source_google_cloud_asset_resources_search_all_test.go.erb index 587bf4fd782b..1a009219876b 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_cloud_asset_resources_search_all_test.go.erb +++ b/mmv1/third_party/terraform/services/cloudasset/data_source_google_cloud_asset_resources_search_all_test.go.erb @@ -1,5 +1,5 @@ <% autogen_exception -%> -package google +package cloudasset_test <% unless version == 'ga' -%> import ( diff --git a/mmv1/third_party/terraform/tests/resource_cloudbuild_worker_pool_test.go.erb b/mmv1/third_party/terraform/services/cloudbuild/resource_cloudbuild_worker_pool_test.go.erb similarity index 99% rename from mmv1/third_party/terraform/tests/resource_cloudbuild_worker_pool_test.go.erb rename to mmv1/third_party/terraform/services/cloudbuild/resource_cloudbuild_worker_pool_test.go.erb index 53247b581b04..127249cb8636 100644 --- a/mmv1/third_party/terraform/tests/resource_cloudbuild_worker_pool_test.go.erb +++ b/mmv1/third_party/terraform/services/cloudbuild/resource_cloudbuild_worker_pool_test.go.erb @@ -1,5 +1,5 @@ <% autogen_exception -%> -package google +package cloudbuild_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/data_source_cloud_identity_group_memberships_test.go b/mmv1/third_party/terraform/services/cloudidentity/data_source_cloud_identity_group_memberships_test.go similarity index 98% rename from mmv1/third_party/terraform/tests/data_source_cloud_identity_group_memberships_test.go rename to mmv1/third_party/terraform/services/cloudidentity/data_source_cloud_identity_group_memberships_test.go index ac03c9d83b7f..2dbf02a3796b 100644 --- a/mmv1/third_party/terraform/tests/data_source_cloud_identity_group_memberships_test.go +++ b/mmv1/third_party/terraform/services/cloudidentity/data_source_cloud_identity_group_memberships_test.go @@ -1,4 +1,4 @@ -package google +package cloudidentity_test import ( "testing" diff --git a/mmv1/third_party/terraform/tests/data_source_cloud_identity_groups_test.go b/mmv1/third_party/terraform/services/cloudidentity/data_source_cloud_identity_groups_test.go similarity index 98% rename from mmv1/third_party/terraform/tests/data_source_cloud_identity_groups_test.go rename to mmv1/third_party/terraform/services/cloudidentity/data_source_cloud_identity_groups_test.go index d7e809367aef..644f56f6a31e 100644 --- a/mmv1/third_party/terraform/tests/data_source_cloud_identity_groups_test.go +++ b/mmv1/third_party/terraform/services/cloudidentity/data_source_cloud_identity_groups_test.go @@ -1,4 +1,4 @@ -package google +package cloudidentity_test import ( "regexp" diff --git a/mmv1/third_party/terraform/tests/resource_cloud_identity_group_membership_test.go.erb b/mmv1/third_party/terraform/services/cloudidentity/resource_cloud_identity_group_membership_test.go.erb similarity index 99% rename from mmv1/third_party/terraform/tests/resource_cloud_identity_group_membership_test.go.erb rename to mmv1/third_party/terraform/services/cloudidentity/resource_cloud_identity_group_membership_test.go.erb index 043c092cf726..ad373a57d9cf 100644 --- a/mmv1/third_party/terraform/tests/resource_cloud_identity_group_membership_test.go.erb +++ b/mmv1/third_party/terraform/services/cloudidentity/resource_cloud_identity_group_membership_test.go.erb @@ -1,5 +1,5 @@ <% autogen_exception -%> -package google +package cloudidentity_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/resource_cloud_identity_group_test.go.erb b/mmv1/third_party/terraform/services/cloudidentity/resource_cloud_identity_group_test.go.erb similarity index 99% rename from mmv1/third_party/terraform/tests/resource_cloud_identity_group_test.go.erb rename to mmv1/third_party/terraform/services/cloudidentity/resource_cloud_identity_group_test.go.erb index 312c56fe8bfb..c49a17fd2c6f 100644 --- a/mmv1/third_party/terraform/tests/resource_cloud_identity_group_test.go.erb +++ b/mmv1/third_party/terraform/services/cloudidentity/resource_cloud_identity_group_test.go.erb @@ -1,5 +1,5 @@ <% autogen_exception -%> -package google +package cloudidentity_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/resource_cloudids_endpoint_test.go b/mmv1/third_party/terraform/services/cloudids/resource_cloudids_endpoint_test.go similarity index 99% rename from mmv1/third_party/terraform/tests/resource_cloudids_endpoint_test.go rename to mmv1/third_party/terraform/services/cloudids/resource_cloudids_endpoint_test.go index 8869dc7149a1..1e9afe51a0a4 100644 --- a/mmv1/third_party/terraform/tests/resource_cloudids_endpoint_test.go +++ b/mmv1/third_party/terraform/services/cloudids/resource_cloudids_endpoint_test.go @@ -1,4 +1,4 @@ -package google +package cloudids_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/resource_cloudiot_device_registry_id_test.go b/mmv1/third_party/terraform/services/cloudiot/resource_cloudiot_device_registry_id_test.go similarity index 98% rename from mmv1/third_party/terraform/tests/resource_cloudiot_device_registry_id_test.go rename to mmv1/third_party/terraform/services/cloudiot/resource_cloudiot_device_registry_id_test.go index be868abe72fb..41d926e421e0 100644 --- a/mmv1/third_party/terraform/tests/resource_cloudiot_device_registry_id_test.go +++ b/mmv1/third_party/terraform/services/cloudiot/resource_cloudiot_device_registry_id_test.go @@ -1,4 +1,4 @@ -package google +package cloudiot_test import ( "strings" diff --git a/mmv1/third_party/terraform/tests/data_source_cloud_run_locations_test.go b/mmv1/third_party/terraform/services/cloudrun/data_source_cloud_run_locations_test.go similarity index 98% rename from mmv1/third_party/terraform/tests/data_source_cloud_run_locations_test.go rename to mmv1/third_party/terraform/services/cloudrun/data_source_cloud_run_locations_test.go index 89410b935d7b..de8207776687 100644 --- a/mmv1/third_party/terraform/tests/data_source_cloud_run_locations_test.go +++ b/mmv1/third_party/terraform/services/cloudrun/data_source_cloud_run_locations_test.go @@ -1,4 +1,4 @@ -package google +package cloudrun_test import ( "errors" diff --git a/mmv1/third_party/terraform/tests/resource_cloud_run_service_test.go.erb b/mmv1/third_party/terraform/services/cloudrun/resource_cloud_run_service_test.go.erb similarity index 99% rename from mmv1/third_party/terraform/tests/resource_cloud_run_service_test.go.erb rename to mmv1/third_party/terraform/services/cloudrun/resource_cloud_run_service_test.go.erb index 644bf281febc..58cf13fad286 100644 --- a/mmv1/third_party/terraform/tests/resource_cloud_run_service_test.go.erb +++ b/mmv1/third_party/terraform/services/cloudrun/resource_cloud_run_service_test.go.erb @@ -1,5 +1,5 @@ <% autogen_exception -%> -package google +package cloudrun_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/resource_cloud_tasks_queue_test.go.erb b/mmv1/third_party/terraform/services/cloudtasks/resource_cloud_tasks_queue_test.go.erb similarity index 99% rename from mmv1/third_party/terraform/tests/resource_cloud_tasks_queue_test.go.erb rename to mmv1/third_party/terraform/services/cloudtasks/resource_cloud_tasks_queue_test.go.erb index eff13754c92c..c6a325dec6b1 100644 --- a/mmv1/third_party/terraform/tests/resource_cloud_tasks_queue_test.go.erb +++ b/mmv1/third_party/terraform/services/cloudtasks/resource_cloud_tasks_queue_test.go.erb @@ -1,5 +1,5 @@ <% autogen_exception -%> -package google +package cloudtasks_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/data_source_google_composer_environment_test.go b/mmv1/third_party/terraform/services/composer/data_source_google_composer_environment_test.go similarity index 99% rename from mmv1/third_party/terraform/tests/data_source_google_composer_environment_test.go rename to mmv1/third_party/terraform/services/composer/data_source_google_composer_environment_test.go index 411cdb41c2d5..b01db3b3e114 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_composer_environment_test.go +++ b/mmv1/third_party/terraform/services/composer/data_source_google_composer_environment_test.go @@ -1,4 +1,4 @@ -package google +package composer_test import ( "errors" diff --git a/mmv1/third_party/terraform/tests/data_source_google_composer_image_versions_test.go b/mmv1/third_party/terraform/services/composer/data_source_google_composer_image_versions_test.go similarity index 98% rename from mmv1/third_party/terraform/tests/data_source_google_composer_image_versions_test.go rename to mmv1/third_party/terraform/services/composer/data_source_google_composer_image_versions_test.go index 0fe8ad79c441..7d7f32e93829 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_composer_image_versions_test.go +++ b/mmv1/third_party/terraform/services/composer/data_source_google_composer_image_versions_test.go @@ -1,4 +1,4 @@ -package google +package composer_test import ( "errors" diff --git a/mmv1/third_party/terraform/tests/resource_composer_environment_test.go.erb b/mmv1/third_party/terraform/services/composer/resource_composer_environment_test.go.erb similarity index 99% rename from mmv1/third_party/terraform/tests/resource_composer_environment_test.go.erb rename to mmv1/third_party/terraform/services/composer/resource_composer_environment_test.go.erb index ddc49e006a8f..9b17426eb0af 100644 --- a/mmv1/third_party/terraform/tests/resource_composer_environment_test.go.erb +++ b/mmv1/third_party/terraform/services/composer/resource_composer_environment_test.go.erb @@ -1,5 +1,5 @@ <% autogen_exception -%> -package google +package composer_test import ( "fmt" @@ -491,13 +491,13 @@ func TestAccComposerEnvironment_ComposerV2(t *testing.T) { func TestAccComposerEnvironment_UpdateComposerV2ResilienceMode(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{ { diff --git a/mmv1/third_party/terraform/tests/data_source_compute_health_check_test.go b/mmv1/third_party/terraform/services/compute/data_source_compute_health_check_test.go similarity index 98% rename from mmv1/third_party/terraform/tests/data_source_compute_health_check_test.go rename to mmv1/third_party/terraform/services/compute/data_source_compute_health_check_test.go index 2e8fca587d17..227ba947b2bd 100644 --- a/mmv1/third_party/terraform/tests/data_source_compute_health_check_test.go +++ b/mmv1/third_party/terraform/services/compute/data_source_compute_health_check_test.go @@ -1,4 +1,4 @@ -package google +package compute_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/data_source_compute_lb_ip_ranges_test.go b/mmv1/third_party/terraform/services/compute/data_source_compute_lb_ip_ranges_test.go similarity index 98% rename from mmv1/third_party/terraform/tests/data_source_compute_lb_ip_ranges_test.go rename to mmv1/third_party/terraform/services/compute/data_source_compute_lb_ip_ranges_test.go index 00fb02f1c7a7..e1d390a4dbf4 100644 --- a/mmv1/third_party/terraform/tests/data_source_compute_lb_ip_ranges_test.go +++ b/mmv1/third_party/terraform/services/compute/data_source_compute_lb_ip_ranges_test.go @@ -1,4 +1,4 @@ -package google +package compute_test import ( "regexp" diff --git a/mmv1/third_party/terraform/tests/data_source_compute_network_endpoint_group_test.go b/mmv1/third_party/terraform/services/compute/data_source_compute_network_endpoint_group_test.go similarity index 99% rename from mmv1/third_party/terraform/tests/data_source_compute_network_endpoint_group_test.go rename to mmv1/third_party/terraform/services/compute/data_source_compute_network_endpoint_group_test.go index b3e0f85bc982..c5eca5ce8554 100644 --- a/mmv1/third_party/terraform/tests/data_source_compute_network_endpoint_group_test.go +++ b/mmv1/third_party/terraform/services/compute/data_source_compute_network_endpoint_group_test.go @@ -1,4 +1,4 @@ -package google +package compute_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/data_source_compute_network_peering_test.go b/mmv1/third_party/terraform/services/compute/data_source_compute_network_peering_test.go similarity index 98% rename from mmv1/third_party/terraform/tests/data_source_compute_network_peering_test.go rename to mmv1/third_party/terraform/services/compute/data_source_compute_network_peering_test.go index 6c75ad995b6c..74fdc83dbf38 100644 --- a/mmv1/third_party/terraform/tests/data_source_compute_network_peering_test.go +++ b/mmv1/third_party/terraform/services/compute/data_source_compute_network_peering_test.go @@ -1,4 +1,4 @@ -package google +package compute_test import ( "testing" diff --git a/mmv1/third_party/terraform/tests/data_source_google_compute_address_test.go b/mmv1/third_party/terraform/services/compute/data_source_google_compute_address_test.go similarity index 99% rename from mmv1/third_party/terraform/tests/data_source_google_compute_address_test.go rename to mmv1/third_party/terraform/services/compute/data_source_google_compute_address_test.go index 1db42441b96f..ab4a6799bb0f 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_compute_address_test.go +++ b/mmv1/third_party/terraform/services/compute/data_source_google_compute_address_test.go @@ -1,4 +1,4 @@ -package google +package compute_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/data_source_google_compute_addresses_test.go.erb b/mmv1/third_party/terraform/services/compute/data_source_google_compute_addresses_test.go.erb similarity index 99% rename from mmv1/third_party/terraform/tests/data_source_google_compute_addresses_test.go.erb rename to mmv1/third_party/terraform/services/compute/data_source_google_compute_addresses_test.go.erb index 48bef7b79e61..7b496e2f2d5c 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_compute_addresses_test.go.erb +++ b/mmv1/third_party/terraform/services/compute/data_source_google_compute_addresses_test.go.erb @@ -1,5 +1,5 @@ <% autogen_exception -%> -package google +package compute_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/data_source_google_compute_default_service_account_test.go b/mmv1/third_party/terraform/services/compute/data_source_google_compute_default_service_account_test.go similarity index 98% rename from mmv1/third_party/terraform/tests/data_source_google_compute_default_service_account_test.go rename to mmv1/third_party/terraform/services/compute/data_source_google_compute_default_service_account_test.go index 54671f112f6c..0642da014051 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_compute_default_service_account_test.go +++ b/mmv1/third_party/terraform/services/compute/data_source_google_compute_default_service_account_test.go @@ -1,4 +1,4 @@ -package google +package compute_test import ( "testing" diff --git a/mmv1/third_party/terraform/tests/data_source_google_compute_forwarding_rule_test.go b/mmv1/third_party/terraform/services/compute/data_source_google_compute_forwarding_rule_test.go similarity index 98% rename from mmv1/third_party/terraform/tests/data_source_google_compute_forwarding_rule_test.go rename to mmv1/third_party/terraform/services/compute/data_source_google_compute_forwarding_rule_test.go index 63ecfe67fc18..1238648064a5 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_compute_forwarding_rule_test.go +++ b/mmv1/third_party/terraform/services/compute/data_source_google_compute_forwarding_rule_test.go @@ -1,4 +1,4 @@ -package google +package compute_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/data_source_google_compute_ha_vpn_gateway_test.go b/mmv1/third_party/terraform/services/compute/data_source_google_compute_ha_vpn_gateway_test.go similarity index 98% rename from mmv1/third_party/terraform/tests/data_source_google_compute_ha_vpn_gateway_test.go rename to mmv1/third_party/terraform/services/compute/data_source_google_compute_ha_vpn_gateway_test.go index c6c12755bc89..c805fb84c257 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_compute_ha_vpn_gateway_test.go +++ b/mmv1/third_party/terraform/services/compute/data_source_google_compute_ha_vpn_gateway_test.go @@ -1,4 +1,4 @@ -package google +package compute_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/data_source_google_compute_instance_group_manager_test.go b/mmv1/third_party/terraform/services/compute/data_source_google_compute_instance_group_manager_test.go similarity index 99% rename from mmv1/third_party/terraform/tests/data_source_google_compute_instance_group_manager_test.go rename to mmv1/third_party/terraform/services/compute/data_source_google_compute_instance_group_manager_test.go index cd3d37b830b5..b782d540a58b 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_compute_instance_group_manager_test.go +++ b/mmv1/third_party/terraform/services/compute/data_source_google_compute_instance_group_manager_test.go @@ -1,4 +1,4 @@ -package google +package compute_test import ( "testing" diff --git a/mmv1/third_party/terraform/tests/data_source_google_compute_instance_group_test.go.erb b/mmv1/third_party/terraform/services/compute/data_source_google_compute_instance_group_test.go.erb similarity index 99% rename from mmv1/third_party/terraform/tests/data_source_google_compute_instance_group_test.go.erb rename to mmv1/third_party/terraform/services/compute/data_source_google_compute_instance_group_test.go.erb index d535292c6e57..92f9df28982f 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_compute_instance_group_test.go.erb +++ b/mmv1/third_party/terraform/services/compute/data_source_google_compute_instance_group_test.go.erb @@ -1,5 +1,5 @@ <% autogen_exception -%> -package google +package compute_test import ( "errors" diff --git a/mmv1/third_party/terraform/tests/data_source_google_compute_instance_serial_port_test.go b/mmv1/third_party/terraform/services/compute/data_source_google_compute_instance_serial_port_test.go similarity index 99% rename from mmv1/third_party/terraform/tests/data_source_google_compute_instance_serial_port_test.go rename to mmv1/third_party/terraform/services/compute/data_source_google_compute_instance_serial_port_test.go index 0bc8fd492efb..4e2b9f67fd68 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_compute_instance_serial_port_test.go +++ b/mmv1/third_party/terraform/services/compute/data_source_google_compute_instance_serial_port_test.go @@ -1,4 +1,4 @@ -package google +package compute_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/data_source_google_compute_instance_template_test.go b/mmv1/third_party/terraform/services/compute/data_source_google_compute_instance_template_test.go similarity index 99% rename from mmv1/third_party/terraform/tests/data_source_google_compute_instance_template_test.go rename to mmv1/third_party/terraform/services/compute/data_source_google_compute_instance_template_test.go index 3e728ec09c9a..9ed0dffc7f67 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_compute_instance_template_test.go +++ b/mmv1/third_party/terraform/services/compute/data_source_google_compute_instance_template_test.go @@ -1,4 +1,4 @@ -package google +package compute_test import ( "testing" diff --git a/mmv1/third_party/terraform/tests/data_source_google_compute_network_test.go b/mmv1/third_party/terraform/services/compute/data_source_google_compute_network_test.go similarity index 99% rename from mmv1/third_party/terraform/tests/data_source_google_compute_network_test.go rename to mmv1/third_party/terraform/services/compute/data_source_google_compute_network_test.go index fb5ec6630a9b..6018f5f83e93 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_compute_network_test.go +++ b/mmv1/third_party/terraform/services/compute/data_source_google_compute_network_test.go @@ -1,4 +1,4 @@ -package google +package compute_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/data_source_google_compute_node_types_test.go b/mmv1/third_party/terraform/services/compute/data_source_google_compute_node_types_test.go similarity index 98% rename from mmv1/third_party/terraform/tests/data_source_google_compute_node_types_test.go rename to mmv1/third_party/terraform/services/compute/data_source_google_compute_node_types_test.go index ca977cfe97ae..fdc3bf16655c 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_compute_node_types_test.go +++ b/mmv1/third_party/terraform/services/compute/data_source_google_compute_node_types_test.go @@ -1,4 +1,4 @@ -package google +package compute_test import ( "errors" diff --git a/mmv1/third_party/terraform/tests/data_source_google_compute_region_instance_group_test.go.erb b/mmv1/third_party/terraform/services/compute/data_source_google_compute_region_instance_group_test.go.erb similarity index 99% rename from mmv1/third_party/terraform/tests/data_source_google_compute_region_instance_group_test.go.erb rename to mmv1/third_party/terraform/services/compute/data_source_google_compute_region_instance_group_test.go.erb index b8740c8a2938..6dfdc51c626b 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_compute_region_instance_group_test.go.erb +++ b/mmv1/third_party/terraform/services/compute/data_source_google_compute_region_instance_group_test.go.erb @@ -1,5 +1,5 @@ <% autogen_exception -%> -package google +package compute_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/data_source_google_compute_region_instance_template_test.go.erb b/mmv1/third_party/terraform/services/compute/data_source_google_compute_region_instance_template_test.go.erb similarity index 99% rename from mmv1/third_party/terraform/tests/data_source_google_compute_region_instance_template_test.go.erb rename to mmv1/third_party/terraform/services/compute/data_source_google_compute_region_instance_template_test.go.erb index 79521de6a391..6c32fddcb0d6 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_compute_region_instance_template_test.go.erb +++ b/mmv1/third_party/terraform/services/compute/data_source_google_compute_region_instance_template_test.go.erb @@ -1,6 +1,6 @@ <% autogen_exception -%> -package google +package compute_test <% unless version == 'ga' -%> diff --git a/mmv1/third_party/terraform/tests/data_source_google_compute_region_network_endpoint_group_test.go b/mmv1/third_party/terraform/services/compute/data_source_google_compute_region_network_endpoint_group_test.go similarity index 98% rename from mmv1/third_party/terraform/tests/data_source_google_compute_region_network_endpoint_group_test.go rename to mmv1/third_party/terraform/services/compute/data_source_google_compute_region_network_endpoint_group_test.go index ab4854349f6f..764ee739757f 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_compute_region_network_endpoint_group_test.go +++ b/mmv1/third_party/terraform/services/compute/data_source_google_compute_region_network_endpoint_group_test.go @@ -1,4 +1,4 @@ -package google +package compute_test import ( "testing" diff --git a/mmv1/third_party/terraform/tests/data_source_google_compute_regions_test.go b/mmv1/third_party/terraform/services/compute/data_source_google_compute_regions_test.go similarity index 98% rename from mmv1/third_party/terraform/tests/data_source_google_compute_regions_test.go rename to mmv1/third_party/terraform/services/compute/data_source_google_compute_regions_test.go index 421db78043b8..9ed5fb1ca1bd 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_compute_regions_test.go +++ b/mmv1/third_party/terraform/services/compute/data_source_google_compute_regions_test.go @@ -1,4 +1,4 @@ -package google +package compute_test import ( "errors" diff --git a/mmv1/third_party/terraform/tests/data_source_google_compute_resource_policy_test.go b/mmv1/third_party/terraform/services/compute/data_source_google_compute_resource_policy_test.go similarity index 99% rename from mmv1/third_party/terraform/tests/data_source_google_compute_resource_policy_test.go rename to mmv1/third_party/terraform/services/compute/data_source_google_compute_resource_policy_test.go index 0aaab391adb4..a5faa5aecd5b 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_compute_resource_policy_test.go +++ b/mmv1/third_party/terraform/services/compute/data_source_google_compute_resource_policy_test.go @@ -1,4 +1,4 @@ -package google +package compute_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/data_source_google_compute_router_nat_test.go b/mmv1/third_party/terraform/services/compute/data_source_google_compute_router_nat_test.go similarity index 99% rename from mmv1/third_party/terraform/tests/data_source_google_compute_router_nat_test.go rename to mmv1/third_party/terraform/services/compute/data_source_google_compute_router_nat_test.go index 31aa46bbc8af..5b83f2a003cd 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_compute_router_nat_test.go +++ b/mmv1/third_party/terraform/services/compute/data_source_google_compute_router_nat_test.go @@ -1,4 +1,4 @@ -package google +package compute_test import ( "testing" diff --git a/mmv1/third_party/terraform/tests/data_source_google_compute_router_test.go b/mmv1/third_party/terraform/services/compute/data_source_google_compute_router_test.go similarity index 98% rename from mmv1/third_party/terraform/tests/data_source_google_compute_router_test.go rename to mmv1/third_party/terraform/services/compute/data_source_google_compute_router_test.go index 42c2fd8cdccd..d3daad9b6b10 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_compute_router_test.go +++ b/mmv1/third_party/terraform/services/compute/data_source_google_compute_router_test.go @@ -1,4 +1,4 @@ -package google +package compute_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/data_source_google_compute_snapshot_test.go b/mmv1/third_party/terraform/services/compute/data_source_google_compute_snapshot_test.go similarity index 99% rename from mmv1/third_party/terraform/tests/data_source_google_compute_snapshot_test.go rename to mmv1/third_party/terraform/services/compute/data_source_google_compute_snapshot_test.go index 87fa3c711035..97c0c1111646 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_compute_snapshot_test.go +++ b/mmv1/third_party/terraform/services/compute/data_source_google_compute_snapshot_test.go @@ -1,4 +1,4 @@ -package google +package compute_test import ( "testing" diff --git a/mmv1/third_party/terraform/tests/data_source_google_compute_ssl_policy_test.go b/mmv1/third_party/terraform/services/compute/data_source_google_compute_ssl_policy_test.go similarity index 99% rename from mmv1/third_party/terraform/tests/data_source_google_compute_ssl_policy_test.go rename to mmv1/third_party/terraform/services/compute/data_source_google_compute_ssl_policy_test.go index 29b12529c051..3cfc6ba2f74d 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_compute_ssl_policy_test.go +++ b/mmv1/third_party/terraform/services/compute/data_source_google_compute_ssl_policy_test.go @@ -1,4 +1,4 @@ -package google +package compute_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/data_source_google_compute_subnetwork_test.go b/mmv1/third_party/terraform/services/compute/data_source_google_compute_subnetwork_test.go similarity index 99% rename from mmv1/third_party/terraform/tests/data_source_google_compute_subnetwork_test.go rename to mmv1/third_party/terraform/services/compute/data_source_google_compute_subnetwork_test.go index 03ec1659d940..dade57dd4ad5 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_compute_subnetwork_test.go +++ b/mmv1/third_party/terraform/services/compute/data_source_google_compute_subnetwork_test.go @@ -1,4 +1,4 @@ -package google +package compute_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/data_source_google_compute_vpn_gateway_test.go b/mmv1/third_party/terraform/services/compute/data_source_google_compute_vpn_gateway_test.go similarity index 99% rename from mmv1/third_party/terraform/tests/data_source_google_compute_vpn_gateway_test.go rename to mmv1/third_party/terraform/services/compute/data_source_google_compute_vpn_gateway_test.go index d22b5297a90a..3592a7e961e8 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_compute_vpn_gateway_test.go +++ b/mmv1/third_party/terraform/services/compute/data_source_google_compute_vpn_gateway_test.go @@ -1,4 +1,4 @@ -package google +package compute_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/data_source_google_compute_zones_test.go b/mmv1/third_party/terraform/services/compute/data_source_google_compute_zones_test.go similarity index 99% rename from mmv1/third_party/terraform/tests/data_source_google_compute_zones_test.go rename to mmv1/third_party/terraform/services/compute/data_source_google_compute_zones_test.go index 042ff2e25438..2043795a8ede 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_compute_zones_test.go +++ b/mmv1/third_party/terraform/services/compute/data_source_google_compute_zones_test.go @@ -1,4 +1,4 @@ -package google +package compute_test import ( "errors" diff --git a/mmv1/third_party/terraform/tests/data_source_google_global_compute_forwarding_rule_test.go b/mmv1/third_party/terraform/services/compute/data_source_google_global_compute_forwarding_rule_test.go similarity index 98% rename from mmv1/third_party/terraform/tests/data_source_google_global_compute_forwarding_rule_test.go rename to mmv1/third_party/terraform/services/compute/data_source_google_global_compute_forwarding_rule_test.go index c6f43e9c2128..70e2f3e6099d 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_global_compute_forwarding_rule_test.go +++ b/mmv1/third_party/terraform/services/compute/data_source_google_global_compute_forwarding_rule_test.go @@ -1,4 +1,4 @@ -package google +package compute_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/resource_compute_instance_iam_test.go b/mmv1/third_party/terraform/services/compute/iam_compute_instance_test.go similarity index 99% rename from mmv1/third_party/terraform/tests/resource_compute_instance_iam_test.go rename to mmv1/third_party/terraform/services/compute/iam_compute_instance_test.go index 378850467992..5c3452ade3a2 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_instance_iam_test.go +++ b/mmv1/third_party/terraform/services/compute/iam_compute_instance_test.go @@ -1,4 +1,4 @@ -package google +package compute_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/resource_compute_subnetwork_iam_test.go b/mmv1/third_party/terraform/services/compute/iam_compute_subnetwork_test.go similarity index 99% rename from mmv1/third_party/terraform/tests/resource_compute_subnetwork_iam_test.go rename to mmv1/third_party/terraform/services/compute/iam_compute_subnetwork_test.go index 9971549c8edf..2b6f2dbf41ab 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_subnetwork_iam_test.go +++ b/mmv1/third_party/terraform/services/compute/iam_compute_subnetwork_test.go @@ -1,4 +1,4 @@ -package google +package compute_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/resource_compute_attached_disk_test.go b/mmv1/third_party/terraform/services/compute/resource_compute_attached_disk_test.go similarity index 99% rename from mmv1/third_party/terraform/tests/resource_compute_attached_disk_test.go rename to mmv1/third_party/terraform/services/compute/resource_compute_attached_disk_test.go index b228ff1f658a..90b0bbd45f5b 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_attached_disk_test.go +++ b/mmv1/third_party/terraform/services/compute/resource_compute_attached_disk_test.go @@ -1,4 +1,4 @@ -package google +package compute_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/resource_compute_backend_bucket_signed_url_key_test.go b/mmv1/third_party/terraform/services/compute/resource_compute_backend_bucket_signed_url_key_test.go similarity index 99% rename from mmv1/third_party/terraform/tests/resource_compute_backend_bucket_signed_url_key_test.go rename to mmv1/third_party/terraform/services/compute/resource_compute_backend_bucket_signed_url_key_test.go index 92cede7b1c18..61fef3376e49 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_backend_bucket_signed_url_key_test.go +++ b/mmv1/third_party/terraform/services/compute/resource_compute_backend_bucket_signed_url_key_test.go @@ -1,4 +1,4 @@ -package google +package compute_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/resource_compute_backend_service_signed_url_key_test.go b/mmv1/third_party/terraform/services/compute/resource_compute_backend_service_signed_url_key_test.go similarity index 99% rename from mmv1/third_party/terraform/tests/resource_compute_backend_service_signed_url_key_test.go rename to mmv1/third_party/terraform/services/compute/resource_compute_backend_service_signed_url_key_test.go index 8f8d2404d059..9f473a2bcb88 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_backend_service_signed_url_key_test.go +++ b/mmv1/third_party/terraform/services/compute/resource_compute_backend_service_signed_url_key_test.go @@ -1,4 +1,4 @@ -package google +package compute_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/resource_compute_disk_async_replication_test.go.erb b/mmv1/third_party/terraform/services/compute/resource_compute_disk_async_replication_test.go.erb similarity index 97% rename from mmv1/third_party/terraform/tests/resource_compute_disk_async_replication_test.go.erb rename to mmv1/third_party/terraform/services/compute/resource_compute_disk_async_replication_test.go.erb index ff87ab3e2071..ded0d6b89de1 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_disk_async_replication_test.go.erb +++ b/mmv1/third_party/terraform/services/compute/resource_compute_disk_async_replication_test.go.erb @@ -1,5 +1,5 @@ <% autogen_exception -%> -package google +package compute_test <% if version != "ga" -%> import ( @@ -9,13 +9,14 @@ 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/envvar" "github.com/hashicorp/terraform-provider-google/google/tpgresource" ) func TestAccComputeDiskAsyncReplication(t *testing.T) { t.Parallel() - region := GetTestRegionFromEnv() + region := envvar.GetTestRegionFromEnv() if !tpgresource.StringInSlice([]string{"europe-west2", "europe-west1", "us-central1", "us-east1", "us-west1", "us-east4", "asia-east1", "australia-southeast1"}, region) { return } diff --git a/mmv1/third_party/terraform/tests/resource_compute_disk_resource_policy_attachment_test.go b/mmv1/third_party/terraform/services/compute/resource_compute_disk_resource_policy_attachment_test.go similarity index 99% rename from mmv1/third_party/terraform/tests/resource_compute_disk_resource_policy_attachment_test.go rename to mmv1/third_party/terraform/services/compute/resource_compute_disk_resource_policy_attachment_test.go index 6b2ff033f7fa..5d60bd8c9ae5 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_disk_resource_policy_attachment_test.go +++ b/mmv1/third_party/terraform/services/compute/resource_compute_disk_resource_policy_attachment_test.go @@ -1,4 +1,4 @@ -package google +package compute_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/resource_compute_external_vpn_gateway_test.go b/mmv1/third_party/terraform/services/compute/resource_compute_external_vpn_gateway_test.go similarity index 98% rename from mmv1/third_party/terraform/tests/resource_compute_external_vpn_gateway_test.go rename to mmv1/third_party/terraform/services/compute/resource_compute_external_vpn_gateway_test.go index 675e568fc6a7..5f34bac1a1d4 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_external_vpn_gateway_test.go +++ b/mmv1/third_party/terraform/services/compute/resource_compute_external_vpn_gateway_test.go @@ -1,4 +1,4 @@ -package google +package compute_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/resource_compute_firewall_policy_association_test.go b/mmv1/third_party/terraform/services/compute/resource_compute_firewall_policy_association_test.go similarity index 98% rename from mmv1/third_party/terraform/tests/resource_compute_firewall_policy_association_test.go rename to mmv1/third_party/terraform/services/compute/resource_compute_firewall_policy_association_test.go index 5dde02fb4265..2ea633ec07f8 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_firewall_policy_association_test.go +++ b/mmv1/third_party/terraform/services/compute/resource_compute_firewall_policy_association_test.go @@ -1,4 +1,4 @@ -package google +package compute_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/resource_compute_firewall_policy_rule_test.go.erb b/mmv1/third_party/terraform/services/compute/resource_compute_firewall_policy_rule_test.go.erb similarity index 99% rename from mmv1/third_party/terraform/tests/resource_compute_firewall_policy_rule_test.go.erb rename to mmv1/third_party/terraform/services/compute/resource_compute_firewall_policy_rule_test.go.erb index 0682692a9a6d..3dfddb0a0661 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_firewall_policy_rule_test.go.erb +++ b/mmv1/third_party/terraform/services/compute/resource_compute_firewall_policy_rule_test.go.erb @@ -1,5 +1,5 @@ <% autogen_exception -%> -package google +package compute_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/resource_compute_global_network_endpoint_test.go.erb b/mmv1/third_party/terraform/services/compute/resource_compute_global_network_endpoint_test.go.erb similarity index 99% rename from mmv1/third_party/terraform/tests/resource_compute_global_network_endpoint_test.go.erb rename to mmv1/third_party/terraform/services/compute/resource_compute_global_network_endpoint_test.go.erb index d94893656460..5ea499110655 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_global_network_endpoint_test.go.erb +++ b/mmv1/third_party/terraform/services/compute/resource_compute_global_network_endpoint_test.go.erb @@ -1,5 +1,5 @@ <% autogen_exception -%> -package google +package compute_test import ( "fmt" "testing" diff --git a/mmv1/third_party/terraform/tests/resource_compute_instance_group_manager_test.go.erb b/mmv1/third_party/terraform/services/compute/resource_compute_instance_group_manager_test.go.erb similarity index 99% rename from mmv1/third_party/terraform/tests/resource_compute_instance_group_manager_test.go.erb rename to mmv1/third_party/terraform/services/compute/resource_compute_instance_group_manager_test.go.erb index 3642b4c57775..242ce11257e9 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_instance_group_manager_test.go.erb +++ b/mmv1/third_party/terraform/services/compute/resource_compute_instance_group_manager_test.go.erb @@ -1,5 +1,5 @@ <% autogen_exception -%> -package google +package compute_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/resource_compute_instance_group_test.go.erb b/mmv1/third_party/terraform/services/compute/resource_compute_instance_group_test.go.erb similarity index 99% rename from mmv1/third_party/terraform/tests/resource_compute_instance_group_test.go.erb rename to mmv1/third_party/terraform/services/compute/resource_compute_instance_group_test.go.erb index 56441b97456e..e80025eefb50 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_instance_group_test.go.erb +++ b/mmv1/third_party/terraform/services/compute/resource_compute_instance_group_test.go.erb @@ -1,5 +1,5 @@ <% autogen_exception -%> -package google +package compute_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/resource_compute_network_endpoint_test.go.erb b/mmv1/third_party/terraform/services/compute/resource_compute_network_endpoint_test.go.erb similarity index 99% rename from mmv1/third_party/terraform/tests/resource_compute_network_endpoint_test.go.erb rename to mmv1/third_party/terraform/services/compute/resource_compute_network_endpoint_test.go.erb index 1dc31fe5045b..455c922092c2 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_network_endpoint_test.go.erb +++ b/mmv1/third_party/terraform/services/compute/resource_compute_network_endpoint_test.go.erb @@ -1,5 +1,5 @@ <% autogen_exception -%> -package google +package compute_test import ( "fmt" "testing" diff --git a/mmv1/third_party/terraform/tests/resource_compute_network_endpoints_test.go.erb b/mmv1/third_party/terraform/services/compute/resource_compute_network_endpoints_test.go.erb similarity index 99% rename from mmv1/third_party/terraform/tests/resource_compute_network_endpoints_test.go.erb rename to mmv1/third_party/terraform/services/compute/resource_compute_network_endpoints_test.go.erb index 5ed5057141be..a9cefd1a4699 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_network_endpoints_test.go.erb +++ b/mmv1/third_party/terraform/services/compute/resource_compute_network_endpoints_test.go.erb @@ -1,5 +1,5 @@ <% autogen_exception -%> -package google +package compute_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/resource_compute_network_peering_test.go b/mmv1/third_party/terraform/services/compute/resource_compute_network_peering_test.go similarity index 98% rename from mmv1/third_party/terraform/tests/resource_compute_network_peering_test.go rename to mmv1/third_party/terraform/services/compute/resource_compute_network_peering_test.go index 18bd000cd71e..eddbf475e12c 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_network_peering_test.go +++ b/mmv1/third_party/terraform/services/compute/resource_compute_network_peering_test.go @@ -1,4 +1,4 @@ -package google +package compute_test import ( "fmt" @@ -111,7 +111,7 @@ func TestAccComputeNetworkPeering_stackType(t *testing.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) + importId := fmt.Sprintf("%s/%s/%s", envvar.GetTestProjectFromEnv(), primaryNetworkName, peeringName) acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, diff --git a/mmv1/third_party/terraform/tests/resource_compute_per_instance_config_test.go.erb b/mmv1/third_party/terraform/services/compute/resource_compute_per_instance_config_test.go.erb similarity index 99% rename from mmv1/third_party/terraform/tests/resource_compute_per_instance_config_test.go.erb rename to mmv1/third_party/terraform/services/compute/resource_compute_per_instance_config_test.go.erb index f43566731528..6845a651d0af 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_per_instance_config_test.go.erb +++ b/mmv1/third_party/terraform/services/compute/resource_compute_per_instance_config_test.go.erb @@ -1,5 +1,5 @@ <% autogen_exception -%> -package google +package compute_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/resource_compute_project_default_network_tier_test.go b/mmv1/third_party/terraform/services/compute/resource_compute_project_default_network_tier_test.go similarity index 99% rename from mmv1/third_party/terraform/tests/resource_compute_project_default_network_tier_test.go rename to mmv1/third_party/terraform/services/compute/resource_compute_project_default_network_tier_test.go index 466320c80219..78c7a9b9640c 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_project_default_network_tier_test.go +++ b/mmv1/third_party/terraform/services/compute/resource_compute_project_default_network_tier_test.go @@ -1,4 +1,4 @@ -package google +package compute_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/resource_compute_project_metadata_item_test.go b/mmv1/third_party/terraform/services/compute/resource_compute_project_metadata_item_test.go similarity index 99% rename from mmv1/third_party/terraform/tests/resource_compute_project_metadata_item_test.go rename to mmv1/third_party/terraform/services/compute/resource_compute_project_metadata_item_test.go index 2b33fcb92422..df00a8f1c5d5 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_project_metadata_item_test.go +++ b/mmv1/third_party/terraform/services/compute/resource_compute_project_metadata_item_test.go @@ -1,4 +1,4 @@ -package google +package compute_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/resource_compute_project_metadata_test.go b/mmv1/third_party/terraform/services/compute/resource_compute_project_metadata_test.go similarity index 99% rename from mmv1/third_party/terraform/tests/resource_compute_project_metadata_test.go rename to mmv1/third_party/terraform/services/compute/resource_compute_project_metadata_test.go index b6f85b6c5648..72bf9a78e622 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_project_metadata_test.go +++ b/mmv1/third_party/terraform/services/compute/resource_compute_project_metadata_test.go @@ -1,4 +1,4 @@ -package google +package compute_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/resource_compute_public_advertised_prefix_test.go b/mmv1/third_party/terraform/services/compute/resource_compute_public_advertised_prefix_test.go similarity index 99% rename from mmv1/third_party/terraform/tests/resource_compute_public_advertised_prefix_test.go rename to mmv1/third_party/terraform/services/compute/resource_compute_public_advertised_prefix_test.go index acbbb6bd4f37..b8fa4b9aa8a0 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_public_advertised_prefix_test.go +++ b/mmv1/third_party/terraform/services/compute/resource_compute_public_advertised_prefix_test.go @@ -1,4 +1,4 @@ -package google +package compute_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/resource_compute_region_instance_group_manager_test.go.erb b/mmv1/third_party/terraform/services/compute/resource_compute_region_instance_group_manager_test.go.erb similarity index 99% rename from mmv1/third_party/terraform/tests/resource_compute_region_instance_group_manager_test.go.erb rename to mmv1/third_party/terraform/services/compute/resource_compute_region_instance_group_manager_test.go.erb index ae6d2404c2f7..66d02e002cc3 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_region_instance_group_manager_test.go.erb +++ b/mmv1/third_party/terraform/services/compute/resource_compute_region_instance_group_manager_test.go.erb @@ -1,5 +1,5 @@ <% autogen_exception -%> -package google +package compute_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/resource_compute_region_per_instance_config_test.go.erb b/mmv1/third_party/terraform/services/compute/resource_compute_region_per_instance_config_test.go.erb similarity index 99% rename from mmv1/third_party/terraform/tests/resource_compute_region_per_instance_config_test.go.erb rename to mmv1/third_party/terraform/services/compute/resource_compute_region_per_instance_config_test.go.erb index 628a2888973b..65b57187ddc9 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_region_per_instance_config_test.go.erb +++ b/mmv1/third_party/terraform/services/compute/resource_compute_region_per_instance_config_test.go.erb @@ -1,5 +1,5 @@ <% autogen_exception -%> -package google +package compute_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/resource_compute_router_bgp_peer_test.go b/mmv1/third_party/terraform/services/compute/resource_compute_router_bgp_peer_test.go similarity index 99% rename from mmv1/third_party/terraform/tests/resource_compute_router_bgp_peer_test.go rename to mmv1/third_party/terraform/services/compute/resource_compute_router_bgp_peer_test.go index de9e2eb70463..be85f30a154a 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_router_bgp_peer_test.go +++ b/mmv1/third_party/terraform/services/compute/resource_compute_router_bgp_peer_test.go @@ -1,4 +1,4 @@ -package google +package compute_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/resource_compute_router_interface_test.go b/mmv1/third_party/terraform/services/compute/resource_compute_router_interface_test.go similarity index 99% rename from mmv1/third_party/terraform/tests/resource_compute_router_interface_test.go rename to mmv1/third_party/terraform/services/compute/resource_compute_router_interface_test.go index de650b885430..036d8685119c 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_router_interface_test.go +++ b/mmv1/third_party/terraform/services/compute/resource_compute_router_interface_test.go @@ -1,4 +1,4 @@ -package google +package compute_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/resource_compute_router_nat_test.go.erb b/mmv1/third_party/terraform/services/compute/resource_compute_router_nat_test.go.erb similarity index 99% rename from mmv1/third_party/terraform/tests/resource_compute_router_nat_test.go.erb rename to mmv1/third_party/terraform/services/compute/resource_compute_router_nat_test.go.erb index d1b10b6c004d..5ecc97a8da16 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_router_nat_test.go.erb +++ b/mmv1/third_party/terraform/services/compute/resource_compute_router_nat_test.go.erb @@ -1,5 +1,5 @@ <% autogen_exception -%> -package google +package compute_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/resource_compute_security_policy_test.go.erb b/mmv1/third_party/terraform/services/compute/resource_compute_security_policy_test.go.erb similarity index 99% rename from mmv1/third_party/terraform/tests/resource_compute_security_policy_test.go.erb rename to mmv1/third_party/terraform/services/compute/resource_compute_security_policy_test.go.erb index 23d4ceffe327..2b657ecdf379 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_security_policy_test.go.erb +++ b/mmv1/third_party/terraform/services/compute/resource_compute_security_policy_test.go.erb @@ -1,5 +1,5 @@ <% autogen_exception -%> -package google +package compute_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/resource_compute_shared_vpc_test.go b/mmv1/third_party/terraform/services/compute/resource_compute_shared_vpc_test.go similarity index 99% rename from mmv1/third_party/terraform/tests/resource_compute_shared_vpc_test.go rename to mmv1/third_party/terraform/services/compute/resource_compute_shared_vpc_test.go index 65ccab6e28e9..61d16cf7fa4f 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_shared_vpc_test.go +++ b/mmv1/third_party/terraform/services/compute/resource_compute_shared_vpc_test.go @@ -1,4 +1,4 @@ -package google +package compute_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/resource_compute_target_pool_test.go b/mmv1/third_party/terraform/services/compute/resource_compute_target_pool_test.go similarity index 99% rename from mmv1/third_party/terraform/tests/resource_compute_target_pool_test.go rename to mmv1/third_party/terraform/services/compute/resource_compute_target_pool_test.go index 4cfc7bd719d5..121e67535144 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_target_pool_test.go +++ b/mmv1/third_party/terraform/services/compute/resource_compute_target_pool_test.go @@ -1,4 +1,4 @@ -package google +package compute_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/resource_usage_export_bucket_test.go b/mmv1/third_party/terraform/services/compute/resource_usage_export_bucket_test.go similarity index 98% rename from mmv1/third_party/terraform/tests/resource_usage_export_bucket_test.go rename to mmv1/third_party/terraform/services/compute/resource_usage_export_bucket_test.go index ee53b66e4f53..238cc7a0caa7 100644 --- a/mmv1/third_party/terraform/tests/resource_usage_export_bucket_test.go +++ b/mmv1/third_party/terraform/services/compute/resource_usage_export_bucket_test.go @@ -1,4 +1,4 @@ -package google +package compute_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/data_source_google_container_cluster_test.go b/mmv1/third_party/terraform/services/container/data_source_google_container_cluster_test.go similarity index 99% rename from mmv1/third_party/terraform/tests/data_source_google_container_cluster_test.go rename to mmv1/third_party/terraform/services/container/data_source_google_container_cluster_test.go index c98f959ce4bd..a4725f5c2a61 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_container_cluster_test.go +++ b/mmv1/third_party/terraform/services/container/data_source_google_container_cluster_test.go @@ -1,4 +1,4 @@ -package google +package container_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/data_source_google_container_engine_versions_test.go b/mmv1/third_party/terraform/services/container/data_source_google_container_engine_versions_test.go similarity index 99% rename from mmv1/third_party/terraform/tests/data_source_google_container_engine_versions_test.go rename to mmv1/third_party/terraform/services/container/data_source_google_container_engine_versions_test.go index 4ea2bd0a1a91..f27f43f7f7cc 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_container_engine_versions_test.go +++ b/mmv1/third_party/terraform/services/container/data_source_google_container_engine_versions_test.go @@ -1,4 +1,4 @@ -package google +package container_test import ( "errors" diff --git a/mmv1/third_party/terraform/tests/resource_container_cluster_test.go.erb b/mmv1/third_party/terraform/services/container/resource_container_cluster_test.go.erb similarity index 98% rename from mmv1/third_party/terraform/tests/resource_container_cluster_test.go.erb rename to mmv1/third_party/terraform/services/container/resource_container_cluster_test.go.erb index 3ed25346a93e..efc1da82f7f4 100644 --- a/mmv1/third_party/terraform/tests/resource_container_cluster_test.go.erb +++ b/mmv1/third_party/terraform/services/container/resource_container_cluster_test.go.erb @@ -1,12 +1,11 @@ <% autogen_exception -%> -package google +package container_test import ( "bytes" "fmt" "testing" "regexp" - "strconv" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" @@ -3731,111 +3730,6 @@ func testAccCheckContainerClusterDestroyProducer(t *testing.T) func(s *terraform } } -func getResourceAttributes(n string, s *terraform.State) (map[string]string, error) { - rs, ok := s.RootModule().Resources[n] - if !ok { - return nil, fmt.Errorf("Not found: %s", n) - } - - if rs.Primary.ID == "" { - return nil, fmt.Errorf("No ID is set") - } - - return rs.Primary.Attributes, nil -} - -func checkMatch(attributes map[string]string, attr string, gcp interface{}) string { - if gcpList, ok := gcp.([]string); ok { - return checkListMatch(attributes, attr, gcpList) - } - if gcpMap, ok := gcp.(map[string]string); ok { - return checkMapMatch(attributes, attr, gcpMap) - } - if gcpBool, ok := gcp.(bool); ok { - return checkBoolMatch(attributes, attr, gcpBool) - } - - tf := attributes[attr] - if tf != gcp { - return matchError(attr, tf, gcp) - } - return "" -} - -func checkListMatch(attributes map[string]string, attr string, gcpList []string) string { - // A bunch of the TestAccDataprocJob_* tests fail without this. It's likely an inaccuracy that happens when shimming the terraform-json - // representation of state back to the old framework's representation of state. So, in the past we would get x.# = 0 whereas now we get x.# = ''. - // It's likely not intentional, however, shouldn't be a big problem - but if we notice it is the sdk team can address it. - if attributes[attr+".#"] == "" { - attributes[attr+".#"] = "0" - } - - num, err := strconv.Atoi(attributes[attr+".#"]) - if err != nil { - return fmt.Sprintf("Error in number conversion for attribute %s: %s", attr, err) - } - if num != len(gcpList) { - return fmt.Sprintf("Cluster has mismatched %s size.\nTF Size: %d\nGCP Size: %d", attr, num, len(gcpList)) - } - - for i, gcp := range gcpList { - if tf := attributes[fmt.Sprintf("%s.%d", attr, i)]; tf != gcp { - return matchError(fmt.Sprintf("%s[%d]", attr, i), tf, gcp) - } - } - - return "" -} - -func checkMapMatch(attributes map[string]string, attr string, gcpMap map[string]string) string { - // A bunch of the TestAccDataprocJob_* tests fail without this. It's likely an inaccuracy that happens when shimming the terraform-json - // representation of state back to the old framework's representation of state. So, in the past we would get x.# = 0 whereas now we get x.# = ''. - // It's likely not intentional, however, shouldn't be a big problem - but if we notice it is the sdk team can address it. - if attributes[attr+".%"] == "" { - attributes[attr+".%"] = "0" - } - - num, err := strconv.Atoi(attributes[attr+".%"]) - if err != nil { - return fmt.Sprintf("Error in number conversion for attribute %s: %s", attr, err) - } - if num != len(gcpMap) { - return fmt.Sprintf("Cluster has mismatched %s size.\nTF Size: %d\nGCP Size: %d", attr, num, len(gcpMap)) - } - - for k, gcp := range gcpMap { - if tf := attributes[fmt.Sprintf("%s.%s", attr, k)]; tf != gcp { - return matchError(fmt.Sprintf("%s[%s]", attr, k), tf, gcp) - } - } - - return "" -} - -func checkBoolMatch(attributes map[string]string, attr string, gcpBool bool) string { - // Handle the case where an unset value defaults to false - var tf bool - var err error - if attributes[attr] == "" { - tf = false - } else { - tf, err = strconv.ParseBool(attributes[attr]) - if err != nil { - return fmt.Sprintf("Error converting attribute %s to boolean: value is %s", attr, attributes[attr]) - } - } - - if tf != gcpBool { - return matchError(attr, tf, gcpBool) - } - - return "" -} - -func matchError(attr, tf interface{}, gcp interface{}) string { - return fmt.Sprintf("Cluster has mismatched %s.\nTF State: %+v\nGCP State: %+v", attr, tf, gcp) -} - func testAccContainerCluster_basic(name string) string { return fmt.Sprintf(` resource "google_container_cluster" "primary" { diff --git a/mmv1/third_party/terraform/tests/resource_container_node_pool_test.go.erb b/mmv1/third_party/terraform/services/container/resource_container_node_pool_test.go.erb similarity index 99% rename from mmv1/third_party/terraform/tests/resource_container_node_pool_test.go.erb rename to mmv1/third_party/terraform/services/container/resource_container_node_pool_test.go.erb index 1e46eaac15b4..390f1228369b 100644 --- a/mmv1/third_party/terraform/tests/resource_container_node_pool_test.go.erb +++ b/mmv1/third_party/terraform/services/container/resource_container_node_pool_test.go.erb @@ -1,5 +1,5 @@ <% autogen_exception -%> -package google +package container_test import ( "fmt" @@ -3085,13 +3085,13 @@ func TestAccContainerNodePool_tpuTopology(t *testing.T) { t.Parallel() acctest.SkipIfVcr(t) - 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{ { diff --git a/mmv1/third_party/terraform/tests/data_source_container_registry_test.go b/mmv1/third_party/terraform/services/containeranalysis/data_source_container_registry_test.go similarity index 98% rename from mmv1/third_party/terraform/tests/data_source_container_registry_test.go rename to mmv1/third_party/terraform/services/containeranalysis/data_source_container_registry_test.go index 3fc3f7e337fc..dfdd8b4644b2 100644 --- a/mmv1/third_party/terraform/tests/data_source_container_registry_test.go +++ b/mmv1/third_party/terraform/services/containeranalysis/data_source_container_registry_test.go @@ -1,4 +1,4 @@ -package google +package containeranalysis_test import ( "testing" diff --git a/mmv1/third_party/terraform/tests/resource_container_registry_test.go b/mmv1/third_party/terraform/services/containeranalysis/resource_container_registry_test.go similarity index 98% rename from mmv1/third_party/terraform/tests/resource_container_registry_test.go rename to mmv1/third_party/terraform/services/containeranalysis/resource_container_registry_test.go index 6c1f3aeed65a..9b0734e21ba5 100644 --- a/mmv1/third_party/terraform/tests/resource_container_registry_test.go +++ b/mmv1/third_party/terraform/services/containeranalysis/resource_container_registry_test.go @@ -1,4 +1,4 @@ -package google +package containeranalysis_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/data_source_google_container_attached_install_manifest_test.go b/mmv1/third_party/terraform/services/containerattached/data_source_google_container_attached_install_manifest_test.go similarity index 98% rename from mmv1/third_party/terraform/tests/data_source_google_container_attached_install_manifest_test.go rename to mmv1/third_party/terraform/services/containerattached/data_source_google_container_attached_install_manifest_test.go index 49cab5efb501..e2cc88a52e47 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_container_attached_install_manifest_test.go +++ b/mmv1/third_party/terraform/services/containerattached/data_source_google_container_attached_install_manifest_test.go @@ -1,4 +1,4 @@ -package google +package containerattached_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/data_source_google_container_attached_versions_test.go b/mmv1/third_party/terraform/services/containerattached/data_source_google_container_attached_versions_test.go similarity index 98% rename from mmv1/third_party/terraform/tests/data_source_google_container_attached_versions_test.go rename to mmv1/third_party/terraform/services/containerattached/data_source_google_container_attached_versions_test.go index a1ae762bb8fb..40fd1dd0440f 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_container_attached_versions_test.go +++ b/mmv1/third_party/terraform/services/containerattached/data_source_google_container_attached_versions_test.go @@ -1,4 +1,4 @@ -package google +package containerattached_test import ( "errors" diff --git a/mmv1/third_party/terraform/tests/resource_database_migration_service_connection_profile_test.go b/mmv1/third_party/terraform/services/databasemigrationservice/resource_database_migration_service_connection_profile_test.go similarity index 98% rename from mmv1/third_party/terraform/tests/resource_database_migration_service_connection_profile_test.go rename to mmv1/third_party/terraform/services/databasemigrationservice/resource_database_migration_service_connection_profile_test.go index 6fb6f79877d0..598da3507871 100644 --- a/mmv1/third_party/terraform/tests/resource_database_migration_service_connection_profile_test.go +++ b/mmv1/third_party/terraform/services/databasemigrationservice/resource_database_migration_service_connection_profile_test.go @@ -1,4 +1,4 @@ -package google +package databasemigrationservice_test import ( "testing" diff --git a/mmv1/third_party/terraform/tests/resource_dataflow_flex_template_job_test.go.erb b/mmv1/third_party/terraform/services/dataflow/resource_dataflow_flex_template_job_test.go.erb similarity index 99% rename from mmv1/third_party/terraform/tests/resource_dataflow_flex_template_job_test.go.erb rename to mmv1/third_party/terraform/services/dataflow/resource_dataflow_flex_template_job_test.go.erb index c75a463a43a3..577ec7f63de8 100644 --- a/mmv1/third_party/terraform/tests/resource_dataflow_flex_template_job_test.go.erb +++ b/mmv1/third_party/terraform/services/dataflow/resource_dataflow_flex_template_job_test.go.erb @@ -1,5 +1,5 @@ <% autogen_exception -%> -package google +package dataflow_test <% unless version == 'ga' -%> import ( @@ -369,7 +369,7 @@ func testAccDataflowFlexTemplateJobHasNetwork(t *testing.T, res, expected string return fmt.Errorf("no network interfaces in template properties: %+v", instanceTmpl.Properties) } actual := instanceTmpl.Properties.NetworkInterfaces[0].Network - if GetResourceNameFromSelfLink(actual) != GetResourceNameFromSelfLink(expected) { + if tpgresource.GetResourceNameFromSelfLink(actual) != tpgresource.GetResourceNameFromSelfLink(expected) { return fmt.Errorf("network mismatch: %s != %s", actual, expected) } return nil @@ -386,7 +386,7 @@ func testAccDataflowFlexTemplateJobHasSubNetwork(t *testing.T, res, expected str return fmt.Errorf("no network interfaces in template properties: %+v", instanceTmpl.Properties) } actual := instanceTmpl.Properties.NetworkInterfaces[0].Subnetwork - if GetResourceNameFromSelfLink(actual) != GetResourceNameFromSelfLink(expected) { + if tpgresource.GetResourceNameFromSelfLink(actual) != tpgresource.GetResourceNameFromSelfLink(expected) { return fmt.Errorf("subnetwork mismatch: %s != %s", actual, expected) } return nil diff --git a/mmv1/third_party/terraform/tests/resource_dataflow_job_test.go.erb b/mmv1/third_party/terraform/services/dataflow/resource_dataflow_job_test.go.erb similarity index 99% rename from mmv1/third_party/terraform/tests/resource_dataflow_job_test.go.erb rename to mmv1/third_party/terraform/services/dataflow/resource_dataflow_job_test.go.erb index ac6789135fbc..9f4f69035a8f 100644 --- a/mmv1/third_party/terraform/tests/resource_dataflow_job_test.go.erb +++ b/mmv1/third_party/terraform/services/dataflow/resource_dataflow_job_test.go.erb @@ -1,5 +1,5 @@ <% autogen_exception -%> -package google +package dataflow_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/resource_dataproc_cluster_iam_test.go b/mmv1/third_party/terraform/services/dataproc/iam_dataproc_cluster_test.go similarity index 98% rename from mmv1/third_party/terraform/tests/resource_dataproc_cluster_iam_test.go rename to mmv1/third_party/terraform/services/dataproc/iam_dataproc_cluster_test.go index 2aa921017dbf..71cc92e15c56 100644 --- a/mmv1/third_party/terraform/tests/resource_dataproc_cluster_iam_test.go +++ b/mmv1/third_party/terraform/services/dataproc/iam_dataproc_cluster_test.go @@ -1,4 +1,4 @@ -package google +package dataproc_test import ( "fmt" @@ -63,7 +63,7 @@ func TestAccDataprocClusterIamMember(t *testing.T) { "us-central1", cluster, role, - serviceAccountCanonicalEmail(account)) + envvar.ServiceAccountCanonicalEmail(account)) acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, @@ -76,7 +76,7 @@ func TestAccDataprocClusterIamMember(t *testing.T) { resource.TestCheckResourceAttr( "google_dataproc_cluster_iam_member.member", "role", role), resource.TestCheckResourceAttr( - "google_dataproc_cluster_iam_member.member", "member", "serviceAccount:"+serviceAccountCanonicalEmail(account)), + "google_dataproc_cluster_iam_member.member", "member", "serviceAccount:"+envvar.ServiceAccountCanonicalEmail(account)), ), }, { diff --git a/mmv1/third_party/terraform/tests/resource_dataproc_job_iam_test.go b/mmv1/third_party/terraform/services/dataproc/iam_dataproc_job_test.go similarity index 98% rename from mmv1/third_party/terraform/tests/resource_dataproc_job_iam_test.go rename to mmv1/third_party/terraform/services/dataproc/iam_dataproc_job_test.go index 596fe7a37774..db870b514093 100644 --- a/mmv1/third_party/terraform/tests/resource_dataproc_job_iam_test.go +++ b/mmv1/third_party/terraform/services/dataproc/iam_dataproc_job_test.go @@ -1,4 +1,4 @@ -package google +package dataproc_test import ( "fmt" @@ -61,7 +61,7 @@ func TestAccDataprocJobIamMember(t *testing.T) { "us-central1", job, role, - serviceAccountCanonicalEmail(account)) + envvar.ServiceAccountCanonicalEmail(account)) acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, diff --git a/mmv1/third_party/terraform/tests/resource_dataproc_cluster_test.go.erb b/mmv1/third_party/terraform/services/dataproc/resource_dataproc_cluster_test.go.erb similarity index 99% rename from mmv1/third_party/terraform/tests/resource_dataproc_cluster_test.go.erb rename to mmv1/third_party/terraform/services/dataproc/resource_dataproc_cluster_test.go.erb index 6ee40530a18f..4e0f97060275 100644 --- a/mmv1/third_party/terraform/tests/resource_dataproc_cluster_test.go.erb +++ b/mmv1/third_party/terraform/services/dataproc/resource_dataproc_cluster_test.go.erb @@ -1,5 +1,5 @@ <% autogen_exception -%> -package google +package dataproc_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/resource_dataproc_job_test.go.erb b/mmv1/third_party/terraform/services/dataproc/resource_dataproc_job_test.go.erb similarity index 88% rename from mmv1/third_party/terraform/tests/resource_dataproc_job_test.go.erb rename to mmv1/third_party/terraform/services/dataproc/resource_dataproc_job_test.go.erb index f9ec11a17a3f..c5e00cbf0494 100644 --- a/mmv1/third_party/terraform/tests/resource_dataproc_job_test.go.erb +++ b/mmv1/third_party/terraform/services/dataproc/resource_dataproc_job_test.go.erb @@ -1,5 +1,5 @@ <% autogen_exception -%> -package google +package dataproc_test import ( "fmt" @@ -8,6 +8,7 @@ import ( "strings" "testing" "time" + "strconv" // "regexp" @@ -16,6 +17,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" "github.com/hashicorp/terraform-provider-google/google/acctest" tpgdataproc "github.com/hashicorp/terraform-provider-google/google/services/dataproc" + "github.com/hashicorp/terraform-provider-google/google/tpgresource" "google.golang.org/api/googleapi" "google.golang.org/api/dataproc/v1" ) @@ -429,7 +431,7 @@ func testAccCheckDataprocJobExists(t *testing.T, n string, job *dataproc.Job) re func testAccCheckDataprocJobAttrMatch(n, jobType string, job *dataproc.Job) resource.TestCheckFunc { return func(s *terraform.State) error { - attributes, err := getResourceAttributes(n, s) + attributes, err := tpgresource.GetResourceAttributes(n, s) if err != nil { return err } @@ -511,6 +513,98 @@ func testAccCheckDataprocJobAttrMatch(n, jobType string, job *dataproc.Job) reso } } +func checkMatch(attributes map[string]string, attr string, gcp interface{}) string { + if gcpList, ok := gcp.([]string); ok { + return checkListMatch(attributes, attr, gcpList) + } + if gcpMap, ok := gcp.(map[string]string); ok { + return checkMapMatch(attributes, attr, gcpMap) + } + if gcpBool, ok := gcp.(bool); ok { + return checkBoolMatch(attributes, attr, gcpBool) + } + + tf := attributes[attr] + if tf != gcp { + return matchError(attr, tf, gcp) + } + return "" +} + +func checkListMatch(attributes map[string]string, attr string, gcpList []string) string { + // A bunch of the TestAccDataprocJob_* tests fail without this. It's likely an inaccuracy that happens when shimming the terraform-json + // representation of state back to the old framework's representation of state. So, in the past we would get x.# = 0 whereas now we get x.# = ''. + // It's likely not intentional, however, shouldn't be a big problem - but if we notice it is the sdk team can address it. + if attributes[attr+".#"] == "" { + attributes[attr+".#"] = "0" + } + + num, err := strconv.Atoi(attributes[attr+".#"]) + if err != nil { + return fmt.Sprintf("Error in number conversion for attribute %s: %s", attr, err) + } + if num != len(gcpList) { + return fmt.Sprintf("Cluster has mismatched %s size.\nTF Size: %d\nGCP Size: %d", attr, num, len(gcpList)) + } + + for i, gcp := range gcpList { + if tf := attributes[fmt.Sprintf("%s.%d", attr, i)]; tf != gcp { + return matchError(fmt.Sprintf("%s[%d]", attr, i), tf, gcp) + } + } + + return "" +} + +func checkMapMatch(attributes map[string]string, attr string, gcpMap map[string]string) string { + // A bunch of the TestAccDataprocJob_* tests fail without this. It's likely an inaccuracy that happens when shimming the terraform-json + // representation of state back to the old framework's representation of state. So, in the past we would get x.# = 0 whereas now we get x.# = ''. + // It's likely not intentional, however, shouldn't be a big problem - but if we notice it is the sdk team can address it. + if attributes[attr+".%"] == "" { + attributes[attr+".%"] = "0" + } + + num, err := strconv.Atoi(attributes[attr+".%"]) + if err != nil { + return fmt.Sprintf("Error in number conversion for attribute %s: %s", attr, err) + } + if num != len(gcpMap) { + return fmt.Sprintf("Cluster has mismatched %s size.\nTF Size: %d\nGCP Size: %d", attr, num, len(gcpMap)) + } + + for k, gcp := range gcpMap { + if tf := attributes[fmt.Sprintf("%s.%s", attr, k)]; tf != gcp { + return matchError(fmt.Sprintf("%s[%s]", attr, k), tf, gcp) + } + } + + return "" +} + +func checkBoolMatch(attributes map[string]string, attr string, gcpBool bool) string { + // Handle the case where an unset value defaults to false + var tf bool + var err error + if attributes[attr] == "" { + tf = false + } else { + tf, err = strconv.ParseBool(attributes[attr]) + if err != nil { + return fmt.Sprintf("Error converting attribute %s to boolean: value is %s", attr, attributes[attr]) + } + } + + if tf != gcpBool { + return matchError(attr, tf, gcpBool) + } + + return "" +} + +func matchError(attr, tf interface{}, gcp interface{}) string { + return fmt.Sprintf("Cluster has mismatched %s.\nTF State: %+v\nGCP State: %+v", attr, tf, gcp) +} + // TODO (mbang): Test `ExactlyOneOf` here // func testAccDataprocJob_missingJobConf() string { // return ` diff --git a/mmv1/third_party/terraform/tests/resource_dataproc_workflow_template_test.go.erb b/mmv1/third_party/terraform/services/dataproc/resource_dataproc_workflow_template_test.go.erb similarity index 99% rename from mmv1/third_party/terraform/tests/resource_dataproc_workflow_template_test.go.erb rename to mmv1/third_party/terraform/services/dataproc/resource_dataproc_workflow_template_test.go.erb index a277266a01a4..65afbe1c1026 100644 --- a/mmv1/third_party/terraform/tests/resource_dataproc_workflow_template_test.go.erb +++ b/mmv1/third_party/terraform/services/dataproc/resource_dataproc_workflow_template_test.go.erb @@ -1,5 +1,5 @@ <% autogen_exception -%> -package google +package dataproc_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/data_source_dataproc_metastore_service_test.go.erb b/mmv1/third_party/terraform/services/dataprocmetastore/data_source_dataproc_metastore_service_test.go.erb similarity index 97% rename from mmv1/third_party/terraform/tests/data_source_dataproc_metastore_service_test.go.erb rename to mmv1/third_party/terraform/services/dataprocmetastore/data_source_dataproc_metastore_service_test.go.erb index aecedcf75e4e..23832fffb79c 100644 --- a/mmv1/third_party/terraform/tests/data_source_dataproc_metastore_service_test.go.erb +++ b/mmv1/third_party/terraform/services/dataprocmetastore/data_source_dataproc_metastore_service_test.go.erb @@ -1,5 +1,5 @@ <% autogen_exception -%> -package google +package dataprocmetastore_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/data_source_google_datastream_static_ips_test.go b/mmv1/third_party/terraform/services/datastream/data_source_google_datastream_static_ips_test.go similarity index 98% rename from mmv1/third_party/terraform/tests/data_source_google_datastream_static_ips_test.go rename to mmv1/third_party/terraform/services/datastream/data_source_google_datastream_static_ips_test.go index 4ecb636fda1a..a583f340d2f1 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_datastream_static_ips_test.go +++ b/mmv1/third_party/terraform/services/datastream/data_source_google_datastream_static_ips_test.go @@ -1,4 +1,4 @@ -package google +package datastream_test import ( "regexp" diff --git a/mmv1/third_party/terraform/tests/resource_dialogflow_agent_test.go.erb b/mmv1/third_party/terraform/services/dialogflow/resource_dialogflow_agent_test.go.erb similarity index 99% rename from mmv1/third_party/terraform/tests/resource_dialogflow_agent_test.go.erb rename to mmv1/third_party/terraform/services/dialogflow/resource_dialogflow_agent_test.go.erb index 4303142fd9c0..68b136a4c9c2 100644 --- a/mmv1/third_party/terraform/tests/resource_dialogflow_agent_test.go.erb +++ b/mmv1/third_party/terraform/services/dialogflow/resource_dialogflow_agent_test.go.erb @@ -1,5 +1,5 @@ <% autogen_exception -%> -package google +package dialogflow_test import ( "testing" diff --git a/mmv1/third_party/terraform/tests/resource_dialogflow_entity_type_test.go.erb b/mmv1/third_party/terraform/services/dialogflow/resource_dialogflow_entity_type_test.go.erb similarity index 99% rename from mmv1/third_party/terraform/tests/resource_dialogflow_entity_type_test.go.erb rename to mmv1/third_party/terraform/services/dialogflow/resource_dialogflow_entity_type_test.go.erb index 83be3a594e66..3c8a77a9ea1b 100644 --- a/mmv1/third_party/terraform/tests/resource_dialogflow_entity_type_test.go.erb +++ b/mmv1/third_party/terraform/services/dialogflow/resource_dialogflow_entity_type_test.go.erb @@ -1,5 +1,5 @@ <% autogen_exception -%> -package google +package dialogflow_test import ( "testing" diff --git a/mmv1/third_party/terraform/tests/resource_dialogflow_fulfillment_test.go.erb b/mmv1/third_party/terraform/services/dialogflow/resource_dialogflow_fulfillment_test.go.erb similarity index 99% rename from mmv1/third_party/terraform/tests/resource_dialogflow_fulfillment_test.go.erb rename to mmv1/third_party/terraform/services/dialogflow/resource_dialogflow_fulfillment_test.go.erb index f37701a23e2e..c1c896bdac54 100644 --- a/mmv1/third_party/terraform/tests/resource_dialogflow_fulfillment_test.go.erb +++ b/mmv1/third_party/terraform/services/dialogflow/resource_dialogflow_fulfillment_test.go.erb @@ -1,5 +1,5 @@ <% autogen_exception -%> -package google +package dialogflow_test import ( "testing" diff --git a/mmv1/third_party/terraform/tests/resource_dialogflow_intent_test.go.erb b/mmv1/third_party/terraform/services/dialogflow/resource_dialogflow_intent_test.go.erb similarity index 99% rename from mmv1/third_party/terraform/tests/resource_dialogflow_intent_test.go.erb rename to mmv1/third_party/terraform/services/dialogflow/resource_dialogflow_intent_test.go.erb index c39d1c6b9ab1..48ffbf858d09 100644 --- a/mmv1/third_party/terraform/tests/resource_dialogflow_intent_test.go.erb +++ b/mmv1/third_party/terraform/services/dialogflow/resource_dialogflow_intent_test.go.erb @@ -1,5 +1,5 @@ <% autogen_exception -%> -package google +package dialogflow_test import ( "testing" diff --git a/mmv1/third_party/terraform/tests/resource_dialogflowcx_agent_test.go.erb b/mmv1/third_party/terraform/services/dialogflowcx/resource_dialogflowcx_agent_test.go.erb similarity index 99% rename from mmv1/third_party/terraform/tests/resource_dialogflowcx_agent_test.go.erb rename to mmv1/third_party/terraform/services/dialogflowcx/resource_dialogflowcx_agent_test.go.erb index 4fd5bf9b29e2..5de09aa3ac51 100644 --- a/mmv1/third_party/terraform/tests/resource_dialogflowcx_agent_test.go.erb +++ b/mmv1/third_party/terraform/services/dialogflowcx/resource_dialogflowcx_agent_test.go.erb @@ -1,5 +1,5 @@ <% autogen_exception -%> -package google +package dialogflowcx_test import ( "testing" diff --git a/mmv1/third_party/terraform/tests/resource_dialogflowcx_entity_type_test.go b/mmv1/third_party/terraform/services/dialogflowcx/resource_dialogflowcx_entity_type_test.go similarity index 99% rename from mmv1/third_party/terraform/tests/resource_dialogflowcx_entity_type_test.go rename to mmv1/third_party/terraform/services/dialogflowcx/resource_dialogflowcx_entity_type_test.go index d9d717fd8ddd..9fefa8bee057 100644 --- a/mmv1/third_party/terraform/tests/resource_dialogflowcx_entity_type_test.go +++ b/mmv1/third_party/terraform/services/dialogflowcx/resource_dialogflowcx_entity_type_test.go @@ -1,4 +1,4 @@ -package google +package dialogflowcx_test import ( "testing" diff --git a/mmv1/third_party/terraform/tests/resource_dialogflowcx_environment_test.go b/mmv1/third_party/terraform/services/dialogflowcx/resource_dialogflowcx_environment_test.go similarity index 99% rename from mmv1/third_party/terraform/tests/resource_dialogflowcx_environment_test.go rename to mmv1/third_party/terraform/services/dialogflowcx/resource_dialogflowcx_environment_test.go index ff26e7f24619..e53cf28ce2b4 100644 --- a/mmv1/third_party/terraform/tests/resource_dialogflowcx_environment_test.go +++ b/mmv1/third_party/terraform/services/dialogflowcx/resource_dialogflowcx_environment_test.go @@ -1,4 +1,4 @@ -package google +package dialogflowcx_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/resource_dialogflowcx_flow_test.go b/mmv1/third_party/terraform/services/dialogflowcx/resource_dialogflowcx_flow_test.go similarity index 99% rename from mmv1/third_party/terraform/tests/resource_dialogflowcx_flow_test.go rename to mmv1/third_party/terraform/services/dialogflowcx/resource_dialogflowcx_flow_test.go index a17d5daf807f..86a8f8133384 100644 --- a/mmv1/third_party/terraform/tests/resource_dialogflowcx_flow_test.go +++ b/mmv1/third_party/terraform/services/dialogflowcx/resource_dialogflowcx_flow_test.go @@ -1,4 +1,4 @@ -package google +package dialogflowcx_test import ( "testing" diff --git a/mmv1/third_party/terraform/tests/resource_dialogflowcx_intent_test.go b/mmv1/third_party/terraform/services/dialogflowcx/resource_dialogflowcx_intent_test.go similarity index 99% rename from mmv1/third_party/terraform/tests/resource_dialogflowcx_intent_test.go rename to mmv1/third_party/terraform/services/dialogflowcx/resource_dialogflowcx_intent_test.go index 40962fab7143..eba882c85830 100644 --- a/mmv1/third_party/terraform/tests/resource_dialogflowcx_intent_test.go +++ b/mmv1/third_party/terraform/services/dialogflowcx/resource_dialogflowcx_intent_test.go @@ -1,4 +1,4 @@ -package google +package dialogflowcx_test import ( "testing" diff --git a/mmv1/third_party/terraform/tests/resource_dialogflowcx_page_test.go b/mmv1/third_party/terraform/services/dialogflowcx/resource_dialogflowcx_page_test.go similarity index 99% rename from mmv1/third_party/terraform/tests/resource_dialogflowcx_page_test.go rename to mmv1/third_party/terraform/services/dialogflowcx/resource_dialogflowcx_page_test.go index 37c27f722e2a..9ccde1d5b8b9 100644 --- a/mmv1/third_party/terraform/tests/resource_dialogflowcx_page_test.go +++ b/mmv1/third_party/terraform/services/dialogflowcx/resource_dialogflowcx_page_test.go @@ -1,4 +1,4 @@ -package google +package dialogflowcx_test import ( "testing" diff --git a/mmv1/third_party/terraform/tests/resource_dialogflowcx_version_test.go.erb b/mmv1/third_party/terraform/services/dialogflowcx/resource_dialogflowcx_version_test.go.erb similarity index 99% rename from mmv1/third_party/terraform/tests/resource_dialogflowcx_version_test.go.erb rename to mmv1/third_party/terraform/services/dialogflowcx/resource_dialogflowcx_version_test.go.erb index 0a2fdd341f8d..8991289374a0 100644 --- a/mmv1/third_party/terraform/tests/resource_dialogflowcx_version_test.go.erb +++ b/mmv1/third_party/terraform/services/dialogflowcx/resource_dialogflowcx_version_test.go.erb @@ -1,5 +1,5 @@ <% autogen_exception -%> -package google +package dialogflowcx_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/resource_dialogflowcx_webhook_test.go b/mmv1/third_party/terraform/services/dialogflowcx/resource_dialogflowcx_webhook_test.go similarity index 99% rename from mmv1/third_party/terraform/tests/resource_dialogflowcx_webhook_test.go rename to mmv1/third_party/terraform/services/dialogflowcx/resource_dialogflowcx_webhook_test.go index 8ea3fad304e4..fbe187309990 100644 --- a/mmv1/third_party/terraform/tests/resource_dialogflowcx_webhook_test.go +++ b/mmv1/third_party/terraform/services/dialogflowcx/resource_dialogflowcx_webhook_test.go @@ -1,4 +1,4 @@ -package google +package dialogflowcx_test import ( "testing" diff --git a/mmv1/third_party/terraform/tests/data_source_dns_key_test.go.erb b/mmv1/third_party/terraform/services/dns/data_source_dns_key_test.go.erb similarity index 99% rename from mmv1/third_party/terraform/tests/data_source_dns_key_test.go.erb rename to mmv1/third_party/terraform/services/dns/data_source_dns_key_test.go.erb index d6755940f3fd..694b85c5b2fa 100644 --- a/mmv1/third_party/terraform/tests/data_source_dns_key_test.go.erb +++ b/mmv1/third_party/terraform/services/dns/data_source_dns_key_test.go.erb @@ -1,5 +1,5 @@ <% autogen_exception -%> -package google +package dns_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/data_source_dns_managed_zone_test.go.erb b/mmv1/third_party/terraform/services/dns/data_source_dns_managed_zone_test.go.erb similarity index 99% rename from mmv1/third_party/terraform/tests/data_source_dns_managed_zone_test.go.erb rename to mmv1/third_party/terraform/services/dns/data_source_dns_managed_zone_test.go.erb index 3358eaee2731..4fa2772cb764 100644 --- a/mmv1/third_party/terraform/tests/data_source_dns_managed_zone_test.go.erb +++ b/mmv1/third_party/terraform/services/dns/data_source_dns_managed_zone_test.go.erb @@ -1,5 +1,5 @@ <% autogen_exception -%> -package google +package dns_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/data_source_dns_record_set_test.go.erb b/mmv1/third_party/terraform/services/dns/data_source_dns_record_set_test.go.erb similarity index 99% rename from mmv1/third_party/terraform/tests/data_source_dns_record_set_test.go.erb rename to mmv1/third_party/terraform/services/dns/data_source_dns_record_set_test.go.erb index d65d09b919e7..b641c7734983 100644 --- a/mmv1/third_party/terraform/tests/data_source_dns_record_set_test.go.erb +++ b/mmv1/third_party/terraform/services/dns/data_source_dns_record_set_test.go.erb @@ -1,5 +1,5 @@ <% autogen_exception -%> -package google +package dns_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/resource_dns_record_set_test.go.erb b/mmv1/third_party/terraform/services/dns/resource_dns_record_set_test.go.erb similarity index 99% rename from mmv1/third_party/terraform/tests/resource_dns_record_set_test.go.erb rename to mmv1/third_party/terraform/services/dns/resource_dns_record_set_test.go.erb index 9ae9afa73acb..11f6e03b63ec 100644 --- a/mmv1/third_party/terraform/tests/resource_dns_record_set_test.go.erb +++ b/mmv1/third_party/terraform/services/dns/resource_dns_record_set_test.go.erb @@ -1,5 +1,5 @@ <% autogen_exception -%> -package google +package dns_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/resource_eventarc_channel_test.go.erb b/mmv1/third_party/terraform/services/eventarc/resource_eventarc_channel_test.go.erb similarity index 99% rename from mmv1/third_party/terraform/tests/resource_eventarc_channel_test.go.erb rename to mmv1/third_party/terraform/services/eventarc/resource_eventarc_channel_test.go.erb index fc0c07745be0..31505af90399 100644 --- a/mmv1/third_party/terraform/tests/resource_eventarc_channel_test.go.erb +++ b/mmv1/third_party/terraform/services/eventarc/resource_eventarc_channel_test.go.erb @@ -1,5 +1,5 @@ <% autogen_exception -%> -package google +package eventarc_test import ( "context" diff --git a/mmv1/third_party/terraform/tests/resource_eventarc_google_channel_config_test.go.erb b/mmv1/third_party/terraform/services/eventarc/resource_eventarc_google_channel_config_test.go.erb similarity index 99% rename from mmv1/third_party/terraform/tests/resource_eventarc_google_channel_config_test.go.erb rename to mmv1/third_party/terraform/services/eventarc/resource_eventarc_google_channel_config_test.go.erb index 98713fee80d6..1ca3f617e3f0 100644 --- a/mmv1/third_party/terraform/tests/resource_eventarc_google_channel_config_test.go.erb +++ b/mmv1/third_party/terraform/services/eventarc/resource_eventarc_google_channel_config_test.go.erb @@ -1,5 +1,5 @@ <% autogen_exception -%> -package google +package eventarc_test import ( "context" diff --git a/mmv1/third_party/terraform/tests/resource_eventarc_trigger_test.go.erb b/mmv1/third_party/terraform/services/eventarc/resource_eventarc_trigger_test.go.erb similarity index 99% rename from mmv1/third_party/terraform/tests/resource_eventarc_trigger_test.go.erb rename to mmv1/third_party/terraform/services/eventarc/resource_eventarc_trigger_test.go.erb index 53a856f49570..b5aabe2cba4a 100644 --- a/mmv1/third_party/terraform/tests/resource_eventarc_trigger_test.go.erb +++ b/mmv1/third_party/terraform/services/eventarc/resource_eventarc_trigger_test.go.erb @@ -1,5 +1,5 @@ <% autogen_exception -%> -package google +package eventarc_test import ( "context" diff --git a/mmv1/third_party/terraform/tests/data_source_google_firebase_android_app_config_test.go.erb b/mmv1/third_party/terraform/services/firebase/data_source_google_firebase_android_app_config_test.go.erb similarity index 99% rename from mmv1/third_party/terraform/tests/data_source_google_firebase_android_app_config_test.go.erb rename to mmv1/third_party/terraform/services/firebase/data_source_google_firebase_android_app_config_test.go.erb index 5567e106cae8..bf0fb75f6a73 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_firebase_android_app_config_test.go.erb +++ b/mmv1/third_party/terraform/services/firebase/data_source_google_firebase_android_app_config_test.go.erb @@ -1,5 +1,5 @@ <% autogen_exception -%> -package google +package firebase_test <% unless version == 'ga' -%> import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/data_source_google_firebase_android_app_test.go.erb b/mmv1/third_party/terraform/services/firebase/data_source_google_firebase_android_app_test.go.erb similarity index 98% rename from mmv1/third_party/terraform/tests/data_source_google_firebase_android_app_test.go.erb rename to mmv1/third_party/terraform/services/firebase/data_source_google_firebase_android_app_test.go.erb index 512148856d77..c85ece343fa2 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_firebase_android_app_test.go.erb +++ b/mmv1/third_party/terraform/services/firebase/data_source_google_firebase_android_app_test.go.erb @@ -1,5 +1,5 @@ <% autogen_exception -%> -package google +package firebase_test <% unless version == 'ga' -%> import ( "testing" diff --git a/mmv1/third_party/terraform/tests/data_source_google_firebase_apple_app_config_test.go.erb b/mmv1/third_party/terraform/services/firebase/data_source_google_firebase_apple_app_config_test.go.erb similarity index 99% rename from mmv1/third_party/terraform/tests/data_source_google_firebase_apple_app_config_test.go.erb rename to mmv1/third_party/terraform/services/firebase/data_source_google_firebase_apple_app_config_test.go.erb index 8c510844ecf5..4ee3f56d5f8e 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_firebase_apple_app_config_test.go.erb +++ b/mmv1/third_party/terraform/services/firebase/data_source_google_firebase_apple_app_config_test.go.erb @@ -1,5 +1,5 @@ <% autogen_exception -%> -package google +package firebase_test <% unless version == 'ga' -%> import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/data_source_google_firebase_apple_app_test.go.erb b/mmv1/third_party/terraform/services/firebase/data_source_google_firebase_apple_app_test.go.erb similarity index 98% rename from mmv1/third_party/terraform/tests/data_source_google_firebase_apple_app_test.go.erb rename to mmv1/third_party/terraform/services/firebase/data_source_google_firebase_apple_app_test.go.erb index d644b02464b0..983ab87dd532 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_firebase_apple_app_test.go.erb +++ b/mmv1/third_party/terraform/services/firebase/data_source_google_firebase_apple_app_test.go.erb @@ -1,5 +1,5 @@ <% autogen_exception -%> -package google +package firebase_test <% unless version == 'ga' -%> import ( "testing" diff --git a/mmv1/third_party/terraform/tests/data_source_google_firebase_web_app_test.go.erb b/mmv1/third_party/terraform/services/firebase/data_source_google_firebase_web_app_test.go.erb similarity index 98% rename from mmv1/third_party/terraform/tests/data_source_google_firebase_web_app_test.go.erb rename to mmv1/third_party/terraform/services/firebase/data_source_google_firebase_web_app_test.go.erb index 55a476684a91..6d387d96fe0b 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_firebase_web_app_test.go.erb +++ b/mmv1/third_party/terraform/services/firebase/data_source_google_firebase_web_app_test.go.erb @@ -1,5 +1,5 @@ <% autogen_exception -%> -package google +package firebase_test <% unless version == 'ga' -%> import ( "testing" diff --git a/mmv1/third_party/terraform/tests/resource_firebase_android_app_update_test.go.erb b/mmv1/third_party/terraform/services/firebase/resource_firebase_android_app_update_test.go.erb similarity index 98% rename from mmv1/third_party/terraform/tests/resource_firebase_android_app_update_test.go.erb rename to mmv1/third_party/terraform/services/firebase/resource_firebase_android_app_update_test.go.erb index a1b9415b19fd..be4f58895584 100644 --- a/mmv1/third_party/terraform/tests/resource_firebase_android_app_update_test.go.erb +++ b/mmv1/third_party/terraform/services/firebase/resource_firebase_android_app_update_test.go.erb @@ -1,5 +1,5 @@ <% autogen_exception -%> -package google +package firebase_test <% unless version == 'ga' -%> import ( diff --git a/mmv1/third_party/terraform/tests/resource_firebase_apple_app_update_test.go.erb b/mmv1/third_party/terraform/services/firebase/resource_firebase_apple_app_update_test.go.erb similarity index 98% rename from mmv1/third_party/terraform/tests/resource_firebase_apple_app_update_test.go.erb rename to mmv1/third_party/terraform/services/firebase/resource_firebase_apple_app_update_test.go.erb index 0a13e1fa88a2..0e1d6ab680eb 100644 --- a/mmv1/third_party/terraform/tests/resource_firebase_apple_app_update_test.go.erb +++ b/mmv1/third_party/terraform/services/firebase/resource_firebase_apple_app_update_test.go.erb @@ -1,5 +1,5 @@ <% autogen_exception -%> -package google +package firebase_test <% unless version == 'ga' -%> import ( diff --git a/mmv1/third_party/terraform/tests/resource_firebase_web_app_test.go.erb b/mmv1/third_party/terraform/services/firebase/resource_firebase_web_app_test.go.erb similarity index 99% rename from mmv1/third_party/terraform/tests/resource_firebase_web_app_test.go.erb rename to mmv1/third_party/terraform/services/firebase/resource_firebase_web_app_test.go.erb index 68ffd72efcd4..f5122c6ade80 100644 --- a/mmv1/third_party/terraform/tests/resource_firebase_web_app_test.go.erb +++ b/mmv1/third_party/terraform/services/firebase/resource_firebase_web_app_test.go.erb @@ -1,5 +1,5 @@ <% autogen_exception -%> -package google +package firebase_test <% unless version == 'ga' -%> import ( diff --git a/mmv1/third_party/terraform/tests/data_source_google_firebase_hosting_channel_test.go.erb b/mmv1/third_party/terraform/services/firebasehosting/data_source_google_firebase_hosting_channel_test.go.erb similarity index 98% rename from mmv1/third_party/terraform/tests/data_source_google_firebase_hosting_channel_test.go.erb rename to mmv1/third_party/terraform/services/firebasehosting/data_source_google_firebase_hosting_channel_test.go.erb index 32079d73a162..ecb0f42ddd07 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_firebase_hosting_channel_test.go.erb +++ b/mmv1/third_party/terraform/services/firebasehosting/data_source_google_firebase_hosting_channel_test.go.erb @@ -1,5 +1,5 @@ <% autogen_exception -%> -package google +package firebasehosting_test <% unless version == 'ga' -%> import ( "testing" diff --git a/mmv1/third_party/terraform/tests/resource_firestore_database_update_test.go.erb b/mmv1/third_party/terraform/services/firestore/resource_firestore_database_update_test.go.erb similarity index 98% rename from mmv1/third_party/terraform/tests/resource_firestore_database_update_test.go.erb rename to mmv1/third_party/terraform/services/firestore/resource_firestore_database_update_test.go.erb index 9c756fed6b70..66ef2cf86766 100644 --- a/mmv1/third_party/terraform/tests/resource_firestore_database_update_test.go.erb +++ b/mmv1/third_party/terraform/services/firestore/resource_firestore_database_update_test.go.erb @@ -1,5 +1,5 @@ <% autogen_exception -%> -package google +package firestore_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/resource_firestore_document_test.go b/mmv1/third_party/terraform/services/firestore/resource_firestore_document_test.go similarity index 98% rename from mmv1/third_party/terraform/tests/resource_firestore_document_test.go rename to mmv1/third_party/terraform/services/firestore/resource_firestore_document_test.go index 9541f042ea5a..12eee62017ce 100644 --- a/mmv1/third_party/terraform/tests/resource_firestore_document_test.go +++ b/mmv1/third_party/terraform/services/firestore/resource_firestore_document_test.go @@ -1,4 +1,4 @@ -package google +package firestore_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/resource_firestore_index_test.go b/mmv1/third_party/terraform/services/firestore/resource_firestore_index_test.go similarity index 99% rename from mmv1/third_party/terraform/tests/resource_firestore_index_test.go rename to mmv1/third_party/terraform/services/firestore/resource_firestore_index_test.go index df3f622aa21d..56260b2f0bab 100644 --- a/mmv1/third_party/terraform/tests/resource_firestore_index_test.go +++ b/mmv1/third_party/terraform/services/firestore/resource_firestore_index_test.go @@ -1,4 +1,4 @@ -package google +package firestore_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/resource_gke_hub_feature_membership_test.go.erb b/mmv1/third_party/terraform/services/gkehub/resource_gke_hub_feature_membership_test.go.erb similarity index 93% rename from mmv1/third_party/terraform/tests/resource_gke_hub_feature_membership_test.go.erb rename to mmv1/third_party/terraform/services/gkehub/resource_gke_hub_feature_membership_test.go.erb index ce640740961e..2a2296196e18 100644 --- a/mmv1/third_party/terraform/tests/resource_gke_hub_feature_membership_test.go.erb +++ b/mmv1/third_party/terraform/services/gkehub/resource_gke_hub_feature_membership_test.go.erb @@ -1,10 +1,11 @@ <% autogen_exception -%> -package google +package gkehub_test <% unless version == 'ga' -%> import ( "context" "fmt" + "strings" "testing" dcl "github.com/GoogleCloudPlatform/declarative-resource-client-library/dcl" @@ -14,6 +15,7 @@ import ( "github.com/hashicorp/terraform-provider-google/google/acctest" "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" ) @@ -1162,4 +1164,102 @@ func testAccCheckGkeHubFeatureMembershipNotPresent(t *testing.T, project, locati return err } } + +// Copy this function from the package gkehub2_test to here +func gkeHubFeatureProjectSetup(context map[string]interface{}) string { + return acctest.Nprintf(` +resource "google_project" "project" { + name = "tf-test-gkehub%{random_suffix}" + project_id = "tf-test-gkehub%{random_suffix}" + org_id = "%{org_id}" + billing_account = "%{billing_account}" + provider = google-beta +} + +resource "google_project_service" "mesh" { + project = google_project.project.project_id + service = "meshconfig.googleapis.com" + provider = google-beta +} + +resource "google_project_service" "mci" { + project = google_project.project.project_id + service = "multiclusteringress.googleapis.com" + provider = google-beta +} + +resource "google_project_service" "acm" { + project = google_project.project.project_id + service = "anthosconfigmanagement.googleapis.com" + provider = google-beta +} + +resource "google_project_service" "mcsd" { + project = google_project.project.project_id + service = "multiclusterservicediscovery.googleapis.com" + provider = google-beta +} + +resource "google_project_service" "compute" { + project = google_project.project.project_id + service = "compute.googleapis.com" + disable_on_destroy = false + provider = google-beta +} + +resource "google_project_service" "container" { + project = google_project.project.project_id + service = "container.googleapis.com" + disable_on_destroy = false + provider = google-beta +} + +resource "google_project_service" "gkehub" { + project = google_project.project.project_id + service = "gkehub.googleapis.com" + disable_on_destroy = false + provider = google-beta +} +`, context) +} + +// Copy this function from the package gkehub2_test to here +func testAccCheckGKEHubFeatureDestroyProducer(t *testing.T) func(s *terraform.State) error { + return func(s *terraform.State) error { + for name, rs := range s.RootModule().Resources { + if rs.Type != "google_gke_hub_feature" { + continue + } + if strings.HasPrefix(name, "data.") { + continue + } + + config := acctest.GoogleProviderConfig(t) + + url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{GKEHub2BasePath}}projects/{{project}}/locations/{{location}}/features/{{name}}") + if err != nil { + return err + } + + billingProject := "" + + if config.BillingProject != "" { + billingProject = config.BillingProject + } + + _, err = transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ + Config: config, + Method: "GET", + Project: billingProject, + RawURL: url, + UserAgent: config.UserAgent, + }) + if err == nil { + return fmt.Errorf("GKEHubFeature still exists at %s", url) + } + } + + return nil + } +} <% end -%> diff --git a/mmv1/third_party/terraform/tests/resource_gke_hub_feature_iam_test.go.erb b/mmv1/third_party/terraform/services/gkehub2/iam_gke_hub_feature_test.go.erb similarity index 99% rename from mmv1/third_party/terraform/tests/resource_gke_hub_feature_iam_test.go.erb rename to mmv1/third_party/terraform/services/gkehub2/iam_gke_hub_feature_test.go.erb index 0d18c0a6bcb7..3024aa234017 100644 --- a/mmv1/third_party/terraform/tests/resource_gke_hub_feature_iam_test.go.erb +++ b/mmv1/third_party/terraform/services/gkehub2/iam_gke_hub_feature_test.go.erb @@ -1,5 +1,5 @@ <% autogen_exception -%> -package google +package gkehub2_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/resource_gke_hub_feature_test.go.erb b/mmv1/third_party/terraform/services/gkehub2/resource_gke_hub_feature_test.go.erb similarity index 99% rename from mmv1/third_party/terraform/tests/resource_gke_hub_feature_test.go.erb rename to mmv1/third_party/terraform/services/gkehub2/resource_gke_hub_feature_test.go.erb index a7dcc1bf37f6..b9d2dce61ccf 100644 --- a/mmv1/third_party/terraform/tests/resource_gke_hub_feature_test.go.erb +++ b/mmv1/third_party/terraform/services/gkehub2/resource_gke_hub_feature_test.go.erb @@ -1,5 +1,5 @@ <% autogen_exception -%> -package google +package gkehub2_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/resource_healthcare_dataset_iam_test.go b/mmv1/third_party/terraform/services/healthcare/iam_healthcare_dataset_test.go similarity index 99% rename from mmv1/third_party/terraform/tests/resource_healthcare_dataset_iam_test.go rename to mmv1/third_party/terraform/services/healthcare/iam_healthcare_dataset_test.go index 160b2c5d6b11..5e78074ad864 100644 --- a/mmv1/third_party/terraform/tests/resource_healthcare_dataset_iam_test.go +++ b/mmv1/third_party/terraform/services/healthcare/iam_healthcare_dataset_test.go @@ -1,4 +1,4 @@ -package google +package healthcare_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/resource_healthcare_dicom_store_iam_test.go b/mmv1/third_party/terraform/services/healthcare/iam_healthcare_dicom_store_test.go similarity index 99% rename from mmv1/third_party/terraform/tests/resource_healthcare_dicom_store_iam_test.go rename to mmv1/third_party/terraform/services/healthcare/iam_healthcare_dicom_store_test.go index 1e71aef36932..c246e98b92a7 100644 --- a/mmv1/third_party/terraform/tests/resource_healthcare_dicom_store_iam_test.go +++ b/mmv1/third_party/terraform/services/healthcare/iam_healthcare_dicom_store_test.go @@ -1,4 +1,4 @@ -package google +package healthcare_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/resource_healthcare_fhir_store_iam_test.go b/mmv1/third_party/terraform/services/healthcare/iam_healthcare_fhir_store_test.go similarity index 99% rename from mmv1/third_party/terraform/tests/resource_healthcare_fhir_store_iam_test.go rename to mmv1/third_party/terraform/services/healthcare/iam_healthcare_fhir_store_test.go index 8d89943612e7..df3e03c668e3 100644 --- a/mmv1/third_party/terraform/tests/resource_healthcare_fhir_store_iam_test.go +++ b/mmv1/third_party/terraform/services/healthcare/iam_healthcare_fhir_store_test.go @@ -1,4 +1,4 @@ -package google +package healthcare_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/resource_healthcare_hl7_v2_store_iam_test.go b/mmv1/third_party/terraform/services/healthcare/iam_healthcare_hl7_v2_store_test.go similarity index 99% rename from mmv1/third_party/terraform/tests/resource_healthcare_hl7_v2_store_iam_test.go rename to mmv1/third_party/terraform/services/healthcare/iam_healthcare_hl7_v2_store_test.go index 6ef1e396225d..7d22ef116ad3 100644 --- a/mmv1/third_party/terraform/tests/resource_healthcare_hl7_v2_store_iam_test.go +++ b/mmv1/third_party/terraform/services/healthcare/iam_healthcare_hl7_v2_store_test.go @@ -1,4 +1,4 @@ -package google +package healthcare_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/resource_iam_access_boundary_policy_test.go b/mmv1/third_party/terraform/services/iam2/resource_iam_access_boundary_policy_test.go similarity index 99% rename from mmv1/third_party/terraform/tests/resource_iam_access_boundary_policy_test.go rename to mmv1/third_party/terraform/services/iam2/resource_iam_access_boundary_policy_test.go index 0daff55c0e65..a85e126b0112 100644 --- a/mmv1/third_party/terraform/tests/resource_iam_access_boundary_policy_test.go +++ b/mmv1/third_party/terraform/services/iam2/resource_iam_access_boundary_policy_test.go @@ -1,4 +1,4 @@ -package google +package iam2_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/resource_iam_beta_workload_identity_pool_id_test.go.erb b/mmv1/third_party/terraform/services/iambeta/resource_iam_beta_workload_identity_pool_id_test.go.erb similarity index 98% rename from mmv1/third_party/terraform/tests/resource_iam_beta_workload_identity_pool_id_test.go.erb rename to mmv1/third_party/terraform/services/iambeta/resource_iam_beta_workload_identity_pool_id_test.go.erb index 0a681078db03..36882424b177 100644 --- a/mmv1/third_party/terraform/tests/resource_iam_beta_workload_identity_pool_id_test.go.erb +++ b/mmv1/third_party/terraform/services/iambeta/resource_iam_beta_workload_identity_pool_id_test.go.erb @@ -1,5 +1,5 @@ <% autogen_exception -%> -package google +package iambeta_test <% unless version == 'ga' %> import ( diff --git a/mmv1/third_party/terraform/tests/resource_iam_beta_workload_identity_pool_provider_id_test.go.erb b/mmv1/third_party/terraform/services/iambeta/resource_iam_beta_workload_identity_pool_provider_id_test.go.erb similarity index 98% rename from mmv1/third_party/terraform/tests/resource_iam_beta_workload_identity_pool_provider_id_test.go.erb rename to mmv1/third_party/terraform/services/iambeta/resource_iam_beta_workload_identity_pool_provider_id_test.go.erb index 23319dc17ac0..2ac7370b7799 100644 --- a/mmv1/third_party/terraform/tests/resource_iam_beta_workload_identity_pool_provider_id_test.go.erb +++ b/mmv1/third_party/terraform/services/iambeta/resource_iam_beta_workload_identity_pool_provider_id_test.go.erb @@ -1,5 +1,5 @@ <% autogen_exception -%> -package google +package iambeta_test <% unless version == 'ga' %> import ( diff --git a/mmv1/third_party/terraform/tests/resource_iam_workforce_pool_workforce_pool_id_test.go.erb b/mmv1/third_party/terraform/services/iamworkforcepool/resource_iam_workforce_pool_workforce_pool_id_test.go.erb similarity index 97% rename from mmv1/third_party/terraform/tests/resource_iam_workforce_pool_workforce_pool_id_test.go.erb rename to mmv1/third_party/terraform/services/iamworkforcepool/resource_iam_workforce_pool_workforce_pool_id_test.go.erb index 4d926f806300..65ea0dd09a4a 100644 --- a/mmv1/third_party/terraform/tests/resource_iam_workforce_pool_workforce_pool_id_test.go.erb +++ b/mmv1/third_party/terraform/services/iamworkforcepool/resource_iam_workforce_pool_workforce_pool_id_test.go.erb @@ -1,5 +1,5 @@ <% autogen_exception -%> -package google +package iamworkforcepool_test import ( "strings" diff --git a/mmv1/third_party/terraform/tests/resource_iam_workforce_pool_workforce_pool_provider_id_test.go.erb b/mmv1/third_party/terraform/services/iamworkforcepool/resource_iam_workforce_pool_workforce_pool_provider_id_test.go.erb similarity index 97% rename from mmv1/third_party/terraform/tests/resource_iam_workforce_pool_workforce_pool_provider_id_test.go.erb rename to mmv1/third_party/terraform/services/iamworkforcepool/resource_iam_workforce_pool_workforce_pool_provider_id_test.go.erb index 1d3fdb5e404a..ed2dcb28736e 100644 --- a/mmv1/third_party/terraform/tests/resource_iam_workforce_pool_workforce_pool_provider_id_test.go.erb +++ b/mmv1/third_party/terraform/services/iamworkforcepool/resource_iam_workforce_pool_workforce_pool_provider_id_test.go.erb @@ -1,5 +1,5 @@ <% autogen_exception -%> -package google +package iamworkforcepool_test import ( "strings" diff --git a/mmv1/third_party/terraform/tests/data_source_iap_client_test.go b/mmv1/third_party/terraform/services/iap/data_source_iap_client_test.go similarity index 99% rename from mmv1/third_party/terraform/tests/data_source_iap_client_test.go rename to mmv1/third_party/terraform/services/iap/data_source_iap_client_test.go index f157757628f5..9b5ff698a957 100644 --- a/mmv1/third_party/terraform/tests/data_source_iap_client_test.go +++ b/mmv1/third_party/terraform/services/iap/data_source_iap_client_test.go @@ -1,4 +1,4 @@ -package google +package iap_test import ( "testing" diff --git a/mmv1/third_party/terraform/tests/resource_iap_brand_test.go b/mmv1/third_party/terraform/services/iap/resource_iap_brand_test.go similarity index 98% rename from mmv1/third_party/terraform/tests/resource_iap_brand_test.go rename to mmv1/third_party/terraform/services/iap/resource_iap_brand_test.go index 0f5b056c34a4..ee6764070c4d 100644 --- a/mmv1/third_party/terraform/tests/resource_iap_brand_test.go +++ b/mmv1/third_party/terraform/services/iap/resource_iap_brand_test.go @@ -1,4 +1,4 @@ -package google +package iap_test import ( "testing" diff --git a/mmv1/third_party/terraform/tests/resource_identity_platform_default_supported_idp_config_test.go b/mmv1/third_party/terraform/services/identityplatform/resource_identity_platform_default_supported_idp_config_test.go similarity index 99% rename from mmv1/third_party/terraform/tests/resource_identity_platform_default_supported_idp_config_test.go rename to mmv1/third_party/terraform/services/identityplatform/resource_identity_platform_default_supported_idp_config_test.go index c208e70ba2f1..dde9dad8e620 100644 --- a/mmv1/third_party/terraform/tests/resource_identity_platform_default_supported_idp_config_test.go +++ b/mmv1/third_party/terraform/services/identityplatform/resource_identity_platform_default_supported_idp_config_test.go @@ -1,4 +1,4 @@ -package google +package identityplatform_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/data_source_google_kms_crypto_key_test.go b/mmv1/third_party/terraform/services/kms/data_source_google_kms_crypto_key_test.go similarity index 98% rename from mmv1/third_party/terraform/tests/data_source_google_kms_crypto_key_test.go rename to mmv1/third_party/terraform/services/kms/data_source_google_kms_crypto_key_test.go index 4760cf9f07fa..eb6d8334d97a 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_kms_crypto_key_test.go +++ b/mmv1/third_party/terraform/services/kms/data_source_google_kms_crypto_key_test.go @@ -1,4 +1,4 @@ -package google +package kms_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/data_source_google_kms_crypto_key_version_test.go b/mmv1/third_party/terraform/services/kms/data_source_google_kms_crypto_key_version_test.go similarity index 99% rename from mmv1/third_party/terraform/tests/data_source_google_kms_crypto_key_version_test.go rename to mmv1/third_party/terraform/services/kms/data_source_google_kms_crypto_key_version_test.go index 02400c767d74..fbb464c6f0d3 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_kms_crypto_key_version_test.go +++ b/mmv1/third_party/terraform/services/kms/data_source_google_kms_crypto_key_version_test.go @@ -1,4 +1,4 @@ -package google +package kms_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/data_source_google_kms_key_ring_test.go b/mmv1/third_party/terraform/services/kms/data_source_google_kms_key_ring_test.go similarity index 98% rename from mmv1/third_party/terraform/tests/data_source_google_kms_key_ring_test.go rename to mmv1/third_party/terraform/services/kms/data_source_google_kms_key_ring_test.go index d314fa5c770f..92e0565ee144 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_kms_key_ring_test.go +++ b/mmv1/third_party/terraform/services/kms/data_source_google_kms_key_ring_test.go @@ -1,4 +1,4 @@ -package google +package kms_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/data_source_google_kms_secret_asymmetric_test.go.erb b/mmv1/third_party/terraform/services/kms/data_source_google_kms_secret_asymmetric_test.go.erb similarity index 99% rename from mmv1/third_party/terraform/tests/data_source_google_kms_secret_asymmetric_test.go.erb rename to mmv1/third_party/terraform/services/kms/data_source_google_kms_secret_asymmetric_test.go.erb index a96132e20b0c..e1e449cc86cf 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_kms_secret_asymmetric_test.go.erb +++ b/mmv1/third_party/terraform/services/kms/data_source_google_kms_secret_asymmetric_test.go.erb @@ -1,5 +1,5 @@ <% autogen_exception -%> -package google +package kms_test <% unless version == 'ga' -%> diff --git a/mmv1/third_party/terraform/tests/data_source_google_kms_secret_ciphertext_test.go b/mmv1/third_party/terraform/services/kms/data_source_google_kms_secret_ciphertext_test.go similarity index 98% rename from mmv1/third_party/terraform/tests/data_source_google_kms_secret_ciphertext_test.go rename to mmv1/third_party/terraform/services/kms/data_source_google_kms_secret_ciphertext_test.go index 18af17233f3a..e23b3d197332 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_kms_secret_ciphertext_test.go +++ b/mmv1/third_party/terraform/services/kms/data_source_google_kms_secret_ciphertext_test.go @@ -1,4 +1,4 @@ -package google +package kms_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/data_source_google_kms_secret_test.go b/mmv1/third_party/terraform/services/kms/data_source_google_kms_secret_test.go similarity index 99% rename from mmv1/third_party/terraform/tests/data_source_google_kms_secret_test.go rename to mmv1/third_party/terraform/services/kms/data_source_google_kms_secret_test.go index cdc500f84739..1122d55f9ebd 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_kms_secret_test.go +++ b/mmv1/third_party/terraform/services/kms/data_source_google_kms_secret_test.go @@ -1,4 +1,4 @@ -package google +package kms_test import ( "encoding/base64" diff --git a/mmv1/third_party/terraform/tests/resource_kms_crypto_key_iam_test.go.erb b/mmv1/third_party/terraform/services/kms/iam_kms_crypto_key_test.go.erb similarity index 99% rename from mmv1/third_party/terraform/tests/resource_kms_crypto_key_iam_test.go.erb rename to mmv1/third_party/terraform/services/kms/iam_kms_crypto_key_test.go.erb index e7845940c6c2..5033f0a2f084 100644 --- a/mmv1/third_party/terraform/tests/resource_kms_crypto_key_iam_test.go.erb +++ b/mmv1/third_party/terraform/services/kms/iam_kms_crypto_key_test.go.erb @@ -1,5 +1,5 @@ <% autogen_exception -%> -package google +package kms_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/resource_kms_key_ring_iam_test.go.erb b/mmv1/third_party/terraform/services/kms/iam_kms_key_ring_test.go.erb similarity index 99% rename from mmv1/third_party/terraform/tests/resource_kms_key_ring_iam_test.go.erb rename to mmv1/third_party/terraform/services/kms/iam_kms_key_ring_test.go.erb index 3d8a0c2e82af..90697935d859 100644 --- a/mmv1/third_party/terraform/tests/resource_kms_key_ring_iam_test.go.erb +++ b/mmv1/third_party/terraform/services/kms/iam_kms_key_ring_test.go.erb @@ -1,5 +1,5 @@ <% autogen_exception -%> -package google +package kms_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/resource_kms_crypto_key_test.go b/mmv1/third_party/terraform/services/kms/resource_kms_crypto_key_test.go similarity index 99% rename from mmv1/third_party/terraform/tests/resource_kms_crypto_key_test.go rename to mmv1/third_party/terraform/services/kms/resource_kms_crypto_key_test.go index 701e80b0e479..6f84c616dc29 100644 --- a/mmv1/third_party/terraform/tests/resource_kms_crypto_key_test.go +++ b/mmv1/third_party/terraform/services/kms/resource_kms_crypto_key_test.go @@ -1,4 +1,4 @@ -package google +package kms_test import ( "context" diff --git a/mmv1/third_party/terraform/tests/resource_kms_key_ring_import_job_test.go b/mmv1/third_party/terraform/services/kms/resource_kms_key_ring_import_job_test.go similarity index 98% rename from mmv1/third_party/terraform/tests/resource_kms_key_ring_import_job_test.go rename to mmv1/third_party/terraform/services/kms/resource_kms_key_ring_import_job_test.go index bc46509f1c01..143c72a5625b 100644 --- a/mmv1/third_party/terraform/tests/resource_kms_key_ring_import_job_test.go +++ b/mmv1/third_party/terraform/services/kms/resource_kms_key_ring_import_job_test.go @@ -1,4 +1,4 @@ -package google +package kms_test import ( "testing" diff --git a/mmv1/third_party/terraform/tests/resource_kms_key_ring_test.go b/mmv1/third_party/terraform/services/kms/resource_kms_key_ring_test.go similarity index 99% rename from mmv1/third_party/terraform/tests/resource_kms_key_ring_test.go rename to mmv1/third_party/terraform/services/kms/resource_kms_key_ring_test.go index 0ab6a1528ee2..992eed1613b4 100644 --- a/mmv1/third_party/terraform/tests/resource_kms_key_ring_test.go +++ b/mmv1/third_party/terraform/services/kms/resource_kms_key_ring_test.go @@ -1,4 +1,4 @@ -package google +package kms_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/resource_kms_secret_ciphertext_test.go b/mmv1/third_party/terraform/services/kms/resource_kms_secret_ciphertext_test.go similarity index 99% rename from mmv1/third_party/terraform/tests/resource_kms_secret_ciphertext_test.go rename to mmv1/third_party/terraform/services/kms/resource_kms_secret_ciphertext_test.go index ce856cac45b9..e7f347255e9c 100644 --- a/mmv1/third_party/terraform/tests/resource_kms_secret_ciphertext_test.go +++ b/mmv1/third_party/terraform/services/kms/resource_kms_secret_ciphertext_test.go @@ -1,4 +1,4 @@ -package google +package kms_test import ( "encoding/base64" diff --git a/mmv1/third_party/terraform/tests/data_source_google_logging_project_cmek_settings_test.go b/mmv1/third_party/terraform/services/logging/data_source_google_logging_project_cmek_settings_test.go similarity index 98% rename from mmv1/third_party/terraform/tests/data_source_google_logging_project_cmek_settings_test.go rename to mmv1/third_party/terraform/services/logging/data_source_google_logging_project_cmek_settings_test.go index 635f82e914f9..9fde4c161077 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_logging_project_cmek_settings_test.go +++ b/mmv1/third_party/terraform/services/logging/data_source_google_logging_project_cmek_settings_test.go @@ -1,4 +1,4 @@ -package google +package logging_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/data_source_google_logging_sink_test.go b/mmv1/third_party/terraform/services/logging/data_source_google_logging_sink_test.go similarity index 98% rename from mmv1/third_party/terraform/tests/data_source_google_logging_sink_test.go rename to mmv1/third_party/terraform/services/logging/data_source_google_logging_sink_test.go index ad7b47d0e165..8818dfa7ac75 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_logging_sink_test.go +++ b/mmv1/third_party/terraform/services/logging/data_source_google_logging_sink_test.go @@ -1,4 +1,4 @@ -package google +package logging_test import ( "testing" diff --git a/mmv1/third_party/terraform/tests/resource_logging_billing_account_exclusion_test.go b/mmv1/third_party/terraform/services/logging/resource_logging_billing_account_exclusion_test.go similarity index 99% rename from mmv1/third_party/terraform/tests/resource_logging_billing_account_exclusion_test.go rename to mmv1/third_party/terraform/services/logging/resource_logging_billing_account_exclusion_test.go index d6b7d9715d17..041f4cf67a80 100644 --- a/mmv1/third_party/terraform/tests/resource_logging_billing_account_exclusion_test.go +++ b/mmv1/third_party/terraform/services/logging/resource_logging_billing_account_exclusion_test.go @@ -1,4 +1,4 @@ -package google +package logging_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/resource_logging_billing_account_sink_test.go b/mmv1/third_party/terraform/services/logging/resource_logging_billing_account_sink_test.go similarity index 98% rename from mmv1/third_party/terraform/tests/resource_logging_billing_account_sink_test.go rename to mmv1/third_party/terraform/services/logging/resource_logging_billing_account_sink_test.go index 6eea276f5ec0..900abd89300e 100644 --- a/mmv1/third_party/terraform/tests/resource_logging_billing_account_sink_test.go +++ b/mmv1/third_party/terraform/services/logging/resource_logging_billing_account_sink_test.go @@ -1,4 +1,4 @@ -package google +package logging_test import ( "fmt" @@ -8,6 +8,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" "github.com/hashicorp/terraform-provider-google/google/acctest" "github.com/hashicorp/terraform-provider-google/google/envvar" + "github.com/hashicorp/terraform-provider-google/google/tpgresource" "google.golang.org/api/logging/v2" ) @@ -215,7 +216,7 @@ func testAccCheckLoggingBillingAccountSinkDestroyProducer(t *testing.T) func(s * func testAccCheckLoggingBillingAccountSinkExists(t *testing.T, n string, sink *logging.LogSink) resource.TestCheckFunc { return func(s *terraform.State) error { - attributes, err := getResourceAttributes(n, s) + attributes, err := tpgresource.GetResourceAttributes(n, s) if err != nil { return err } @@ -233,7 +234,7 @@ func testAccCheckLoggingBillingAccountSinkExists(t *testing.T, n string, sink *l func testAccCheckLoggingBillingAccountSink(sink *logging.LogSink, n string) resource.TestCheckFunc { return func(s *terraform.State) error { - attributes, err := getResourceAttributes(n, s) + attributes, err := tpgresource.GetResourceAttributes(n, s) if err != nil { return err } diff --git a/mmv1/third_party/terraform/tests/resource_logging_bucket_config_test.go b/mmv1/third_party/terraform/services/logging/resource_logging_bucket_config_test.go similarity index 99% rename from mmv1/third_party/terraform/tests/resource_logging_bucket_config_test.go rename to mmv1/third_party/terraform/services/logging/resource_logging_bucket_config_test.go index a1295ef5612c..e9f8da482821 100644 --- a/mmv1/third_party/terraform/tests/resource_logging_bucket_config_test.go +++ b/mmv1/third_party/terraform/services/logging/resource_logging_bucket_config_test.go @@ -1,4 +1,4 @@ -package google +package logging_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/resource_logging_folder_exclusion_test.go b/mmv1/third_party/terraform/services/logging/resource_logging_folder_exclusion_test.go similarity index 99% rename from mmv1/third_party/terraform/tests/resource_logging_folder_exclusion_test.go rename to mmv1/third_party/terraform/services/logging/resource_logging_folder_exclusion_test.go index 56c23985f8f1..1c1498fd94d2 100644 --- a/mmv1/third_party/terraform/tests/resource_logging_folder_exclusion_test.go +++ b/mmv1/third_party/terraform/services/logging/resource_logging_folder_exclusion_test.go @@ -1,4 +1,4 @@ -package google +package logging_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/resource_logging_folder_sink_test.go b/mmv1/third_party/terraform/services/logging/resource_logging_folder_sink_test.go similarity index 98% rename from mmv1/third_party/terraform/tests/resource_logging_folder_sink_test.go rename to mmv1/third_party/terraform/services/logging/resource_logging_folder_sink_test.go index c2c6860c27d7..d078170eaf66 100644 --- a/mmv1/third_party/terraform/tests/resource_logging_folder_sink_test.go +++ b/mmv1/third_party/terraform/services/logging/resource_logging_folder_sink_test.go @@ -1,4 +1,4 @@ -package google +package logging_test import ( "fmt" @@ -8,6 +8,7 @@ import ( "github.com/hashicorp/terraform-provider-google/google/acctest" "github.com/hashicorp/terraform-provider-google/google/envvar" + "github.com/hashicorp/terraform-provider-google/google/tpgresource" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" @@ -288,7 +289,7 @@ func testAccCheckLoggingFolderSinkDestroyProducer(t *testing.T) func(s *terrafor func testAccCheckLoggingFolderSinkExists(t *testing.T, n string, sink *logging.LogSink) resource.TestCheckFunc { return func(s *terraform.State) error { - attributes, err := getResourceAttributes(n, s) + attributes, err := tpgresource.GetResourceAttributes(n, s) if err != nil { return err } @@ -306,7 +307,7 @@ func testAccCheckLoggingFolderSinkExists(t *testing.T, n string, sink *logging.L func testAccCheckLoggingFolderSink(sink *logging.LogSink, n string) resource.TestCheckFunc { return func(s *terraform.State) error { - attributes, err := getResourceAttributes(n, s) + attributes, err := tpgresource.GetResourceAttributes(n, s) if err != nil { return err } diff --git a/mmv1/third_party/terraform/tests/resource_logging_organization_exclusion_test.go b/mmv1/third_party/terraform/services/logging/resource_logging_organization_exclusion_test.go similarity index 99% rename from mmv1/third_party/terraform/tests/resource_logging_organization_exclusion_test.go rename to mmv1/third_party/terraform/services/logging/resource_logging_organization_exclusion_test.go index 87cd6f09a10c..0c3855a1e09c 100644 --- a/mmv1/third_party/terraform/tests/resource_logging_organization_exclusion_test.go +++ b/mmv1/third_party/terraform/services/logging/resource_logging_organization_exclusion_test.go @@ -1,4 +1,4 @@ -package google +package logging_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/resource_logging_organization_sink_test.go b/mmv1/third_party/terraform/services/logging/resource_logging_organization_sink_test.go similarity index 98% rename from mmv1/third_party/terraform/tests/resource_logging_organization_sink_test.go rename to mmv1/third_party/terraform/services/logging/resource_logging_organization_sink_test.go index dd27b39b165b..b2ffc3878608 100644 --- a/mmv1/third_party/terraform/tests/resource_logging_organization_sink_test.go +++ b/mmv1/third_party/terraform/services/logging/resource_logging_organization_sink_test.go @@ -1,4 +1,4 @@ -package google +package logging_test import ( "fmt" @@ -10,6 +10,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" "github.com/hashicorp/terraform-provider-google/google/acctest" "github.com/hashicorp/terraform-provider-google/google/envvar" + "github.com/hashicorp/terraform-provider-google/google/tpgresource" "google.golang.org/api/logging/v2" ) @@ -217,7 +218,7 @@ func testAccCheckLoggingOrganizationSinkDestroyProducer(t *testing.T) func(s *te func testAccCheckLoggingOrganizationSinkExists(t *testing.T, n string, sink *logging.LogSink) resource.TestCheckFunc { return func(s *terraform.State) error { - attributes, err := getResourceAttributes(n, s) + attributes, err := tpgresource.GetResourceAttributes(n, s) if err != nil { return err } @@ -235,7 +236,7 @@ func testAccCheckLoggingOrganizationSinkExists(t *testing.T, n string, sink *log func testAccCheckLoggingOrganizationSink(sink *logging.LogSink, n string) resource.TestCheckFunc { return func(s *terraform.State) error { - attributes, err := getResourceAttributes(n, s) + attributes, err := tpgresource.GetResourceAttributes(n, s) if err != nil { return err } diff --git a/mmv1/third_party/terraform/tests/resource_logging_project_exclusion_test.go b/mmv1/third_party/terraform/services/logging/resource_logging_project_exclusion_test.go similarity index 99% rename from mmv1/third_party/terraform/tests/resource_logging_project_exclusion_test.go rename to mmv1/third_party/terraform/services/logging/resource_logging_project_exclusion_test.go index ac0e0991d0b5..34304a8ffa87 100644 --- a/mmv1/third_party/terraform/tests/resource_logging_project_exclusion_test.go +++ b/mmv1/third_party/terraform/services/logging/resource_logging_project_exclusion_test.go @@ -1,4 +1,4 @@ -package google +package logging_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/resource_logging_project_sink_test.go b/mmv1/third_party/terraform/services/logging/resource_logging_project_sink_test.go similarity index 99% rename from mmv1/third_party/terraform/tests/resource_logging_project_sink_test.go rename to mmv1/third_party/terraform/services/logging/resource_logging_project_sink_test.go index 25f668997b04..2c5a08926abd 100644 --- a/mmv1/third_party/terraform/tests/resource_logging_project_sink_test.go +++ b/mmv1/third_party/terraform/services/logging/resource_logging_project_sink_test.go @@ -1,4 +1,4 @@ -package google +package logging_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/data_source_google_monitoring_uptime_check_ips_test.go b/mmv1/third_party/terraform/services/monitoring/data_source_google_monitoring_uptime_check_ips_test.go similarity index 98% rename from mmv1/third_party/terraform/tests/data_source_google_monitoring_uptime_check_ips_test.go rename to mmv1/third_party/terraform/services/monitoring/data_source_google_monitoring_uptime_check_ips_test.go index b788e96ea118..480212671dcf 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_monitoring_uptime_check_ips_test.go +++ b/mmv1/third_party/terraform/services/monitoring/data_source_google_monitoring_uptime_check_ips_test.go @@ -1,4 +1,4 @@ -package google +package monitoring_test import ( "regexp" diff --git a/mmv1/third_party/terraform/tests/data_source_monitoring_notification_channel_test.go b/mmv1/third_party/terraform/services/monitoring/data_source_monitoring_notification_channel_test.go similarity index 99% rename from mmv1/third_party/terraform/tests/data_source_monitoring_notification_channel_test.go rename to mmv1/third_party/terraform/services/monitoring/data_source_monitoring_notification_channel_test.go index 559257895ba9..8d79ca5fbfd7 100644 --- a/mmv1/third_party/terraform/tests/data_source_monitoring_notification_channel_test.go +++ b/mmv1/third_party/terraform/services/monitoring/data_source_monitoring_notification_channel_test.go @@ -1,4 +1,4 @@ -package google +package monitoring_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/data_source_monitoring_service_test.go b/mmv1/third_party/terraform/services/monitoring/data_source_monitoring_service_test.go similarity index 98% rename from mmv1/third_party/terraform/tests/data_source_monitoring_service_test.go rename to mmv1/third_party/terraform/services/monitoring/data_source_monitoring_service_test.go index 726710b5cdeb..7eab715d5e52 100644 --- a/mmv1/third_party/terraform/tests/data_source_monitoring_service_test.go +++ b/mmv1/third_party/terraform/services/monitoring/data_source_monitoring_service_test.go @@ -1,4 +1,4 @@ -package google +package monitoring_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/resource_monitoring_alert_policy_test.go b/mmv1/third_party/terraform/services/monitoring/resource_monitoring_alert_policy_test.go similarity index 99% rename from mmv1/third_party/terraform/tests/resource_monitoring_alert_policy_test.go rename to mmv1/third_party/terraform/services/monitoring/resource_monitoring_alert_policy_test.go index c9441f0c3fad..803c341853af 100644 --- a/mmv1/third_party/terraform/tests/resource_monitoring_alert_policy_test.go +++ b/mmv1/third_party/terraform/services/monitoring/resource_monitoring_alert_policy_test.go @@ -1,4 +1,4 @@ -package google +package monitoring_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/resource_monitoring_dashboard_test.go b/mmv1/third_party/terraform/services/monitoring/resource_monitoring_dashboard_test.go similarity index 99% rename from mmv1/third_party/terraform/tests/resource_monitoring_dashboard_test.go rename to mmv1/third_party/terraform/services/monitoring/resource_monitoring_dashboard_test.go index 5876b7ab6d63..1f8caaa86759 100644 --- a/mmv1/third_party/terraform/tests/resource_monitoring_dashboard_test.go +++ b/mmv1/third_party/terraform/services/monitoring/resource_monitoring_dashboard_test.go @@ -1,4 +1,4 @@ -package google +package monitoring_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/resource_notebooks_environment_test.go.erb b/mmv1/third_party/terraform/services/notebooks/resource_notebooks_environment_test.go.erb similarity index 97% rename from mmv1/third_party/terraform/tests/resource_notebooks_environment_test.go.erb rename to mmv1/third_party/terraform/services/notebooks/resource_notebooks_environment_test.go.erb index d4c694b14489..e75fbee970ee 100644 --- a/mmv1/third_party/terraform/tests/resource_notebooks_environment_test.go.erb +++ b/mmv1/third_party/terraform/services/notebooks/resource_notebooks_environment_test.go.erb @@ -1,5 +1,5 @@ <% autogen_exception -%> -package google +package notebooks_test <% unless version == 'ga' %> import ( diff --git a/mmv1/third_party/terraform/tests/resource_notebooks_instance_container_test.go.erb b/mmv1/third_party/terraform/services/notebooks/resource_notebooks_instance_container_test.go.erb similarity index 98% rename from mmv1/third_party/terraform/tests/resource_notebooks_instance_container_test.go.erb rename to mmv1/third_party/terraform/services/notebooks/resource_notebooks_instance_container_test.go.erb index 169d6da716da..c7ca628d1435 100644 --- a/mmv1/third_party/terraform/tests/resource_notebooks_instance_container_test.go.erb +++ b/mmv1/third_party/terraform/services/notebooks/resource_notebooks_instance_container_test.go.erb @@ -1,5 +1,5 @@ <% autogen_exception -%> -package google +package notebooks_test <% unless version == 'ga' %> import ( diff --git a/mmv1/third_party/terraform/tests/resource_notebooks_instance_gpu_test.go.erb b/mmv1/third_party/terraform/services/notebooks/resource_notebooks_instance_gpu_test.go.erb similarity index 98% rename from mmv1/third_party/terraform/tests/resource_notebooks_instance_gpu_test.go.erb rename to mmv1/third_party/terraform/services/notebooks/resource_notebooks_instance_gpu_test.go.erb index 71eaab37708a..2fa556899e71 100644 --- a/mmv1/third_party/terraform/tests/resource_notebooks_instance_gpu_test.go.erb +++ b/mmv1/third_party/terraform/services/notebooks/resource_notebooks_instance_gpu_test.go.erb @@ -1,5 +1,5 @@ <% autogen_exception -%> -package google +package notebooks_test <% unless version == 'ga' %> import ( diff --git a/mmv1/third_party/terraform/tests/resource_notebooks_instance_test.go.erb b/mmv1/third_party/terraform/services/notebooks/resource_notebooks_instance_test.go.erb similarity index 99% rename from mmv1/third_party/terraform/tests/resource_notebooks_instance_test.go.erb rename to mmv1/third_party/terraform/services/notebooks/resource_notebooks_instance_test.go.erb index a3165ffa39a6..63857df18d57 100644 --- a/mmv1/third_party/terraform/tests/resource_notebooks_instance_test.go.erb +++ b/mmv1/third_party/terraform/services/notebooks/resource_notebooks_instance_test.go.erb @@ -1,5 +1,5 @@ <% autogen_exception -%> -package google +package notebooks_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/resource_os_config_os_policy_assignment_test.go.erb b/mmv1/third_party/terraform/services/osconfig/resource_os_config_os_policy_assignment_test.go.erb similarity index 96% rename from mmv1/third_party/terraform/tests/resource_os_config_os_policy_assignment_test.go.erb rename to mmv1/third_party/terraform/services/osconfig/resource_os_config_os_policy_assignment_test.go.erb index 10a347b0eee2..e715fb0e5fd7 100644 --- a/mmv1/third_party/terraform/tests/resource_os_config_os_policy_assignment_test.go.erb +++ b/mmv1/third_party/terraform/services/osconfig/resource_os_config_os_policy_assignment_test.go.erb @@ -1,6 +1,6 @@ <% autogen_exception -%> -package google +package osconfig_test import ( "fmt" @@ -10,6 +10,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/tpgresource" transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" ) @@ -228,7 +229,7 @@ func testAccCheckOSConfigOSPolicyAssignmentDestroyProducer(t *testing.T) func(s config := acctest.GoogleProviderConfig(t) - url, err := replaceVarsForTest(config, rs, "{{OSConfigBasePath}}projects/{{project}}/locations/{{location}}/osPolicyAssignments/{{name}}") + url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{OSConfigBasePath}}projects/{{project}}/locations/{{location}}/osPolicyAssignments/{{name}}") if err != nil { return err } diff --git a/mmv1/third_party/terraform/tests/resource_privateca_ca_pool_iam_test.go b/mmv1/third_party/terraform/services/privateca/iam_privateca_ca_pool_test.go similarity index 99% rename from mmv1/third_party/terraform/tests/resource_privateca_ca_pool_iam_test.go rename to mmv1/third_party/terraform/services/privateca/iam_privateca_ca_pool_test.go index 27bb57725de7..adeda1ba5b15 100644 --- a/mmv1/third_party/terraform/tests/resource_privateca_ca_pool_iam_test.go +++ b/mmv1/third_party/terraform/services/privateca/iam_privateca_ca_pool_test.go @@ -1,4 +1,4 @@ -package google +package privateca_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/resource_pubsub_subscription_iam_test.go b/mmv1/third_party/terraform/services/pubsub/iam_pubsub_subscription_test.go similarity index 99% rename from mmv1/third_party/terraform/tests/resource_pubsub_subscription_iam_test.go rename to mmv1/third_party/terraform/services/pubsub/iam_pubsub_subscription_test.go index d5841be373a7..33daa6c8fbe3 100644 --- a/mmv1/third_party/terraform/tests/resource_pubsub_subscription_iam_test.go +++ b/mmv1/third_party/terraform/services/pubsub/iam_pubsub_subscription_test.go @@ -1,4 +1,4 @@ -package google +package pubsub_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/resource_pubsub_topic_iam_test.go b/mmv1/third_party/terraform/services/pubsub/iam_pubsub_topic_test.go similarity index 99% rename from mmv1/third_party/terraform/tests/resource_pubsub_topic_iam_test.go rename to mmv1/third_party/terraform/services/pubsub/iam_pubsub_topic_test.go index 51435b8a9bf6..166aeb0b1bfb 100644 --- a/mmv1/third_party/terraform/tests/resource_pubsub_topic_iam_test.go +++ b/mmv1/third_party/terraform/services/pubsub/iam_pubsub_topic_test.go @@ -1,4 +1,4 @@ -package google +package pubsub_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/data_source_redis_instance_test.go b/mmv1/third_party/terraform/services/redis/data_source_redis_instance_test.go similarity index 98% rename from mmv1/third_party/terraform/tests/data_source_redis_instance_test.go rename to mmv1/third_party/terraform/services/redis/data_source_redis_instance_test.go index 1e499a3200fd..0c03762b0021 100644 --- a/mmv1/third_party/terraform/tests/data_source_redis_instance_test.go +++ b/mmv1/third_party/terraform/services/redis/data_source_redis_instance_test.go @@ -1,4 +1,4 @@ -package google +package redis_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/iam_scc_source_test.go b/mmv1/third_party/terraform/services/securitycenter/iam_scc_source_test.go similarity index 99% rename from mmv1/third_party/terraform/tests/iam_scc_source_test.go rename to mmv1/third_party/terraform/services/securitycenter/iam_scc_source_test.go index 5ce94e261dfe..2b008820d21a 100644 --- a/mmv1/third_party/terraform/tests/iam_scc_source_test.go +++ b/mmv1/third_party/terraform/services/securitycenter/iam_scc_source_test.go @@ -1,4 +1,4 @@ -package google +package securitycenter_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/resource_security_center_source_test.go b/mmv1/third_party/terraform/services/securitycenter/resource_scc_source_test.go similarity index 97% rename from mmv1/third_party/terraform/tests/resource_security_center_source_test.go rename to mmv1/third_party/terraform/services/securitycenter/resource_scc_source_test.go index e08605323b3b..db23fba07d78 100644 --- a/mmv1/third_party/terraform/tests/resource_security_center_source_test.go +++ b/mmv1/third_party/terraform/services/securitycenter/resource_scc_source_test.go @@ -1,4 +1,4 @@ -package google +package securitycenter_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/data_source_google_service_networking_peered_dns_domain_test.go b/mmv1/third_party/terraform/services/servicenetworking/data_source_google_service_networking_peered_dns_domain_test.go similarity index 99% rename from mmv1/third_party/terraform/tests/data_source_google_service_networking_peered_dns_domain_test.go rename to mmv1/third_party/terraform/services/servicenetworking/data_source_google_service_networking_peered_dns_domain_test.go index e883fe7fc0d1..20076a17d773 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_service_networking_peered_dns_domain_test.go +++ b/mmv1/third_party/terraform/services/servicenetworking/data_source_google_service_networking_peered_dns_domain_test.go @@ -1,4 +1,4 @@ -package google +package servicenetworking_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/resource_google_service_networking_peered_dns_domain_test.go b/mmv1/third_party/terraform/services/servicenetworking/resource_google_service_networking_peered_dns_domain_test.go similarity index 98% rename from mmv1/third_party/terraform/tests/resource_google_service_networking_peered_dns_domain_test.go rename to mmv1/third_party/terraform/services/servicenetworking/resource_google_service_networking_peered_dns_domain_test.go index ae2f6a83e100..fbde0bac86ec 100644 --- a/mmv1/third_party/terraform/tests/resource_google_service_networking_peered_dns_domain_test.go +++ b/mmv1/third_party/terraform/services/servicenetworking/resource_google_service_networking_peered_dns_domain_test.go @@ -1,4 +1,4 @@ -package google +package servicenetworking_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/resource_service_networking_connection_test.go b/mmv1/third_party/terraform/services/servicenetworking/resource_service_networking_connection_test.go similarity index 99% rename from mmv1/third_party/terraform/tests/resource_service_networking_connection_test.go rename to mmv1/third_party/terraform/services/servicenetworking/resource_service_networking_connection_test.go index efc3c99aa6cc..374a8be52ac5 100644 --- a/mmv1/third_party/terraform/tests/resource_service_networking_connection_test.go +++ b/mmv1/third_party/terraform/services/servicenetworking/resource_service_networking_connection_test.go @@ -1,4 +1,4 @@ -package google +package servicenetworking_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/resource_spanner_database_iam_test.go b/mmv1/third_party/terraform/services/spanner/iam_spanner_database_test.go similarity index 99% rename from mmv1/third_party/terraform/tests/resource_spanner_database_iam_test.go rename to mmv1/third_party/terraform/services/spanner/iam_spanner_database_test.go index aab552a3afb6..edb993494eb7 100644 --- a/mmv1/third_party/terraform/tests/resource_spanner_database_iam_test.go +++ b/mmv1/third_party/terraform/services/spanner/iam_spanner_database_test.go @@ -1,4 +1,4 @@ -package google +package spanner_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/resource_spanner_instance_iam_test.go b/mmv1/third_party/terraform/services/spanner/iam_spanner_instance_test.go similarity index 99% rename from mmv1/third_party/terraform/tests/resource_spanner_instance_iam_test.go rename to mmv1/third_party/terraform/services/spanner/iam_spanner_instance_test.go index 4d3e15c62619..e99736f46e21 100644 --- a/mmv1/third_party/terraform/tests/resource_spanner_instance_iam_test.go +++ b/mmv1/third_party/terraform/services/spanner/iam_spanner_instance_test.go @@ -1,4 +1,4 @@ -package google +package spanner_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/data_source_google_sql_ca_certs_test.go b/mmv1/third_party/terraform/services/sql/data_source_google_sql_ca_certs_test.go similarity index 97% rename from mmv1/third_party/terraform/tests/data_source_google_sql_ca_certs_test.go rename to mmv1/third_party/terraform/services/sql/data_source_google_sql_ca_certs_test.go index c2a5097bf456..2297c908346c 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_sql_ca_certs_test.go +++ b/mmv1/third_party/terraform/services/sql/data_source_google_sql_ca_certs_test.go @@ -1,4 +1,4 @@ -package google +package sql_test import ( "fmt" @@ -17,7 +17,6 @@ func TestAccDataSourceGoogleSQLCaCerts_basic(t *testing.T) { acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), - CheckDestroy: testAccCheckComputeInstanceDestroyProducer(t), Steps: []resource.TestStep{ { Config: testAccDataSourceGoogleSQLCaCertsConfig(instanceName), diff --git a/mmv1/third_party/terraform/tests/data_source_google_sql_tiers_test.go b/mmv1/third_party/terraform/services/sql/data_source_google_sql_tiers_test.go similarity index 98% rename from mmv1/third_party/terraform/tests/data_source_google_sql_tiers_test.go rename to mmv1/third_party/terraform/services/sql/data_source_google_sql_tiers_test.go index 3824d901e630..ea09ca734790 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_sql_tiers_test.go +++ b/mmv1/third_party/terraform/services/sql/data_source_google_sql_tiers_test.go @@ -1,4 +1,4 @@ -package google +package sql_test import ( "testing" diff --git a/mmv1/third_party/terraform/tests/data_source_sql_backup_run_test.go b/mmv1/third_party/terraform/services/sql/data_source_sql_backup_run_test.go similarity index 99% rename from mmv1/third_party/terraform/tests/data_source_sql_backup_run_test.go rename to mmv1/third_party/terraform/services/sql/data_source_sql_backup_run_test.go index 88b68ba22481..07473c0018db 100644 --- a/mmv1/third_party/terraform/tests/data_source_sql_backup_run_test.go +++ b/mmv1/third_party/terraform/services/sql/data_source_sql_backup_run_test.go @@ -1,4 +1,4 @@ -package google +package sql_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/data_source_sql_database_instance_test.go b/mmv1/third_party/terraform/services/sql/data_source_sql_database_instance_test.go similarity index 98% rename from mmv1/third_party/terraform/tests/data_source_sql_database_instance_test.go rename to mmv1/third_party/terraform/services/sql/data_source_sql_database_instance_test.go index 3ea6ab0dfe2e..1f73b5c4fb86 100644 --- a/mmv1/third_party/terraform/tests/data_source_sql_database_instance_test.go +++ b/mmv1/third_party/terraform/services/sql/data_source_sql_database_instance_test.go @@ -1,4 +1,4 @@ -package google +package sql_test import ( "testing" diff --git a/mmv1/third_party/terraform/tests/data_source_sql_database_instances_test.go b/mmv1/third_party/terraform/services/sql/data_source_sql_database_instances_test.go similarity index 99% rename from mmv1/third_party/terraform/tests/data_source_sql_database_instances_test.go rename to mmv1/third_party/terraform/services/sql/data_source_sql_database_instances_test.go index ab02f83ec1fb..a5a73e3d11b0 100644 --- a/mmv1/third_party/terraform/tests/data_source_sql_database_instances_test.go +++ b/mmv1/third_party/terraform/services/sql/data_source_sql_database_instances_test.go @@ -1,4 +1,4 @@ -package google +package sql_test import ( "errors" diff --git a/mmv1/third_party/terraform/tests/data_source_sql_database_test.go b/mmv1/third_party/terraform/services/sql/data_source_sql_database_test.go similarity index 98% rename from mmv1/third_party/terraform/tests/data_source_sql_database_test.go rename to mmv1/third_party/terraform/services/sql/data_source_sql_database_test.go index 109a7c75fed8..4a288203e384 100644 --- a/mmv1/third_party/terraform/tests/data_source_sql_database_test.go +++ b/mmv1/third_party/terraform/services/sql/data_source_sql_database_test.go @@ -1,4 +1,4 @@ -package google +package sql_test import ( "testing" diff --git a/mmv1/third_party/terraform/tests/data_source_sql_databases_test.go b/mmv1/third_party/terraform/services/sql/data_source_sql_databases_test.go similarity index 99% rename from mmv1/third_party/terraform/tests/data_source_sql_databases_test.go rename to mmv1/third_party/terraform/services/sql/data_source_sql_databases_test.go index 49732707f157..91bd88b7a106 100644 --- a/mmv1/third_party/terraform/tests/data_source_sql_databases_test.go +++ b/mmv1/third_party/terraform/services/sql/data_source_sql_databases_test.go @@ -1,4 +1,4 @@ -package google +package sql_test import ( "errors" diff --git a/mmv1/third_party/terraform/tests/resource_sql_database_instance_test.go b/mmv1/third_party/terraform/services/sql/resource_sql_database_instance_test.go similarity index 99% rename from mmv1/third_party/terraform/tests/resource_sql_database_instance_test.go rename to mmv1/third_party/terraform/services/sql/resource_sql_database_instance_test.go index 2e0941754f01..8653c4c5fbfe 100644 --- a/mmv1/third_party/terraform/tests/resource_sql_database_instance_test.go +++ b/mmv1/third_party/terraform/services/sql/resource_sql_database_instance_test.go @@ -1,4 +1,4 @@ -package google +package sql_test import ( "fmt" @@ -8,6 +8,7 @@ import ( "github.com/hashicorp/terraform-provider-google/google/acctest" "github.com/hashicorp/terraform-provider-google/google/envvar" + "github.com/hashicorp/terraform-provider-google/google/services/sql" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" @@ -153,7 +154,7 @@ func TestAccSqlDatabaseInstance_dontDeleteDefaultUserOnReplica(t *testing.T) { t.Errorf("Error while inserting root@%% user: %s", err) return } - err = SqlAdminOperationWaitTime(config, op, config.Project, "Waiting for user to insert", config.UserAgent, 10*time.Minute) + err = sql.SqlAdminOperationWaitTime(config, op, config.Project, "Waiting for user to insert", config.UserAgent, 10*time.Minute) if err != nil { t.Errorf("Error while waiting for user insert operation to complete: %s", err.Error()) } @@ -206,7 +207,7 @@ func TestAccSqlDatabaseInstance_deleteDefaultUserBeforeSubsequentApiCalls(t *tes t.Errorf("Error while inserting root@%% user: %s", err) return } - err = SqlAdminOperationWaitTime(config, op, config.Project, "Waiting for user to insert", config.UserAgent, 10*time.Minute) + err = sql.SqlAdminOperationWaitTime(config, op, config.Project, "Waiting for user to insert", config.UserAgent, 10*time.Minute) if err != nil { t.Errorf("Error while waiting for user insert operation to complete: %s", err.Error()) } diff --git a/mmv1/third_party/terraform/tests/resource_sql_database_test.go b/mmv1/third_party/terraform/services/sql/resource_sql_database_test.go similarity index 99% rename from mmv1/third_party/terraform/tests/resource_sql_database_test.go rename to mmv1/third_party/terraform/services/sql/resource_sql_database_test.go index 044eb42c9589..7c2833ee5ea2 100644 --- a/mmv1/third_party/terraform/tests/resource_sql_database_test.go +++ b/mmv1/third_party/terraform/services/sql/resource_sql_database_test.go @@ -1,4 +1,4 @@ -package google +package sql_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/resource_sql_ssl_cert_test.go b/mmv1/third_party/terraform/services/sql/resource_sql_ssl_cert_test.go similarity index 99% rename from mmv1/third_party/terraform/tests/resource_sql_ssl_cert_test.go rename to mmv1/third_party/terraform/services/sql/resource_sql_ssl_cert_test.go index d456f78c2175..dbee06dfb8fd 100644 --- a/mmv1/third_party/terraform/tests/resource_sql_ssl_cert_test.go +++ b/mmv1/third_party/terraform/services/sql/resource_sql_ssl_cert_test.go @@ -1,4 +1,4 @@ -package google +package sql_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/resource_sql_user_test.go b/mmv1/third_party/terraform/services/sql/resource_sql_user_test.go similarity index 99% rename from mmv1/third_party/terraform/tests/resource_sql_user_test.go rename to mmv1/third_party/terraform/services/sql/resource_sql_user_test.go index 7672a71530cc..efcf0d5f5962 100644 --- a/mmv1/third_party/terraform/tests/resource_sql_user_test.go +++ b/mmv1/third_party/terraform/services/sql/resource_sql_user_test.go @@ -1,4 +1,4 @@ -package google +package sql_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/data_source_google_storage_project_service_account_test.go b/mmv1/third_party/terraform/services/storage/data_source_google_storage_project_service_account_test.go similarity index 97% rename from mmv1/third_party/terraform/tests/data_source_google_storage_project_service_account_test.go rename to mmv1/third_party/terraform/services/storage/data_source_google_storage_project_service_account_test.go index aa0900af11a5..619f70afa7b1 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_storage_project_service_account_test.go +++ b/mmv1/third_party/terraform/services/storage/data_source_google_storage_project_service_account_test.go @@ -1,4 +1,4 @@ -package google +package storage_test import ( "testing" diff --git a/mmv1/third_party/terraform/tests/data_source_storage_bucket_object_content_test.go b/mmv1/third_party/terraform/services/storage/data_source_storage_bucket_object_content_test.go similarity index 98% rename from mmv1/third_party/terraform/tests/data_source_storage_bucket_object_content_test.go rename to mmv1/third_party/terraform/services/storage/data_source_storage_bucket_object_content_test.go index 0e31d8fced46..5b40c4ee1089 100644 --- a/mmv1/third_party/terraform/tests/data_source_storage_bucket_object_content_test.go +++ b/mmv1/third_party/terraform/services/storage/data_source_storage_bucket_object_content_test.go @@ -1,4 +1,4 @@ -package google +package storage_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/data_source_storage_object_signed_url_test.go b/mmv1/third_party/terraform/services/storage/data_source_storage_object_signed_url_test.go similarity index 99% rename from mmv1/third_party/terraform/tests/data_source_storage_object_signed_url_test.go rename to mmv1/third_party/terraform/services/storage/data_source_storage_object_signed_url_test.go index 0904310bef8d..950b32e98e6f 100644 --- a/mmv1/third_party/terraform/tests/data_source_storage_object_signed_url_test.go +++ b/mmv1/third_party/terraform/services/storage/data_source_storage_object_signed_url_test.go @@ -1,4 +1,4 @@ -package google +package storage_test import ( "testing" diff --git a/mmv1/third_party/terraform/tests/resource_storage_bucket_iam_test.go b/mmv1/third_party/terraform/services/storage/resource_storage_bucket_iam_test.go similarity index 99% rename from mmv1/third_party/terraform/tests/resource_storage_bucket_iam_test.go rename to mmv1/third_party/terraform/services/storage/resource_storage_bucket_iam_test.go index 87a7a2909500..540b7ded2ca0 100644 --- a/mmv1/third_party/terraform/tests/resource_storage_bucket_iam_test.go +++ b/mmv1/third_party/terraform/services/storage/resource_storage_bucket_iam_test.go @@ -1,4 +1,4 @@ -package google +package storage_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/data_source_google_storage_transfer_project_service_account_test.go b/mmv1/third_party/terraform/services/storagetransfer/data_source_google_storage_transfer_project_service_account_test.go similarity index 97% rename from mmv1/third_party/terraform/tests/data_source_google_storage_transfer_project_service_account_test.go rename to mmv1/third_party/terraform/services/storagetransfer/data_source_google_storage_transfer_project_service_account_test.go index f71775cd6653..e49fe9f4acf3 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_storage_transfer_project_service_account_test.go +++ b/mmv1/third_party/terraform/services/storagetransfer/data_source_google_storage_transfer_project_service_account_test.go @@ -1,4 +1,4 @@ -package google +package storagetransfer_test import ( "testing" diff --git a/mmv1/third_party/terraform/tests/resource_storage_transfer_agent_pool_test.go b/mmv1/third_party/terraform/services/storagetransfer/resource_storage_transfer_agent_pool_test.go similarity index 99% rename from mmv1/third_party/terraform/tests/resource_storage_transfer_agent_pool_test.go rename to mmv1/third_party/terraform/services/storagetransfer/resource_storage_transfer_agent_pool_test.go index 458337675cf3..3791e06b0d85 100644 --- a/mmv1/third_party/terraform/tests/resource_storage_transfer_agent_pool_test.go +++ b/mmv1/third_party/terraform/services/storagetransfer/resource_storage_transfer_agent_pool_test.go @@ -1,4 +1,4 @@ -package google +package storagetransfer_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/resource_storage_transfer_job_test.go b/mmv1/third_party/terraform/services/storagetransfer/resource_storage_transfer_job_test.go similarity index 99% rename from mmv1/third_party/terraform/tests/resource_storage_transfer_job_test.go rename to mmv1/third_party/terraform/services/storagetransfer/resource_storage_transfer_job_test.go index 6d43b2571914..0346bb7e6b2b 100644 --- a/mmv1/third_party/terraform/tests/resource_storage_transfer_job_test.go +++ b/mmv1/third_party/terraform/services/storagetransfer/resource_storage_transfer_job_test.go @@ -1,4 +1,4 @@ -package google +package storagetransfer_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/data_source_tags_tag_key_test.go b/mmv1/third_party/terraform/services/tags/data_source_tags_tag_key_test.go similarity index 99% rename from mmv1/third_party/terraform/tests/data_source_tags_tag_key_test.go rename to mmv1/third_party/terraform/services/tags/data_source_tags_tag_key_test.go index f1fb59ead109..68fc492475c0 100644 --- a/mmv1/third_party/terraform/tests/data_source_tags_tag_key_test.go +++ b/mmv1/third_party/terraform/services/tags/data_source_tags_tag_key_test.go @@ -1,4 +1,4 @@ -package google +package tags_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/data_source_tags_tag_value_test.go b/mmv1/third_party/terraform/services/tags/data_source_tags_tag_value_test.go similarity index 99% rename from mmv1/third_party/terraform/tests/data_source_tags_tag_value_test.go rename to mmv1/third_party/terraform/services/tags/data_source_tags_tag_value_test.go index b061ceab7eb4..14722c2ef8ed 100644 --- a/mmv1/third_party/terraform/tests/data_source_tags_tag_value_test.go +++ b/mmv1/third_party/terraform/services/tags/data_source_tags_tag_value_test.go @@ -1,4 +1,4 @@ -package google +package tags_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/resource_tags_test.go b/mmv1/third_party/terraform/services/tags/resource_tags_test.go similarity index 99% rename from mmv1/third_party/terraform/tests/resource_tags_test.go rename to mmv1/third_party/terraform/services/tags/resource_tags_test.go index a13059c10759..55ea6bd43acc 100644 --- a/mmv1/third_party/terraform/tests/resource_tags_test.go +++ b/mmv1/third_party/terraform/services/tags/resource_tags_test.go @@ -1,4 +1,4 @@ -package google +package tags_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/data_source_tpu_tensorflow_versions_test.go b/mmv1/third_party/terraform/services/tpu/data_source_tpu_tensorflow_versions_test.go similarity index 99% rename from mmv1/third_party/terraform/tests/data_source_tpu_tensorflow_versions_test.go rename to mmv1/third_party/terraform/services/tpu/data_source_tpu_tensorflow_versions_test.go index 4137d2621c3e..15a4f15a0325 100644 --- a/mmv1/third_party/terraform/tests/data_source_tpu_tensorflow_versions_test.go +++ b/mmv1/third_party/terraform/services/tpu/data_source_tpu_tensorflow_versions_test.go @@ -1,4 +1,4 @@ -package google +package tpu_test import ( "errors" diff --git a/mmv1/third_party/terraform/tests/data_source_vertex_ai_index_test.go b/mmv1/third_party/terraform/services/vertexai/data_source_vertex_ai_index_test.go similarity index 99% rename from mmv1/third_party/terraform/tests/data_source_vertex_ai_index_test.go rename to mmv1/third_party/terraform/services/vertexai/data_source_vertex_ai_index_test.go index a7adf39be607..a1e4b56bfd6e 100644 --- a/mmv1/third_party/terraform/tests/data_source_vertex_ai_index_test.go +++ b/mmv1/third_party/terraform/services/vertexai/data_source_vertex_ai_index_test.go @@ -1,4 +1,4 @@ -package google +package vertexai_test import ( "testing" diff --git a/mmv1/third_party/terraform/tests/resource_vertex_ai_endpoint_test.go b/mmv1/third_party/terraform/services/vertexai/resource_vertex_ai_endpoint_test.go similarity index 99% rename from mmv1/third_party/terraform/tests/resource_vertex_ai_endpoint_test.go rename to mmv1/third_party/terraform/services/vertexai/resource_vertex_ai_endpoint_test.go index 46ee9ae869a1..2cde7c0a6862 100644 --- a/mmv1/third_party/terraform/tests/resource_vertex_ai_endpoint_test.go +++ b/mmv1/third_party/terraform/services/vertexai/resource_vertex_ai_endpoint_test.go @@ -1,4 +1,4 @@ -package google +package vertexai_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/resource_vertex_ai_index_test.go b/mmv1/third_party/terraform/services/vertexai/resource_vertex_ai_index_test.go similarity index 99% rename from mmv1/third_party/terraform/tests/resource_vertex_ai_index_test.go rename to mmv1/third_party/terraform/services/vertexai/resource_vertex_ai_index_test.go index e737d6d5a75b..09964869d97a 100644 --- a/mmv1/third_party/terraform/tests/resource_vertex_ai_index_test.go +++ b/mmv1/third_party/terraform/services/vertexai/resource_vertex_ai_index_test.go @@ -1,4 +1,4 @@ -package google +package vertexai_test import ( "fmt" diff --git a/mmv1/third_party/terraform/tests/resource_vertex_ai_metadata_store_test.go.erb b/mmv1/third_party/terraform/services/vertexai/resource_vertex_ai_metadata_store_test.go.erb similarity index 99% rename from mmv1/third_party/terraform/tests/resource_vertex_ai_metadata_store_test.go.erb rename to mmv1/third_party/terraform/services/vertexai/resource_vertex_ai_metadata_store_test.go.erb index a8df5f425bf7..5fb1713bb866 100644 --- a/mmv1/third_party/terraform/tests/resource_vertex_ai_metadata_store_test.go.erb +++ b/mmv1/third_party/terraform/services/vertexai/resource_vertex_ai_metadata_store_test.go.erb @@ -1,5 +1,5 @@ <% autogen_exception -%> -package google +package vertexai_test <% unless version == 'ga' -%> import ( diff --git a/mmv1/third_party/terraform/tests/resource_vmwareengine_cluster_test.go.erb b/mmv1/third_party/terraform/services/vmwareengine/resource_vmwareengine_cluster_test.go.erb similarity index 99% rename from mmv1/third_party/terraform/tests/resource_vmwareengine_cluster_test.go.erb rename to mmv1/third_party/terraform/services/vmwareengine/resource_vmwareengine_cluster_test.go.erb index 5f45350bdf4d..c128ec1ce24d 100644 --- a/mmv1/third_party/terraform/tests/resource_vmwareengine_cluster_test.go.erb +++ b/mmv1/third_party/terraform/services/vmwareengine/resource_vmwareengine_cluster_test.go.erb @@ -1,5 +1,5 @@ <% autogen_exception -%> -package google +package vmwareengine_test <% unless version == 'ga' -%> import ( diff --git a/mmv1/third_party/terraform/tests/resource_vmwareengine_private_cloud_test.go.erb b/mmv1/third_party/terraform/services/vmwareengine/resource_vmwareengine_private_cloud_test.go.erb similarity index 99% rename from mmv1/third_party/terraform/tests/resource_vmwareengine_private_cloud_test.go.erb rename to mmv1/third_party/terraform/services/vmwareengine/resource_vmwareengine_private_cloud_test.go.erb index ac4aed6b6b51..6a0d8f1148fc 100644 --- a/mmv1/third_party/terraform/tests/resource_vmwareengine_private_cloud_test.go.erb +++ b/mmv1/third_party/terraform/services/vmwareengine/resource_vmwareengine_private_cloud_test.go.erb @@ -1,5 +1,5 @@ <% autogen_exception -%> -package google +package vmwareengine_test <% unless version == 'ga' -%> import ( diff --git a/mmv1/third_party/terraform/tests/data_source_vpc_access_connector_test.go b/mmv1/third_party/terraform/services/vpcaccess/data_source_vpc_access_connector_test.go similarity index 98% rename from mmv1/third_party/terraform/tests/data_source_vpc_access_connector_test.go rename to mmv1/third_party/terraform/services/vpcaccess/data_source_vpc_access_connector_test.go index a9ca132fd1ee..ac0d31eead9c 100644 --- a/mmv1/third_party/terraform/tests/data_source_vpc_access_connector_test.go +++ b/mmv1/third_party/terraform/services/vpcaccess/data_source_vpc_access_connector_test.go @@ -1,4 +1,4 @@ -package google +package vpcaccess_test import ( "fmt" 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 f4a72c3f37e1..b3d18e47f2a6 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 @@ -21,7 +21,6 @@ func TestAccDataSourceAlloydbLocations_basic(t *testing.T) { acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), - CheckDestroy: testAccSqlDatabaseDestroyProducer(t), Steps: []resource.TestStep{ { Config: testAccDataSourceAlloydbLocations_basic(context), 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 6a8de7767237..c088225fc2df 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 @@ -50,7 +50,7 @@ func TestAccAccessContextManagerAccessPolicyIamMember(t *testing.T) { resource.TestCheckResourceAttr( "google_access_context_manager_access_policy_iam_member.member", "role", role), resource.TestCheckResourceAttr( - "google_access_context_manager_access_policy_iam_member.member", "member", "serviceAccount:"+serviceAccountCanonicalEmail(account)), + "google_access_context_manager_access_policy_iam_member.member", "member", "serviceAccount:"+envvar.ServiceAccountCanonicalEmail(account)), ), }, }, 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 d17bc18cfade..85e6aaa05904 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 @@ -99,7 +99,7 @@ func TestAccServiceAccountIamMember(t *testing.T) { t.Parallel() account := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) - email := serviceAccountCanonicalEmail(account) + email := envvar.ServiceAccountCanonicalEmail(account) identity := fmt.Sprintf("serviceAccount:%s", email) acctest.VcrTest(t, resource.TestCase{ @@ -132,7 +132,7 @@ func TestAccServiceAccountIamMember_withCondition(t *testing.T) { t.Parallel() account := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) - identity := fmt.Sprintf("serviceAccount:%s", serviceAccountCanonicalEmail(account)) + identity := fmt.Sprintf("serviceAccount:%s", envvar.ServiceAccountCanonicalEmail(account)) conditionTitle := "expires_after_2019_12_31" acctest.VcrTest(t, resource.TestCase{ @@ -159,7 +159,7 @@ func TestAccServiceAccountIamMember_withAndWithoutCondition(t *testing.T) { t.Parallel() account := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) - identity := fmt.Sprintf("serviceAccount:%s", serviceAccountCanonicalEmail(account)) + identity := fmt.Sprintf("serviceAccount:%s", envvar.ServiceAccountCanonicalEmail(account)) conditionTitle := "expires_after_2019_12_31" acctest.VcrTest(t, resource.TestCase{ @@ -339,10 +339,6 @@ func serviceAccountCanonicalId(account string) string { return fmt.Sprintf("projects/%s/serviceAccounts/%s@%s.iam.gserviceaccount.com", envvar.GetTestProjectFromEnv(), account, envvar.GetTestProjectFromEnv()) } -func serviceAccountCanonicalEmail(account string) string { - return fmt.Sprintf("%s@%s.iam.gserviceaccount.com", account, envvar.GetTestProjectFromEnv()) -} - func testAccServiceAccountIamBinding_basic(account string) string { return fmt.Sprintf(` resource "google_service_account" "test_account" { diff --git a/mmv1/third_party/terraform/tpgresource/resource_test_utils.go b/mmv1/third_party/terraform/tpgresource/resource_test_utils.go index 69d8c1e3c434..ecd889f0ba29 100644 --- a/mmv1/third_party/terraform/tpgresource/resource_test_utils.go +++ b/mmv1/third_party/terraform/tpgresource/resource_test_utils.go @@ -1,6 +1,7 @@ package tpgresource import ( + "fmt" "reflect" "regexp" "strings" @@ -178,3 +179,16 @@ func SetupTestResourceDataFromConfigMap(t *testing.T, s map[string]*schema.Schem return d } + +func GetResourceAttributes(n string, s *terraform.State) (map[string]string, error) { + rs, ok := s.RootModule().Resources[n] + if !ok { + return nil, fmt.Errorf("Not found: %s", n) + } + + if rs.Primary.ID == "" { + return nil, fmt.Errorf("No ID is set") + } + + return rs.Primary.Attributes, nil +} diff --git a/mmv1/third_party/terraform/utils/test_utils.go b/mmv1/third_party/terraform/utils/test_utils.go index 148e64668cbb..87a19712d558 100644 --- a/mmv1/third_party/terraform/utils/test_utils.go +++ b/mmv1/third_party/terraform/utils/test_utils.go @@ -5,8 +5,10 @@ import ( "github.com/hashicorp/terraform-plugin-go/tfprotov5" "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + "github.com/hashicorp/terraform-provider-google/google/tpgresource" "github.com/hashicorp/terraform-provider-google/google/acctest" + "github.com/hashicorp/terraform-provider-google/google/envvar" ) // Deprecated: For backward compatibility CheckDataSourceStateMatchesResourceState is still working, @@ -43,3 +45,11 @@ func ProtoV5ProviderFactories(t *testing.T) map[string]func() (tfprotov5.Provide func ProtoV5ProviderBetaFactories(t *testing.T) map[string]func() (tfprotov5.ProviderServer, error) { return acctest.ProtoV5ProviderBetaFactories(t) } + +func serviceAccountCanonicalEmail(account string) string { + return envvar.ServiceAccountCanonicalEmail(account) +} + +func getResourceAttributes(n string, s *terraform.State) (map[string]string, error) { + return tpgresource.GetResourceAttributes(n, s) +}