1. Packages
  2. Volcengine
  3. API Docs
  4. iam
  5. Role
Volcengine v0.0.24 published on Tuesday, Jun 25, 2024 by Volcengine

volcengine.iam.Role

Explore with Pulumi AI

volcengine logo
Volcengine v0.0.24 published on Tuesday, Jun 25, 2024 by Volcengine

    Provides a resource to manage iam role

    Example Usage

    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Volcengine = Pulumi.Volcengine;
    
    return await Deployment.RunAsync(() => 
    {
        var foo = new Volcengine.Iam.Role("foo", new()
        {
            Description = "acc-test",
            DisplayName = "acc-test",
            MaxSessionDuration = 3600,
            RoleName = "acc-test-role",
            TrustPolicyDocument = "{\"Statement\":[{\"Effect\":\"Allow\",\"Action\":[\"sts:AssumeRole\"],\"Principal\":{\"Service\":[\"auto_scaling\"]}}]}",
        });
    
    });
    
    package main
    
    import (
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/volcengine/pulumi-volcengine/sdk/go/volcengine/iam"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := iam.NewRole(ctx, "foo", &iam.RoleArgs{
    			Description:         pulumi.String("acc-test"),
    			DisplayName:         pulumi.String("acc-test"),
    			MaxSessionDuration:  pulumi.Int(3600),
    			RoleName:            pulumi.String("acc-test-role"),
    			TrustPolicyDocument: pulumi.String("{\"Statement\":[{\"Effect\":\"Allow\",\"Action\":[\"sts:AssumeRole\"],\"Principal\":{\"Service\":[\"auto_scaling\"]}}]}"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.volcengine.iam.Role;
    import com.pulumi.volcengine.iam.RoleArgs;
    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 foo = new Role("foo", RoleArgs.builder()        
                .description("acc-test")
                .displayName("acc-test")
                .maxSessionDuration(3600)
                .roleName("acc-test-role")
                .trustPolicyDocument("{\"Statement\":[{\"Effect\":\"Allow\",\"Action\":[\"sts:AssumeRole\"],\"Principal\":{\"Service\":[\"auto_scaling\"]}}]}")
                .build());
    
        }
    }
    
    import pulumi
    import pulumi_volcengine as volcengine
    
    foo = volcengine.iam.Role("foo",
        description="acc-test",
        display_name="acc-test",
        max_session_duration=3600,
        role_name="acc-test-role",
        trust_policy_document="{\"Statement\":[{\"Effect\":\"Allow\",\"Action\":[\"sts:AssumeRole\"],\"Principal\":{\"Service\":[\"auto_scaling\"]}}]}")
    
    import * as pulumi from "@pulumi/pulumi";
    import * as volcengine from "@volcengine/pulumi";
    
    const foo = new volcengine.iam.Role("foo", {
        description: "acc-test",
        displayName: "acc-test",
        maxSessionDuration: 3600,
        roleName: "acc-test-role",
        trustPolicyDocument: "{\"Statement\":[{\"Effect\":\"Allow\",\"Action\":[\"sts:AssumeRole\"],\"Principal\":{\"Service\":[\"auto_scaling\"]}}]}",
    });
    
    resources:
      foo:
        type: volcengine:iam:Role
        properties:
          description: acc-test
          displayName: acc-test
          maxSessionDuration: 3600
          roleName: acc-test-role
          trustPolicyDocument: '{"Statement":[{"Effect":"Allow","Action":["sts:AssumeRole"],"Principal":{"Service":["auto_scaling"]}}]}'
    

    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,
             display_name: Optional[str] = None,
             role_name: Optional[str] = None,
             trust_policy_document: Optional[str] = None,
             description: Optional[str] = None,
             max_session_duration: Optional[int] = 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: volcengine: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.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var roleResource = new Volcengine.Iam.Role("roleResource", new()
    {
        DisplayName = "string",
        RoleName = "string",
        TrustPolicyDocument = "string",
        Description = "string",
        MaxSessionDuration = 0,
    });
    
    example, err := iam.NewRole(ctx, "roleResource", &iam.RoleArgs{
    	DisplayName:         pulumi.String("string"),
    	RoleName:            pulumi.String("string"),
    	TrustPolicyDocument: pulumi.String("string"),
    	Description:         pulumi.String("string"),
    	MaxSessionDuration:  pulumi.Int(0),
    })
    
    var roleResource = new Role("roleResource", RoleArgs.builder()
        .displayName("string")
        .roleName("string")
        .trustPolicyDocument("string")
        .description("string")
        .maxSessionDuration(0)
        .build());
    
    role_resource = volcengine.iam.Role("roleResource",
        display_name="string",
        role_name="string",
        trust_policy_document="string",
        description="string",
        max_session_duration=0)
    
    const roleResource = new volcengine.iam.Role("roleResource", {
        displayName: "string",
        roleName: "string",
        trustPolicyDocument: "string",
        description: "string",
        maxSessionDuration: 0,
    });
    
    type: volcengine:iam:Role
    properties:
        description: string
        displayName: string
        maxSessionDuration: 0
        roleName: string
        trustPolicyDocument: string
    

    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

    The Role resource accepts the following input properties:

    DisplayName string
    The display name of the Role.
    RoleName string
    The name of the Role.
    TrustPolicyDocument string
    The trust policy document of the Role.
    Description string
    The description of the Role.
    MaxSessionDuration int
    The max session duration of the Role.
    DisplayName string
    The display name of the Role.
    RoleName string
    The name of the Role.
    TrustPolicyDocument string
    The trust policy document of the Role.
    Description string
    The description of the Role.
    MaxSessionDuration int
    The max session duration of the Role.
    displayName String
    The display name of the Role.
    roleName String
    The name of the Role.
    trustPolicyDocument String
    The trust policy document of the Role.
    description String
    The description of the Role.
    maxSessionDuration Integer
    The max session duration of the Role.
    displayName string
    The display name of the Role.
    roleName string
    The name of the Role.
    trustPolicyDocument string
    The trust policy document of the Role.
    description string
    The description of the Role.
    maxSessionDuration number
    The max session duration of the Role.
    display_name str
    The display name of the Role.
    role_name str
    The name of the Role.
    trust_policy_document str
    The trust policy document of the Role.
    description str
    The description of the Role.
    max_session_duration int
    The max session duration of the Role.
    displayName String
    The display name of the Role.
    roleName String
    The name of the Role.
    trustPolicyDocument String
    The trust policy document of the Role.
    description String
    The description of the Role.
    maxSessionDuration Number
    The max session duration of the Role.

    Outputs

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

    Id string
    The provider-assigned unique ID for this managed resource.
    Trn string
    The resource name of the Role.
    Id string
    The provider-assigned unique ID for this managed resource.
    Trn string
    The resource name of the Role.
    id String
    The provider-assigned unique ID for this managed resource.
    trn String
    The resource name of the Role.
    id string
    The provider-assigned unique ID for this managed resource.
    trn string
    The resource name of the Role.
    id str
    The provider-assigned unique ID for this managed resource.
    trn str
    The resource name of the Role.
    id String
    The provider-assigned unique ID for this managed resource.
    trn String
    The resource name of the Role.

    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,
            description: Optional[str] = None,
            display_name: Optional[str] = None,
            max_session_duration: Optional[int] = None,
            role_name: Optional[str] = None,
            trn: Optional[str] = None,
            trust_policy_document: 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)
    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.
    The following state arguments are supported:
    Description string
    The description of the Role.
    DisplayName string
    The display name of the Role.
    MaxSessionDuration int
    The max session duration of the Role.
    RoleName string
    The name of the Role.
    Trn string
    The resource name of the Role.
    TrustPolicyDocument string
    The trust policy document of the Role.
    Description string
    The description of the Role.
    DisplayName string
    The display name of the Role.
    MaxSessionDuration int
    The max session duration of the Role.
    RoleName string
    The name of the Role.
    Trn string
    The resource name of the Role.
    TrustPolicyDocument string
    The trust policy document of the Role.
    description String
    The description of the Role.
    displayName String
    The display name of the Role.
    maxSessionDuration Integer
    The max session duration of the Role.
    roleName String
    The name of the Role.
    trn String
    The resource name of the Role.
    trustPolicyDocument String
    The trust policy document of the Role.
    description string
    The description of the Role.
    displayName string
    The display name of the Role.
    maxSessionDuration number
    The max session duration of the Role.
    roleName string
    The name of the Role.
    trn string
    The resource name of the Role.
    trustPolicyDocument string
    The trust policy document of the Role.
    description str
    The description of the Role.
    display_name str
    The display name of the Role.
    max_session_duration int
    The max session duration of the Role.
    role_name str
    The name of the Role.
    trn str
    The resource name of the Role.
    trust_policy_document str
    The trust policy document of the Role.
    description String
    The description of the Role.
    displayName String
    The display name of the Role.
    maxSessionDuration Number
    The max session duration of the Role.
    roleName String
    The name of the Role.
    trn String
    The resource name of the Role.
    trustPolicyDocument String
    The trust policy document of the Role.

    Import

    Iam role can be imported using the id, e.g.

     $ pulumi import volcengine:iam/role:Role default TerraformTestRole
    

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

    Package Details

    Repository
    volcengine volcengine/pulumi-volcengine
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the volcengine Terraform Provider.
    volcengine logo
    Volcengine v0.0.24 published on Tuesday, Jun 25, 2024 by Volcengine