1. Packages
  2. Yandex
  3. API Docs
  4. ContainerRepositoryIamBinding
Yandex v0.13.0 published on Tuesday, Feb 22, 2022 by Pulumi

yandex.ContainerRepositoryIamBinding

Explore with Pulumi AI

yandex_container_repository_iam_binding

Allows creation and management of a single binding within IAM policy for an existing Yandex Container Repository.

Example Usage

using Pulumi;
using Yandex = Pulumi.Yandex;

class MyStack : Stack
{
    public MyStack()
    {
        var your_registry = new Yandex.ContainerRegistry("your-registry", new Yandex.ContainerRegistryArgs
        {
            FolderId = "your-folder-id",
        });
        var repo_1 = new Yandex.ContainerRepository("repo-1", new Yandex.ContainerRepositoryArgs
        {
        });
        var puller = new Yandex.ContainerRepositoryIamBinding("puller", new Yandex.ContainerRepositoryIamBindingArgs
        {
            RepositoryId = repo_1.Id,
            Role = "container-registry.images.puller",
            Members = 
            {
                "system:allUsers",
            },
        });
        var repo_2 = Output.Create(Yandex.GetContainerRepository.InvokeAsync(new Yandex.GetContainerRepositoryArgs
        {
            Name = "some_repository_name",
        }));
        var pusher = new Yandex.ContainerRepositoryIamBinding("pusher", new Yandex.ContainerRepositoryIamBindingArgs
        {
            RepositoryId = repo_2.Apply(repo_2 => repo_2.Id),
            Role = "container-registry.images.pusher",
            Members = 
            {
                "serviceAccount:your-service-account-id",
            },
        });
    }

}
Copy
package main

