# Google Cloud Artifact Registry Module
This module simplifies the creation of repositories using Google Cloud Artifact Registry.
- [Standard Repository](#standard-repository)
- [Remote and Virtual Repositories](#remote-and-virtual-repositories)
- [Additional Docker and Maven Options](#additional-docker-and-maven-options)
- [Variables](#variables)
- [Outputs](#outputs)
## Standard Repository
```hcl
module "docker_artifact_registry" {
source = "./fabric/modules/artifact-registry"
project_id = "myproject"
location = "europe-west1"
name = "myregistry"
iam = {
"roles/artifactregistry.admin" = ["group:cicd@example.com"]
}
}
# tftest modules=1 resources=2
```
## Remote and Virtual Repositories
```hcl
module "registry-local" {
source = "./fabric/modules/artifact-registry"
project_id = var.project_id
location = "europe-west1"
name = "local"
format = { python = {} }
}
module "registry-remote" {
source = "./fabric/modules/artifact-registry"
project_id = var.project_id
location = "europe-west1"
name = "remote"
format = { python = {} }
mode = { remote = true }
}
module "registry-virtual" {
source = "./fabric/modules/artifact-registry"
project_id = var.project_id
location = "europe-west1"
name = "virtual"
format = { python = {} }
mode = {
virtual = {
remote = {
repository = module.registry-remote.id
priority = 1
}
local = {
repository = module.registry-local.id
priority = 10
}
}
}
}
# tftest modules=3 resources=3 inventory=remote-virtual.yaml
```
## Additional Docker and Maven Options
```hcl
module "registry-docker" {
source = "./fabric/modules/artifact-registry"
project_id = var.project_id
location = "europe-west1"
name = "docker"
format = {
docker = {
immutable_tags = true
}
}
}
module "registry-maven" {
source = "./fabric/modules/artifact-registry"
project_id = var.project_id
location = "europe-west1"
name = "maven"
format = {
maven = {
allow_snapshot_overwrites = true
version_policy = "RELEASE"
}
}
}
# tftest modules=2 resources=2
```
## Variables
| name | description | type | required | default |
|---|---|:---:|:---:|:---:|
| [location](variables.tf#L68) | Registry location. Use `gcloud beta artifacts locations list' to get valid values. | string
| ✓ | |
| [name](variables.tf#L93) | Registry name. | string
| ✓ | |
| [project_id](variables.tf#L98) | Registry project id. | string
| ✓ | |
| [description](variables.tf#L17) | An optional description for the repository. | string
| | "Terraform-managed registry"
|
| [encryption_key](variables.tf#L23) | The KMS key name to use for encryption at rest. | string
| | null
|
| [format](variables.tf#L29) | Repository format. | object({…})
| | { docker = {} }
|
| [iam](variables.tf#L56) | IAM bindings in {ROLE => [MEMBERS]} format. | map(list(string))
| | {}
|
| [labels](variables.tf#L62) | Labels to be attached to the registry. | map(string)
| | {}
|
| [mode](variables.tf#L73) | Repository mode. | object({…})
| | { standard = true }
|
## Outputs
| name | description | sensitive |
|---|---|:---:|
| [id](outputs.tf#L17) | Fully qualified repository id. | |
| [image_path](outputs.tf#L22) | Repository path for images. | |
| [name](outputs.tf#L32) | Repository name. | |