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

storage_bucket retention_period incorrect max value (regression) #19051

Open
StephenWithPH opened this issue Aug 8, 2024 · 2 comments · May be fixed by #21692 or GoogleCloudPlatform/magic-modules#13297

Comments

@StephenWithPH
Copy link

StephenWithPH commented Aug 8, 2024

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request.
  • Please do not leave +1 or me too comments, they generate extra noise for issue followers and do not help prioritize the request.
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment.
  • If an issue is assigned to a user, that user is claiming responsibility for the issue.
  • Customers working with a Google Technical Account Manager or Customer Engineer can ask them to reach out internally to expedite investigation and resolution of this issue.

Terraform Version & Provider Version(s)

OpenTofu v1.7.3
on darwin_arm64

  • provider registry.opentofu.org/hashicorp/google v5.40.0
  • provider registry.opentofu.org/hashicorp/google-beta v5.40.0

Affected Resource(s)

google_storage_bucket

Terraform Configuration

resource "google_storage_bucket" "sad" {
  location                    = "us-west1"
  name                        = "a-sad-bucket"
  uniform_bucket_level_access = true

  retention_policy {
    retention_period = 3155760000
  }
}

Debug Output

No response

Expected Behavior

validate (or plan or apply) should succeed.

Actual Behavior

Validation fails with:

│ Error: expected retention_policy.0.retention_period to be in the range (1 - 2147483647), got 3155760000
│
│   with google_storage_bucket.sad,
│   on buckets.tf line 17, in resource "google_storage_bucket" "invalid_data":
│   17:     retention_period = 3155760000

Steps to reproduce

  1. terraform validate with the above configuration.

Important Factoids

This is the same issue as was solved in #6510 / #6511 . So it appears there was a regression.

The GCP docs still show the max value as 3,155,760,000 seconds
https://cloud.google.com/storage/docs/bucket-lock#retention-periods

References

No response

b/359075861

@github-actions github-actions bot added forward/review In review; remove label to forward service/storage labels Aug 8, 2024
@StephenWithPH
Copy link
Author

Looking closely at #6511 (comment), then looking at https://cloud.google.com/storage/docs/json_api/v1/buckets#resource:

Screenshot 2024-08-08 at 3 57 55 PM

Screenshot 2024-08-08 at 3 58 11 PM

... this may require changing the data type of the Terraform field to string and passing it all the way to the API call as a string.

@ggtisc ggtisc self-assigned this Aug 12, 2024
@ggtisc
Copy link
Collaborator

ggtisc commented Aug 12, 2024

Confirmed issue!

There is an inconsistency between the terraform behavior when running a terraform apply, what does terraform registry say and the API documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment