update and refactor artifact registry module (#1536)
This commit is contained in:
committed by
GitHub
parent
960c84b347
commit
5a534edf5c
@@ -2,37 +2,111 @@
|
||||
|
||||
This module simplifies the creation of repositories using Google Cloud Artifact Registry.
|
||||
|
||||
Note: Artifact Registry is still in beta, hence this module currently uses the beta provider.
|
||||
|
||||
## Example
|
||||
## Standard Repository
|
||||
|
||||
```hcl
|
||||
module "docker_artifact_registry" {
|
||||
source = "./fabric/modules/artifact-registry"
|
||||
project_id = "myproject"
|
||||
location = "europe-west1"
|
||||
format = "DOCKER"
|
||||
id = "myregistry"
|
||||
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
|
||||
```
|
||||
<!-- BEGIN TFDOC -->
|
||||
|
||||
## Variables
|
||||
|
||||
| name | description | type | required | default |
|
||||
|---|---|:---:|:---:|:---:|
|
||||
| [id](variables.tf#L41) | Repository id. | <code>string</code> | ✓ | |
|
||||
| [project_id](variables.tf#L58) | Registry project id. | <code>string</code> | ✓ | |
|
||||
| [location](variables.tf#L68) | Registry location. Use `gcloud beta artifacts locations list' to get valid values. | <code>string</code> | ✓ | |
|
||||
| [name](variables.tf#L93) | Registry name. | <code>string</code> | ✓ | |
|
||||
| [project_id](variables.tf#L98) | Registry project id. | <code>string</code> | ✓ | |
|
||||
| [description](variables.tf#L17) | An optional description for the repository. | <code>string</code> | | <code>"Terraform-managed registry"</code> |
|
||||
| [encryption_key](variables.tf#L23) | The KMS key name to use for encryption at rest. | <code>string</code> | | <code>null</code> |
|
||||
| [format](variables.tf#L29) | Repository format. One of DOCKER or UNSPECIFIED. | <code>string</code> | | <code>"DOCKER"</code> |
|
||||
| [iam](variables.tf#L35) | IAM bindings in {ROLE => [MEMBERS]} format. | <code>map(list(string))</code> | | <code>{}</code> |
|
||||
| [labels](variables.tf#L46) | Labels to be attached to the registry. | <code>map(string)</code> | | <code>{}</code> |
|
||||
| [location](variables.tf#L52) | Registry location. Use `gcloud beta artifacts locations list' to get valid values. | <code>string</code> | | <code>null</code> |
|
||||
| [format](variables.tf#L29) | Repository format. | <code title="object({ apt = optional(object({})) docker = optional(object({ immutable_tags = optional(bool) })) kfp = optional(object({})) go = optional(object({})) maven = optional(object({ allow_snapshot_overwrites = optional(bool) version_policy = optional(string) })) npm = optional(object({})) python = optional(object({})) yum = optional(object({})) })">object({…})</code> | | <code>{ docker = {} }</code> |
|
||||
| [iam](variables.tf#L56) | IAM bindings in {ROLE => [MEMBERS]} format. | <code>map(list(string))</code> | | <code>{}</code> |
|
||||
| [labels](variables.tf#L62) | Labels to be attached to the registry. | <code>map(string)</code> | | <code>{}</code> |
|
||||
| [mode](variables.tf#L73) | Repository mode. | <code title="object({ standard = optional(bool) remote = optional(bool) virtual = optional(map(object({ repository = string priority = number }))) })">object({…})</code> | | <code>{ standard = true }</code> |
|
||||
|
||||
## Outputs
|
||||
|
||||
|
||||
Reference in New Issue
Block a user