-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Adding a failing test/logs that illustrates problem with lifecycle age #9512
Conversation
…le condition age.
Hello! I am a robot. It looks like you are a: @slevenick, a repository maintainer, has been assigned to review your changes. If you have not received review feedback within 2 business days, please leave a comment on this PR asking them to take a look. You can help make sure that review is quick by doing a self-review and by running impacted tests locally. |
Hi there, I'm the Modular magician. I've detected the following information about your changes: Diff reportYour PR generated some diffs in downstreams - here they are. Terraform GA: Diff ( 2 files changed, 146 insertions(+), 2 deletions(-)) |
Tests analyticsTotal tests: Action takenFound 1 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected testsTestAccStorageBucket_lifecycleRuleAge |
|
I think the general way we handle this is by adding a boolean that controls if the empty value is sent or not. See |
Based on what I'm seeing it looks like you're adding a Terraform-only field to distinguish between the
That way, |
I don't think that we can change the existing default as it would be a breaking change. It might have to be switched around so that we keep the existing default and use the boolean to set age to |
Makes sense. So I'll implement something more like the following:
|
Hey! I'm closing this PR as a part of a cleanup of older inactive PRs, using a threshold of PRs last updated over 3 months ago. This doesn't represent rejection of the change, and feel free to comment for me to reopen it if you plan to pick it back up, or feel free to start a new PR with the same changes in the future. |
This is related to hashicorp/terraform-provider-google#14044
The issue appears to be caused by a confusion in the way Terraform handles config integer values as 0 vs
nil
. The API requires a*int64
which only complicates matters because the conversion from the config to the API request could also be a problem as well.This draft PR illustrates the problem by way of a failing test. I've tried a lot of different ways of resolving the issue within the bucket resource code but so far I haven't been able to come up with a fix.
From where I am now it seems like the central issue is that when converting the config to an API request, Terraform always sees
nil
values as 0, even after I changed the config for theage
field to default tonil
. Isolating the relevant changes you get something like this:When updating a bucket so that the lifecycle rule condition age is unset (i.e.
nil
) the logs always show the following:Obviously I would expect the value output here to be
nil
rather than 0, given that the age field is clearly both optional and nil by default.Release Note Template for Downstream PRs (will be copied)