Skip to content

googleArtifactRegistryRepository

A repository for storing artifacts

To get more information about Repository, see:

Example Usage - Artifact Registry Repository Basic

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as google from "./.gen/providers/google";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: google.
For a more precise conversion please use the --provider flag in convert.*/
new google.artifactRegistryRepository.ArtifactRegistryRepository(
  this,
  "my-repo",
  {
    description: "example docker repository",
    format: "DOCKER",
    location: "us-central1",
    repository_id: "my-repository",
  }
);

Example Usage - Artifact Registry Repository Cmek

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as google from "./.gen/providers/google";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: google.
For a more precise conversion please use the --provider flag in convert.*/
const dataGoogleProjectProject = new google.dataGoogleProject.DataGoogleProject(
  this,
  "project",
  {}
);
const googleKmsCryptoKeyIamMemberCryptoKey =
  new google.kmsCryptoKeyIamMember.KmsCryptoKeyIamMember(this, "crypto_key", {
    crypto_key_id: "kms-key",
    member: `serviceAccount:service-\${${dataGoogleProjectProject.number}}@gcp-sa-artifactregistry.iam.gserviceaccount.com`,
    role: "roles/cloudkms.cryptoKeyEncrypterDecrypter",
  });
new google.artifactRegistryRepository.ArtifactRegistryRepository(
  this,
  "my-repo",
  {
    depends_on: [`\${${googleKmsCryptoKeyIamMemberCryptoKey.fqn}}`],
    description: "example docker repository with cmek",
    format: "DOCKER",
    kms_key_name: "kms-key",
    location: "us-central1",
    repository_id: "my-repository",
  }
);

Example Usage - Artifact Registry Repository Virtual

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as google from "./.gen/providers/google";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: google.
For a more precise conversion please use the --provider flag in convert.*/
const googleArtifactRegistryRepositoryMyRepoUpstream =
  new google.artifactRegistryRepository.ArtifactRegistryRepository(
    this,
    "my-repo-upstream",
    {
      description: "example docker repository (upstream source)",
      format: "DOCKER",
      location: "us-central1",
      provider: "${google-beta}",
      repository_id: "my-repository-upstream",
    }
  );
new google.artifactRegistryRepository.ArtifactRegistryRepository(
  this,
  "my-repo",
  {
    depends_on: [],
    description: "example virtual docker repository",
    format: "DOCKER",
    location: "us-central1",
    mode: "VIRTUAL_REPOSITORY",
    provider: "${google-beta}",
    repository_id: "my-repository",
    virtual_repository_config: [
      {
        upstream_policies: [
          {
            id: "my-repository-upstream",
            priority: 1,
            repository: googleArtifactRegistryRepositoryMyRepoUpstream.id,
          },
        ],
      },
    ],
  }
);

Example Usage - Artifact Registry Repository Remote

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as google from "./.gen/providers/google";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: google.
For a more precise conversion please use the --provider flag in convert.*/
new google.artifactRegistryRepository.ArtifactRegistryRepository(
  this,
  "my-repo",
  {
    description: "example remote docker repository",
    format: "DOCKER",
    location: "us-central1",
    mode: "REMOTE_REPOSITORY",
    provider: "${google-beta}",
    remote_repository_config: [
      {
        description: "docker hub",
        docker_repository: [
          {
            public_repository: "DOCKER_HUB",
          },
        ],
      },
    ],
    repository_id: "my-repository",
  }
);

Argument Reference

