yandex.IamServiceAccountIamMember
Explore with Pulumi AI
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 withyandex.IamServiceAccountIamBinding
andyandex.IamServiceAccountIamMember
or they will conflict over what your policy should be.
Note:
yandex.IamServiceAccountIamBinding
resources can be used in conjunction withyandex.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 IamServiceAccountIamMember Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new IamServiceAccountIamMember(name: string, args: IamServiceAccountIamMemberArgs, opts?: CustomResourceOptions);
@overload
def IamServiceAccountIamMember(resource_name: str,
args: IamServiceAccountIamMemberArgs,
opts: Optional[ResourceOptions] = None)
@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)
func NewIamServiceAccountIamMember(ctx *Context, name string, args IamServiceAccountIamMemberArgs, opts ...ResourceOption) (*IamServiceAccountIamMember, error)
public IamServiceAccountIamMember(string name, IamServiceAccountIamMemberArgs args, CustomResourceOptions? opts = null)
public IamServiceAccountIamMember(String name, IamServiceAccountIamMemberArgs args)
public IamServiceAccountIamMember(String name, IamServiceAccountIamMemberArgs args, CustomResourceOptions options)
type: yandex:IamServiceAccountIamMember
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 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.
- name String
- The unique name of the resource.
- args IamServiceAccountIamMemberArgs
- 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 iamServiceAccountIamMemberResource = new Yandex.IamServiceAccountIamMember("iamServiceAccountIamMemberResource", new()
{
Member = "string",
Role = "string",
ServiceAccountId = "string",
SleepAfter = 0,
});
example, err := yandex.NewIamServiceAccountIamMember(ctx, "iamServiceAccountIamMemberResource", &yandex.IamServiceAccountIamMemberArgs{
Member: pulumi.String("string"),
Role: pulumi.String("string"),
ServiceAccountId: pulumi.String("string"),
SleepAfter: pulumi.Int(0),
})
var iamServiceAccountIamMemberResource = new IamServiceAccountIamMember("iamServiceAccountIamMemberResource", IamServiceAccountIamMemberArgs.builder()
.member("string")
.role("string")
.serviceAccountId("string")
.sleepAfter(0)
.build());
iam_service_account_iam_member_resource = yandex.IamServiceAccountIamMember("iamServiceAccountIamMemberResource",
member="string",
role="string",
service_account_id="string",
sleep_after=0)
const iamServiceAccountIamMemberResource = new yandex.IamServiceAccountIamMember("iamServiceAccountIamMemberResource", {
member: "string",
role: "string",
serviceAccountId: "string",
sleepAfter: 0,
});
type: yandex:IamServiceAccountIamMember
properties:
member: string
role: string
serviceAccountId: string
sleepAfter: 0
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
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
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. - Service
Account stringId - The service account ID to apply a policy to.
- Sleep
After 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. - Service
Account stringId - The service account ID to apply a policy to.
- Sleep
After 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. - service
Account StringId - The service account ID to apply a policy to.
- sleep
After Integer
- 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. - service
Account stringId - The service account ID to apply a policy to.
- sleep
After 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_ strid - The service account ID to apply a policy to.
- sleep_
after 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. - service
Account StringId - The service account ID to apply a policy to.
- sleep
After Number
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 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 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)
public static IamServiceAccountIamMember get(String name, Output<String> id, IamServiceAccountIamMemberState 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.
- 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. - Service
Account stringId - The service account ID to apply a policy to.
- Sleep
After 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. - Service
Account stringId - The service account ID to apply a policy to.
- Sleep
After 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. - service
Account StringId - The service account ID to apply a policy to.
- sleep
After Integer
- 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. - service
Account stringId - The service account ID to apply a policy to.
- sleep
After 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_ strid - The service account ID to apply a policy to.
- sleep_
after 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. - service
Account StringId - The service account ID to apply a policy to.
- sleep
After Number
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"
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.