1. Packages
  2. Alibaba Cloud Provider
  3. API Docs
  4. cloudsso
  5. getGroups
Alibaba Cloud v3.76.0 published on Tuesday, Apr 8, 2025 by Pulumi

alicloud.cloudsso.getGroups

Explore with Pulumi AI

Alibaba Cloud v3.76.0 published on Tuesday, Apr 8, 2025 by Pulumi

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 And us-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);
Copy
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)
Copy
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
	})
}
Copy
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),
    };
});
Copy
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.applyValue(getGroupsResult -> getGroupsResult.groups()[0].id()));
        final var nameRegex = CloudssoFunctions.getGroups(GetGroupsArgs.builder()
            .directoryId("example_value")
            .nameRegex("^my-Group")
            .build());

        ctx.export("cloudSsoGroupId2", nameRegex.applyValue(getGroupsResult -> getGroupsResult.groups()[0].id()));
    }
}
Copy
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}
Copy

Using getGroups

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 getGroups(args: GetGroupsArgs, opts?: InvokeOptions): Promise<GetGroupsResult>
function getGroupsOutput(args: GetGroupsOutputArgs, opts?: InvokeOptions): Output<GetGroupsResult>
Copy
def get_groups(directory_id: Optional[str] = None,
               ids: Optional[Sequence[str]] = None,
               name_regex: Optional[str] = None,
               output_file: Optional[str] = None,
               provision_type: Optional[str] = None,
               opts: Optional[InvokeOptions] = None) -> GetGroupsResult
def get_groups_output(directory_id: Optional[pulumi.Input[str]] = None,
               ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
               name_regex: Optional[pulumi.Input[str]] = None,
               output_file: Optional[pulumi.Input[str]] = None,
               provision_type: Optional[pulumi.Input[str]] = None,
               opts: Optional[InvokeOptions] = None) -> Output[GetGroupsResult]
Copy
func GetGroups(ctx *Context, args *GetGroupsArgs, opts ...InvokeOption) (*GetGroupsResult, error)
func GetGroupsOutput(ctx *Context, args *GetGroupsOutputArgs, opts ...InvokeOption) GetGroupsResultOutput
Copy

> Note: This function is named GetGroups in the Go SDK.

