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 #4548

Merged
merged 2 commits into from
Mar 4, 2021

Conversation

c2thorn
Copy link
Member

@c2thorn c2thorn commented Mar 1, 2021

Upstreams hashicorp/terraform-provider-google-beta#2985

default_if_empty custom flattener will not work here since override_value is required and has no default value

If this PR is for Terraform, I acknowledge that I have:

  • Searched through the issue tracker for an open issue that this either resolves or contributes to, commented on it to claim it, and written "fixes {url}" or "part of {url}" in this PR description. If there were no relevant open issues, I opened one and commented that I would like to work on it (not necessary for very small changes).
  • Generated Terraform, and ran make test and make lint to ensure it passes unit and linter tests.
  • Ensured that all new fields I added that can be set by a user appear in at least one example (for generated resources) or third_party test (for handwritten resources or update tests).
  • Ran relevant acceptance tests (If the acceptance tests do not yet pass or you are unable to run them, please let your reviewer know).
  • Read the Release Notes Guide before writing my release note below.

Release Note Template for Downstream PRs (will be copied)

serviceusage: fixed an issue in `google_service_usage_consumer_quota_override` where setting the `override_value` to 0 would result in a permanent diff

`default_if_empty` custom flattener will not work here since `override_value` is required and has no default value
@google-cla google-cla bot added the cla: yes label Mar 1, 2021
@c2thorn c2thorn requested review from a team and melinath and removed request for a team March 1, 2021 22:16
@modular-magician
Copy link
Collaborator

Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are.

Diff report:

Terraform Beta: Diff ( 2 files changed, 4 insertions(+), 1 deletion(-))

@modular-magician
Copy link
Collaborator

I have triggered VCR tests based on this PR's diffs. See the results here: "https://ci-oss.hashicorp.engineering/viewQueued.html?itemId=174979"

@modular-magician
Copy link
Collaborator

I have triggered VCR tests in RECORDING mode for the following tests that failed during VCR: TestAccServiceUsageConsumerQuotaOverride_regionConsumerQuotaOverrideExample You can view the result here: "https://ci-oss.hashicorp.engineering/viewQueued.html?itemId=174982"

@modular-magician
Copy link
Collaborator

Tests failed during RECORDING mode: TestAccServiceUsageConsumerQuotaOverride_regionConsumerQuotaOverrideExample Please fix these to complete your PR

Copy link
Member

@melinath melinath left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Do you think we should have a new test case for this change? The test failure seems to be a more general failure but it is on one of the resources changed so I don't know if you want to make sure it runs - I think Riley was in the process of fixing it.

@melinath
Copy link
Member

melinath commented Mar 2, 2021

Would it be possible to set a default_value even though override_value is required, and then use the default_if_empty flattener?

@melinath
Copy link
Member

melinath commented Mar 2, 2021

Ah, terraform prevents Default if Required is true.

@modular-magician
Copy link
Collaborator

Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are.

Diff report:

Terraform Beta: Diff ( 2 files changed, 47 insertions(+))

@modular-magician
Copy link
Collaborator

I have triggered VCR tests based on this PR's diffs. See the results here: "https://ci-oss.hashicorp.engineering/viewQueued.html?itemId=175141"

@melinath
Copy link
Member

melinath commented Mar 2, 2021

/gcbrun (automatic test run failed)

@modular-magician
Copy link
Collaborator

Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are.

Diff report:

Terraform Beta: Diff ( 2 files changed, 47 insertions(+))

@modular-magician
Copy link
Collaborator

I have triggered VCR tests based on this PR's diffs. See the results here: "https://ci-oss.hashicorp.engineering/viewQueued.html?itemId=175143"

@modular-magician
Copy link
Collaborator

I have triggered VCR tests in RECORDING mode for the following tests that failed during VCR: TestAccServiceUsageConsumerQuotaOverride_consumerQuotaOverrideZeroValueExample|TestAccServiceUsageConsumerQuotaOverride_regionConsumerQuotaOverrideExample You can view the result here: "https://ci-oss.hashicorp.engineering/viewQueued.html?itemId=175152"

@modular-magician
Copy link
Collaborator

Tests failed during RECORDING mode: TestAccServiceUsageConsumerQuotaOverride_regionConsumerQuotaOverrideExample|TestAccServiceUsageConsumerQuotaOverride_consumerQuotaOverrideZeroValueExample Please fix these to complete your PR

