Volcengine v0.0.38 published on Friday, Oct 31, 2025 by Volcengine
Volcengine v0.0.38 published on Friday, Oct 31, 2025 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";
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.getRolesOutput({
roleName: pulumi.interpolate`${foo1.roleName},${foo2.roleName}`,
});
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.get_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}"))
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.GetRolesOutput(ctx, iam.GetRolesOutputArgs{
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
})
}
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.GetRoles.Invoke(new()
{
RoleName = $"{foo1.RoleName},{foo2.RoleName}",
});
});
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.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) {
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.getRoles(GetRolesArgs.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());
}
}
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:getRoles
Arguments:
roleName: ${foo1.roleName},${foo2.roleName}
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,
role_name: 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,
role_name: 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 dictionaryThe following arguments are supported:
- Name
Regex string - A Name Regex of Role.
- Output
File string - File name where to save data source results.
- Query string
- The query field of Role.
- Role
Name string - The name of the Role, comma separated.
- Name
Regex string - A Name Regex of Role.
- Output
File string - File name where to save data source results.
- Query string
- The query field of Role.
- Role
Name string - The name of the Role, comma separated.
- name
Regex String - A Name Regex of Role.
- output
File String - File name where to save data source results.
- query String
- The query field of Role.
- role
Name String - The name of the Role, comma separated.
- name
Regex string - A Name Regex of Role.
- output
File string - File name where to save data source results.
- query string
- The query field of Role.
- role
Name 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.
- name
Regex String - A Name Regex of Role.
- output
File String - File name where to save data source results.
- query String
- The query field of Role.
- role
Name String - The name of the Role, comma separated.
getRoles Result
The following output properties are available:
- Id string
- The provider-assigned unique ID for this managed resource.
- Roles
List<Get
Roles Role> - The collection of Role query.
- Total
Count int - The total count of Role query.
- Name
Regex string - Output
File string - Query string
- Role
Name string - The name of the Role.
- Id string
- The provider-assigned unique ID for this managed resource.
- Roles
[]Get
Roles Role - The collection of Role query.
- Total
Count int - The total count of Role query.
- Name
Regex string - Output
File string - Query string
- Role
Name string - The name of the Role.
- id String
- The provider-assigned unique ID for this managed resource.
- roles
List<Get
Roles Role> - The collection of Role query.
- total
Count Integer - The total count of Role query.
- name
Regex String - output
File String - query String
- role
Name String - The name of the Role.
- id string
- The provider-assigned unique ID for this managed resource.
- roles
Get
Roles Role[] - The collection of Role query.
- total
Count number - The total count of Role query.
- name
Regex string - output
File string - query string
- role
Name string - The name of the Role.
- id str
- The provider-assigned unique ID for this managed resource.
- roles
Sequence[Get
Roles Role] - 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.
- total
Count Number - The total count of Role query.
- name
Regex String - output
File String - query String
- role
Name String - The name of the Role.
Supporting Types
GetRolesRole
- Create
Date string - The create time of the Role.
- Description string
- The description of the Role.
- Id string
- The ID of the Role.
- Role
Name string - The name of the Role, comma separated.
- Trn string
- The resource name of the Role.
- Trust
Policy stringDocument - The trust policy document of the Role.
- Create
Date string - The create time of the Role.
- Description string
- The description of the Role.
- Id string
- The ID of the Role.
- Role
Name string - The name of the Role, comma separated.
- Trn string
- The resource name of the Role.
- Trust
Policy stringDocument - The trust policy document of the Role.
- create
Date String - The create time of the Role.
- description String
- The description of the Role.
- id String
- The ID of the Role.
- role
Name String - The name of the Role, comma separated.
- trn String
- The resource name of the Role.
- trust
Policy StringDocument - The trust policy document of the Role.
- create
Date string - The create time of the Role.
- description string
- The description of the Role.
- id string
- The ID of the Role.
- role
Name string - The name of the Role, comma separated.
- trn string
- The resource name of the Role.
- trust
Policy stringDocument - 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_ strdocument - The trust policy document of the Role.
- create
Date String - The create time of the Role.
- description String
- The description of the Role.
- id String
- The ID of the Role.
- role
Name String - The name of the Role, comma separated.
- trn String
- The resource name of the Role.
- trust
Policy StringDocument - 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
volcengineTerraform Provider.
Volcengine v0.0.38 published on Friday, Oct 31, 2025 by Volcengine
