Skip to content

Commit

Permalink
Support common_repository for google_artifact_registry_repository (
Browse files Browse the repository at this point in the history
  • Loading branch information
joemiller authored Nov 12, 2024
1 parent c690cc8 commit 8179902
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 0 deletions.
37 changes: 37 additions & 0 deletions mmv1/products/artifactregistry/Repository.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,17 @@ examples:
# Ignore this field as it is INPUT_ONLY. AR will not return this in the
# response.
- 'remote_repository_config.0.disable_upstream_validation'
- name: 'artifact_registry_repository_remote_common_repository_with_docker'
primary_resource_id: 'my-repo'
vars:
repository_id: 'example-common-remote'
desc: 'example remote common repository with docker upstream'
upstream_repository_id: 'example-upstream-repo'
upstream_repository_desc: 'example upstream repository'
ignore_read_extra:
# Ignore this field as it is INPUT_ONLY. AR will not return this in the
# response.
- 'remote_repository_config.0.disable_upstream_validation'
parameters:
properties:
- name: 'name'
Expand Down Expand Up @@ -419,6 +430,7 @@ properties:
- 'remoteRepositoryConfig.0.npm_repository'
- 'remoteRepositoryConfig.0.python_repository'
- 'remoteRepositoryConfig.0.yum_repository'
- 'remoteRepositoryConfig.0.common_repository'
properties:
- name: 'publicRepository'
type: NestedObject
Expand Down Expand Up @@ -453,6 +465,7 @@ properties:
- 'remoteRepositoryConfig.0.npm_repository'
- 'remoteRepositoryConfig.0.python_repository'
- 'remoteRepositoryConfig.0.yum_repository'
- 'remoteRepositoryConfig.0.common_repository'
properties:
- name: 'publicRepository'
type: Enum
Expand Down Expand Up @@ -491,6 +504,7 @@ properties:
- 'remoteRepositoryConfig.0.npm_repository'
- 'remoteRepositoryConfig.0.python_repository'
- 'remoteRepositoryConfig.0.yum_repository'
- 'remoteRepositoryConfig.0.common_repository'
properties:
- name: 'publicRepository'
type: Enum
Expand Down Expand Up @@ -529,6 +543,7 @@ properties:
- 'remoteRepositoryConfig.0.npm_repository'
- 'remoteRepositoryConfig.0.python_repository'
- 'remoteRepositoryConfig.0.yum_repository'
- 'remoteRepositoryConfig.0.common_repository'
properties:
- name: 'publicRepository'
type: Enum
Expand Down Expand Up @@ -567,6 +582,7 @@ properties:
- 'remoteRepositoryConfig.0.npm_repository'
- 'remoteRepositoryConfig.0.python_repository'
- 'remoteRepositoryConfig.0.yum_repository'
- 'remoteRepositoryConfig.0.common_repository'
properties:
- name: 'publicRepository'
type: Enum
Expand Down Expand Up @@ -605,6 +621,7 @@ properties:
- 'remoteRepositoryConfig.0.npm_repository'
- 'remoteRepositoryConfig.0.python_repository'
- 'remoteRepositoryConfig.0.yum_repository'
- 'remoteRepositoryConfig.0.common_repository'
properties:
- name: 'publicRepository'
type: NestedObject
Expand All @@ -631,6 +648,26 @@ properties:
Specific repository from the base, e.g. `"pub/rocky/9/BaseOS/x86_64/os"`
required: true
immutable: true
- name: 'commonRepository'
type: NestedObject
description: |-
Specific settings for an Artifact Registory remote repository.
immutable: true
exactly_one_of:
- 'remoteRepositoryConfig.0.apt_repository'
- 'remoteRepositoryConfig.0.docker_repository'
- 'remoteRepositoryConfig.0.maven_repository'
- 'remoteRepositoryConfig.0.npm_repository'
- 'remoteRepositoryConfig.0.python_repository'
- 'remoteRepositoryConfig.0.yum_repository'
- 'remoteRepositoryConfig.0.common_repository'
properties:
- name: 'uri'
type: String
description: |-
Specific uri to the Artifact Registory repository, e.g. `projects/UPSTREAM_PROJECT_ID/locations/REGION/repositories/UPSTREAM_REPOSITORY`
immutable: true
required: true
- name: 'upstreamCredentials'
type: NestedObject
description: |-
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
resource "google_artifact_registry_repository" "upstream_repo" {
location = "us-central1"
repository_id = "{{index $.Vars "upstream_repository_id"}}"
description = "{{index $.Vars "upstream_repository_desc"}}"
format = "DOCKER"
}

resource "google_artifact_registry_repository" "{{$.PrimaryResourceId}}" {
location = "us-central1"
repository_id = "{{index $.Vars "repository_id"}}"
description = "{{index $.Vars "desc"}}"
format = "DOCKER"
mode = "REMOTE_REPOSITORY"
remote_repository_config {
description = "pull-through cache of another Artifact Registry repository"
common_repository {
uri = google_artifact_registry_repository.upstream_repo.id
}
}
}

0 comments on commit 8179902

Please sign in to comment.