public static class GetGroups 
{
    public static Task<GetGroupsResult> InvokeAsync(GetGroupsArgs args, InvokeOptions? opts = null)
    public static Output<GetGroupsResult> Invoke(GetGroupsInvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetGroupsResult> getGroups(GetGroupsArgs args, InvokeOptions options)
public static Output<GetGroupsResult> getGroups(GetGroupsArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: alicloud:cloudsso/getGroups:getGroups
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

DirectoryId
This property is required.
Changes to this property will trigger replacement.
string
The ID of the Directory.
Ids Changes to this property will trigger replacement. List<string>
A list of Group IDs.
NameRegex Changes to this property will trigger replacement. string
A regex string to filter results by Group name.
OutputFile string
File name where to save data source results (after running pulumi preview).
ProvisionType Changes to this property will trigger replacement. string
The ProvisionType of the Group. Valid values: Manual, Synchronized.
DirectoryId
This property is required.
Changes to this property will trigger replacement.
string
The ID of the Directory.
Ids Changes to this property will trigger replacement. []string
A list of Group IDs.
NameRegex Changes to this property will trigger replacement. string
A regex string to filter results by Group name.
OutputFile string
File name where to save data source results (after running pulumi preview).
ProvisionType Changes to this property will trigger replacement. string
The ProvisionType of the Group. Valid values: Manual, Synchronized.
directoryId
This property is required.
Changes to this property will trigger replacement.
String
The ID of the Directory.
ids Changes to this property will trigger replacement. List<String>
A list of Group IDs.
nameRegex Changes to this property will trigger replacement. String
A regex string to filter results by Group name.
outputFile String
File name where to save data source results (after running pulumi preview).
provisionType Changes to this property will trigger replacement. String
The ProvisionType of the Group. Valid values: Manual, Synchronized.
directoryId
This property is required.
Changes to this property will trigger replacement.
string
The ID of the Directory.
ids Changes to this property will trigger replacement. string[]
A list of Group IDs.
nameRegex Changes to this property will trigger replacement. string
A regex string to filter results by Group name.
outputFile string
File name where to save data source results (after running pulumi preview).
provisionType Changes to this property will trigger replacement. string
The ProvisionType of the Group. Valid values: Manual, Synchronized.
directory_id
This property is required.
Changes to this property will trigger replacement.
str
The ID of the Directory.
ids Changes to this property will trigger replacement. Sequence[str]
A list of Group IDs.
name_regex Changes to this property will trigger replacement. str
A regex string to filter results by Group name.
output_file str
File name where to save data source results (after running pulumi preview).
provision_type Changes to this property will trigger replacement. str
The ProvisionType of the Group. Valid values: Manual, Synchronized.
directoryId
This property is required.
Changes to this property will trigger replacement.
String
The ID of the Directory.
ids Changes to this property will trigger replacement. List<String>
A list of Group IDs.
nameRegex Changes to this property will trigger replacement. String
A regex string to filter results by Group name.
outputFile String
File name where to save data source results (after running pulumi preview).
provisionType Changes to this property will trigger replacement. String
The ProvisionType of the Group. Valid values: Manual, Synchronized.

getGroups Result

The following output properties are available:

DirectoryId string
Groups List<Pulumi.AliCloud.CloudSso.Outputs.GetGroupsGroup>
Id string
The provider-assigned unique ID for this managed resource.
Ids List<string>
Names List<string>
NameRegex string
OutputFile string
ProvisionType string
DirectoryId string
Groups []GetGroupsGroup
Id string
The provider-assigned unique ID for this managed resource.
Ids []string
Names []string
NameRegex string
OutputFile string
ProvisionType string
directoryId String
groups List<GetGroupsGroup>
id String
The provider-assigned unique ID for this managed resource.
ids List<String>
names List<String>
nameRegex String
outputFile String
provisionType String
directoryId string
groups GetGroupsGroup[]
id string
The provider-assigned unique ID for this managed resource.
ids string[]
names string[]
nameRegex string
outputFile string
provisionType string
directory_id str
groups Sequence[GetGroupsGroup]
id str
The provider-assigned unique ID for this managed resource.
ids Sequence[str]
names Sequence[str]
name_regex str
output_file str
provision_type str
directoryId String
groups List<Property Map>
id String
The provider-assigned unique ID for this managed resource.
ids List<String>
names List<String>
nameRegex String
outputFile String
provisionType String

Supporting Types

GetGroupsGroup

CreateTime This property is required. string
The Created Time of the Directory.
Description This property is required. string
The Description of the Directory.
DirectoryId This property is required. string
The ID of the Directory.
GroupId This property is required. string
The Group ID of the group.
GroupName This property is required. string
The Name of the group.
Id This property is required. string
The ID of the Group.
ProvisionType This property is required. string
The Provision Type of the Group. Valid values: Manual, Synchronized.
CreateTime This property is required. string
The Created Time of the Directory.
Description This property is required. string
The Description of the Directory.
DirectoryId This property is required. string
The ID of the Directory.
GroupId This property is required. string
The Group ID of the group.
GroupName This property is required. string
The Name of the group.
Id This property is required. string
The ID of the Group.
ProvisionType This property is required. string
The Provision Type of the Group. Valid values: Manual, Synchronized.
createTime This property is required. String
The Created Time of the Directory.
description This property is required. String
The Description of the Directory.
directoryId This property is required. String
The ID of the Directory.
groupId This property is required. String
The Group ID of the group.
groupName This property is required. String
The Name of the group.
id This property is required. String
The ID of the Group.
provisionType This property is required. String
The Provision Type of the Group. Valid values: Manual, Synchronized.
createTime This property is required. string
The Created Time of the Directory.
description This property is required. string
The Description of the Directory.
directoryId This property is required. string
The ID of the Directory.
groupId This property is required. string
The Group ID of the group.
groupName This property is required. string
The Name of the group.
id This property is required. string
The ID of the Group.
provisionType This property is required. string
The Provision Type of the Group. Valid values: Manual, Synchronized.
create_time This property is required. str
The Created Time of the Directory.
description This property is required. str
The Description of the Directory.
directory_id This property is required. str
The ID of the Directory.
group_id This property is required. str
The Group ID of the group.
group_name This property is required. str
The Name of the group.
id This property is required. str
The ID of the Group.
provision_type This property is required. str
The Provision Type of the Group. Valid values: Manual, Synchronized.
createTime This property is required. String
The Created Time of the Directory.
description This property is required. String
The Description of the Directory.
directoryId This property is required. String
The ID of the Directory.
groupId This property is required. String
The Group ID of the group.
groupName This property is required. String
The Name of the group.
id This property is required. String
The ID of the Group.
provisionType This property is required. String
The Provision Type of the Group. Valid values: Manual, Synchronized.

Package Details

Repository
Alibaba Cloud pulumi/pulumi-alicloud
License
Apache-2.0
Notes
This Pulumi package is based on the alicloud Terraform Provider.
Alibaba Cloud v3.76.0 published on Tuesday, Apr 8, 2025 by Pulumi