» google_artifact_registry_repository

A repository for storing artifacts

To get more information about Repository, see:

» Example Usage - Artifact Registry Repository Basic

resource "google_artifact_registry_repository" "my-repo" {
  provider = google-beta

  location = "us-central1"
  repository_id = "my-repository"
  description = "example docker repository"
  format = "DOCKER"
}

» Example Usage - Artifact Registry Repository Cmek

resource "google_artifact_registry_repository" "my-repo" {
  provider = google-beta

  location = "us-central1"
  repository_id = "my-repository"
  description = "example docker repository with cmek"
  format = "DOCKER"
  kms_key_name = "kms-key"
}

» Example Usage - Artifact Registry Repository Iam

resource "google_artifact_registry_repository" "my-repo" {
  provider = google-beta

  location = "us-central1"
  repository_id = "my-repository"
  description = "example docker repository with iam"
  format = "DOCKER"
}

resource "google_service_account" "test-account" {
  provider = google-beta

  account_id   = "my-account"
  display_name = "Test Service Account"
}

resource "google_artifact_registry_repository_iam_member" "test-iam" {
  provider = google-beta

  location = google_artifact_registry_repository.my-repo.location
  repository = google_artifact_registry_repository.my-repo.name
  role   = "roles/artifactregistry.reader"
  member = "serviceAccount:${google_service_account.test-account.email}"
}

» Argument Reference

The following arguments are supported:

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

  • format - (Required) The format of packages that are stored in the repoitory. Possible values are DOCKER.


  • 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.

  • kms_key_name - (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/my-project/locations/my-region/keyRings/my-kr/cryptoKeys/my-key. This value may not be changed after the Repository has been created.

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

» 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/{{repsitory_id}}

  • name - The name of the repository, for example: "projects/p1/locations/us-central1/repositories/repo1"

  • create_time - The time when the repository was created.

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

» Timeouts

This resource provides the following Timeouts configuration options:

  • create - Default is 4 minutes.
  • update - Default is 4 minutes.
  • delete - Default is 4 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.