yandex.IamServiceAccountIamBinding
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_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 IamServiceAccountIamBinding Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new IamServiceAccountIamBinding(name: string, args: IamServiceAccountIamBindingArgs, opts?: CustomResourceOptions);
@overload
def IamServiceAccountIamBinding(resource_name: str,
args: IamServiceAccountIamBindingArgs,
opts: Optional[ResourceOptions] = None)
@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)
func NewIamServiceAccountIamBinding(ctx *Context, name string, args IamServiceAccountIamBindingArgs, opts ...ResourceOption) (*IamServiceAccountIamBinding, error)
public IamServiceAccountIamBinding(string name, IamServiceAccountIamBindingArgs args, CustomResourceOptions? opts = null)
public IamServiceAccountIamBinding(String name, IamServiceAccountIamBindingArgs args)
public IamServiceAccountIamBinding(String name, IamServiceAccountIamBindingArgs args, CustomResourceOptions options)
type: yandex:IamServiceAccountIamBinding
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 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.
- name String
- The unique name of the resource.
- args IamServiceAccountIamBindingArgs
- 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 iamServiceAccountIamBindingResource = new Yandex.IamServiceAccountIamBinding("iamServiceAccountIamBindingResource", new()
{
Members = new[]
{
"string",
},
Role = "string",
ServiceAccountId = "string",
SleepAfter = 0,
});
example, err := yandex.NewIamServiceAccountIamBinding(ctx, "iamServiceAccountIamBindingResource", &yandex.IamServiceAccountIamBindingArgs{
Members: pulumi.StringArray{
pulumi.String("string"),
},
Role: pulumi.String("string"),
ServiceAccountId: pulumi.String("string"),
SleepAfter: pulumi.Int(0),
})
var iamServiceAccountIamBindingResource = new IamServiceAccountIamBinding("iamServiceAccountIamBindingResource", IamServiceAccountIamBindingArgs.builder()
.members("string")
.role("string")
.serviceAccountId("string")
.sleepAfter(0)
.build());
iam_service_account_iam_binding_resource = yandex.IamServiceAccountIamBinding("iamServiceAccountIamBindingResource",
members=["string"],
role="string",
service_account_id="string",
sleep_after=0)
const iamServiceAccountIamBindingResource = new yandex.IamServiceAccountIamBinding("iamServiceAccountIamBindingResource", {
members: ["string"],
role: "string",
serviceAccountId: "string",
sleepAfter: 0,
});
type: yandex:IamServiceAccountIamBinding
properties:
members:
- string
role: string
serviceAccountId: string
sleepAfter: 0
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
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
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. - Service
Account stringId - The service account ID to apply a binding to.
- Sleep
After 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. - Service
Account stringId - The service account ID to apply a binding to.
- 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.
- 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 binding to.
- sleep
After 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.
- 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 binding to.
- sleep
After 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_ strid - The service account ID to apply a binding to.
- 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.
- 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 binding to.
- sleep
After Number
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 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 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)
public static IamServiceAccountIamBinding get(String name, Output<String> id, IamServiceAccountIamBindingState 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.
- 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. - Service
Account stringId - The service account ID to apply a binding to.
- Sleep
After 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. - Service
Account stringId - The service account ID to apply a binding to.
- 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.
- 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 binding to.
- sleep
After 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.
- 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 binding to.
- sleep
After 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_ strid - The service account ID to apply a binding to.
- 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.
- 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 binding to.
- sleep
After Number
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"
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.