Alibaba Cloud v3.76.0 published on Tuesday, Apr 8, 2025 by Pulumi
alicloud.resourcemanager.getResourceGroups
Explore with Pulumi AI
This data source provides resource groups of the current Alibaba Cloud user.
NOTE: Available since v1.84.0.
Example Usage
Basic Usage
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
const example = alicloud.resourcemanager.getResourceGroups({
    nameRegex: "tf",
});
export const firstResourceGroupId = example.then(example => example.groups?.[0]?.id);
import pulumi
import pulumi_alicloud as alicloud
example = alicloud.resourcemanager.get_resource_groups(name_regex="tf")
pulumi.export("firstResourceGroupId", example.groups[0].id)
package main
import (
	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/resourcemanager"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		example, err := resourcemanager.GetResourceGroups(ctx, &resourcemanager.GetResourceGroupsArgs{
			NameRegex: pulumi.StringRef("tf"),
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("firstResourceGroupId", example.Groups[0].Id)
		return nil
	})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;
return await Deployment.RunAsync(() => 
{
    var example = AliCloud.ResourceManager.GetResourceGroups.Invoke(new()
    {
        NameRegex = "tf",
    });
    return new Dictionary<string, object?>
    {
        ["firstResourceGroupId"] = example.Apply(getResourceGroupsResult => getResourceGroupsResult.Groups[0]?.Id),
    };
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.resourcemanager.ResourcemanagerFunctions;
import com.pulumi.alicloud.resourcemanager.inputs.GetResourceGroupsArgs;
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 example = ResourcemanagerFunctions.getResourceGroups(GetResourceGroupsArgs.builder()
            .nameRegex("tf")
            .build());
        ctx.export("firstResourceGroupId", example.applyValue(getResourceGroupsResult -> getResourceGroupsResult.groups()[0].id()));
    }
}
variables:
  example:
    fn::invoke:
      function: alicloud:resourcemanager:getResourceGroups
      arguments:
        nameRegex: tf
outputs:
  firstResourceGroupId: ${example.groups[0].id}
Using getResourceGroups
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 getResourceGroups(args: GetResourceGroupsArgs, opts?: InvokeOptions): Promise<GetResourceGroupsResult>
function getResourceGroupsOutput(args: GetResourceGroupsOutputArgs, opts?: InvokeOptions): Output<GetResourceGroupsResult>def get_resource_groups(enable_details: Optional[bool] = None,
                        ids: Optional[Sequence[str]] = None,
                        name_regex: Optional[str] = None,
                        output_file: Optional[str] = None,
                        status: Optional[str] = None,
                        opts: Optional[InvokeOptions] = None) -> GetResourceGroupsResult
def get_resource_groups_output(enable_details: Optional[pulumi.Input[bool]] = None,
                        ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                        name_regex: Optional[pulumi.Input[str]] = None,
                        output_file: Optional[pulumi.Input[str]] = None,
                        status: Optional[pulumi.Input[str]] = None,
                        opts: Optional[InvokeOptions] = None) -> Output[GetResourceGroupsResult]func GetResourceGroups(ctx *Context, args *GetResourceGroupsArgs, opts ...InvokeOption) (*GetResourceGroupsResult, error)