@c2thorn
Copy link
Member Author

c2thorn commented Mar 2, 2021

Not sure why it failed in post_destroy, it passed locally. I'll try one more time?

@c2thorn
Copy link
Member Author

c2thorn commented Mar 2, 2021

/gcbrun

@modular-magician
Copy link
Collaborator

Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are.

Diff report:

Terraform Beta: Diff ( 2 files changed, 47 insertions(+))

@modular-magician
Copy link
Collaborator

I have triggered VCR tests based on this PR's diffs. See the results here: "https://ci-oss.hashicorp.engineering/viewQueued.html?itemId=175153"

@modular-magician
Copy link
Collaborator

I have triggered VCR tests in RECORDING mode for the following tests that failed during VCR: TestAccServiceUsageConsumerQuotaOverride_consumerQuotaOverrideZeroValueExample|TestAccServiceUsageConsumerQuotaOverride_regionConsumerQuotaOverrideExample You can view the result here: "https://ci-oss.hashicorp.engineering/viewQueued.html?itemId=175168"

@modular-magician
Copy link
Collaborator

Tests failed during RECORDING mode: TestAccServiceUsageConsumerQuotaOverride_regionConsumerQuotaOverrideExample|TestAccServiceUsageConsumerQuotaOverride_consumerQuotaOverrideZeroValueExample Please fix these to complete your PR

@c2thorn
Copy link
Member Author

c2thorn commented Mar 2, 2021

@c2thorn
Copy link
Member Author

c2thorn commented Mar 3, 2021

The flakiness my test and the existing TestAccServiceUsageConsumerQuotaOverride_consumerQuotaOverrideExample seems to be in the Test destroy producer: https://github.com/hashicorp/terraform-provider-google-beta/blob/master/google-beta/resource_service_usage_consumer_quota_override_generated_test.go#L141

The resource deletes, but when we check to make sure it deleted in the destroy producer, the API sometimes reports that the resource still exists. So there is some eventual consistency here.

Not sure what the correct approach would be here. We have polling autogeneration in MMv1 that is possible: https://github.com/hashicorp/terraform-provider-google/wiki/Developer-Best-Practices#polling
but when I tried that out, it added a bunch of code that affected more than just the delete function. I think that goes outside of the scope of this PR. I could add handwrite the polling in the resource's delete function, or handwrite the destroy producer to poll/just skip checking in general. Or I could create an issue to tackle the flakiness later. What do you think @melinath

@melinath
Copy link
Member

melinath commented Mar 3, 2021

TIL about that wiki page. Thanks!

I think doing the more thorough fix as a separate issue sounds like the way to go.

@c2thorn
Copy link
Member Author

c2thorn commented Mar 3, 2021

Added. Let's try one more VCR recording. Surely I'll get lucky this time

@c2thorn
Copy link
Member Author

c2thorn commented Mar 3, 2021

/gcbrun

@modular-magician
Copy link
Collaborator

Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are.

Diff report:

Terraform Beta: Diff ( 2 files changed, 47 insertions(+))

@modular-magician
Copy link
Collaborator

I have triggered VCR tests based on this PR's diffs. See the results here: "https://ci-oss.hashicorp.engineering/viewQueued.html?itemId=175378"

@modular-magician
Copy link
Collaborator

I have triggered VCR tests in RECORDING mode for the following tests that failed during VCR: TestAccApiGatewayGateway_apigatewayGatewayBasicExampleUpdated|TestAccServiceUsageConsumerQuotaOverride_consumerQuotaOverrideZeroValueExample|TestAccServiceUsageConsumerQuotaOverride_regionConsumerQuotaOverrideExample You can view the result here: "https://ci-oss.hashicorp.engineering/viewQueued.html?itemId=175380"

@modular-magician
Copy link
Collaborator

Tests failed during RECORDING mode: TestAccServiceUsageConsumerQuotaOverride_regionConsumerQuotaOverrideExample|TestAccApiGatewayGateway_apigatewayGatewayBasicExampleUpdated Please fix these to complete your PR

@c2thorn c2thorn merged commit 70af3dc into GoogleCloudPlatform:master Mar 4, 2021
@c2thorn c2thorn deleted the upstream-tpgb-2985 branch March 4, 2021 00:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants