Google Container Registry Registry

This page shows how to write Terraform for Container Registry Registry and write them securely.

google_container_registry (Terraform)

The Registry in Container Registry can be configured in Terraform with the resource name google_container_registry. The following sections describe 5 examples of how to use the resource and its parameters.

Example Usage from GitHub

docker_registry.tf#L8
resource "google_container_registry" "default_us" {
  project = local.project_id
  location = "US"
  depends_on = [google_project_service.container_registry]
}

gcr.tf#L1
resource "google_container_registry" "registry" {
  project  = var.project
  location = "EU"
gcr.tf#L1
resource "google_container_registry" "oreno-gke" {
  project = "oreno-gke"
}
gcr.tf#L1
resource "google_container_registry" "registry" {
  project = var.project_id
}
gcr.tf#L1
resource "google_container_registry" "registry" {
  project = var.project_id
}

Review your Terraform file for Google best practices

Shisho Cloud, our free checker to make sure your Terraform configuration follows best practices, is available (beta).

Parameters

The URI of the created resource.

The location of the registry. One of ASIA, EU, US or not specified. See the official documentation for more information on registry locations.

The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

Explanation in Terraform Registry

Ensures that the Google Cloud Storage bucket that backs Google Container Registry exists. Creating this resource will create the backing bucket if it does not exist, or do nothing if the bucket already exists. Destroying this resource does NOT destroy the backing bucket. For more information see the official documentation This resource can be used to ensure that the GCS bucket exists prior to assigning permissions. For more information see the access control page for GCR.

Frequently asked questions

What is Google Container Registry Registry?

Google Container Registry Registry is a resource for Container Registry of Google Cloud Platform. Settings can be wrote in Terraform.

Where can I find the example code for the Google Container Registry Registry?

For Terraform, the JordanP/terraform-playground, mattb45uk/jenkins and inokappa/oreno-gke-cluster source code examples are useful. See the Terraform Example section for further details.

security-icon

Automate config file reviews on your commits

Fix issues in your infrastructure as code with auto-generated patches.