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

alicloud.ram.getGroups

Explore with Pulumi AI

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

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);
Copy
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)
Copy
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
	})
}
Copy
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),
    };
});
Copy
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()));
    }
}
Copy
variables:
  groupsDs:
    fn::invoke:
      function: alicloud:ram:getGroups
      arguments:
        outputFile: groups.txt
        userName: user1
        nameRegex: ^group[0-9]*
outputs:
  firstGroupName: ${groupsDs.groups[0].name}
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(name_regex: Optional[str] = None,
               output_file: Optional[str] = None,
               policy_name: Optional[str] = None,
               policy_type: Optional[str] = None,
               user_name: Optional[str] = None,
               opts: Optional[InvokeOptions] = None) -> GetGroupsResult
def get_groups_output(name_regex: Optional[pulumi.Input[str]] = None,
               output_file: Optional[pulumi.Input[str]] = None,
               policy_name: Optional[pulumi.Input[str]] = None,
               policy_type: Optional[pulumi.Input[str]] = None,
               user_name: 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:ram/getGroups:getGroups
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

NameRegex Changes to this property will trigger replacement. string
A regex string to filter the returned groups by their names.
OutputFile string
File name where to save data source results (after running pulumi preview).
PolicyName Changes to this property will trigger replacement. string
Filter the results by a specific policy name. If you set this parameter without setting policy_type, it will be automatically set to System.
PolicyType Changes to this property will trigger replacement. string
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.
UserName Changes to this property will trigger replacement. string
Filter the results by a specific the user name.
NameRegex Changes to this property will trigger replacement. string
A regex string to filter the returned groups by their names.
OutputFile string
File name where to save data source results (after running pulumi preview).
PolicyName Changes to this property will trigger replacement. string
Filter the results by a specific policy name. If you set this parameter without setting policy_type, it will be automatically set to System.
PolicyType Changes to this property will trigger replacement. string
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.
UserName Changes to this property will trigger replacement. string
Filter the results by a specific the user name.
nameRegex Changes to this property will trigger replacement. String
A regex string to filter the returned groups by their names.
outputFile String
File name where to save data source results (after running pulumi preview).
policyName Changes to this property will trigger replacement. String
Filter the results by a specific policy name. If you set this parameter without setting policy_type, it will be automatically set to System.
policyType Changes to this property will trigger replacement. String
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.
userName Changes to this property will trigger replacement. String
Filter the results by a specific the user name.
nameRegex Changes to this property will trigger replacement. string
A regex string to filter the returned groups by their names.
outputFile string
File name where to save data source results (after running pulumi preview).
policyName Changes to this property will trigger replacement. string
Filter the results by a specific policy name. If you set this parameter without setting policy_type, it will be automatically set to System.
policyType Changes to this property will trigger replacement. string
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.
userName Changes to this property will trigger replacement. string
Filter the results by a specific the user name.
name_regex Changes to this property will trigger replacement. str
A regex string to filter the returned groups by their names.
output_file str
File name where to save data source results (after running pulumi preview).
policy_name Changes to this property will trigger replacement. str
Filter the results by a specific policy name. If you set this parameter without setting policy_type, it will be automatically set to System.
policy_type Changes to this property will trigger replacement. str
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.
user_name Changes to this property will trigger replacement. str
Filter the results by a specific the user name.
nameRegex Changes to this property will trigger replacement. String
A regex string to filter the returned groups by their names.
outputFile String
File name where to save data source results (after running pulumi preview).
policyName Changes to this property will trigger replacement. String
Filter the results by a specific policy name. If you set this parameter without setting policy_type, it will be automatically set to System.
policyType Changes to this property will trigger replacement. String
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.
userName Changes to this property will trigger replacement. String
Filter the results by a specific the user name.

getGroups Result

The following output properties are available:

Groups List<Pulumi.AliCloud.Ram.Outputs.GetGroupsGroup>
A list of groups. Each element contains the following attributes:
Id string
The provider-assigned unique ID for this managed resource.
Names List<string>
A list of ram group names.
NameRegex string
OutputFile string
PolicyName string
PolicyType string
UserName string
Groups []GetGroupsGroup
A list of groups. Each element contains the following attributes:
Id string
The provider-assigned unique ID for this managed resource.
Names []string
A list of ram group names.
NameRegex string
OutputFile string
PolicyName string
PolicyType string
UserName string
groups List<GetGroupsGroup>
A list of groups. Each element contains the following attributes:
id String
The provider-assigned unique ID for this managed resource.
names List<String>
A list of ram group names.
nameRegex String
outputFile String
policyName String
policyType String
userName String
groups GetGroupsGroup[]
A list of groups. Each element contains the following attributes:
id string
The provider-assigned unique ID for this managed resource.
names string[]
A list of ram group names.
nameRegex string
outputFile string
policyName string
policyType string
userName string
groups Sequence[GetGroupsGroup]
A list of groups. Each element contains the following attributes:
id str
The provider-assigned unique ID for this managed resource.
names Sequence[str]
A list of ram group names.
name_regex str
output_file str
policy_name str
policy_type str
user_name str
groups List<Property Map>
A list of groups. Each element contains the following attributes:
id String
The provider-assigned unique ID for this managed resource.
names List<String>
A list of ram group names.
nameRegex String
outputFile String
policyName String
policyType String
userName String

Supporting Types

GetGroupsGroup

Comments This property is required. string
Comments of the group.
Name This property is required. string
Name of the group.
Comments This property is required. string
Comments of the group.
Name This property is required. string
Name of the group.
comments This property is required. String
Comments of the group.
name This property is required. String
Name of the group.
comments This property is required. string
Comments of the group.
name This property is required. string
Name of the group.
comments This property is required. str
Comments of the group.
name This property is required. str
Name of the group.
comments This property is required. String
Comments of the group.
name This property is required. String
Name of the group.

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