From 3c984edf52e077f6a40eacb79691b30ce669424c Mon Sep 17 00:00:00 2001 From: The Magician Date: Mon, 31 Jul 2023 12:02:54 -0700 Subject: [PATCH] fix TestAccAppEngineApplication* tests (#8486) (#5980) Signed-off-by: Modular Magician --- .changelog/8486.txt | 3 +++ .../resource_app_engine_application_test.go | 24 ++++++++++++------- ...app_engine_firewall_rule_generated_test.go | 6 +++-- .../r/app_engine_firewall_rule.html.markdown | 1 + 4 files changed, 23 insertions(+), 11 deletions(-) create mode 100644 .changelog/8486.txt diff --git a/.changelog/8486.txt b/.changelog/8486.txt new file mode 100644 index 0000000000..8ec013c069 --- /dev/null +++ b/.changelog/8486.txt @@ -0,0 +1,3 @@ +```release-note:none + +``` diff --git a/google-beta/resource_app_engine_application_test.go b/google-beta/resource_app_engine_application_test.go index 5e5bd31b2a..880fe2fb4f 100644 --- a/google-beta/resource_app_engine_application_test.go +++ b/google-beta/resource_app_engine_application_test.go @@ -16,12 +16,14 @@ func TestAccAppEngineApplication_basic(t *testing.T) { org := envvar.GetTestOrgFromEnv(t) pid := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) + billingAccount := envvar.GetTestBillingAccountFromEnv(t) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { - Config: testAccAppEngineApplication_basic(pid, org), + Config: testAccAppEngineApplication_basic(pid, org, billingAccount), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttrSet("google_app_engine_application.acceptance", "url_dispatch_rule.#"), resource.TestCheckResourceAttrSet("google_app_engine_application.acceptance", "name"), @@ -36,7 +38,7 @@ func TestAccAppEngineApplication_basic(t *testing.T) { ImportStateVerify: true, }, { - Config: testAccAppEngineApplication_update(pid, org), + Config: testAccAppEngineApplication_update(pid, org, billingAccount), }, { ResourceName: "google_app_engine_application.acceptance", @@ -52,13 +54,14 @@ func TestAccAppEngineApplication_withIAP(t *testing.T) { org := envvar.GetTestOrgFromEnv(t) pid := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) + billingAccount := envvar.GetTestBillingAccountFromEnv(t) acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { - Config: testAccAppEngineApplication_withIAP(pid, org), + Config: testAccAppEngineApplication_withIAP(pid, org, billingAccount), }, { ResourceName: "google_app_engine_application.acceptance", @@ -70,12 +73,13 @@ func TestAccAppEngineApplication_withIAP(t *testing.T) { }) } -func testAccAppEngineApplication_withIAP(pid, org string) string { +func testAccAppEngineApplication_withIAP(pid, org, billingAccount string) string { return fmt.Sprintf(` resource "google_project" "acceptance" { project_id = "%s" name = "%s" org_id = "%s" + billing_account = "%s" } resource "google_app_engine_application" "acceptance" { @@ -90,15 +94,16 @@ resource "google_app_engine_application" "acceptance" { oauth2_client_secret = "test" } } -`, pid, pid, org) +`, pid, pid, org, billingAccount) } -func testAccAppEngineApplication_basic(pid, org string) string { +func testAccAppEngineApplication_basic(pid, org, billingAccount string) string { return fmt.Sprintf(` resource "google_project" "acceptance" { project_id = "%s" name = "%s" org_id = "%s" + billing_account = "%s" } resource "google_app_engine_application" "acceptance" { @@ -108,15 +113,16 @@ resource "google_app_engine_application" "acceptance" { database_type = "CLOUD_DATASTORE_COMPATIBILITY" serving_status = "SERVING" } -`, pid, pid, org) +`, pid, pid, org, billingAccount) } -func testAccAppEngineApplication_update(pid, org string) string { +func testAccAppEngineApplication_update(pid, org, billingAccount string) string { return fmt.Sprintf(` resource "google_project" "acceptance" { project_id = "%s" name = "%s" org_id = "%s" + billing_account = "%s" } resource "google_app_engine_application" "acceptance" { @@ -126,5 +132,5 @@ resource "google_app_engine_application" "acceptance" { database_type = "CLOUD_DATASTORE_COMPATIBILITY" serving_status = "USER_DISABLED" } -`, pid, pid, org) +`, pid, pid, org, billingAccount) } diff --git a/google-beta/resource_app_engine_firewall_rule_generated_test.go b/google-beta/resource_app_engine_firewall_rule_generated_test.go index 1a72f9baa0..a52a23cf6f 100644 --- a/google-beta/resource_app_engine_firewall_rule_generated_test.go +++ b/google-beta/resource_app_engine_firewall_rule_generated_test.go @@ -35,8 +35,9 @@ func TestAccAppEngineFirewallRule_appEngineFirewallRuleBasicExample(t *testing.T t.Parallel() context := map[string]interface{}{ - "org_id": envvar.GetTestOrgFromEnv(t), - "random_suffix": acctest.RandString(t, 10), + "org_id": envvar.GetTestOrgFromEnv(t), + "billing_account": envvar.GetTestBillingAccountFromEnv(t), + "random_suffix": acctest.RandString(t, 10), } acctest.VcrTest(t, resource.TestCase{ @@ -62,6 +63,7 @@ resource "google_project" "my_project" { name = "tf-test-project" project_id = "tf-test-ae-project%{random_suffix}" org_id = "%{org_id}" + billing_account = "%{billing_account}" } resource "google_app_engine_application" "app" { diff --git a/website/docs/r/app_engine_firewall_rule.html.markdown b/website/docs/r/app_engine_firewall_rule.html.markdown index 0cf4b3b8b5..e71b70dbb2 100644 --- a/website/docs/r/app_engine_firewall_rule.html.markdown +++ b/website/docs/r/app_engine_firewall_rule.html.markdown @@ -38,6 +38,7 @@ resource "google_project" "my_project" { name = "tf-test-project" project_id = "ae-project" org_id = "123456789" + billing_account = "000000-0000000-0000000-000000" } resource "google_app_engine_application" "app" {