Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion google_gar/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ module "gar" {
| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_application"></a> [application](#input\_application) | Application, e.g. bouncer. | `string` | n/a | yes |
| <a name="input_cleanup_policies"></a> [cleanup\_policies](#input\_cleanup\_policies) | n/a | <pre>map(object({<br/> id = string<br/> action = string<br/> condition = optional(object({<br/> tag_state = string<br/> tag_prefixes = string<br/> version_name_prefixes = any<br/> package_name_prefixes = any<br/> older_than = any<br/> newer_than = any<br/> }))<br/> most_recent_versions = optional(object({<br/> package_name_prefixes = any<br/> keep_count = any<br/> }))<br/> }))</pre> | n/a | yes |
| <a name="input_cleanup_policies"></a> [cleanup\_policies](#input\_cleanup\_policies) | Map of Cleanup Policies https://cloud.google.com/artifact-registry/docs/repositories/cleanup-policy-overview . | <pre>map(object({<br/> id = string<br/> action = string<br/> condition = optional(object({<br/> tag_state = optional(string)<br/> tag_prefixes = optional(list(string))<br/> version_name_prefixes = optional(list(string))<br/> package_name_prefixes = optional(list(string))<br/> older_than = optional(string)<br/> newer_than = optional(string)<br/> }))<br/> most_recent_versions = optional(object({<br/> package_name_prefixes = optional(list(string))<br/> keep_count = optional(number)<br/> }))<br/> }))</pre> | `{}` | no |
| <a name="input_description"></a> [description](#input\_description) | n/a | `string` | `null` | no |
| <a name="input_format"></a> [format](#input\_format) | n/a | `string` | `"DOCKER"` | no |
| <a name="input_location"></a> [location](#input\_location) | Location of the repository. Should generally be set to a multi-region location like 'us' or 'europe'. | `string` | `"us"` | no |
Expand Down
4 changes: 2 additions & 2 deletions google_gar/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ resource "google_artifact_registry_repository" "repository" {
action = cleanup_policies.value.action

dynamic "condition" {
for_each = cleanup_policies.value.condition
for_each = cleanup_policies.value.condition != null ? { condition = cleanup_policies.value.condition } : {}

content {
tag_state = condition.value.tag_state
Expand All @@ -39,7 +39,7 @@ resource "google_artifact_registry_repository" "repository" {
}

dynamic "most_recent_versions" {
for_each = cleanup_policies.value.most_recent_versions
for_each = cleanup_policies.value.most_recent_versions != null ? { most_recent_versions = cleanup_policies.value.most_recent_versions } : {}

content {
package_name_prefixes = most_recent_versions.value.package_name_prefixes
Expand Down
18 changes: 10 additions & 8 deletions google_gar/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,18 @@ variable "cleanup_policies" {
id = string
action = string
condition = optional(object({
tag_state = string
tag_prefixes = string
version_name_prefixes = any
package_name_prefixes = any
older_than = any
newer_than = any
tag_state = optional(string)
tag_prefixes = optional(list(string))
version_name_prefixes = optional(list(string))
package_name_prefixes = optional(list(string))
older_than = optional(string)
newer_than = optional(string)
}))
most_recent_versions = optional(object({
package_name_prefixes = any
keep_count = any
package_name_prefixes = optional(list(string))
keep_count = optional(number)
}))
}))
default = {}
description = "Map of Cleanup Policies https://cloud.google.com/artifact-registry/docs/repositories/cleanup-policy-overview ."
}
Loading