From fbb290751d2507f24e9c23d1a384812629ffecfd Mon Sep 17 00:00:00 2001 From: Modular Magician Date: Mon, 13 Jan 2025 22:29:59 +0000 Subject: [PATCH] artifactregistry: accept all valid durations (#12667) Co-authored-by: Chris Hawk [upstream:94499923e80f3168760b9a75e0b3d3a5c07e67e3] Signed-off-by: Modular Magician --- artifact_registry_repository_cleanup/main.tf | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/artifact_registry_repository_cleanup/main.tf b/artifact_registry_repository_cleanup/main.tf index fd534aaa..b132059f 100644 --- a/artifact_registry_repository_cleanup/main.tf +++ b/artifact_registry_repository_cleanup/main.tf @@ -4,13 +4,28 @@ resource "google_artifact_registry_repository" "my-repo" { description = "example docker repository with cleanup policies-${local.name_suffix}" format = "DOCKER" cleanup_policy_dry_run = false + cleanup_policies { + id = "delete-untagged" + action = "DELETE" + condition { + tag_state = "UNTAGGED" + } + } + cleanup_policies { + id = "keep-new-untagged" + action = "KEEP" + condition { + tag_state = "UNTAGGED" + newer_than = "7d" + } + } cleanup_policies { id = "delete-prerelease" action = "DELETE" condition { tag_state = "TAGGED" tag_prefixes = ["alpha", "v0"] - older_than = "2592000s" + older_than = "30d" } } cleanup_policies {