1. Packages
  2. Alibaba Cloud Provider
  3. API Docs
  4. resourcemanager
  5. getResourceGroups
Alibaba Cloud v3.66.0 published on Friday, Nov 15, 2024 by Pulumi

alicloud.resourcemanager.getResourceGroups

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.66.0 published on Friday, Nov 15, 2024 by Pulumi

    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)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: alicloud:resourcemanager/getResourceGroups:getResourceGroups
      arguments:
        # arguments dictionary

    The following arguments are supported:

    EnableDetails bool
    Set it to true can output more details. Default value: false.
    Ids List<string>
    A list of resource group IDs.
    NameRegex string
    A regex string to filter results by resource group identifier.
    OutputFile 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, OK and PendingDelete. NOTE: From version 1.114.0, status can be set to Deleting.
    EnableDetails bool
    Set it to true can output more details. Default value: false.
    Ids []string
    A list of resource group IDs.
    NameRegex string
    A regex string to filter results by resource group identifier.
    OutputFile 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, OK and PendingDelete. NOTE: From version 1.114.0, status can be set to Deleting.
    enableDetails Boolean
    Set it to true can output more details. Default value: false.
    ids List<String>
    A list of resource group IDs.
    nameRegex String
    A regex string to filter results by resource group identifier.
    outputFile 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, OK and PendingDelete. NOTE: From version 1.114.0, status can be set to Deleting.
    enableDetails boolean
    Set it to true can output more details. Default value: false.
    ids string[]
    A list of resource group IDs.
    nameRegex string
    A regex string to filter results by resource group identifier.
    outputFile 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, OK and PendingDelete. NOTE: From version 1.114.0, status can be set to Deleting.
    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, OK and PendingDelete. NOTE: From version 1.114.0, status can be set to Deleting.
    enableDetails Boolean
    Set it to true can output more details. Default value: false.
    ids List<String>
    A list of resource group IDs.
    nameRegex String
    A regex string to filter results by resource group identifier.
    outputFile 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, OK and PendingDelete. NOTE: From version 1.114.0, status can be set to Deleting.

    getResourceGroups Result

    The following output properties are available:

    Groups List<Pulumi.AliCloud.ResourceManager.Outputs.GetResourceGroupsGroup>
    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.
    EnableDetails bool
    NameRegex string
    OutputFile string
    Status string
    The status of the regional resource group.
    Groups []GetResourceGroupsGroup
    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.
    EnableDetails bool
    NameRegex string
    OutputFile string
    Status string
    The status of the regional resource group.
    groups List<GetResourceGroupsGroup>
    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.
    enableDetails Boolean
    nameRegex String
    outputFile String
    status String
    The status of the regional resource group.
    groups GetResourceGroupsGroup[]
    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.
    enableDetails boolean
    nameRegex string
    outputFile string
    status string
    The status of the regional resource group.
    groups Sequence[GetResourceGroupsGroup]
    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.
    enableDetails Boolean
    nameRegex String
    outputFile String
    status String
    The status of the regional resource group.

    Supporting Types

    GetResourceGroupsGroup

    AccountId string
    The ID of the Alibaba Cloud account to which the resource group belongs.
    DisplayName 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.
    RegionStatuses List<Pulumi.AliCloud.ResourceManager.Inputs.GetResourceGroupsGroupRegionStatus>
    (Available since v1.114.0) The status of the resource group in all regions.
    ResourceGroupName string
    (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, OK and PendingDelete. NOTE: From version 1.114.0, status can be set to Deleting.
    AccountId string
    The ID of the Alibaba Cloud account to which the resource group belongs.
    DisplayName 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.
    RegionStatuses []GetResourceGroupsGroupRegionStatus
    (Available since v1.114.0) The status of the resource group in all regions.
    ResourceGroupName string
    (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, OK and PendingDelete. NOTE: From version 1.114.0, status can be set to Deleting.
    accountId String
    The ID of the Alibaba Cloud account to which the resource group belongs.
    displayName 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.
    regionStatuses List<GetResourceGroupsGroupRegionStatus>
    (Available since v1.114.0) The status of the resource group in all regions.
    resourceGroupName String
    (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, OK and PendingDelete. NOTE: From version 1.114.0, status can be set to Deleting.
    accountId string
    The ID of the Alibaba Cloud account to which the resource group belongs.
    displayName 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.
    regionStatuses GetResourceGroupsGroupRegionStatus[]
    (Available since v1.114.0) The status of the resource group in all regions.
    resourceGroupName string
    (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, OK and PendingDelete. NOTE: From version 1.114.0, status can be set to Deleting.
    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[GetResourceGroupsGroupRegionStatus]
    (Available since v1.114.0) The status of the resource group in all regions.
    resource_group_name str
    (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, OK and PendingDelete. NOTE: From version 1.114.0, status can be set to Deleting.
    accountId String
    The ID of the Alibaba Cloud account to which the resource group belongs.
    displayName 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.
    regionStatuses List<Property Map>
    (Available since v1.114.0) The status of the resource group in all regions.
    resourceGroupName String
    (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, OK and PendingDelete. NOTE: From version 1.114.0, status can be set to Deleting.

    GetResourceGroupsGroupRegionStatus

    RegionId string
    The region ID.
    Status string
    The status of the resource group. Valid values: Creating, Deleted, Deleting, OK and PendingDelete. NOTE: From version 1.114.0, status can be set to Deleting.
    RegionId string
    The region ID.
    Status string
    The status of the resource group. Valid values: Creating, Deleted, Deleting, OK and PendingDelete. NOTE: From version 1.114.0, status can be set to Deleting.
    regionId String
    The region ID.
    status String
    The status of the resource group. Valid values: Creating, Deleted, Deleting, OK and PendingDelete. NOTE: From version 1.114.0, status can be set to Deleting.
    regionId string
    The region ID.
    status string
    The status of the resource group. Valid values: Creating, Deleted, Deleting, OK and PendingDelete. NOTE: From version 1.114.0, status can be set to Deleting.
    region_id str
    The region ID.
    status str
    The status of the resource group. Valid values: Creating, Deleted, Deleting, OK and PendingDelete. NOTE: From version 1.114.0, status can be set to Deleting.
    regionId String
    The region ID.
    status String
    The status of the resource group. Valid values: Creating, Deleted, Deleting, OK and PendingDelete. NOTE: From version 1.114.0, status can be set to Deleting.

    Package Details

    Repository
    Alibaba Cloud pulumi/pulumi-alicloud
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the alicloud Terraform Provider.
    alicloud logo
    Alibaba Cloud v3.66.0 published on Friday, Nov 15, 2024 by Pulumi