getUserGroups

This data source provides the Bastionhost User Groups of the current Alibaba Cloud user.

NOTE: Available in v1.132.0+.

Example Usage

Basic Usage

import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
const ids = alicloud.bastionhost.getUserGroups({
instanceId: "bastionhost-cn-xxxx",
ids: [
"1",
"2",
],
});
export const bastionhostUserGroupId1 = ids.then(ids => ids.groups?.[0]?.id);
const nameRegex = alicloud.bastionhost.getUserGroups({
instanceId: "bastionhost-cn-xxxx",
nameRegex: "^my-UserGroup",
});
export const bastionhostUserGroupId2 = nameRegex.then(nameRegex => nameRegex.groups?.[0]?.id);
import pulumi
import pulumi_alicloud as alicloud
ids = alicloud.bastionhost.get_user_groups(instance_id="bastionhost-cn-xxxx",
ids=[
"1",
"2",
])
pulumi.export("bastionhostUserGroupId1", ids.groups[0].id)
name_regex = alicloud.bastionhost.get_user_groups(instance_id="bastionhost-cn-xxxx",
name_regex="^my-UserGroup")
pulumi.export("bastionhostUserGroupId2", name_regex.groups[0].id)
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;
return await Deployment.RunAsync(() =>
{
var ids = AliCloud.BastionHost.GetUserGroups.Invoke(new()
{
InstanceId = "bastionhost-cn-xxxx",
Ids = new[]
{
"1",
"2",
},
});
var nameRegex = AliCloud.BastionHost.GetUserGroups.Invoke(new()
{
InstanceId = "bastionhost-cn-xxxx",
NameRegex = "^my-UserGroup",
});
return new Dictionary<string, object?>
{
["bastionhostUserGroupId1"] = ids&#46;Apply(getUserGroupsResult => getUserGroupsResult&#46;Groups[0]?.Id),
["bastionhostUserGroupId2"] = nameRegex&#46;Apply(getUserGroupsResult => getUserGroupsResult&#46;Groups[0]?.Id),
};
});
package main
import (
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/bastionhost"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
ids, err := bastionhost.GetUserGroups(ctx, &bastionhost.GetUserGroupsArgs{
InstanceId: "bastionhost-cn-xxxx",
Ids: []string{
"1",
"2",
},
}, nil)
if err != nil {
return err
}
ctx.Export("bastionhostUserGroupId1", ids.Groups[0].Id)
nameRegex, err := bastionhost.GetUserGroups(ctx, &bastionhost.GetUserGroupsArgs{
InstanceId: "bastionhost-cn-xxxx",
NameRegex: pulumi.StringRef("^my-UserGroup"),
}, nil)
if err != nil {
return err
}
ctx.Export("bastionhostUserGroupId2", nameRegex.Groups[0].Id)
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.bastionhost.BastionhostFunctions;
import com.pulumi.alicloud.bastionhost.inputs.GetUserGroupsArgs;
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 ids = BastionhostFunctions.getUserGroups(GetUserGroupsArgs.builder()
.instanceId("bastionhost-cn-xxxx")
.ids(
"1",
"2")
.build());
ctx.export("bastionhostUserGroupId1", ids.groups()[0].id());
final var nameRegex = BastionhostFunctions.getUserGroups(GetUserGroupsArgs.builder()
.instanceId("bastionhost-cn-xxxx")
.nameRegex("^my-UserGroup")
.build());
ctx.export("bastionhostUserGroupId2", nameRegex.groups()[0].id());
}
}
variables:
ids:
fn::invoke:
function: alicloud:bastionhost:getUserGroups
arguments:
instanceId: bastionhost-cn-xxxx
ids:
- '1'
- '2'
nameRegex:
fn::invoke:
function: alicloud:bastionhost:getUserGroups
arguments:
instanceId: bastionhost-cn-xxxx
nameRegex: ^my-UserGroup
outputs:
bastionhostUserGroupId1: ${ids.groups[0].id}
bastionhostUserGroupId2: ${nameRegex.groups[0].id}

Return

A collection of values returned by getUserGroups.

Parameters

argument

A collection of arguments for invoking getUserGroups.


suspend fun getUserGroups(ids: List<String>? = null, instanceId: String, nameRegex: String? = null, outputFile: String? = null, userGroupName: String? = null): GetUserGroupsResult

Return

A collection of values returned by getUserGroups.

Parameters

ids

A list of User Group self IDs.

instanceId

Specify the New Group of the Bastion Host of Instance Id.

nameRegex

A regex string to filter results by User Group name.

outputFile

File name where to save data source results (after running pulumi preview).

userGroupName

Specify the New Group Name. Supports up to 128 Characters.

See also


Return

A collection of values returned by getUserGroups.

Parameters

argument

Builder for com.pulumi.alicloud.bastionhost.kotlin.inputs.GetUserGroupsPlainArgs.

See also