getServerGroups

This data source provides the Alb Server Groups of the current Alibaba Cloud user.

NOTE: Available since v1.131.0.

Example Usage

Basic Usage

import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
const ids = alicloud.alb.getServerGroups({});
export const albServerGroupId1 = ids.then(ids => ids.groups?.[0]?.id);
const nameRegex = alicloud.alb.getServerGroups({
nameRegex: "^my-ServerGroup",
});
export const albServerGroupId2 = nameRegex.then(nameRegex => nameRegex.groups?.[0]?.id);
import pulumi
import pulumi_alicloud as alicloud
ids = alicloud.alb.get_server_groups()
pulumi.export("albServerGroupId1", ids.groups[0].id)
name_regex = alicloud.alb.get_server_groups(name_regex="^my-ServerGroup")
pulumi.export("albServerGroupId2", name_regex.groups[0].id)
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;
return await Deployment.RunAsync(() =>
{
var ids = AliCloud.Alb.GetServerGroups.Invoke();
var nameRegex = AliCloud.Alb.GetServerGroups.Invoke(new()
{
NameRegex = "^my-ServerGroup",
});
return new Dictionary<string, object?>
{
["albServerGroupId1"] = ids&#46;Apply(getServerGroupsResult => getServerGroupsResult&#46;Groups[0]?.Id),
["albServerGroupId2"] = nameRegex&#46;Apply(getServerGroupsResult => getServerGroupsResult&#46;Groups[0]?.Id),
};
});
package main
import (
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/alb"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
ids, err := alb.GetServerGroups(ctx, nil, nil)
if err != nil {
return err
}
ctx.Export("albServerGroupId1", ids.Groups[0].Id)
nameRegex, err := alb.GetServerGroups(ctx, &alb.GetServerGroupsArgs{
NameRegex: pulumi.StringRef("^my-ServerGroup"),
}, nil)
if err != nil {
return err
}
ctx.Export("albServerGroupId2", nameRegex.Groups[0].Id)
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.alb.AlbFunctions;
import com.pulumi.alicloud.alb.inputs.GetServerGroupsArgs;
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 = AlbFunctions.getServerGroups();
ctx.export("albServerGroupId1", ids.applyValue(getServerGroupsResult -> getServerGroupsResult.groups()[0].id()));
final var nameRegex = AlbFunctions.getServerGroups(GetServerGroupsArgs.builder()
.nameRegex("^my-ServerGroup")
.build());
ctx.export("albServerGroupId2", nameRegex.applyValue(getServerGroupsResult -> getServerGroupsResult.groups()[0].id()));
}
}
variables:
ids:
fn::invoke:
Function: alicloud:alb:getServerGroups
Arguments: {}
nameRegex:
fn::invoke:
Function: alicloud:alb:getServerGroups
Arguments:
nameRegex: ^my-ServerGroup
outputs:
albServerGroupId1: ${ids.groups[0].id}
albServerGroupId2: ${nameRegex.groups[0].id}

Return

A collection of values returned by getServerGroups.

Parameters

argument

A collection of arguments for invoking getServerGroups.


suspend fun getServerGroups(enableDetails: Boolean? = null, ids: List<String>? = null, nameRegex: String? = null, outputFile: String? = null, resourceGroupId: String? = null, serverGroupIds: List<String>? = null, serverGroupName: String? = null, status: String? = null, tags: Map<String, Any>? = null, vpcId: String? = null): GetServerGroupsResult

Return

A collection of values returned by getServerGroups.

Parameters

enableDetails

Default to false. Set it to true can output more details about resource attributes.

ids

A list of Server Group IDs.

nameRegex

A regex string to filter results by Server Group name.

outputFile

File name where to save data source results (after running pulumi preview).

resourceGroupId

The ID of the resource group.

serverGroupIds

The server group ids.

serverGroupName

The name of the resource.

status

The status of the resource.

tags

A map of tags assigned to the group.

vpcId

The ID of the VPC that you want to access.

See also


Return

A collection of values returned by getServerGroups.

Parameters

argument

Builder for com.pulumi.alicloud.alb.kotlin.inputs.GetServerGroupsPlainArgs.

See also