get Groups
This data source provides a list of RAM Groups in an Alibaba Cloud account according to the specified filters.
NOTE: Available since v1.0.0+.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
const groupsDs = alicloud.ram.getGroups({
outputFile: "groups.txt",
userName: "user1",
nameRegex: "^group[0-9]*",
});
export const firstGroupName = groupsDs.then(groupsDs => groupsDs.groups?.[0]?.name);
import pulumi
import pulumi_alicloud as alicloud
groups_ds = alicloud.ram.get_groups(output_file="groups.txt",
user_name="user1",
name_regex="^group[0-9]*")
pulumi.export("firstGroupName", groups_ds.groups[0].name)
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;
return await Deployment.RunAsync(() =>
{
var groupsDs = AliCloud.Ram.GetGroups.Invoke(new()
{
OutputFile = "groups.txt",
UserName = "user1",
NameRegex = "^group[0-9]*",
});
return new Dictionary<string, object?>
{
["firstGroupName"] = groupsDs.Apply(getGroupsResult => getGroupsResult.Groups[0]?.Name),
};
});
package main
import (
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/ram"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
groupsDs, err := ram.GetGroups(ctx, &ram.GetGroupsArgs{
OutputFile: pulumi.StringRef("groups.txt"),
UserName: pulumi.StringRef("user1"),
NameRegex: pulumi.StringRef("^group[0-9]*"),
}, nil)
if err != nil {
return err
}
ctx.Export("firstGroupName", groupsDs.Groups[0].Name)
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.ram.RamFunctions;
import com.pulumi.alicloud.ram.inputs.GetGroupsArgs;
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 groupsDs = RamFunctions.getGroups(GetGroupsArgs.builder()
.outputFile("groups.txt")
.userName("user1")
.nameRegex("^group[0-9]*")
.build());
ctx.export("firstGroupName", groupsDs.applyValue(getGroupsResult -> getGroupsResult.groups()[0].name()));
}
}
variables:
groupsDs:
fn::invoke:
function: alicloud:ram:getGroups
arguments:
outputFile: groups.txt
userName: user1
nameRegex: ^group[0-9]*
outputs:
firstGroupName: ${groupsDs.groups[0].name}
Return
A collection of values returned by getGroups.
Parameters
A collection of arguments for invoking getGroups.
Return
A collection of values returned by getGroups.
Parameters
A regex string to filter the returned groups by their names.
File name where to save data source results (after running pulumi preview
).
Filter the results by a specific policy name. If you set this parameter without setting policy_type
, it will be automatically set to System
.
Filter the results by a specific policy type. Valid items are Custom
and System
. If you set this parameter, you must set policy_name
as well.
Filter the results by a specific the user name.
See also
Return
A collection of values returned by getGroups.
Parameters
Builder for com.pulumi.alicloud.ram.kotlin.inputs.GetGroupsPlainArgs.