-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
remove allow-missing flag & fix update test failure
- Loading branch information
Showing
2 changed files
with
21 additions
and
121 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
// Copyright (c) HashiCorp, Inc. | ||
// SPDX-License-Identifier: MPL-2.0 | ||
// Copyright (c) HashiCorp, Inc. | ||
// SPDX-License-Identifier: MPL-2.0 | ||
package cloudquotas_test | ||
|
||
import ( | ||
|
@@ -34,7 +36,7 @@ func TestAccCloudQuotasQuotaPreference_cloudquotasQuotaPreferenceBasicExample_up | |
ResourceName: "google_cloud_quotas_quota_preference.my_preference", | ||
ImportState: true, | ||
ImportStateVerify: true, | ||
ImportStateVerifyIgnore: []string{"parent", "quota_preference_id", "allow_missing", "validate_only", "ignore_safety_checks", "contact_email"}, | ||
ImportStateVerifyIgnore: []string{"parent", "quota_preference_id", "validate_only", "ignore_safety_checks", "contact_email"}, | ||
}, | ||
{ | ||
Config: testAccCloudQuotasQuotaPreference_cloudquotasQuotaPreferenceBasicExample_increaseQuota(context), | ||
|
@@ -44,7 +46,7 @@ func TestAccCloudQuotasQuotaPreference_cloudquotasQuotaPreferenceBasicExample_up | |
ImportState: true, | ||
ImportStateVerify: true, | ||
ExpectNonEmptyPlan: true, | ||
ImportStateVerifyIgnore: []string{"parent", "quota_preference_id", "allow_missing", "validate_only", "ignore_safety_checks", "contact_email", "justification", "quota_config.0.annotations"}, | ||
ImportStateVerifyIgnore: []string{"parent", "quota_preference_id", "validate_only", "ignore_safety_checks", "contact_email", "justification", "quota_config.0.annotations"}, | ||
}, | ||
{ | ||
Config: testAccCloudQuotasQuotaPreference_cloudquotasQuotaPreferenceBasicExample_decreaseQuota(context), | ||
|
@@ -53,16 +55,7 @@ func TestAccCloudQuotasQuotaPreference_cloudquotasQuotaPreferenceBasicExample_up | |
ResourceName: "google_cloud_quotas_quota_preference.my_preference", | ||
ImportState: true, | ||
ImportStateVerify: true, | ||
ImportStateVerifyIgnore: []string{"parent", "quota_preference_id", "allow_missing", "validate_only", "ignore_safety_checks", "contact_email", "justification"}, | ||
}, | ||
{ | ||
Config: testAccCloudQuotasQuotaPreference_cloudquotasQuotaPreferenceBasicExample_upsert(context), | ||
}, | ||
{ | ||
ResourceName: "google_cloud_quotas_quota_preference.my_preference", | ||
ImportState: true, | ||
ImportStateVerify: true, | ||
ImportStateVerifyIgnore: []string{"parent", "quota_preference_id", "allow_missing", "validate_only", "ignore_safety_checks", "contact_email", "justification"}, | ||
ImportStateVerifyIgnore: []string{"parent", "quota_preference_id", "validate_only", "ignore_safety_checks", "contact_email", "justification"}, | ||
}, | ||
}, | ||
}) | ||
|
@@ -73,23 +66,14 @@ func testAccCloudQuotasQuotaPreference_cloudquotasQuotaPreferenceBasicExample_ba | |
resource "google_project" "new_project" { | ||
project_id = "tf-test%{random_suffix}" | ||
name = "tf-test%{random_suffix}" | ||
org_id = "%{org_id}" | ||
org_id = "%{org_id}" | ||
billing_account = "%{billing_account}" | ||
} | ||
resource "google_project_iam_binding" "project_iam" { | ||
project = google_project.new_project.project_id | ||
role = "roles/cloudquotas.admin" | ||
members = [ | ||
"user:[email protected]" | ||
] | ||
depends_on = [google_project.new_project] | ||
} | ||
resource "google_project_service" "cloudquotas" { | ||
project = google_project.new_project.project_id | ||
service = "cloudquotas.googleapis.com" | ||
depends_on = [google_project_iam_binding.project_iam] | ||
depends_on = [google_project.new_project] | ||
} | ||
resource "google_project_service" "compute" { | ||
|
@@ -112,15 +96,16 @@ func testAccCloudQuotasQuotaPreference_cloudquotasQuotaPreferenceBasicExample_ba | |
} | ||
resource "google_cloud_quotas_quota_preference" "my_preference"{ | ||
parent = "projects/${google_project_service.billing.project}" | ||
name = "compute_googleapis_com-CPUS-per-project_us-central1" | ||
dimensions = { region = "us-central1" } | ||
service = "compute.googleapis.com" | ||
quota_id = "CPUS-per-project-region" | ||
contact_email = "testinguser2@google.com" | ||
parent = "projects/${google_project_service.billing.project}" | ||
name = "compute_googleapis_com-CPUS-per-project_us-central1" | ||
dimensions = { region = "us-central1" } | ||
service = "compute.googleapis.com" | ||
quota_id = "CPUS-per-project-region" | ||
contact_email = "testuser@gmail.com" | ||
quota_config { | ||
preferred_value = 70 | ||
preferred_value = 70 | ||
} | ||
ignore_safety_checks = "QUOTA_DECREASE_PERCENTAGE_TOO_HIGH" | ||
} | ||
`, context) | ||
} | ||
|
@@ -130,23 +115,14 @@ func testAccCloudQuotasQuotaPreference_cloudquotasQuotaPreferenceBasicExample_in | |
resource "google_project" "new_project" { | ||
project_id = "tf-test%{random_suffix}" | ||
name = "tf-test%{random_suffix}" | ||
org_id = "%{org_id}" | ||
org_id = "%{org_id}" | ||
billing_account = "%{billing_account}" | ||
} | ||
resource "google_project_iam_binding" "project_iam" { | ||
project = google_project.new_project.project_id | ||
role = "roles/cloudquotas.admin" | ||
members = [ | ||
"user:[email protected]" | ||
] | ||
depends_on = [google_project.new_project] | ||
} | ||
resource "google_project_service" "cloudquotas" { | ||
project = google_project.new_project.project_id | ||
service = "cloudquotas.googleapis.com" | ||
depends_on = [google_project_iam_binding.project_iam] | ||
depends_on = [google_project.new_project] | ||
} | ||
resource "google_project_service" "compute" { | ||
|
@@ -169,7 +145,6 @@ func testAccCloudQuotasQuotaPreference_cloudquotasQuotaPreferenceBasicExample_in | |
} | ||
resource "google_cloud_quotas_quota_preference" "my_preference"{ | ||
dimensions = { region = "us-central1" } | ||
contact_email = "[email protected]" | ||
justification = "Ignore. Increase quota for Terraform testing." | ||
quota_config { | ||
|
@@ -185,23 +160,14 @@ func testAccCloudQuotasQuotaPreference_cloudquotasQuotaPreferenceBasicExample_de | |
resource "google_project" "new_project" { | ||
project_id = "tf-test%{random_suffix}" | ||
name = "tf-test%{random_suffix}" | ||
org_id = "%{org_id}" | ||
org_id = "%{org_id}" | ||
billing_account = "%{billing_account}" | ||
} | ||
resource "google_project_iam_binding" "project_iam" { | ||
project = google_project.new_project.project_id | ||
role = "roles/cloudquotas.admin" | ||
members = [ | ||
"user:[email protected]" | ||
] | ||
depends_on = [google_project.new_project] | ||
} | ||
resource "google_project_service" "cloudquotas" { | ||
project = google_project.new_project.project_id | ||
service = "cloudquotas.googleapis.com" | ||
depends_on = [google_project_iam_binding.project_iam] | ||
depends_on = [google_project.new_project] | ||
} | ||
resource "google_project_service" "compute" { | ||
|
@@ -224,69 +190,10 @@ func testAccCloudQuotasQuotaPreference_cloudquotasQuotaPreferenceBasicExample_de | |
} | ||
resource "google_cloud_quotas_quota_preference" "my_preference"{ | ||
dimensions = { region = "us-central1" } | ||
contact_email = "[email protected]" | ||
ignore_safety_checks = "QUOTA_DECREASE_PERCENTAGE_TOO_HIGH" | ||
quota_config { | ||
preferred_value = 65 | ||
} | ||
} | ||
`, context) | ||
} | ||
|
||
func testAccCloudQuotasQuotaPreference_cloudquotasQuotaPreferenceBasicExample_upsert(context map[string]interface{}) string { | ||
return acctest.Nprintf(` | ||
resource "google_project" "new_project" { | ||
project_id = "tf-test%{random_suffix}" | ||
name = "tf-test%{random_suffix}" | ||
org_id = "%{org_id}" | ||
billing_account = "%{billing_account}" | ||
} | ||
resource "google_project_iam_binding" "project_iam" { | ||
project = google_project.new_project.project_id | ||
role = "roles/cloudquotas.admin" | ||
members = [ | ||
"user:[email protected]" | ||
] | ||
depends_on = [google_project.new_project] | ||
} | ||
resource "google_project_service" "cloudquotas" { | ||
project = google_project.new_project.project_id | ||
service = "cloudquotas.googleapis.com" | ||
depends_on = [google_project_iam_binding.project_iam] | ||
} | ||
resource "google_project_service" "compute" { | ||
project = google_project.new_project.project_id | ||
service = "compute.googleapis.com" | ||
depends_on = [google_project_service.cloudquotas] | ||
} | ||
resource "google_project_service" "billing" { | ||
project = google_project.new_project.project_id | ||
service = "cloudbilling.googleapis.com" | ||
depends_on = [google_project_service.compute] | ||
} | ||
resource "time_sleep" "wait_180_seconds" { | ||
create_duration = "180s" | ||
depends_on = [ | ||
google_project_service.billing, | ||
] | ||
} | ||
resource "google_cloud_quotas_quota_preference" "my_preference"{ | ||
parent = "projects/${google_project_service.billing.project}" | ||
name = "libraryagent_googleapis_com-ReadsPerMinutePerProject" | ||
service = "libraryagent.googleapis.com" | ||
quota_id = "ReadsPerMinutePerProject" | ||
contact_email = "[email protected]" | ||
quota_config { | ||
preferred_value = 15 | ||
} | ||
allow_missing = true | ||
} | ||
`, context) | ||
} |