Yandex

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

IamServiceAccountIamMember

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_member

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

const admin_account_iam = new yandex.IamServiceAccountIamMember("admin-account-iam", {
    member: "userAccount:bar_user_id",
    role: "admin",
    serviceAccountId: "your-service-account-id",
});
import pulumi
import pulumi_yandex as yandex

admin_account_iam = yandex.IamServiceAccountIamMember("admin-account-iam",
    member="userAccount:bar_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.IamServiceAccountIamMember("admin-account-iam", new Yandex.IamServiceAccountIamMemberArgs
        {
            Member = "userAccount:bar_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.NewIamServiceAccountIamMember(ctx, "admin_account_iam", &yandex.IamServiceAccountIamMemberArgs{
			Member:           pulumi.String("userAccount:bar_user_id"),
			Role:             pulumi.String("admin"),
			ServiceAccountId: pulumi.String("your-service-account-id"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}

Create a IamServiceAccountIamMember Resource

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

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

Member string

Identity that will be granted the privilege in role. 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 policy to.
SleepAfter int
Member string

Identity that will be granted the privilege in role. 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 policy to.
SleepAfter int
member string

Identity that will be granted the privilege in role. 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 policy to.
sleepAfter number
member str

Identity that will be granted the privilege in role. 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 policy to.
sleep_after int

Outputs

All input properties are implicitly available as output properties. Additionally, the IamServiceAccountIamMember 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 IamServiceAccountIamMember Resource

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

Member string

Identity that will be granted the privilege in role. 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 policy to.
SleepAfter int
Member string

Identity that will be granted the privilege in role. 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 policy to.
SleepAfter int
member string

Identity that will be granted the privilege in role. 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 policy to.
sleepAfter number
member str

Identity that will be granted the privilege in role. 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 policy to.
sleep_after int

Import

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

 $ pulumi import yandex:index/iamServiceAccountIamMember:IamServiceAccountIamMember admin-account-iam "service_account_id roles/editor foo@example.com"

Package Details

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