import (
	"github.com/pulumi/pulumi-yandex/sdk/go/yandex"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := yandex.NewContainerRegistry(ctx, "your-registry", &yandex.ContainerRegistryArgs{
			FolderId: pulumi.String("your-folder-id"),
		})
		if err != nil {
			return err
		}
		_, err = yandex.NewContainerRepository(ctx, "repo-1", nil)
		if err != nil {
			return err
		}
		_, err = yandex.NewContainerRepositoryIamBinding(ctx, "puller", &yandex.ContainerRepositoryIamBindingArgs{
			RepositoryId: repo_1.ID(),
			Role:         pulumi.String("container-registry.images.puller"),
			Members: pulumi.StringArray{
				pulumi.String("system:allUsers"),
			},
		})
		if err != nil {
			return err
		}
		opt0 := "some_repository_name"
		repo_2, err := yandex.LookupContainerRepository(ctx, &GetContainerRepositoryArgs{
			Name: &opt0,
		}, nil)
		if err != nil {
			return err
		}
		_, err = yandex.NewContainerRepositoryIamBinding(ctx, "pusher", &yandex.ContainerRepositoryIamBindingArgs{
			RepositoryId: pulumi.String(repo_2.Id),
			Role:         pulumi.String("container-registry.images.pusher"),
			Members: pulumi.StringArray{
				pulumi.String("serviceAccount:your-service-account-id"),
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy

Coming soon!

import * as pulumi from "@pulumi/pulumi";
import * as yandex from "@pulumi/yandex";

const your_registry = new yandex.ContainerRegistry("your-registry", {folderId: "your-folder-id"});
const repo_1 = new yandex.ContainerRepository("repo-1", {});
const puller = new yandex.ContainerRepositoryIamBinding("puller", {
    repositoryId: repo_1.id,
    role: "container-registry.images.puller",
    members: ["system:allUsers"],
});
const repo-2 = yandex.getContainerRepository({
    name: "some_repository_name",
});
const pusher = new yandex.ContainerRepositoryIamBinding("pusher", {
    repositoryId: repo_2.then(repo_2 => repo_2.id),
    role: "container-registry.images.pusher",
    members: ["serviceAccount:your-service-account-id"],
});
Copy
import pulumi
import pulumi_yandex as yandex

your_registry = yandex.ContainerRegistry("your-registry", folder_id="your-folder-id")
repo_1 = yandex.ContainerRepository("repo-1")
puller = yandex.ContainerRepositoryIamBinding("puller",
    repository_id=repo_1.id,
    role="container-registry.images.puller",
    members=["system:allUsers"])
repo_2 = yandex.get_container_repository(name="some_repository_name")
pusher = yandex.ContainerRepositoryIamBinding("pusher",
    repository_id=repo_2.id,
    role="container-registry.images.pusher",
    members=["serviceAccount:your-service-account-id"])
Copy

Coming soon!

Create ContainerRepositoryIamBinding Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new ContainerRepositoryIamBinding(name: string, args: ContainerRepositoryIamBindingArgs, opts?: CustomResourceOptions);
@overload
def ContainerRepositoryIamBinding(resource_name: str,
                                  args: ContainerRepositoryIamBindingArgs,
                                  opts: Optional[ResourceOptions] = None)

@overload
def ContainerRepositoryIamBinding(resource_name: str,
                                  opts: Optional[ResourceOptions] = None,
                                  members: Optional[Sequence[str]] = None,
                                  repository_id: Optional[str] = None,
                                  role: Optional[str] = None,
                                  sleep_after: Optional[int] = None)
func NewContainerRepositoryIamBinding(ctx *Context, name string, args ContainerRepositoryIamBindingArgs, opts ...ResourceOption) (*ContainerRepositoryIamBinding, error)
public ContainerRepositoryIamBinding(string name, ContainerRepositoryIamBindingArgs args, CustomResourceOptions? opts = null)
public ContainerRepositoryIamBinding(String name, ContainerRepositoryIamBindingArgs args)
public ContainerRepositoryIamBinding(String name, ContainerRepositoryIamBindingArgs args, CustomResourceOptions options)
type: yandex:ContainerRepositoryIamBinding
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. ContainerRepositoryIamBindingArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. ContainerRepositoryIamBindingArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. ContainerRepositoryIamBindingArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. ContainerRepositoryIamBindingArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. ContainerRepositoryIamBindingArgs
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 containerRepositoryIamBindingResource = new Yandex.ContainerRepositoryIamBinding("containerRepositoryIamBindingResource", new()
{
    Members = new[]
    {
        "string",
    },
    RepositoryId = "string",
    Role = "string",
    SleepAfter = 0,
});
Copy
example, err := yandex.NewContainerRepositoryIamBinding(ctx, "containerRepositoryIamBindingResource", &yandex.ContainerRepositoryIamBindingArgs{
	Members: pulumi.StringArray{
		pulumi.String("string"),
	},
	RepositoryId: pulumi.String("string"),
	Role:         pulumi.String("string"),
	SleepAfter:   pulumi.Int(0),
})
Copy
var containerRepositoryIamBindingResource = new ContainerRepositoryIamBinding("containerRepositoryIamBindingResource", ContainerRepositoryIamBindingArgs.builder()
    .members("string")
    .repositoryId("string")
    .role("string")
    .sleepAfter(0)
    .build());
Copy
container_repository_iam_binding_resource = yandex.ContainerRepositoryIamBinding("containerRepositoryIamBindingResource",
    members=["string"],
    repository_id="string",
    role="string",
    sleep_after=0)
Copy
const containerRepositoryIamBindingResource = new yandex.ContainerRepositoryIamBinding("containerRepositoryIamBindingResource", {
    members: ["string"],
    repositoryId: "string",
    role: "string",
    sleepAfter: 0,
});
Copy
type: yandex:ContainerRepositoryIamBinding
properties:
    members:
        - string
    repositoryId: string
    role: string
    sleepAfter: 0
Copy

ContainerRepositoryIamBinding 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 ContainerRepositoryIamBinding resource accepts the following input properties:

Members This property is required. List<string>
Identities that will be granted the privilege in role. Each entry can have one of the following values:

  • userAccount:{user_id}: A unique user ID that represents a specific Yandex account.
  • serviceAccount:{service_account_id}: A unique service account ID.
  • system:{allUsers|allAuthenticatedUsers}: see system groups
RepositoryId This property is required. string
The Yandex Container Repository ID to apply a binding to.
Role This property is required. string
The role that should be applied. See roles.
SleepAfter int
Members This property is required. []string
Identities that will be granted the privilege in role. Each entry can have one of the following values:

  • userAccount:{user_id}: A unique user ID that represents a specific Yandex account.
  • serviceAccount:{service_account_id}: A unique service account ID.
  • system:{allUsers|allAuthenticatedUsers}: see system groups
RepositoryId This property is required. string
The Yandex Container Repository ID to apply a binding to.
Role This property is required. string
The role that should be applied. See roles.
SleepAfter int
members This property is required. List<String>
Identities that will be granted the privilege in role. Each entry can have one of the following values:

  • userAccount:{user_id}: A unique user ID that represents a specific Yandex account.
  • serviceAccount:{service_account_id}: A unique service account ID.
  • system:{allUsers|allAuthenticatedUsers}: see system groups
repositoryId This property is required. String
The Yandex Container Repository ID to apply a binding to.
role This property is required. String
The role that should be applied. See roles.
sleepAfter Integer
members This property is required. string[]
Identities that will be granted the privilege in role. Each entry can have one of the following values:

  • userAccount:{user_id}: A unique user ID that represents a specific Yandex account.
  • serviceAccount:{service_account_id}: A unique service account ID.
  • system:{allUsers|allAuthenticatedUsers}: see system groups
repositoryId This property is required. string
The Yandex Container Repository ID to apply a binding to.
role This property is required. string
The role that should be applied. See roles.
sleepAfter number
members This property is required. Sequence[str]
Identities that will be granted the privilege in role. Each entry can have one of the following values:

  • userAccount:{user_id}: A unique user ID that represents a specific Yandex account.
  • serviceAccount:{service_account_id}: A unique service account ID.
  • system:{allUsers|allAuthenticatedUsers}: see system groups
repository_id This property is required. str
The Yandex Container Repository ID to apply a binding to.
role This property is required. str
The role that should be applied. See roles.
sleep_after int
members This property is required. List<String>
Identities that will be granted the privilege in role. Each entry can have one of the following values:

  • userAccount:{user_id}: A unique user ID that represents a specific Yandex account.
  • serviceAccount:{service_account_id}: A unique service account ID.
  • system:{allUsers|allAuthenticatedUsers}: see system groups
repositoryId This property is required. String
The Yandex Container Repository ID to apply a binding to.
role This property is required. String
The role that should be applied. See roles.
sleepAfter Number

Outputs

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

Id string
The provider-assigned unique ID for this managed resource.
Id string
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.
id string
The provider-assigned unique ID for this managed resource.
id str
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.

Look up Existing ContainerRepositoryIamBinding Resource

Get an existing ContainerRepositoryIamBinding 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?: ContainerRepositoryIamBindingState, opts?: CustomResourceOptions): ContainerRepositoryIamBinding
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        members: Optional[Sequence[str]] = None,
        repository_id: Optional[str] = None,
        role: Optional[str] = None,
        sleep_after: Optional[int] = None) -> ContainerRepositoryIamBinding
func GetContainerRepositoryIamBinding(ctx *Context, name string, id IDInput, state *ContainerRepositoryIamBindingState, opts ...ResourceOption) (*ContainerRepositoryIamBinding, error)
public static ContainerRepositoryIamBinding Get(string name, Input<string> id, ContainerRepositoryIamBindingState? state, CustomResourceOptions? opts = null)
public static ContainerRepositoryIamBinding get(String name, Output<String> id, ContainerRepositoryIamBindingState state, CustomResourceOptions options)
resources:  _:    type: yandex:ContainerRepositoryIamBinding    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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:
Members List<string>
Identities that will be granted the privilege in role. Each entry can have one of the following values:

  • userAccount:{user_id}: A unique user ID that represents a specific Yandex account.
  • serviceAccount:{service_account_id}: A unique service account ID.
  • system:{allUsers|allAuthenticatedUsers}: see system groups
RepositoryId string
The Yandex Container Repository ID to apply a binding to.
Role string
The role that should be applied. See roles.
SleepAfter int
Members []string
Identities that will be granted the privilege in role. Each entry can have one of the following values:

  • userAccount:{user_id}: A unique user ID that represents a specific Yandex account.
  • serviceAccount:{service_account_id}: A unique service account ID.
  • system:{allUsers|allAuthenticatedUsers}: see system groups
RepositoryId string
The Yandex Container Repository ID to apply a binding to.
Role string
The role that should be applied. See roles.
SleepAfter int
members List<String>
Identities that will be granted the privilege in role. Each entry can have one of the following values:

  • userAccount:{user_id}: A unique user ID that represents a specific Yandex account.
  • serviceAccount:{service_account_id}: A unique service account ID.
  • system:{allUsers|allAuthenticatedUsers}: see system groups
repositoryId String
The Yandex Container Repository ID to apply a binding to.
role String
The role that should be applied. See roles.
sleepAfter Integer
members string[]
Identities that will be granted the privilege in role. Each entry can have one of the following values:

  • userAccount:{user_id}: A unique user ID that represents a specific Yandex account.
  • serviceAccount:{service_account_id}: A unique service account ID.
  • system:{allUsers|allAuthenticatedUsers}: see system groups
repositoryId string
The Yandex Container Repository ID to apply a binding to.
role string
The role that should be applied. See roles.
sleepAfter number
members Sequence[str]
Identities that will be granted the privilege in role. Each entry can have one of the following values:

  • userAccount:{user_id}: A unique user ID that represents a specific Yandex account.
  • serviceAccount:{service_account_id}: A unique service account ID.
  • system:{allUsers|allAuthenticatedUsers}: see system groups
repository_id str
The Yandex Container Repository ID to apply a binding to.
role str
The role that should be applied. See roles.
sleep_after int
members List<String>
Identities that will be granted the privilege in role. Each entry can have one of the following values:

  • userAccount:{user_id}: A unique user ID that represents a specific Yandex account.
  • serviceAccount:{service_account_id}: A unique service account ID.
  • system:{allUsers|allAuthenticatedUsers}: see system groups
repositoryId String
The Yandex Container Repository ID to apply a binding to.
role String
The role that should be applied. See roles.
sleepAfter Number

Import

IAM binding imports use space-delimited identifiers; first the resource in question and then the role. These bindings can be imported using the repository_id and role, e.g.

 $ pulumi import yandex:index/containerRepositoryIamBinding:ContainerRepositoryIamBinding puller "repository_id container-registry.images.puller"
Copy

To learn more about importing existing cloud resources, see Importing resources.

Package Details

Repository
Yandex pulumi/pulumi-yandex
License
Apache-2.0
Notes
This Pulumi package is based on the yandex Terraform Provider.