gcp logo
Google Cloud Classic v6.56.0, May 18 23

gcp.container.Registry

Explore with Pulumi AI

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

using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;

return await Deployment.RunAsync(() => 
{
    var registry = new Gcp.Container.Registry("registry", new()
    {
        Location = "EU",
        Project = "my-project",
    });

});
package main

import (
	"github.com/pulumi/pulumi-gcp/sdk/v6/go/gcp/container"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := container.NewRegistry(ctx, "registry", &container.RegistryArgs{
			Location: pulumi.String("EU"),
			Project:  pulumi.String("my-project"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.container.Registry;
import com.pulumi.gcp.container.RegistryArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var registry = new Registry("registry", RegistryArgs.builder()        
            .location("EU")
            .project("my-project")
            .build());

    }
}
import pulumi
import pulumi_gcp as gcp

registry = gcp.container.Registry("registry",
    location="EU",
    project="my-project")
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";

const registry = new gcp.container.Registry("registry", {
    location: "EU",
    project: "my-project",
});
resources:
  registry:
    type: gcp:container:Registry
    properties:
      location: EU
      project: my-project

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

using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;

return await Deployment.RunAsync(() => 
{
    var registry = new Gcp.Container.Registry("registry", new()
    {
        Project = "my-project",
        Location = "EU",
    });

    var viewer = new Gcp.Storage.BucketIAMMember("viewer", new()
    {
        Bucket = registry.Id,
        Role = "roles/storage.objectViewer",
        Member = "user:jane@example.com",
    });

});
package main

import (
	"github.com/pulumi/pulumi-gcp/sdk/v6/go/gcp/container"
	"github.com/pulumi/pulumi-gcp/sdk/v6/go/gcp/storage"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		registry, err := container.NewRegistry(ctx, "registry", &container.RegistryArgs{
			Project:  pulumi.String("my-project"),
			Location: pulumi.String("EU"),
		})
		if err != nil {
			return err
		}
		_, err = storage.NewBucketIAMMember(ctx, "viewer", &storage.BucketIAMMemberArgs{
			Bucket: registry.ID(),
			Role:   pulumi.String("roles/storage.objectViewer"),
			Member: pulumi.String("user:jane@example.com"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.container.Registry;
import com.pulumi.gcp.container.RegistryArgs;
import com.pulumi.gcp.storage.BucketIAMMember;
import com.pulumi.gcp.storage.BucketIAMMemberArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var registry = new Registry("registry", RegistryArgs.builder()        
            .project("my-project")
            .location("EU")
            .build());

        var viewer = new BucketIAMMember("viewer", BucketIAMMemberArgs.builder()        
            .bucket(registry.id())
            .role("roles/storage.objectViewer")
            .member("user:jane@example.com")
            .build());

    }
}
import pulumi
import pulumi_gcp as gcp

registry = gcp.container.Registry("registry",
    project="my-project",
    location="EU")
viewer = gcp.storage.BucketIAMMember("viewer",
    bucket=registry.id,
    role="roles/storage.objectViewer",
    member="user:jane@example.com")
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";

const registry = new gcp.container.Registry("registry", {
    project: "my-project",
    location: "EU",
});
const viewer = new gcp.storage.BucketIAMMember("viewer", {
    bucket: registry.id,
    role: "roles/storage.objectViewer",
    member: "user:jane@example.com",
});
resources:
  registry:
    type: gcp:container:Registry
    properties:
      project: my-project
      location: EU
  viewer:
    type: gcp:storage:BucketIAMMember
    properties:
      bucket: ${registry.id}
      role: roles/storage.objectViewer
      member: user:jane@example.com

Create Registry Resource

new Registry(name: string, args?: RegistryArgs, opts?: CustomResourceOptions);
@overload
def Registry(resource_name: str,
             opts: Optional[ResourceOptions] = None,
             location: Optional[str] = None,
             project: Optional[str] = None)
@overload
def Registry(resource_name: str,
             args: Optional[RegistryArgs] = None,
             opts: Optional[ResourceOptions] = None)
func NewRegistry(ctx *Context, name string, args *RegistryArgs, opts ...ResourceOption) (*Registry, error)
public Registry(string name, RegistryArgs? args = null, CustomResourceOptions? opts = null)
public Registry(String name, RegistryArgs args)
public Registry(String name, RegistryArgs args, CustomResourceOptions options)
type: gcp:container:Registry
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

name string
The unique name of the resource.
args RegistryArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
args RegistryArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args RegistryArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args RegistryArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name String
The unique name of the resource.
args RegistryArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Registry Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

The Registry resource accepts the following input properties:

Location string

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

Project string

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

Location string

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

Project string

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

location String

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

project String

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

location string

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

project string

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

location str

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

project str

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

location String

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

project String

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

Outputs

All input properties are implicitly available as output properties. Additionally, the Registry resource produces the following output properties:

BucketSelfLink string

The URI of the created resource.

Id string

The provider-assigned unique ID for this managed resource.

BucketSelfLink string

The URI of the created resource.

Id string

The provider-assigned unique ID for this managed resource.

bucketSelfLink String

The URI of the created resource.

id String

The provider-assigned unique ID for this managed resource.

bucketSelfLink string

The URI of the created resource.

id string

The provider-assigned unique ID for this managed resource.

bucket_self_link str

The URI of the created resource.

id str

The provider-assigned unique ID for this managed resource.

bucketSelfLink String

The URI of the created resource.

id String

The provider-assigned unique ID for this managed resource.

Look up Existing Registry Resource

Get an existing Registry resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: RegistryState, opts?: CustomResourceOptions): Registry
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        bucket_self_link: Optional[str] = None,
        location: Optional[str] = None,
        project: Optional[str] = None) -> Registry
func GetRegistry(ctx *Context, name string, id IDInput, state *RegistryState, opts ...ResourceOption) (*Registry, error)
public static Registry Get(string name, Input<string> id, RegistryState? state, CustomResourceOptions? opts = null)
public static Registry get(String name, Output<String> id, RegistryState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
BucketSelfLink string

The URI of the created resource.

Location string

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

Project string

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

BucketSelfLink string

The URI of the created resource.

Location string

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

Project string

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

bucketSelfLink String

The URI of the created resource.

location String

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

project String

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

bucketSelfLink string

The URI of the created resource.

location string

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

project string

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

bucket_self_link str

The URI of the created resource.

location str

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

project str

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

bucketSelfLink String

The URI of the created resource.

location String

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

project String

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

Import

This resource does not support import.

Package Details

Repository
Google Cloud (GCP) Classic pulumi/pulumi-gcp
License
Apache-2.0
Notes

This Pulumi package is based on the google-beta Terraform Provider.