get Groups
This data source provides the Cloud Sso Groups of the current Alibaba Cloud user.
NOTE: Available in v1.138.0+. NOTE: Cloud SSO Only Support
cn-shanghai
Andus-west-1
Region
Example Usage
Basic Usage
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
const ids = alicloud.cloudsso.getGroups({
directoryId: "example_value",
ids: [
"example_value-1",
"example_value-2",
],
});
export const cloudSsoGroupId1 = ids.then(ids => ids.groups?.[0]?.id);
const nameRegex = alicloud.cloudsso.getGroups({
directoryId: "example_value",
nameRegex: "^my-Group",
});
export const cloudSsoGroupId2 = nameRegex.then(nameRegex => nameRegex.groups?.[0]?.id);
Content copied to clipboard
import pulumi
import pulumi_alicloud as alicloud
ids = alicloud.cloudsso.get_groups(directory_id="example_value",
ids=[
"example_value-1",
"example_value-2",
])
pulumi.export("cloudSsoGroupId1", ids.groups[0].id)
name_regex = alicloud.cloudsso.get_groups(directory_id="example_value",
name_regex="^my-Group")
pulumi.export("cloudSsoGroupId2", name_regex.groups[0].id)
Content copied to clipboard
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;
return await Deployment.RunAsync(() =>
{
var ids = AliCloud.CloudSso.GetGroups.Invoke(new()
{
DirectoryId = "example_value",
Ids = new[]
{
"example_value-1",
"example_value-2",
},
});
var nameRegex = AliCloud.CloudSso.GetGroups.Invoke(new()
{
DirectoryId = "example_value",
NameRegex = "^my-Group",
});
return new Dictionary<string, object?>
{
["cloudSsoGroupId1"] = ids.Apply(getGroupsResult => getGroupsResult.Groups[0]?.Id),
["cloudSsoGroupId2"] = nameRegex.Apply(getGroupsResult => getGroupsResult.Groups[0]?.Id),
};
});
Content copied to clipboard
package main
import (
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/cloudsso"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
ids, err := cloudsso.GetGroups(ctx, &cloudsso.GetGroupsArgs{
DirectoryId: "example_value",
Ids: []string{
"example_value-1",
"example_value-2",
},
}, nil)
if err != nil {
return err
}
ctx.Export("cloudSsoGroupId1", ids.Groups[0].Id)
nameRegex, err := cloudsso.GetGroups(ctx, &cloudsso.GetGroupsArgs{
DirectoryId: "example_value",
NameRegex: pulumi.StringRef("^my-Group"),
}, nil)
if err != nil {
return err
}
ctx.Export("cloudSsoGroupId2", nameRegex.Groups[0].Id)
return nil
})
}
Content copied to clipboard
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.cloudsso.CloudssoFunctions;
import com.pulumi.alicloud.cloudsso.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 ids = CloudssoFunctions.getGroups(GetGroupsArgs.builder()
.directoryId("example_value")
.ids(
"example_value-1",
"example_value-2")
.build());
ctx.export("cloudSsoGroupId1", ids.groups()[0].id());
final var nameRegex = CloudssoFunctions.getGroups(GetGroupsArgs.builder()
.directoryId("example_value")
.nameRegex("^my-Group")
.build());
ctx.export("cloudSsoGroupId2", nameRegex.groups()[0].id());
}
}
Content copied to clipboard
variables:
ids:
fn::invoke:
function: alicloud:cloudsso:getGroups
arguments:
directoryId: example_value
ids:
- example_value-1
- example_value-2
nameRegex:
fn::invoke:
function: alicloud:cloudsso:getGroups
arguments:
directoryId: example_value
nameRegex: ^my-Group
outputs:
cloudSsoGroupId1: ${ids.groups[0].id}
cloudSsoGroupId2: ${nameRegex.groups[0].id}
Content copied to clipboard
Return
A collection of values returned by getGroups.
Parameters
argument
A collection of arguments for invoking getGroups.
suspend fun getGroups(directoryId: String, ids: List<String>? = null, nameRegex: String? = null, outputFile: String? = null, provisionType: String? = null): GetGroupsResult
Return
A collection of values returned by getGroups.
Parameters
directory Id
The ID of the Directory.
ids
A list of Group IDs.
name Regex
A regex string to filter results by Group name.
output File
File name where to save data source results (after running pulumi preview
).
provision Type
The ProvisionType of the Group. Valid values: Manual
, Synchronized
.
See also
Return
A collection of values returned by getGroups.
Parameters
argument
Builder for com.pulumi.alicloud.cloudsso.kotlin.inputs.GetGroupsPlainArgs.