diff --git a/mmv1/third_party/terraform/tests/data_source_google_billing_account_test.go b/mmv1/third_party/terraform/tests/data_source_google_billing_account_test.go index d57598ed7d8f..e12b00314e28 100644 --- a/mmv1/third_party/terraform/tests/data_source_google_billing_account_test.go +++ b/mmv1/third_party/terraform/tests/data_source_google_billing_account_test.go @@ -9,7 +9,7 @@ import ( ) func TestAccDataSourceGoogleBillingAccount_byFullName(t *testing.T) { - billingId := getTestBillingAccountFromEnv(t) + billingId := getTestMasterBillingAccountFromEnv(t) name := "billingAccounts/" + billingId vcrTest(t, resource.TestCase{ @@ -29,7 +29,7 @@ func TestAccDataSourceGoogleBillingAccount_byFullName(t *testing.T) { } func TestAccDataSourceGoogleBillingAccount_byShortName(t *testing.T) { - billingId := getTestBillingAccountFromEnv(t) + billingId := getTestMasterBillingAccountFromEnv(t) name := "billingAccounts/" + billingId vcrTest(t, resource.TestCase{ @@ -49,7 +49,7 @@ func TestAccDataSourceGoogleBillingAccount_byShortName(t *testing.T) { } func TestAccDataSourceGoogleBillingAccount_byFullNameClosed(t *testing.T) { - billingId := getTestBillingAccountFromEnv(t) + billingId := getTestMasterBillingAccountFromEnv(t) name := "billingAccounts/" + billingId vcrTest(t, resource.TestCase{ diff --git a/mmv1/third_party/terraform/tests/resource_google_project_test.go b/mmv1/third_party/terraform/tests/resource_google_project_test.go index 44506121468b..ed7c5ae8fce3 100644 --- a/mmv1/third_party/terraform/tests/resource_google_project_test.go +++ b/mmv1/third_party/terraform/tests/resource_google_project_test.go @@ -123,6 +123,8 @@ func TestAccProject_create(t *testing.T) { func TestAccProject_billing(t *testing.T) { t.Parallel() org := getTestOrgFromEnv(t) + // This is a second billing account that can be charged, which is used only in this test to + // verify that a project can update its billing account. skipIfEnvNotSet(t, "GOOGLE_BILLING_ACCOUNT_2") billingId2 := os.Getenv("GOOGLE_BILLING_ACCOUNT_2") billingId := getTestBillingAccountFromEnv(t) diff --git a/mmv1/third_party/terraform/tests/resource_logging_bucket_config_test.go b/mmv1/third_party/terraform/tests/resource_logging_bucket_config_test.go index fda3da4063b8..560fdda43d13 100644 --- a/mmv1/third_party/terraform/tests/resource_logging_bucket_config_test.go +++ b/mmv1/third_party/terraform/tests/resource_logging_bucket_config_test.go @@ -131,7 +131,7 @@ func TestAccLoggingBucketConfigBillingAccount_basic(t *testing.T) { context := map[string]interface{}{ "random_suffix": randString(t, 10), - "billing_account_name": "billingAccounts/" + getTestBillingAccountFromEnv(t), + "billing_account_name": "billingAccounts/" + getTestMasterBillingAccountFromEnv(t), "org_id": getTestOrgFromEnv(t), } diff --git a/mmv1/third_party/terraform/utils/provider_test.go.erb b/mmv1/third_party/terraform/utils/provider_test.go.erb index 8d2c771de7ee..8611068fc7ef 100644 --- a/mmv1/third_party/terraform/utils/provider_test.go.erb +++ b/mmv1/third_party/terraform/utils/provider_test.go.erb @@ -104,6 +104,8 @@ var orgTargetEnvVars = []string{ "GOOGLE_ORG_2", } +// This is the billing account that will be charged for the infrastructure used during testing. For +// that reason, it is also the billing account used for creating new projects. var billingAccountEnvVars = []string{ "GOOGLE_BILLING_ACCOUNT", } @@ -118,6 +120,8 @@ type VcrSource struct { var sources map[string]VcrSource +// This is the billing account that will be modified to test billing-related functionality. It is +// expected to have more permissions granted to the test user and support subaccounts. var masterBillingAccountEnvVars = []string{ "GOOGLE_MASTER_BILLING_ACCOUNT", } @@ -838,11 +842,15 @@ func getTestOrgTargetFromEnv(t *testing.T) string { return MultiEnvSearch(orgTargetEnvVars) } +// This is the billing account that will be charged for the infrastructure used during testing. For +// that reason, it is also the billing account used for creating new projects. func getTestBillingAccountFromEnv(t *testing.T) string { skipIfEnvNotSet(t, billingAccountEnvVars...) return MultiEnvSearch(billingAccountEnvVars) } +// This is the billing account that will be modified to test billing-related functionality. It is +// expected to have more permissions granted to the test user and support subaccounts. func getTestMasterBillingAccountFromEnv(t *testing.T) string { skipIfEnvNotSet(t, masterBillingAccountEnvVars...) return MultiEnvSearch(masterBillingAccountEnvVars)