1. Packages
  2. Volcengine
  3. API Docs
  4. iam
  5. getRoles
Volcengine v0.0.45 published on Tuesday, Feb 10, 2026 by Volcengine
volcengine logo
Volcengine v0.0.45 published on Tuesday, Feb 10, 2026 by Volcengine

    Use this data source to query detailed information of iam roles

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as volcengine from "@pulumi/volcengine";
    
    const default = volcengine.iam.getRoles({
        query: "CustomRoleForOOS",
    });
    
    import pulumi
    import pulumi_volcengine as volcengine
    
    default = volcengine.iam.get_roles(query="CustomRoleForOOS")
    
    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.GetRoles(ctx, &iam.GetRolesArgs{
    			Query: pulumi.StringRef("CustomRoleForOOS"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Volcengine = Pulumi.Volcengine;
    
    return await Deployment.RunAsync(() => 
    {
        var @default = Volcengine.Iam.GetRoles.Invoke(new()
        {
            Query = "CustomRoleForOOS",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.volcengine.iam.IamFunctions;
    import com.pulumi.volcengine.iam.inputs.GetRolesArgs;
    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) {
            final var default = IamFunctions.getRoles(GetRolesArgs.builder()
                .query("CustomRoleForOOS")
                .build());
    
        }
    }
    
    variables:
      default:
        fn::invoke:
          Function: volcengine:iam:getRoles
          Arguments:
            query: CustomRoleForOOS
    

    Using getRoles

    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 getRoles(args: GetRolesArgs, opts?: InvokeOptions): Promise<GetRolesResult>
    function getRolesOutput(args: GetRolesOutputArgs, opts?: InvokeOptions): Output<GetRolesResult>
    def get_roles(name_regex: Optional[str] = None,
                  output_file: Optional[str] = None,
                  query: Optional[str] = None,
                  opts: Optional[InvokeOptions] = None) -> GetRolesResult
    def get_roles_output(name_regex: Optional[pulumi.Input[str]] = None,
                  output_file: Optional[pulumi.Input[str]] = None,
                  query: Optional[pulumi.Input[str]] = None,
                  opts: Optional[InvokeOptions] = None) -> Output[GetRolesResult]
    func GetRoles(ctx *Context, args *GetRolesArgs, opts ...InvokeOption) (*GetRolesResult, error)
    func GetRolesOutput(ctx *Context, args *GetRolesOutputArgs, opts ...InvokeOption) GetRolesResultOutput

    > Note: This function is named GetRoles in the Go SDK.

    public static class GetRoles 
    {
        public static Task<GetRolesResult> InvokeAsync(GetRolesArgs args, InvokeOptions? opts = null)
        public static Output<GetRolesResult> Invoke(GetRolesInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetRolesResult> getRoles(GetRolesArgs args, InvokeOptions options)
    public static Output<GetRolesResult> getRoles(GetRolesArgs args, InvokeOptions options)
    
    fn::invoke:
      function: volcengine:iam/getRoles:getRoles
      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
    Fuzzy query. Can query by role name, display name or description.
    NameRegex string
    A Name Regex of Role.
    OutputFile string
    File name where to save data source results.
    Query string
    Fuzzy query. Can query by role name, display name or description.
    nameRegex String
    A Name Regex of Role.
    outputFile String
    File name where to save data source results.
    query String
    Fuzzy query. Can query by role name, display name or description.
    nameRegex string
    A Name Regex of Role.
    outputFile string
    File name where to save data source results.
    query string
    Fuzzy query. Can query by role name, display name or description.
    name_regex str
    A Name Regex of Role.
    output_file str
    File name where to save data source results.
    query str
    Fuzzy query. Can query by role name, display name or description.
    nameRegex String
    A Name Regex of Role.
    outputFile String
    File name where to save data source results.
    query String
    Fuzzy query. Can query by role name, display name or description.

    getRoles Result

    The following output properties are available:

    Id string
    The provider-assigned unique ID for this managed resource.
    Roles List<GetRolesRole>
    The collection of Role query.
    TotalCount int
    The total count of Role query.
    NameRegex string
    OutputFile string
    Query string
    Id string
    The provider-assigned unique ID for this managed resource.
    Roles []GetRolesRole
    The collection of Role query.
    TotalCount int
    The total count of Role query.
    NameRegex string
    OutputFile string
    Query string
    id String
    The provider-assigned unique ID for this managed resource.
    roles List<GetRolesRole>
    The collection of Role query.
    totalCount Integer
    The total count of Role query.
    nameRegex String
    outputFile String
    query String
    id string
    The provider-assigned unique ID for this managed resource.
    roles GetRolesRole[]
    The collection of Role query.
    totalCount number
    The total count of Role query.
    nameRegex string
    outputFile string
    query string
    id str
    The provider-assigned unique ID for this managed resource.
    roles Sequence[GetRolesRole]
    The collection of Role query.
    total_count int
    The total count of Role query.
    name_regex str
    output_file str
    query str
    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

    Supporting Types

    GetRolesRole

    CreateDate string
    The create time of the Role.
    Description string
    The description of the Role.
    DisplayName string
    The display name of the Role.
    IsServiceLinkedRole int
    Whether the Role is a service linked role.
    MaxSessionDuration int
    The max session duration of the Role.
    RoleId int
    The id of the Role.
    RoleName string
    The name of the Role.
    Tags List<GetRolesRoleTag>
    Tags.
    Trn string
    The resource name of the Role.
    TrustPolicyDocument string
    The trust policy document of the Role.
    UpdateDate string
    The update time of the Role.
    CreateDate string
    The create time of the Role.
    Description string
    The description of the Role.
    DisplayName string
    The display name of the Role.
    IsServiceLinkedRole int
    Whether the Role is a service linked role.
    MaxSessionDuration int
    The max session duration of the Role.
    RoleId int
    The id of the Role.
    RoleName string
    The name of the Role.
    Tags []GetRolesRoleTag
    Tags.
    Trn string
    The resource name of the Role.
    TrustPolicyDocument string
    The trust policy document of the Role.
    UpdateDate string
    The update time of the Role.
    createDate String
    The create time of the Role.
    description String
    The description of the Role.
    displayName String
    The display name of the Role.
    isServiceLinkedRole Integer
    Whether the Role is a service linked role.
    maxSessionDuration Integer
    The max session duration of the Role.
    roleId Integer
    The id of the Role.
    roleName String
    The name of the Role.
    tags List<GetRolesRoleTag>
    Tags.
    trn String
    The resource name of the Role.
    trustPolicyDocument String
    The trust policy document of the Role.
    updateDate String
    The update time of the Role.
    createDate string
    The create time of the Role.
    description string
    The description of the Role.
    displayName string
    The display name of the Role.
    isServiceLinkedRole number
    Whether the Role is a service linked role.
    maxSessionDuration number
    The max session duration of the Role.
    roleId number
    The id of the Role.
    roleName string
    The name of the Role.
    tags GetRolesRoleTag[]
    Tags.
    trn string
    The resource name of the Role.
    trustPolicyDocument string
    The trust policy document of the Role.
    updateDate string
    The update time of the Role.
    create_date str
    The create time of the Role.
    description str
    The description of the Role.
    display_name str
    The display name of the Role.
    is_service_linked_role int
    Whether the Role is a service linked role.
    max_session_duration int
    The max session duration of the Role.
    role_id int
    The id of the Role.
    role_name str
    The name of the Role.
    tags Sequence[GetRolesRoleTag]
    Tags.
    trn str
    The resource name of the Role.
    trust_policy_document str
    The trust policy document of the Role.
    update_date str
    The update time of the Role.
    createDate String
    The create time of the Role.
    description String
    The description of the Role.
    displayName String
    The display name of the Role.
    isServiceLinkedRole Number
    Whether the Role is a service linked role.
    maxSessionDuration Number
    The max session duration of the Role.
    roleId Number
    The id of the Role.
    roleName String
    The name of the Role.
    tags List<Property Map>
    Tags.
    trn String
    The resource name of the Role.
    trustPolicyDocument String
    The trust policy document of the Role.
    updateDate String
    The update time of the Role.

    GetRolesRoleTag

    Key string
    The Key of Tags.
    Value string
    The Value of Tags.
    Key string
    The Key of Tags.
    Value string
    The Value of Tags.
    key String
    The Key of Tags.
    value String
    The Value of Tags.
    key string
    The Key of Tags.
    value string
    The Value of Tags.
    key str
    The Key of Tags.
    value str
    The Value of Tags.
    key String
    The Key of Tags.
    value String
    The Value of Tags.

    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.45 published on Tuesday, Feb 10, 2026 by Volcengine
      Meet Neo: Your AI Platform Teammate