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
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const registry = new gcp.container.Registry("registry", {
project: "my-project",
location: "EU",
});
import pulumi
import pulumi_gcp as gcp
registry = gcp.container.Registry("registry",
project="my-project",
location="EU")
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v8/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{
Project: pulumi.String("my-project"),
Location: pulumi.String("EU"),
})
if err != nil {
return err
}
return nil
})
}
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",
});
});
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()
.project("my-project")
.location("EU")
.build());
}
}
resources:
registry:
type: gcp:container:Registry
properties:
project: my-project
location: EU
The id
field of the gcp.container.Registry
is the identifier of the storage bucket that backs GCR and can be used to assign permissions to the bucket.
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",
});
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")
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/container"
"github.com/pulumi/pulumi-gcp/sdk/v8/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
})
}
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 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());
}
}
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
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new Registry(name: string, args?: RegistryArgs, opts?: CustomResourceOptions);
@overload
def Registry(resource_name: str,
args: Optional[RegistryArgs] = None,
opts: Optional[ResourceOptions] = None)
@overload
def Registry(resource_name: str,
opts: Optional[ResourceOptions] = None,
location: Optional[str] = None,
project: Optional[str] = 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.
Parameters
- 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.
Constructor example
The following reference example uses placeholder values for all input properties.
var registryResource = new Gcp.Container.Registry("registryResource", new()
{
Location = "string",
Project = "string",
});
example, err := container.NewRegistry(ctx, "registryResource", &container.RegistryArgs{
Location: pulumi.String("string"),
Project: pulumi.String("string"),
})
var registryResource = new Registry("registryResource", RegistryArgs.builder()
.location("string")
.project("string")
.build());
registry_resource = gcp.container.Registry("registryResource",
location="string",
project="string")
const registryResource = new gcp.container.Registry("registryResource", {
location: "string",
project: "string",
});
type: gcp:container:Registry
properties:
location: string
project: string
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
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
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:
- Bucket
Self stringLink - The URI of the created resource.
- Id string
- The provider-assigned unique ID for this managed resource.
- Bucket
Self stringLink - The URI of the created resource.
- Id string
- The provider-assigned unique ID for this managed resource.
- bucket
Self StringLink - The URI of the created resource.
- id String
- The provider-assigned unique ID for this managed resource.
- bucket
Self stringLink - The URI of the created resource.
- id string
- The provider-assigned unique ID for this managed resource.
- bucket_
self_ strlink - The URI of the created resource.
- id str
- The provider-assigned unique ID for this managed resource.
- bucket
Self StringLink - 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)
resources: _: type: gcp:container:Registry get: id: ${id}
- 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.
- Bucket
Self stringLink - 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 stringLink - 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 StringLink - 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 stringLink - 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_ strlink - 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.
- bucket
Self StringLink - 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.
To learn more about importing existing cloud resources, see Importing resources.
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.