func GetResourceGroupsOutput(ctx *Context, args *GetResourceGroupsOutputArgs, opts ...InvokeOption) GetResourceGroupsResultOutput> Note: This function is named GetResourceGroups in the Go SDK.
public static class GetResourceGroups 
{
    public static Task<GetResourceGroupsResult> InvokeAsync(GetResourceGroupsArgs args, InvokeOptions? opts = null)
    public static Output<GetResourceGroupsResult> Invoke(GetResourceGroupsInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetResourceGroupsResult> getResourceGroups(GetResourceGroupsArgs args, InvokeOptions options)
public static Output<GetResourceGroupsResult> getResourceGroups(GetResourceGroupsArgs args, InvokeOptions options)
fn::invoke:
  function: alicloud:resourcemanager/getResourceGroups:getResourceGroups
  arguments:
    # arguments dictionaryThe following arguments are supported:
- Enable
Details bool - Set it to true can output more details. Default value: 
false. - Ids List<string>
 - A list of resource group IDs.
 - Name
Regex string - A regex string to filter results by resource group identifier.
 - Output
File string - File name where to save data source results (after running 
pulumi preview). - Status string
 - The status of the resource group. Valid values: 
Creating,Deleted,Deleting,OKandPendingDelete. NOTE: From version 1.114.0,statuscan be set toDeleting. 
- Enable
Details bool - Set it to true can output more details. Default value: 
false. - Ids []string
 - A list of resource group IDs.
 - Name
Regex string - A regex string to filter results by resource group identifier.
 - Output
File string - File name where to save data source results (after running 
pulumi preview). - Status string
 - The status of the resource group. Valid values: 
Creating,Deleted,Deleting,OKandPendingDelete. NOTE: From version 1.114.0,statuscan be set toDeleting. 
- enable
Details Boolean - Set it to true can output more details. Default value: 
false. - ids List<String>
 - A list of resource group IDs.
 - name
Regex String - A regex string to filter results by resource group identifier.
 - output
File String - File name where to save data source results (after running 
pulumi preview). - status String
 - The status of the resource group. Valid values: 
Creating,Deleted,Deleting,OKandPendingDelete. NOTE: From version 1.114.0,statuscan be set toDeleting. 
- enable
Details boolean - Set it to true can output more details. Default value: 
false. - ids string[]
 - A list of resource group IDs.
 - name
Regex string - A regex string to filter results by resource group identifier.
 - output
File string - File name where to save data source results (after running 
pulumi preview). - status string
 - The status of the resource group. Valid values: 
Creating,Deleted,Deleting,OKandPendingDelete. NOTE: From version 1.114.0,statuscan be set toDeleting. 
- enable_
details bool - Set it to true can output more details. Default value: 
false. - ids Sequence[str]
 - A list of resource group IDs.
 - name_
regex str - A regex string to filter results by resource group identifier.
 - output_
file str - File name where to save data source results (after running 
pulumi preview). - status str
 - The status of the resource group. Valid values: 
Creating,Deleted,Deleting,OKandPendingDelete. NOTE: From version 1.114.0,statuscan be set toDeleting. 
- enable
Details Boolean - Set it to true can output more details. Default value: 
false. - ids List<String>
 - A list of resource group IDs.
 - name
Regex String - A regex string to filter results by resource group identifier.
 - output
File String - File name where to save data source results (after running 
pulumi preview). - status String
 - The status of the resource group. Valid values: 
Creating,Deleted,Deleting,OKandPendingDelete. NOTE: From version 1.114.0,statuscan be set toDeleting. 
getResourceGroups Result
The following output properties are available:
- Groups
List<Pulumi.
Ali Cloud. Resource Manager. Outputs. Get Resource Groups Group>  - A list of resource groups. Each element contains the following attributes:
 - Id string
 - The provider-assigned unique ID for this managed resource.
 - Ids List<string>
 - A list of resource group IDs.
 - Names List<string>
 - A list of resource group identifiers.
 - Enable
Details bool - Name
Regex string - Output
File string - Status string
 - The status of the regional resource group.
 
- Groups
[]Get
Resource Groups Group  - A list of resource groups. Each element contains the following attributes:
 - Id string
 - The provider-assigned unique ID for this managed resource.
 - Ids []string
 - A list of resource group IDs.
 - Names []string
 - A list of resource group identifiers.
 - Enable
Details bool - Name
Regex string - Output
File string - Status string
 - The status of the regional resource group.
 
- groups
List<Get
Resource Groups Group>  - A list of resource groups. Each element contains the following attributes:
 - id String
 - The provider-assigned unique ID for this managed resource.
 - ids List<String>
 - A list of resource group IDs.
 - names List<String>
 - A list of resource group identifiers.
 - enable
Details Boolean - name
Regex String - output
File String - status String
 - The status of the regional resource group.
 
- groups
Get
Resource Groups Group[]  - A list of resource groups. Each element contains the following attributes:
 - id string
 - The provider-assigned unique ID for this managed resource.
 - ids string[]
 - A list of resource group IDs.
 - names string[]
 - A list of resource group identifiers.
 - enable
Details boolean - name
Regex string - output
File string - status string
 - The status of the regional resource group.
 
- groups
Sequence[Get
Resource Groups Group]  - A list of resource groups. Each element contains the following attributes:
 - id str
 - The provider-assigned unique ID for this managed resource.
 - ids Sequence[str]
 - A list of resource group IDs.
 - names Sequence[str]
 - A list of resource group identifiers.
 - enable_
details bool - name_
regex str - output_
file str - status str
 - The status of the regional resource group.
 
- groups List<Property Map>
 - A list of resource groups. Each element contains the following attributes:
 - id String
 - The provider-assigned unique ID for this managed resource.
 - ids List<String>
 - A list of resource group IDs.
 - names List<String>
 - A list of resource group identifiers.
 - enable
Details Boolean - name
Regex String - output
File String - status String
 - The status of the regional resource group.
 
Supporting Types
GetResourceGroupsGroup   
- Account
Id string - The ID of the Alibaba Cloud account to which the resource group belongs.
 - Display
Name string - The display name of the resource group.
 - Id string
 - The ID of the resource group.
 - Name string
 - The unique identifier of the resource group.
 - Region
Statuses List<Pulumi.Ali Cloud. Resource Manager. Inputs. Get Resource Groups Group Region Status>  - (Available since v1.114.0) The status of the resource group in all regions.
 - Resource
Group stringName  - (Available since v1.114.0) The unique identifier of the resource group.
 - Status string
 - The status of the resource group. Valid values: 
Creating,Deleted,Deleting,OKandPendingDelete. NOTE: From version 1.114.0,statuscan be set toDeleting. 
- Account
Id string - The ID of the Alibaba Cloud account to which the resource group belongs.
 - Display
Name string - The display name of the resource group.
 - Id string
 - The ID of the resource group.
 - Name string
 - The unique identifier of the resource group.
 - Region
Statuses []GetResource Groups Group Region Status  - (Available since v1.114.0) The status of the resource group in all regions.
 - Resource
Group stringName  - (Available since v1.114.0) The unique identifier of the resource group.
 - Status string
 - The status of the resource group. Valid values: 
Creating,Deleted,Deleting,OKandPendingDelete. NOTE: From version 1.114.0,statuscan be set toDeleting. 
- account
Id String - The ID of the Alibaba Cloud account to which the resource group belongs.
 - display
Name String - The display name of the resource group.
 - id String
 - The ID of the resource group.
 - name String
 - The unique identifier of the resource group.
 - region
Statuses List<GetResource Groups Group Region Status>  - (Available since v1.114.0) The status of the resource group in all regions.
 - resource
Group StringName  - (Available since v1.114.0) The unique identifier of the resource group.
 - status String
 - The status of the resource group. Valid values: 
Creating,Deleted,Deleting,OKandPendingDelete. NOTE: From version 1.114.0,statuscan be set toDeleting. 
- account
Id string - The ID of the Alibaba Cloud account to which the resource group belongs.
 - display
Name string - The display name of the resource group.
 - id string
 - The ID of the resource group.
 - name string
 - The unique identifier of the resource group.
 - region
Statuses GetResource Groups Group Region Status[]  - (Available since v1.114.0) The status of the resource group in all regions.
 - resource
Group stringName  - (Available since v1.114.0) The unique identifier of the resource group.
 - status string
 - The status of the resource group. Valid values: 
Creating,Deleted,Deleting,OKandPendingDelete. NOTE: From version 1.114.0,statuscan be set toDeleting. 
- account_
id str - The ID of the Alibaba Cloud account to which the resource group belongs.
 - display_
name str - The display name of the resource group.
 - id str
 - The ID of the resource group.
 - name str
 - The unique identifier of the resource group.
 - region_
statuses Sequence[GetResource Groups Group Region Status]  - (Available since v1.114.0) The status of the resource group in all regions.
 - resource_
group_ strname  - (Available since v1.114.0) The unique identifier of the resource group.
 - status str
 - The status of the resource group. Valid values: 
Creating,Deleted,Deleting,OKandPendingDelete. NOTE: From version 1.114.0,statuscan be set toDeleting. 
- account
Id String - The ID of the Alibaba Cloud account to which the resource group belongs.
 - display
Name String - The display name of the resource group.
 - id String
 - The ID of the resource group.
 - name String
 - The unique identifier of the resource group.
 - region
Statuses List<Property Map> - (Available since v1.114.0) The status of the resource group in all regions.
 - resource
Group StringName  - (Available since v1.114.0) The unique identifier of the resource group.
 - status String
 - The status of the resource group. Valid values: 
Creating,Deleted,Deleting,OKandPendingDelete. NOTE: From version 1.114.0,statuscan be set toDeleting. 
GetResourceGroupsGroupRegionStatus     
Package Details
- Repository
 - Alibaba Cloud pulumi/pulumi-alicloud
 - License
 - Apache-2.0
 - Notes
 - This Pulumi package is based on the 
alicloudTerraform Provider.