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

google_artifact_registry_repository cleanup_policies doesn't work with non-second unit durations #20796

Open
cornmander opened this issue Dec 29, 2024 · 0 comments · May be fixed by GoogleCloudPlatform/magic-modules#12667

Comments

@cornmander
Copy link

cornmander commented Dec 29, 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)

Terraform v1.10.3
on darwin_arm64

  • provider registry.terraform.io/hashicorp/google v6.14.1
  • provider registry.terraform.io/hashicorp/random v3.6.3

Affected Resource(s)

google_artifact_registry_repository

Terraform Configuration

resource "google_artifact_registry_repository" "app_repo" {
  project       = "test"
  location      = "us-central1"
  repository_id = "test"
  description   = "test"
  format        = "DOCKER"

  cleanup_policies {
    id     = "keep-recent"
    action = "KEEP"
    most_recent_versions {
      keep_count = 5
    }
  }
  cleanup_policies {
    id     = "delete-old"
    action = "DELETE"
    condition {
      older_than = "30d"
    }
  }
}

Debug Output

No response

Expected Behavior

The resource should accept values documented in the docs:

https://cloud.google.com/artifact-registry/docs/repositories/cleanup-policy#delete

Older than: is the minimum time since the version of an artifact was created in the repository, specified as a duration. For example, 30d is 30 days. You can specify durations of seconds, minutes, hours, or days by appending s, m, h, or d respectively.

Actual Behavior

Server-side validation error

 googleapi: Error 400: Invalid value at 'repository.cleanup_policies[0].value.condition.older_than' (type.googleapis.com/google.protobuf.Duration), Field 'olderThan', Illegal duration format; duration must end with 's'
│ Details:
│ [
│   {
│     "@type": "type.googleapis.com/google.rpc.BadRequest",
│     "fieldViolations": [
│       {
│         "description": "Invalid value at 'repository.cleanup_policies[0].value.condition.older_than' (type.googleapis.com/google.protobuf.Duration), Field 'olderThan', Illegal duration format; duration must end with 's'",
│         "field": "repository.cleanup_policies[0].value.condition.older_than"
│       }
│     ]

Steps to reproduce

  1. terraform apply

Important Factoids

No response

References

No response

b/386816510

@cornmander cornmander added the bug label Dec 29, 2024
@github-actions github-actions bot added forward/review In review; remove label to forward service/artifactregistry labels Dec 29, 2024
@zli82016 zli82016 removed the forward/review In review; remove label to forward label Dec 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants