1. Packages
  2. Packages
  3. Volcenginecc Provider
  4. API Docs
  5. iam
  6. Role
Viewing docs for volcenginecc v0.0.32
published on Thursday, Apr 23, 2026 by Volcengine
volcenginecc logo
Viewing docs for volcenginecc v0.0.32
published on Thursday, Apr 23, 2026 by Volcengine

    A role is a virtual identity in the IAM system that grants certain access permissions within an account to various identity entities. Trusted identity entities can assume this role to access cloud resources within the account.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as volcenginecc from "@volcengine/pulumi-volcenginecc";
    
    const roleDemo = new volcenginecc.iam.Role("RoleDemo", {
        roleName: "RoleDemo",
        description: "role attach policies",
        maxSessionDuration: 3600,
        trustPolicyDocument: `{
        "Statement": [
            {
                "Effect": "Allow",
                "Action": [
                    "sts:AssumeRole"
                ],
                "Principal": {
                    "IAM": [
                        "trn:iam::20000000xx:root"
                    ]
                }
            }
        ]
    }`,
        tags: [{
            key: "env",
            value: "test",
        }],
    });
    
    import pulumi
    import pulumi_volcenginecc as volcenginecc
    
    role_demo = volcenginecc.iam.Role("RoleDemo",
        role_name="RoleDemo",
        description="role attach policies",
        max_session_duration=3600,
        trust_policy_document="""{
        "Statement": [
            {
                "Effect": "Allow",
                "Action": [
                    "sts:AssumeRole"
                ],
                "Principal": {
                    "IAM": [
                        "trn:iam::20000000xx:root"
                    ]
                }
            }
        ]
    }""",
        tags=[{
            "key": "env",
            "value": "test",
        }])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/volcengine/pulumi-volcenginecc/sdk/go/volcenginecc/iam"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := iam.NewRole(ctx, "RoleDemo", &iam.RoleArgs{
    			RoleName:           pulumi.String("RoleDemo"),
    			Description:        pulumi.String("role attach policies"),
    			MaxSessionDuration: pulumi.Int(3600),
    			TrustPolicyDocument: pulumi.String(`{
        "Statement": [
            {
                "Effect": "Allow",
                "Action": [
                    "sts:AssumeRole"
                ],
                "Principal": {
                    "IAM": [
                        "trn:iam::20000000xx:root"
                    ]
                }
            }
        ]
    }`),
    			Tags: iam.RoleTagArray{
    				&iam.RoleTagArgs{
    					Key:   pulumi.String("env"),
    					Value: pulumi.String("test"),
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Volcenginecc = Volcengine.Pulumi.Volcenginecc;
    
    return await Deployment.RunAsync(() => 
    {
        var roleDemo = new Volcenginecc.Iam.Role("RoleDemo", new()
        {
            RoleName = "RoleDemo",
            Description = "role attach policies",
            MaxSessionDuration = 3600,
            TrustPolicyDocument = @"{
        ""Statement"": [
            {
                ""Effect"": ""Allow"",
                ""Action"": [
                    ""sts:AssumeRole""
                ],
                ""Principal"": {
                    ""IAM"": [
                        ""trn:iam::20000000xx:root""
                    ]
                }
            }
        ]
    }",
            Tags = new[]
            {
                new Volcenginecc.Iam.Inputs.RoleTagArgs
                {
                    Key = "env",
                    Value = "test",
                },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.volcengine.volcenginecc.iam.Role;
    import com.volcengine.volcenginecc.iam.RoleArgs;
    import com.pulumi.volcenginecc.iam.inputs.RoleTagArgs;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            var roleDemo = new Role("roleDemo", RoleArgs.builder()
                .roleName("RoleDemo")
                .description("role attach policies")
                .maxSessionDuration(3600)
                .trustPolicyDocument("""
    {
        "Statement": [
            {
                "Effect": "Allow",
                "Action": [
                    "sts:AssumeRole"
                ],
                "Principal": {
                    "IAM": [
                        "trn:iam::20000000xx:root"
                    ]
                }
            }
        ]
    }            """)
                .tags(RoleTagArgs.builder()
                    .key("env")
                    .value("test")
                    .build())
                .build());
    
        }
    }
    
    resources:
      roleDemo:
        type: volcenginecc:iam:Role
        name: RoleDemo
        properties:
          roleName: RoleDemo
          description: role attach policies
          maxSessionDuration: 3600
          trustPolicyDocument: |-
            {
                "Statement": [
                    {
                        "Effect": "Allow",
                        "Action": [
                            "sts:AssumeRole"
                        ],
                        "Principal": {
                            "IAM": [
                                "trn:iam::20000000xx:root"
                            ]
                        }
                    }
                ]
            }
          tags:
            - key: env
              value: test
    

    Create Role Resource

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

    Constructor syntax

    new Role(name: string, args: RoleArgs, opts?: CustomResourceOptions);
    @overload
    def Role(resource_name: str,
             args: RoleArgs,
             opts: Optional[ResourceOptions] = None)
    
    @overload
    def Role(resource_name: str,
             opts: Optional[ResourceOptions] = None,
             role_name: Optional[str] = None,
             description: Optional[str] = None,
             display_name: Optional[str] = None,
             max_session_duration: Optional[int] = None,
             policies: Optional[Sequence[RolePolicyArgs]] = None,
             tags: Optional[Sequence[RoleTagArgs]] = None,
             trust_policy_document: Optional[str] = None)
    func NewRole(ctx *Context, name string, args RoleArgs, opts ...ResourceOption) (*Role, error)
    public Role(string name, RoleArgs args, CustomResourceOptions? opts = null)
    public Role(String name, RoleArgs args)
    public Role(String name, RoleArgs args, CustomResourceOptions options)
    
    type: volcenginecc:iam:Role
    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 RoleArgs
    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 RoleArgs
    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 RoleArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args RoleArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args RoleArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

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

    RoleName string
    Role name, length 1–64, supports English letters, numbers, and .-_ characters
    Description string
    Role description, maximum length 128
    DisplayName string
    Role display name, maximum length 64
    MaxSessionDuration int
    Maximum session duration for the role. Maximum session duration for the role. Limits the maximum validity period of temporary security credentials generated by role assumption. Value range: 3600–43200, unit: seconds, default is 43200
    Policies List<Volcengine.RolePolicy>
    Tags List<Volcengine.RoleTag>
    TrustPolicyDocument string
    Role trust policy. The trust policy follows resource-based policy rules in IAM policy syntax.
    RoleName string
    Role name, length 1–64, supports English letters, numbers, and .-_ characters
    Description string
    Role description, maximum length 128
    DisplayName string
    Role display name, maximum length 64
    MaxSessionDuration int
    Maximum session duration for the role. Maximum session duration for the role. Limits the maximum validity period of temporary security credentials generated by role assumption. Value range: 3600–43200, unit: seconds, default is 43200
    Policies []RolePolicyArgs
    Tags []RoleTagArgs
    TrustPolicyDocument string
    Role trust policy. The trust policy follows resource-based policy rules in IAM policy syntax.
    roleName String
    Role name, length 1–64, supports English letters, numbers, and .-_ characters
    description String
    Role description, maximum length 128
    displayName String
    Role display name, maximum length 64
    maxSessionDuration Integer
    Maximum session duration for the role. Maximum session duration for the role. Limits the maximum validity period of temporary security credentials generated by role assumption. Value range: 3600–43200, unit: seconds, default is 43200
    policies List<RolePolicy>
    tags List<RoleTag>
    trustPolicyDocument String
    Role trust policy. The trust policy follows resource-based policy rules in IAM policy syntax.
    roleName string
    Role name, length 1–64, supports English letters, numbers, and .-_ characters
    description string
    Role description, maximum length 128
    displayName string
    Role display name, maximum length 64
    maxSessionDuration number
    Maximum session duration for the role. Maximum session duration for the role. Limits the maximum validity period of temporary security credentials generated by role assumption. Value range: 3600–43200, unit: seconds, default is 43200
    policies RolePolicy[]
    tags RoleTag[]
    trustPolicyDocument string
    Role trust policy. The trust policy follows resource-based policy rules in IAM policy syntax.
    role_name str
    Role name, length 1–64, supports English letters, numbers, and .-_ characters
    description str
    Role description, maximum length 128
    display_name str
    Role display name, maximum length 64
    max_session_duration int
    Maximum session duration for the role. Maximum session duration for the role. Limits the maximum validity period of temporary security credentials generated by role assumption. Value range: 3600–43200, unit: seconds, default is 43200
    policies Sequence[RolePolicyArgs]
    tags Sequence[RoleTagArgs]
    trust_policy_document str
    Role trust policy. The trust policy follows resource-based policy rules in IAM policy syntax.
    roleName String
    Role name, length 1–64, supports English letters, numbers, and .-_ characters
    description String
    Role description, maximum length 128
    displayName String
    Role display name, maximum length 64
    maxSessionDuration Number
    Maximum session duration for the role. Maximum session duration for the role. Limits the maximum validity period of temporary security credentials generated by role assumption. Value range: 3600–43200, unit: seconds, default is 43200
    policies List<Property Map>
    tags List<Property Map>
    trustPolicyDocument String
    Role trust policy. The trust policy follows resource-based policy rules in IAM policy syntax.

    Outputs

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

    CreateDate string
    Role creation time
    Id string
    The provider-assigned unique ID for this managed resource.
    IsServiceLinkedRole int
    Service-linked role or not: 0 for No, 1 for Yes
    RoleId int
    Role ID
    Trn string
    Role TRN
    UpdateDate string
    Role update time
    CreateDate string
    Role creation time
    Id string
    The provider-assigned unique ID for this managed resource.
    IsServiceLinkedRole int
    Service-linked role or not: 0 for No, 1 for Yes
    RoleId int
    Role ID
    Trn string
    Role TRN
    UpdateDate string
    Role update time
    createDate String
    Role creation time
    id String
    The provider-assigned unique ID for this managed resource.
    isServiceLinkedRole Integer
    Service-linked role or not: 0 for No, 1 for Yes
    roleId Integer
    Role ID
    trn String
    Role TRN
    updateDate String
    Role update time
    createDate string
    Role creation time
    id string
    The provider-assigned unique ID for this managed resource.
    isServiceLinkedRole number
    Service-linked role or not: 0 for No, 1 for Yes
    roleId number
    Role ID
    trn string
    Role TRN
    updateDate string
    Role update time
    create_date str
    Role creation time
    id str
    The provider-assigned unique ID for this managed resource.
    is_service_linked_role int
    Service-linked role or not: 0 for No, 1 for Yes
    role_id int
    Role ID
    trn str
    Role TRN
    update_date str
    Role update time
    createDate String
    Role creation time
    id String
    The provider-assigned unique ID for this managed resource.
    isServiceLinkedRole Number
    Service-linked role or not: 0 for No, 1 for Yes
    roleId Number
    Role ID
    trn String
    Role TRN
    updateDate String
    Role update time

    Look up Existing Role Resource

    Get an existing Role 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?: RoleState, opts?: CustomResourceOptions): Role
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            create_date: Optional[str] = None,
            description: Optional[str] = None,
            display_name: Optional[str] = None,
            is_service_linked_role: Optional[int] = None,
            max_session_duration: Optional[int] = None,
            policies: Optional[Sequence[RolePolicyArgs]] = None,
            role_id: Optional[int] = None,
            role_name: Optional[str] = None,
            tags: Optional[Sequence[RoleTagArgs]] = None,
            trn: Optional[str] = None,
            trust_policy_document: Optional[str] = None,
            update_date: Optional[str] = None) -> Role
    func GetRole(ctx *Context, name string, id IDInput, state *RoleState, opts ...ResourceOption) (*Role, error)
    public static Role Get(string name, Input<string> id, RoleState? state, CustomResourceOptions? opts = null)
    public static Role get(String name, Output<String> id, RoleState state, CustomResourceOptions options)
    resources:  _:    type: volcenginecc:iam:Role    get:      id: ${id}
    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.
    The following state arguments are supported:
    CreateDate string
    Role creation time
    Description string
    Role description, maximum length 128
    DisplayName string
    Role display name, maximum length 64
    IsServiceLinkedRole int
    Service-linked role or not: 0 for No, 1 for Yes
    MaxSessionDuration int
    Maximum session duration for the role. Maximum session duration for the role. Limits the maximum validity period of temporary security credentials generated by role assumption. Value range: 3600–43200, unit: seconds, default is 43200
    Policies List<Volcengine.RolePolicy>
    RoleId int
    Role ID
    RoleName string
    Role name, length 1–64, supports English letters, numbers, and .-_ characters
    Tags List<Volcengine.RoleTag>
    Trn string
    Role TRN
    TrustPolicyDocument string
    Role trust policy. The trust policy follows resource-based policy rules in IAM policy syntax.
    UpdateDate string
    Role update time
    CreateDate string
    Role creation time
    Description string
    Role description, maximum length 128
    DisplayName string
    Role display name, maximum length 64
    IsServiceLinkedRole int
    Service-linked role or not: 0 for No, 1 for Yes
    MaxSessionDuration int
    Maximum session duration for the role. Maximum session duration for the role. Limits the maximum validity period of temporary security credentials generated by role assumption. Value range: 3600–43200, unit: seconds, default is 43200
    Policies []RolePolicyArgs
    RoleId int
    Role ID
    RoleName string
    Role name, length 1–64, supports English letters, numbers, and .-_ characters
    Tags []RoleTagArgs
    Trn string
    Role TRN
    TrustPolicyDocument string
    Role trust policy. The trust policy follows resource-based policy rules in IAM policy syntax.
    UpdateDate string
    Role update time
    createDate String
    Role creation time
    description String
    Role description, maximum length 128
    displayName String
    Role display name, maximum length 64
    isServiceLinkedRole Integer
    Service-linked role or not: 0 for No, 1 for Yes
    maxSessionDuration Integer
    Maximum session duration for the role. Maximum session duration for the role. Limits the maximum validity period of temporary security credentials generated by role assumption. Value range: 3600–43200, unit: seconds, default is 43200
    policies List<RolePolicy>
    roleId Integer
    Role ID
    roleName String
    Role name, length 1–64, supports English letters, numbers, and .-_ characters
    tags List<RoleTag>
    trn String
    Role TRN
    trustPolicyDocument String
    Role trust policy. The trust policy follows resource-based policy rules in IAM policy syntax.
    updateDate String
    Role update time
    createDate string
    Role creation time
    description string
    Role description, maximum length 128
    displayName string
    Role display name, maximum length 64
    isServiceLinkedRole number
    Service-linked role or not: 0 for No, 1 for Yes
    maxSessionDuration number
    Maximum session duration for the role. Maximum session duration for the role. Limits the maximum validity period of temporary security credentials generated by role assumption. Value range: 3600–43200, unit: seconds, default is 43200
    policies RolePolicy[]
    roleId number
    Role ID
    roleName string
    Role name, length 1–64, supports English letters, numbers, and .-_ characters
    tags RoleTag[]
    trn string
    Role TRN
    trustPolicyDocument string
    Role trust policy. The trust policy follows resource-based policy rules in IAM policy syntax.
    updateDate string
    Role update time
    create_date str
    Role creation time
    description str
    Role description, maximum length 128
    display_name str
    Role display name, maximum length 64
    is_service_linked_role int
    Service-linked role or not: 0 for No, 1 for Yes
    max_session_duration int
    Maximum session duration for the role. Maximum session duration for the role. Limits the maximum validity period of temporary security credentials generated by role assumption. Value range: 3600–43200, unit: seconds, default is 43200
    policies Sequence[RolePolicyArgs]
    role_id int
    Role ID
    role_name str
    Role name, length 1–64, supports English letters, numbers, and .-_ characters
    tags Sequence[RoleTagArgs]
    trn str
    Role TRN
    trust_policy_document str
    Role trust policy. The trust policy follows resource-based policy rules in IAM policy syntax.
    update_date str
    Role update time
    createDate String
    Role creation time
    description String
    Role description, maximum length 128
    displayName String
    Role display name, maximum length 64
    isServiceLinkedRole Number
    Service-linked role or not: 0 for No, 1 for Yes
    maxSessionDuration Number
    Maximum session duration for the role. Maximum session duration for the role. Limits the maximum validity period of temporary security credentials generated by role assumption. Value range: 3600–43200, unit: seconds, default is 43200
    policies List<Property Map>
    roleId Number
    Role ID
    roleName String
    Role name, length 1–64, supports English letters, numbers, and .-_ characters
    tags List<Property Map>
    trn String
    Role TRN
    trustPolicyDocument String
    Role trust policy. The trust policy follows resource-based policy rules in IAM policy syntax.
    updateDate String
    Role update time

    Supporting Types

    RolePolicy, RolePolicyArgs

    PolicyName string
    Policy name
    PolicyType string
    Policy type. Policy type. System indicates a system preset policy; Custom indicates a custom policy.
    PolicyName string
    Policy name
    PolicyType string
    Policy type. Policy type. System indicates a system preset policy; Custom indicates a custom policy.
    policyName String
    Policy name
    policyType String
    Policy type. Policy type. System indicates a system preset policy; Custom indicates a custom policy.
    policyName string
    Policy name
    policyType string
    Policy type. Policy type. System indicates a system preset policy; Custom indicates a custom policy.
    policy_name str
    Policy name
    policy_type str
    Policy type. Policy type. System indicates a system preset policy; Custom indicates a custom policy.
    policyName String
    Policy name
    policyType String
    Policy type. Policy type. System indicates a system preset policy; Custom indicates a custom policy.

    RoleTag, RoleTagArgs

    Key string
    Tag key
    Value string
    Tag value
    Key string
    Tag key
    Value string
    Tag value
    key String
    Tag key
    value String
    Tag value
    key string
    Tag key
    value string
    Tag value
    key str
    Tag key
    value str
    Tag value
    key String
    Tag key
    value String
    Tag value

    Import

    $ pulumi import volcenginecc:iam/role:Role example "role_name"
    

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

    Package Details

    Repository
    volcenginecc volcengine/pulumi-volcenginecc
    License
    MPL-2.0
    Notes
    This Pulumi package is based on the volcenginecc Terraform Provider.
    volcenginecc logo
    Viewing docs for volcenginecc v0.0.32
    published on Thursday, Apr 23, 2026 by Volcengine
      Try Pulumi Cloud free. Your team will thank you.