Alibaba Cloud v3.87.0 published on Saturday, Oct 18, 2025 by Pulumi
alicloud.resourcemanager.getRoles
This data source provides the Resource Manager Roles of the current Alibaba Cloud user.
NOTE: Available in 1.86.0+.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
const example = alicloud.resourcemanager.getRoles({
nameRegex: "tftest",
});
export const firstRoleId = example.then(example => example.roles?.[0]?.id);
import pulumi
import pulumi_alicloud as alicloud
example = alicloud.resourcemanager.get_roles(name_regex="tftest")
pulumi.export("firstRoleId", example.roles[0].id)
package main
import (
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/resourcemanager"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
example, err := resourcemanager.GetRoles(ctx, &resourcemanager.GetRolesArgs{
NameRegex: pulumi.StringRef("tftest"),
}, nil)
if err != nil {
return err
}
ctx.Export("firstRoleId", example.Roles[0].Id)
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;
return await Deployment.RunAsync(() =>
{
var example = AliCloud.ResourceManager.GetRoles.Invoke(new()
{
NameRegex = "tftest",
});
return new Dictionary<string, object?>
{
["firstRoleId"] = example.Apply(getRolesResult => getRolesResult.Roles[0]?.Id),
};
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.resourcemanager.ResourcemanagerFunctions;
import com.pulumi.alicloud.resourcemanager.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 example = ResourcemanagerFunctions.getRoles(GetRolesArgs.builder()
.nameRegex("tftest")
.build());
ctx.export("firstRoleId", example.roles()[0].id());
}
}
variables:
example:
fn::invoke:
function: alicloud:resourcemanager:getRoles
arguments:
nameRegex: tftest
outputs:
firstRoleId: ${example.roles[0].id}
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(enable_details: Optional[bool] = None,
ids: Optional[Sequence[str]] = None,
name_regex: Optional[str] = None,
output_file: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetRolesResult
def get_roles_output(enable_details: Optional[pulumi.Input[bool]] = None,
ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
name_regex: Optional[pulumi.Input[str]] = None,
output_file: 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: alicloud:resourcemanager/getRoles:getRoles
arguments:
# arguments dictionary
The following arguments are supported:
- Enable
Details bool - Default to
false
. Set it to true can output more details. - Ids List<string>
- A list of Resource Manager Role IDs.
- Name
Regex string - A regex string to filter results by role name.
- Output
File string - File name where to save data source results (after running
pulumi preview
).
- Enable
Details bool - Default to
false
. Set it to true can output more details. - Ids []string
- A list of Resource Manager Role IDs.
- Name
Regex string - A regex string to filter results by role name.
- Output
File string - File name where to save data source results (after running
pulumi preview
).
- enable
Details Boolean - Default to
false
. Set it to true can output more details. - ids List<String>
- A list of Resource Manager Role IDs.
- name
Regex String - A regex string to filter results by role name.
- output
File String - File name where to save data source results (after running
pulumi preview
).
- enable
Details boolean - Default to
false
. Set it to true can output more details. - ids string[]
- A list of Resource Manager Role IDs.
- name
Regex string - A regex string to filter results by role name.
- output
File string - File name where to save data source results (after running
pulumi preview
).
- enable_
details bool - Default to
false
. Set it to true can output more details. - ids Sequence[str]
- A list of Resource Manager Role IDs.
- name_
regex str - A regex string to filter results by role name.
- output_
file str - File name where to save data source results (after running
pulumi preview
).
- enable
Details Boolean - Default to
false
. Set it to true can output more details. - ids List<String>
- A list of Resource Manager Role IDs.
- name
Regex String - A regex string to filter results by role name.
- output
File String - File name where to save data source results (after running
pulumi preview
).
getRoles Result
The following output properties are available:
- Id string
- The provider-assigned unique ID for this managed resource.
- Ids List<string>
- A list of role IDs.
- Names List<string>
- A list of role names.
- Roles
List<Pulumi.
Ali Cloud. Resource Manager. Outputs. Get Roles Role> - A list of roles. Each element contains the following attributes:
- Enable
Details bool - Name
Regex string - Output
File string
- Id string
- The provider-assigned unique ID for this managed resource.
- Ids []string
- A list of role IDs.
- Names []string
- A list of role names.
- Roles
[]Get
Roles Role - A list of roles. Each element contains the following attributes:
- Enable
Details bool - Name
Regex string - Output
File string
- id String
- The provider-assigned unique ID for this managed resource.
- ids List<String>
- A list of role IDs.
- names List<String>
- A list of role names.
- roles
List<Get
Roles Role> - A list of roles. Each element contains the following attributes:
- enable
Details Boolean - name
Regex String - output
File String
- id string
- The provider-assigned unique ID for this managed resource.
- ids string[]
- A list of role IDs.
- names string[]
- A list of role names.
- roles
Get
Roles Role[] - A list of roles. Each element contains the following attributes:
- enable
Details boolean - name
Regex string - output
File string
- id str
- The provider-assigned unique ID for this managed resource.
- ids Sequence[str]
- A list of role IDs.
- names Sequence[str]
- A list of role names.
- roles
Sequence[Get
Roles Role] - A list of roles. Each element contains the following attributes:
- enable_
details bool - name_
regex str - output_
file str
- id String
- The provider-assigned unique ID for this managed resource.
- ids List<String>
- A list of role IDs.
- names List<String>
- A list of role names.
- roles List<Property Map>
- A list of roles. Each element contains the following attributes:
- enable
Details Boolean - name
Regex String - output
File String
Supporting Types
GetRolesRole
- Arn string
- The Alibaba Cloud Resource Name (ARN) of the RAM role.
- Assume
Role stringPolicy Document - (Available in v1.114.0+) The assume role policy document.
- Description string
- The description of the RAM role.
- Id string
- The ID of the role.
- Max
Session intDuration - The maximum session duration of the RAM role.
- Role
Id string - The ID of the role.
- Role
Name string - The name of the role.
- Update
Date string - The time when the RAM role was updated.
- Arn string
- The Alibaba Cloud Resource Name (ARN) of the RAM role.
- Assume
Role stringPolicy Document - (Available in v1.114.0+) The assume role policy document.
- Description string
- The description of the RAM role.
- Id string
- The ID of the role.
- Max
Session intDuration - The maximum session duration of the RAM role.
- Role
Id string - The ID of the role.
- Role
Name string - The name of the role.
- Update
Date string - The time when the RAM role was updated.
- arn String
- The Alibaba Cloud Resource Name (ARN) of the RAM role.
- assume
Role StringPolicy Document - (Available in v1.114.0+) The assume role policy document.
- description String
- The description of the RAM role.
- id String
- The ID of the role.
- max
Session IntegerDuration - The maximum session duration of the RAM role.
- role
Id String - The ID of the role.
- role
Name String - The name of the role.
- update
Date String - The time when the RAM role was updated.
- arn string
- The Alibaba Cloud Resource Name (ARN) of the RAM role.
- assume
Role stringPolicy Document - (Available in v1.114.0+) The assume role policy document.
- description string
- The description of the RAM role.
- id string
- The ID of the role.
- max
Session numberDuration - The maximum session duration of the RAM role.
- role
Id string - The ID of the role.
- role
Name string - The name of the role.
- update
Date string - The time when the RAM role was updated.
- arn str
- The Alibaba Cloud Resource Name (ARN) of the RAM role.
- assume_
role_ strpolicy_ document - (Available in v1.114.0+) The assume role policy document.
- description str
- The description of the RAM role.
- id str
- The ID of the role.
- max_
session_ intduration - The maximum session duration of the RAM role.
- role_
id str - The ID of the role.
- role_
name str - The name of the role.
- update_
date str - The time when the RAM role was updated.
- arn String
- The Alibaba Cloud Resource Name (ARN) of the RAM role.
- assume
Role StringPolicy Document - (Available in v1.114.0+) The assume role policy document.
- description String
- The description of the RAM role.
- id String
- The ID of the role.
- max
Session NumberDuration - The maximum session duration of the RAM role.
- role
Id String - The ID of the role.
- role
Name String - The name of the role.
- update
Date String - The time when the RAM role was updated.
Package Details
- Repository
- Alibaba Cloud pulumi/pulumi-alicloud
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
alicloud
Terraform Provider.