1. Packages
  2. Volcengine
  3. API Docs
  4. iam
  5. Roles
Volcengine v0.0.26 published on Friday, Sep 13, 2024 by Volcengine

volcengine.iam.Roles

Explore with Pulumi AI

volcengine logo
Volcengine v0.0.26 published on Friday, Sep 13, 2024 by Volcengine

    Use this data source to query detailed information of iam roles

    Example Usage

    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Volcengine = Pulumi.Volcengine;
    
    return await Deployment.RunAsync(() => 
    {
        var foo1 = new Volcengine.Iam.Role("foo1", new()
        {
            Description = "acc-test1",
            DisplayName = "acc-test1",
            MaxSessionDuration = 3600,
            RoleName = "acc-test-role1",
            TrustPolicyDocument = "{\"Statement\":[{\"Effect\":\"Allow\",\"Action\":[\"sts:AssumeRole\"],\"Principal\":{\"Service\":[\"auto_scaling\"]}}]}",
        });
    
        var foo2 = new Volcengine.Iam.Role("foo2", new()
        {
            Description = "acc-test2",
            DisplayName = "acc-test2",
            MaxSessionDuration = 3600,
            RoleName = "acc-test-role2",
            TrustPolicyDocument = "{\"Statement\":[{\"Effect\":\"Allow\",\"Action\":[\"sts:AssumeRole\"],\"Principal\":{\"Service\":[\"ecs\"]}}]}",
        });
    
        var foo = Volcengine.Iam.Roles.Invoke(new()
        {
            RoleName = $"{foo1.RoleName},{foo2.RoleName}",
        });
    
    });
    
    package main
    
    import (
    	"fmt"
    
    	"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 {
    		foo1, err := iam.NewRole(ctx, "foo1", &iam.RoleArgs{
    			Description:         pulumi.String("acc-test1"),
    			DisplayName:         pulumi.String("acc-test1"),
    			MaxSessionDuration:  pulumi.Int(3600),
    			RoleName:            pulumi.String("acc-test-role1"),
    			TrustPolicyDocument: pulumi.String("{\"Statement\":[{\"Effect\":\"Allow\",\"Action\":[\"sts:AssumeRole\"],\"Principal\":{\"Service\":[\"auto_scaling\"]}}]}"),
    		})
    		if err != nil {
    			return err
    		}
    		foo2, err := iam.NewRole(ctx, "foo2", &iam.RoleArgs{
    			Description:         pulumi.String("acc-test2"),
    			DisplayName:         pulumi.String("acc-test2"),
    			MaxSessionDuration:  pulumi.Int(3600),
    			RoleName:            pulumi.String("acc-test-role2"),
    			TrustPolicyDocument: pulumi.String("{\"Statement\":[{\"Effect\":\"Allow\",\"Action\":[\"sts:AssumeRole\"],\"Principal\":{\"Service\":[\"ecs\"]}}]}"),
    		})
    		if err != nil {
    			return err
    		}
    		_ = iam.RolesOutput(ctx, iam.RolesOutputArgs{
    			RoleName: pulumi.All(foo1.RoleName, foo2.RoleName).ApplyT(func(_args []interface{}) (string, error) {
    				foo1RoleName := _args[0].(string)
    				foo2RoleName := _args[1].(string)
    				return fmt.Sprintf("%v,%v", foo1RoleName, foo2RoleName), nil
    			}).(pulumi.StringOutput),
    		}, nil)
    		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 com.pulumi.volcengine.iam.IamFunctions;
    import com.pulumi.volcengine.iam.inputs.RolesArgs;
    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 foo1 = new Role("foo1", RoleArgs.builder()        
                .description("acc-test1")
                .displayName("acc-test1")
                .maxSessionDuration(3600)
                .roleName("acc-test-role1")
                .trustPolicyDocument("{\"Statement\":[{\"Effect\":\"Allow\",\"Action\":[\"sts:AssumeRole\"],\"Principal\":{\"Service\":[\"auto_scaling\"]}}]}")
                .build());
    
            var foo2 = new Role("foo2", RoleArgs.builder()        
                .description("acc-test2")
                .displayName("acc-test2")
                .maxSessionDuration(3600)
                .roleName("acc-test-role2")
                .trustPolicyDocument("{\"Statement\":[{\"Effect\":\"Allow\",\"Action\":[\"sts:AssumeRole\"],\"Principal\":{\"Service\":[\"ecs\"]}}]}")
                .build());
    
            final var foo = IamFunctions.Roles(RolesArgs.builder()
                .roleName(Output.tuple(foo1.roleName(), foo2.roleName()).applyValue(values -> {
                    var foo1RoleName = values.t1;
                    var foo2RoleName = values.t2;
                    return String.format("%s,%s", foo1RoleName,foo2RoleName);
                }))
                .build());
    
        }
    }
    
    import pulumi
    import pulumi_volcengine as volcengine
    
    foo1 = volcengine.iam.Role("foo1",
        description="acc-test1",
        display_name="acc-test1",
        max_session_duration=3600,
        role_name="acc-test-role1",
        trust_policy_document="{\"Statement\":[{\"Effect\":\"Allow\",\"Action\":[\"sts:AssumeRole\"],\"Principal\":{\"Service\":[\"auto_scaling\"]}}]}")
    foo2 = volcengine.iam.Role("foo2",
        description="acc-test2",
        display_name="acc-test2",
        max_session_duration=3600,
        role_name="acc-test-role2",
        trust_policy_document="{\"Statement\":[{\"Effect\":\"Allow\",\"Action\":[\"sts:AssumeRole\"],\"Principal\":{\"Service\":[\"ecs\"]}}]}")
    foo = volcengine.iam.roles_output(role_name=pulumi.Output.all(foo1.role_name, foo2.role_name).apply(lambda foo1Role_name, foo2Role_name: f"{foo1_role_name},{foo2_role_name}"))
    
    import * as pulumi from "@pulumi/pulumi";
    import * as volcengine from "@pulumi/volcengine";
    import * as volcengine from "@volcengine/pulumi";
    
    const foo1 = new volcengine.iam.Role("foo1", {
        description: "acc-test1",
        displayName: "acc-test1",
        maxSessionDuration: 3600,
        roleName: "acc-test-role1",
        trustPolicyDocument: "{\"Statement\":[{\"Effect\":\"Allow\",\"Action\":[\"sts:AssumeRole\"],\"Principal\":{\"Service\":[\"auto_scaling\"]}}]}",
    });
    const foo2 = new volcengine.iam.Role("foo2", {
        description: "acc-test2",
        displayName: "acc-test2",
        maxSessionDuration: 3600,
        roleName: "acc-test-role2",
        trustPolicyDocument: "{\"Statement\":[{\"Effect\":\"Allow\",\"Action\":[\"sts:AssumeRole\"],\"Principal\":{\"Service\":[\"ecs\"]}}]}",
    });
    const foo = volcengine.iam.RolesOutput({
        roleName: pulumi.interpolate`${foo1.roleName},${foo2.roleName}`,
    });
    
    resources:
      foo1:
        type: volcengine:iam:Role
        properties:
          description: acc-test1
          displayName: acc-test1
          maxSessionDuration: 3600
          roleName: acc-test-role1
          trustPolicyDocument: '{"Statement":[{"Effect":"Allow","Action":["sts:AssumeRole"],"Principal":{"Service":["auto_scaling"]}}]}'
      foo2:
        type: volcengine:iam:Role
        properties:
          description: acc-test2
          displayName: acc-test2
          maxSessionDuration: 3600
          roleName: acc-test-role2
          trustPolicyDocument: '{"Statement":[{"Effect":"Allow","Action":["sts:AssumeRole"],"Principal":{"Service":["ecs"]}}]}'
    variables:
      foo:
        fn::invoke:
          Function: volcengine:iam:Roles
          Arguments:
            roleName: ${foo1.roleName},${foo2.roleName}
    

    Using Roles

    Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

    function roles(args: RolesArgs, opts?: InvokeOptions): Promise<RolesResult>
    function rolesOutput(args: RolesOutputArgs, opts?: InvokeOptions): Output<RolesResult>
    def roles(name_regex: Optional[str] = None,
              output_file: Optional[str] = None,
              query: Optional[str] = None,
              role_name: Optional[str] = None,
              opts: Optional[InvokeOptions] = None) -> RolesResult
    def roles_output(name_regex: Optional[pulumi.Input[str]] = None,
              output_file: Optional[pulumi.Input[str]] = None,
              query: Optional[pulumi.Input[str]] = None,
              role_name: Optional[pulumi.Input[str]] = None,
              opts: Optional[InvokeOptions] = None) -> Output[RolesResult]
    func Roles(ctx *Context, args *RolesArgs, opts ...InvokeOption) (*RolesResult, error)
    func RolesOutput(ctx *Context, args *RolesOutputArgs, opts ...InvokeOption) RolesResultOutput
    public static class Roles 
    {
        public static Task<RolesResult> InvokeAsync(RolesArgs args, InvokeOptions? opts = null)
        public static Output<RolesResult> Invoke(RolesInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<RolesResult> roles(RolesArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: volcengine:iam:Roles
      arguments:
        # arguments dictionary

    The following arguments are supported:

    NameRegex string
    A Name Regex of Role.
    OutputFile string
    File name where to save data source results.
    Query string
    The query field of Role.
    RoleName string
    The name of the Role, comma separated.
    NameRegex string
    A Name Regex of Role.
    OutputFile string
    File name where to save data source results.
    Query string
    The query field of Role.
    RoleName string
    The name of the Role, comma separated.
    nameRegex String
    A Name Regex of Role.
    outputFile String
    File name where to save data source results.
    query String
    The query field of Role.
    roleName String
    The name of the Role, comma separated.
    nameRegex string
    A Name Regex of Role.
    outputFile string
    File name where to save data source results.
    query string
    The query field of Role.
    roleName string
    The name of the Role, comma separated.
    name_regex str
    A Name Regex of Role.
    output_file str
    File name where to save data source results.
    query str
    The query field of Role.
    role_name str
    The name of the Role, comma separated.
    nameRegex String
    A Name Regex of Role.
    outputFile String
    File name where to save data source results.
    query String
    The query field of Role.
    roleName String
    The name of the Role, comma separated.

    Roles Result

    The following output properties are available:

    Id string
    The provider-assigned unique ID for this managed resource.
    Roles List<RolesRole>
    The collection of Role query.
    TotalCount int
    The total count of Role query.
    NameRegex string
    OutputFile string
    Query string
    RoleName string
    The name of the Role.
    Id string
    The provider-assigned unique ID for this managed resource.
    Roles []RolesRole
    The collection of Role query.
    TotalCount int
    The total count of Role query.
    NameRegex string
    OutputFile string
    Query string
    RoleName string
    The name of the Role.
    id String
    The provider-assigned unique ID for this managed resource.
    roles List<RolesRole>
    The collection of Role query.
    totalCount Integer
    The total count of Role query.
    nameRegex String
    outputFile String
    query String
    roleName String
    The name of the Role.
    id string
    The provider-assigned unique ID for this managed resource.
    roles RolesRole[]
    The collection of Role query.
    totalCount number
    The total count of Role query.
    nameRegex string
    outputFile string
    query string
    roleName string
    The name of the Role.
    id str
    The provider-assigned unique ID for this managed resource.
    roles Sequence[RolesRole]
    The collection of Role query.
    total_count int
    The total count of Role query.
    name_regex str
    output_file str
    query str
    role_name str
    The name of the Role.
    id String
    The provider-assigned unique ID for this managed resource.
    roles List<Property Map>
    The collection of Role query.
    totalCount Number
    The total count of Role query.
    nameRegex String
    outputFile String
    query String
    roleName String
    The name of the Role.

    Supporting Types

    RolesRole

    CreateDate string
    The create time of the Role.
    Description string
    The description of the Role.
    Id string
    The ID of the Role.
    RoleName string
    The name of the Role, comma separated.
    Trn string
    The resource name of the Role.
    TrustPolicyDocument string
    The trust policy document of the Role.
    CreateDate string
    The create time of the Role.
    Description string
    The description of the Role.
    Id string
    The ID of the Role.
    RoleName string
    The name of the Role, comma separated.
    Trn string
    The resource name of the Role.
    TrustPolicyDocument string
    The trust policy document of the Role.
    createDate String
    The create time of the Role.
    description String
    The description of the Role.
    id String
    The ID of the Role.
    roleName String
    The name of the Role, comma separated.
    trn String
    The resource name of the Role.
    trustPolicyDocument String
    The trust policy document of the Role.
    createDate string
    The create time of the Role.
    description string
    The description of the Role.
    id string
    The ID of the Role.
    roleName string
    The name of the Role, comma separated.
    trn string
    The resource name of the Role.
    trustPolicyDocument string
    The trust policy document of the Role.
    create_date str
    The create time of the Role.
    description str
    The description of the Role.
    id str
    The ID of the Role.
    role_name str
    The name of the Role, comma separated.
    trn str
    The resource name of the Role.
    trust_policy_document str
    The trust policy document of the Role.
    createDate String
    The create time of the Role.
    description String
    The description of the Role.
    id String
    The ID of the Role.
    roleName String
    The name of the Role, comma separated.
    trn String
    The resource name of the Role.
    trustPolicyDocument String
    The trust policy document of the Role.

    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.26 published on Friday, Sep 13, 2024 by Volcengine