diff --git a/modules/artifact-registry/README.md b/modules/artifact-registry/README.md index b782c0688..6e3d0340c 100644 --- a/modules/artifact-registry/README.md +++ b/modules/artifact-registry/README.md @@ -13,7 +13,7 @@ module "docker_artifact_registry" { location = "europe-west1" format = "DOCKER" id = "myregistry" - iam = { + iam = { "roles/artifactregistry.admin" = ["group:cicd@example.com"] } } @@ -28,6 +28,7 @@ module "docker_artifact_registry" { | [id](variables.tf#L35) | Repository id. | string | ✓ | | | [project_id](variables.tf#L52) | Registry project id. | string | ✓ | | | [description](variables.tf#L17) | An optional description for the repository. | string | | "Terraform-managed registry" | +| [encryption_key](variables.tf#L57) | The KMS key name to use for encryption at rest. | string | | null | | [format](variables.tf#L23) | Repository format. One of DOCKER or UNSPECIFIED. | string | | "DOCKER" | | [iam](variables.tf#L29) | IAM bindings in {ROLE => [MEMBERS]} format. | map(list(string)) | | {} | | [labels](variables.tf#L40) | Labels to be attached to the registry. | map(string) | | {} | diff --git a/modules/artifact-registry/main.tf b/modules/artifact-registry/main.tf index 8b01e0961..814aaba14 100644 --- a/modules/artifact-registry/main.tf +++ b/modules/artifact-registry/main.tf @@ -22,6 +22,7 @@ resource "google_artifact_registry_repository" "registry" { format = var.format labels = var.labels repository_id = var.id + kms_key_name = var.encryption_key } resource "google_artifact_registry_repository_iam_binding" "bindings" { diff --git a/modules/artifact-registry/variables.tf b/modules/artifact-registry/variables.tf index 907ee976b..8fcd2c4d2 100644 --- a/modules/artifact-registry/variables.tf +++ b/modules/artifact-registry/variables.tf @@ -53,3 +53,9 @@ variable "project_id" { description = "Registry project id." type = string } + +variable "encryption_key" { + description = "The KMS key name to use for encryption at rest." + type = string + default = null +}