The following arguments are supported:

  • repositoryId - (Required) The last part of the repository name, for example: "repo1"

  • format - (Required) The format of packages that are stored in the repository. Supported formats can be found here. You can only create alpha formats if you are a member of the alpha user group.


  • location - (Optional) The name of the location this repository is located in.

  • description - (Optional) The user-provided description of the repository.

  • labels - (Optional) Labels with user-defined metadata. This field may contain up to 64 entries. Label keys and values may be no longer than 63 characters. Label keys must begin with a lowercase letter and may only contain lowercase letters, numeric characters, underscores, and dashes.

  • kmsKeyName - (Optional) The Cloud KMS resource name of the customer managed encryption key that’s used to encrypt the contents of the Repository. Has the form: projects/myProject/locations/myRegion/keyRings/myKr/cryptoKeys/myKey. This value may not be changed after the Repository has been created.

  • mavenConfig - (Optional) MavenRepositoryConfig is maven related repository details. Provides additional configuration details for repositories of the maven format type. Structure is documented below.

  • mode - (Optional, Beta) The mode configures the repository to serve artifacts from different sources. Default value is standardRepository. Possible values are standardRepository, virtualRepository, and remoteRepository.

  • virtualRepositoryConfig - (Optional, Beta) Configuration specific for a Virtual Repository. Structure is documented below.

  • remoteRepositoryConfig - (Optional, Beta) Configuration specific for a Remote Repository. Structure is documented below.

  • project - (Optional) The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

The mavenConfig block supports:

  • allowSnapshotOverwrites - (Optional) The repository with this flag will allow publishing the same snapshot versions.

  • versionPolicy - (Optional) Version policy defines the versions that the registry will accept. Default value is versionPolicyUnspecified. Possible values are versionPolicyUnspecified, release, and snapshot.

The virtualRepositoryConfig block supports:

  • upstreamPolicies - (Optional) Policies that configure the upstream artifacts distributed by the Virtual Repository. Upstream policies cannot be set on a standard repository. Structure is documented below.

The upstreamPolicies block supports:

  • id - (Optional) The user-provided ID of the upstream policy.

  • repository - (Optional) A reference to the repository resource, for example: "projects/p1/locations/us-central1/repository/repo1".

  • priority - (Optional) Entries with a greater priority value take precedence in the pull order.

The remoteRepositoryConfig block supports:

  • description - (Optional) The description of the remote source.

  • dockerRepository - (Optional) Specific settings for a Docker remote repository. Structure is documented below.

  • mavenRepository - (Optional) Specific settings for a Maven remote repository. Structure is documented below.

  • npmRepository - (Optional) Specific settings for an Npm remote repository. Structure is documented below.

  • pythonRepository - (Optional) Specific settings for a Python remote repository. Structure is documented below.

The dockerRepository block supports:

  • publicRepository - (Optional) Address of the remote repository. Default value is dockerHub. Possible values are dockerHub.

The mavenRepository block supports:

  • publicRepository - (Optional) Address of the remote repository. Default value is mavenCentral. Possible values are mavenCentral.

The npmRepository block supports:

  • publicRepository - (Optional) Address of the remote repository. Default value is npmjs. Possible values are npmjs.

The pythonRepository block supports:

  • publicRepository - (Optional) Address of the remote repository. Default value is pypi. Possible values are pypi.

Attributes Reference

In addition to the arguments listed above, the following computed attributes are exported:

  • id - an identifier for the resource with format projects/{{project}}/locations/{{location}}/repositories/{{repositoryId}}

  • name - The name of the repository, for example: "repo1"

  • createTime - The time when the repository was created.

  • updateTime - The time when the repository was last updated.

Timeouts

This resource provides the following Timeouts configuration options:

  • create - Default is 20 minutes.
  • update - Default is 20 minutes.
  • delete - Default is 20 minutes.

Import

Repository can be imported using any of these accepted formats:

$ terraform import google_artifact_registry_repository.default projects/{{project}}/locations/{{location}}/repositories/{{repository_id}}
$ terraform import google_artifact_registry_repository.default {{project}}/{{location}}/{{repository_id}}
$ terraform import google_artifact_registry_repository.default {{location}}/{{repository_id}}
$ terraform import google_artifact_registry_repository.default {{repository_id}}

User Project Overrides

This resource supports User Project Overrides.