Welcome to Pulumi Registry, your window into the cloud. Read the announcement.

Yandex

v0.10.0 published on Thursday, Nov 18, 2021 by Pulumi

IamServiceAccountIamBinding

When managing IAM roles, you can treat a service account either as a resource or as an identity. This resource is used to add IAM policy bindings to a service account resource to configure permissions that define who can edit the service account.

There are three different resources that help you manage your IAM policy for a service account. Each of these resources is used for a different use case:

  • yandex_iam_service_account_iam_policy: Authoritative. Sets the IAM policy for the service account and replaces any existing policy already attached.
  • yandex_iam_service_account_iam_binding: Authoritative for a given role. Updates the IAM policy to grant a role to a list of members. Other roles within the IAM policy for the service account are preserved.
  • yandex_iam_service_account_iam_member: Non-authoritative. Updates the IAM policy to grant a role to a new member. Other members for the role of the service account are preserved.

Note: yandex.IamServiceAccountIamPolicy cannot be used in conjunction with yandex.IamServiceAccountIamBinding and yandex.IamServiceAccountIamMember or they will conflict over what your policy should be.

Note: yandex.IamServiceAccountIamBinding resources can be used in conjunction with yandex.IamServiceAccountIamMember resources only if they do not grant privileges to the same role.

yandex_service_account_iam_binding

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

const admin_account_iam = new yandex.IamServiceAccountIamBinding("admin-account-iam", {
    members: ["userAccount:foo_user_id"],
    role: "admin",
    serviceAccountId: "your-service-account-id",
});
import pulumi
import pulumi_yandex as yandex

admin_account_iam = yandex.IamServiceAccountIamBinding("admin-account-iam",
    members=["userAccount:foo_user_id"],
    role="admin",
    service_account_id="your-service-account-id")
using Pulumi;
using Yandex = Pulumi.Yandex;

class MyStack : Stack
{
    public MyStack()
    {
        var admin_account_iam = new Yandex.IamServiceAccountIamBinding("admin-account-iam", new Yandex.IamServiceAccountIamBindingArgs
        {
            Members = 
            {
                "userAccount:foo_user_id",
            },
            Role = "admin",
            ServiceAccountId = "your-service-account-id",
        });
    }

}
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.NewIamServiceAccountIamBinding(ctx, "admin_account_iam", &yandex.IamServiceAccountIamBindingArgs{
			Members: pulumi.StringArray{
				pulumi.String("userAccount:foo_user_id"),
			},
			Role:             pulumi.String("admin"),
			ServiceAccountId: pulumi.String("your-service-account-id"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}

Create a IamServiceAccountIamBinding Resource

new IamServiceAccountIamBinding(name: string, args: IamServiceAccountIamBindingArgs, opts?: CustomResourceOptions);
@overload
def IamServiceAccountIamBinding(resource_name: str,
                                opts: Optional[ResourceOptions] = None,
                                members: Optional[Sequence[str]] = None,
                                role: Optional[str] = None,
                                service_account_id: Optional[str] = None,
                                sleep_after: Optional[int] = None)
@overload
def IamServiceAccountIamBinding(resource_name: str,
                                args: IamServiceAccountIamBindingArgs,
                                opts: Optional[ResourceOptions] = None)
func NewIamServiceAccountIamBinding(ctx *Context, name string, args IamServiceAccountIamBindingArgs, opts ...ResourceOption) (*IamServiceAccountIamBinding, error)
public IamServiceAccountIamBinding(string name, IamServiceAccountIamBindingArgs args, CustomResourceOptions? opts = null)
name string
The unique name of the resource.
args IamServiceAccountIamBindingArgs
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 IamServiceAccountIamBindingArgs
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 IamServiceAccountIamBindingArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args IamServiceAccountIamBindingArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.

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

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.
Role string
The role that should be applied. Only one yandex.IamServiceAccountIamBinding can be used per role.
ServiceAccountId string
The service account ID to apply a binding to.
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.
Role string
The role that should be applied. Only one yandex.IamServiceAccountIamBinding can be used per role.
ServiceAccountId string
The service account ID to apply a binding to.
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.
role string
The role that should be applied. Only one yandex.IamServiceAccountIamBinding can be used per role.
serviceAccountId string
The service account ID to apply a binding to.
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.
role str
The role that should be applied. Only one yandex.IamServiceAccountIamBinding can be used per role.
service_account_id str
The service account ID to apply a binding to.
sleep_after int

Outputs

All input properties are implicitly available as output properties. Additionally, the IamServiceAccountIamBinding 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 str
The provider-assigned unique ID for this managed resource.

Look up an Existing IamServiceAccountIamBinding Resource

Get an existing IamServiceAccountIamBinding 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?: IamServiceAccountIamBindingState, opts?: CustomResourceOptions): IamServiceAccountIamBinding
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        members: Optional[Sequence[str]] = None,
        role: Optional[str] = None,
        service_account_id: Optional[str] = None,
        sleep_after: Optional[int] = None) -> IamServiceAccountIamBinding
func GetIamServiceAccountIamBinding(ctx *Context, name string, id IDInput, state *IamServiceAccountIamBindingState, opts ...ResourceOption) (*IamServiceAccountIamBinding, error)
public static IamServiceAccountIamBinding Get(string name, Input<string> id, IamServiceAccountIamBindingState? state, CustomResourceOptions? opts = null)
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.

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.
Role string
The role that should be applied. Only one yandex.IamServiceAccountIamBinding can be used per role.
ServiceAccountId string
The service account ID to apply a binding to.
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.
Role string
The role that should be applied. Only one yandex.IamServiceAccountIamBinding can be used per role.
ServiceAccountId string
The service account ID to apply a binding to.
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.
role string
The role that should be applied. Only one yandex.IamServiceAccountIamBinding can be used per role.
serviceAccountId string
The service account ID to apply a binding to.
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.
role str
The role that should be applied. Only one yandex.IamServiceAccountIamBinding can be used per role.
service_account_id str
The service account ID to apply a binding to.
sleep_after int

Import

Service account IAM binding resources can be imported using the service account ID and role.

 $ pulumi import yandex:index/iamServiceAccountIamBinding:IamServiceAccountIamBinding admin-account-iam "service_account_id roles/editor"

Package Details

Repository
https://github.com/pulumi/pulumi-yandex
License
Apache-2.0
Notes
This Pulumi package is based on the yandex Terraform Provider.