Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set override_value to 0 when not returned by the API #3025

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/4548.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
serviceusage: fixed an issue in `google_service_usage_consumer_quota_override` where setting the `override_value` to 0 would result in a permanent diff
```
2 changes: 1 addition & 1 deletion google-beta/resource_dataflow_flex_template_job_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (

"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
"google.golang.org/api/compute/v1"
compute "google.golang.org/api/compute/v1"
)

func TestAccDataflowFlexTemplateJob_basic(t *testing.T) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,50 @@ resource "google_service_usage_consumer_quota_override" "override" {
`, context)
}

func TestAccServiceUsageConsumerQuotaOverride_consumerQuotaOverrideZeroValueExample(t *testing.T) {
t.Parallel()

context := map[string]interface{}{
"org_id": getTestOrgFromEnv(t),
"random_suffix": randString(t, 10),
}

vcrTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProvidersOiCS,
ExternalProviders: map[string]resource.ExternalProvider{
"random": {},
},
CheckDestroy: testAccCheckServiceUsageConsumerQuotaOverrideDestroyProducer(t),
Steps: []resource.TestStep{
{
Config: testAccServiceUsageConsumerQuotaOverride_consumerQuotaOverrideZeroValueExample(context),
},
},
})
}

func testAccServiceUsageConsumerQuotaOverride_consumerQuotaOverrideZeroValueExample(context map[string]interface{}) string {
return Nprintf(`
resource "google_project" "my_project" {
provider = google-beta
name = "tf-test-project"
project_id = "quota%{random_suffix}"
org_id = "%{org_id}"
}

resource "google_service_usage_consumer_quota_override" "override" {
provider = google-beta
project = google_project.my_project.project_id
service = "servicemanagement.googleapis.com"
metric = "servicemanagement.googleapis.com%2Fdefault_requests"
limit = "%2Fmin%2Fproject"
override_value = "0"
force = true
}
`, context)
}

func TestAccServiceUsageConsumerQuotaOverride_regionConsumerQuotaOverrideExample(t *testing.T) {
t.Parallel()

Expand Down