Skip to content

googleContainerRegistry

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.

Example Usage

/*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.containerRegistry.ContainerRegistry(this, "registry", {
  location: "EU",
  project: "my-project",
});

The id field of the googleContainerRegistry is the identifier of the storage bucket that backs GCR and can be used to assign permissions to the bucket.

/*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 googleContainerRegistryRegistry =
  new google.containerRegistry.ContainerRegistry(this, "registry", {
    location: "EU",
    project: "my-project",
  });
new google.storageBucketIamMember.StorageBucketIamMember(this, "viewer", {
  bucket: googleContainerRegistryRegistry.id,
  member: "user:jane@example.com",
  role: "roles/storage.objectViewer",
});

Argument Reference

The following arguments are supported:

  • location - (Optional) The location of the registry. One of asia, eu, us or not specified. See the official documentation for more information on registry locations.

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

  • bucketSelfLink - The URI of the created resource.

  • id - The name of the bucket that supports the Container Registry. In the form of artifacts.{project}AppspotCom or {location}Artifacts.{project}AppspotCom if location is specified.

Import

This resource does not support import.