Skip to content

Commit

Permalink
platform/3241: Add labels to artifact registry repositories (#15)
Browse files Browse the repository at this point in the history
refs board#3241: Add labels to artifact registry repositories
  • Loading branch information
FabrizioCafolla authored Jan 15, 2025
1 parent e1ff061 commit 780ede7
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 1 deletion.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@ Following semver, any non backwards compatible feature implies that the next rel

## [Unreleased]

## [0.8.0] - 2024-10-17

[Compare with previous version](https://github.com/sparkfabrik/terraform-google-gcp-artifact-registry/compare/0.7.1...0.8.0)

### Changed

- FEAT: Add labels to artifact registry repositories

## [0.7.1] - 2024-10-17

[Compare with previous version](https://github.com/sparkfabrik/terraform-google-gcp-artifact-registry/compare/0.7.0...0.7.1)
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,11 @@ This module is provided without any kind of warranty and is GPL3 licensed.
|------|-------------|------|---------|:--------:|
| <a name="input_artifact_registry_listers"></a> [artifact\_registry\_listers](#input\_artifact\_registry\_listers) | List of principals that can list Artifact Registry repositories. | `list(string)` | `[]` | no |
| <a name="input_artifact_registry_listers_custom_role_name"></a> [artifact\_registry\_listers\_custom\_role\_name](#input\_artifact\_registry\_listers\_custom\_role\_name) | Name of the custom role for Artifact Registry listers. | `string` | `"custom.artifactRegistryLister"` | no |
| <a name="input_default_labels"></a> [default\_labels](#input\_default\_labels) | Default labels to apply to all Artifact Registry resources. | `map(string)` | <pre>{<br> "managed-by": "terraform"<br>}</pre> | no |
| <a name="input_default_location"></a> [default\_location](#input\_default\_location) | The default location for the Artifact Registry repositories. | `string` | `"europe-west1"` | no |
| <a name="input_enable_api"></a> [enable\_api](#input\_enable\_api) | Enable the Artifact Registry API. | `bool` | `true` | no |
| <a name="input_project_id"></a> [project\_id](#input\_project\_id) | The GCP project ID that hosts the Artifact Registry. | `string` | n/a | yes |
| <a name="input_repositories"></a> [repositories](#input\_repositories) | List of Artifact Registry repositories to create. | <pre>map(object({<br> description = string<br> format = optional(string, "DOCKER")<br> mode = optional(string, "STANDARD_REPOSITORY")<br> cleanup_policy_dry_run = optional(bool, true)<br> cleanup_policies = optional(map(object({<br> action = optional(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, 0)<br> }), {})<br> })), {})<br> docker_immutable_tags = optional(bool, true)<br> virtual_repository_config = optional(map(object({<br> repository = string<br> priority = optional(number, 0)<br> })), null)<br> remote_repository_config_docker = optional(object({<br> description = optional(string, "")<br> custom_repository_uri = string<br> disable_upstream_validation = optional(bool, false)<br> username_password_credentials_username = optional(string, "")<br> username_password_credentials_password_secret_version = optional(string, "")<br> }), null)<br> readers = optional(list(string), [])<br> writers = optional(list(string), [])<br> location = optional(string, "")<br> }))</pre> | n/a | yes |
| <a name="input_repositories"></a> [repositories](#input\_repositories) | List of Artifact Registry repositories to create. | <pre>map(object({<br> description = string<br> format = optional(string, "DOCKER")<br> mode = optional(string, "STANDARD_REPOSITORY")<br> cleanup_policy_dry_run = optional(bool, true)<br> cleanup_policies = optional(map(object({<br> action = optional(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, 0)<br> }), {})<br> })), {})<br> docker_immutable_tags = optional(bool, true)<br> virtual_repository_config = optional(map(object({<br> repository = string<br> priority = optional(number, 0)<br> })), null)<br> remote_repository_config_docker = optional(object({<br> description = optional(string, "")<br> custom_repository_uri = string<br> disable_upstream_validation = optional(bool, false)<br> username_password_credentials_username = optional(string, "")<br> username_password_credentials_password_secret_name = optional(string, "")<br> username_password_credentials_password_secret_version = optional(string, "")<br> }), null)<br> readers = optional(list(string), [])<br> writers = optional(list(string), [])<br> location = optional(string, "")<br> labels = optional(map(string), {})<br> }))</pre> | n/a | yes |

## Outputs

Expand All @@ -49,6 +50,7 @@ This module is provided without any kind of warranty and is GPL3 licensed.
| [google_project_iam_binding.artifact_registry_lister](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/project_iam_binding) | resource |
| [google_project_iam_custom_role.artifact_registry_lister](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/project_iam_custom_role) | resource |
| [google_project_service.project](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/project_service) | resource |
| [google_secret_manager_secret_version.remote_repository_secrets](https://registry.terraform.io/providers/hashicorp/google/latest/docs/data-sources/secret_manager_secret_version) | data source |

## Modules

Expand Down
1 change: 1 addition & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ resource "google_artifact_registry_repository" "repositories" {
mode = each.value.mode
location = each.value.location != "" ? each.value.location : var.default_location
cleanup_policy_dry_run = each.value.cleanup_policy_dry_run
labels = merge(var.default_labels, each.value.labels)

dynamic "cleanup_policies" {
for_each = each.value.cleanup_policies
Expand Down
9 changes: 9 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ variable "repositories" {
readers = optional(list(string), [])
writers = optional(list(string), [])
location = optional(string, "")
labels = optional(map(string), {})
}))

description = "List of Artifact Registry repositories to create."
Expand Down Expand Up @@ -90,3 +91,11 @@ variable "artifact_registry_listers" {
description = "List of principals that can list Artifact Registry repositories."
default = []
}

variable "default_labels" {
type = map(string)
description = "Default labels to apply to all Artifact Registry resources."
default = {
"managed-by" = "terraform"
}
}

0 comments on commit 780ede7

Please sign in to comment.