ServerGroupArgs

data class ServerGroupArgs(val dryRun: Output<Boolean>? = null, val healthCheckConfig: Output<ServerGroupHealthCheckConfigArgs>? = null, val protocol: Output<String>? = null, val resourceGroupId: Output<String>? = null, val scheduler: Output<String>? = null, val serverGroupName: Output<String>? = null, val serverGroupType: Output<String>? = null, val servers: Output<List<ServerGroupServerArgs>>? = null, val stickySessionConfig: Output<ServerGroupStickySessionConfigArgs>? = null, val tags: Output<Map<String, Any>>? = null, val vpcId: Output<String>? = null) : ConvertibleToJava<ServerGroupArgs>

Provides a ALB Server Group resource. For information about ALB Server Group and how to use it, see What is Server Group.

NOTE: Available since v1.131.0.

Example Usage

Basic Usage

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.AlicloudFunctions;
import com.pulumi.alicloud.inputs.GetZonesArgs;
import com.pulumi.alicloud.ecs.EcsFunctions;
import com.pulumi.alicloud.ecs.inputs.GetInstanceTypesArgs;
import com.pulumi.alicloud.ecs.inputs.GetImagesArgs;
import com.pulumi.alicloud.resourcemanager.ResourcemanagerFunctions;
import com.pulumi.alicloud.resourcemanager.inputs.GetResourceGroupsArgs;
import com.pulumi.alicloud.vpc.Network;
import com.pulumi.alicloud.vpc.NetworkArgs;
import com.pulumi.alicloud.vpc.Switch;
import com.pulumi.alicloud.vpc.SwitchArgs;
import com.pulumi.alicloud.ecs.SecurityGroup;
import com.pulumi.alicloud.ecs.SecurityGroupArgs;
import com.pulumi.alicloud.ecs.Instance;
import com.pulumi.alicloud.ecs.InstanceArgs;
import com.pulumi.alicloud.alb.ServerGroup;
import com.pulumi.alicloud.alb.ServerGroupArgs;
import com.pulumi.alicloud.alb.inputs.ServerGroupHealthCheckConfigArgs;
import com.pulumi.alicloud.alb.inputs.ServerGroupStickySessionConfigArgs;
import com.pulumi.alicloud.alb.inputs.ServerGroupServerArgs;
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 config = ctx.config();
final var name = config.get("name").orElse("terraform-example");
final var exampleZones = AlicloudFunctions.getZones(GetZonesArgs.builder()
.availableResourceCreation("Instance")
.build());
final var exampleInstanceTypes = EcsFunctions.getInstanceTypes(GetInstanceTypesArgs.builder()
.availabilityZone(exampleZones.applyValue(getZonesResult -> getZonesResult.zones()[0].id()))
.cpuCoreCount(1)
.memorySize(2)
.build());
final var exampleImages = EcsFunctions.getImages(GetImagesArgs.builder()
.nameRegex("^ubuntu_[0-9]+_[0-9]+_x64*")
.owners("system")
.build());
final var exampleResourceGroups = ResourcemanagerFunctions.getResourceGroups();
var exampleNetwork = new Network("exampleNetwork", NetworkArgs.builder()
.vpcName(name)
.cidrBlock("10.4.0.0/16")
.build());
var exampleSwitch = new Switch("exampleSwitch", SwitchArgs.builder()
.vswitchName(name)
.cidrBlock("10.4.0.0/16")
.vpcId(exampleNetwork.id())
.zoneId(exampleZones.applyValue(getZonesResult -> getZonesResult.zones()[0].id()))
.build());
var exampleSecurityGroup = new SecurityGroup("exampleSecurityGroup", SecurityGroupArgs.builder()
.description(name)
.vpcId(exampleNetwork.id())
.build());
var exampleInstance = new Instance("exampleInstance", InstanceArgs.builder()
.availabilityZone(exampleZones.applyValue(getZonesResult -> getZonesResult.zones()[0].id()))
.instanceName(name)
.imageId(exampleImages.applyValue(getImagesResult -> getImagesResult.images()[0].id()))
.instanceType(exampleInstanceTypes.applyValue(getInstanceTypesResult -> getInstanceTypesResult.instanceTypes()[0].id()))
.securityGroups(exampleSecurityGroup.id())
.vswitchId(exampleSwitch.id())
.build());
var exampleServerGroup = new ServerGroup("exampleServerGroup", ServerGroupArgs.builder()
.protocol("HTTP")
.vpcId(exampleNetwork.id())
.serverGroupName(name)
.resourceGroupId(exampleResourceGroups.applyValue(getResourceGroupsResult -> getResourceGroupsResult.groups()[0].id()))
.healthCheckConfig(ServerGroupHealthCheckConfigArgs.builder()
.healthCheckConnectPort("46325")
.healthCheckEnabled(true)
.healthCheckHost("tf-example.com")
.healthCheckCodes(
"http_2xx",
"http_3xx",
"http_4xx")
.healthCheckHttpVersion("HTTP1.1")
.healthCheckInterval("2")
.healthCheckMethod("HEAD")
.healthCheckPath("/tf-example")
.healthCheckProtocol("HTTP")
.healthCheckTimeout(5)
.healthyThreshold(3)
.unhealthyThreshold(3)
.build())
.stickySessionConfig(ServerGroupStickySessionConfigArgs.builder()
.stickySessionEnabled(true)
.cookie("tf-example")
.stickySessionType("Server")
.build())
.tags(Map.of("Created", "TF"))
.servers(ServerGroupServerArgs.builder()
.description(name)
.port(80)
.serverId(exampleInstance.id())
.serverIp(exampleInstance.privateIp())
.serverType("Ecs")
.weight(10)
.build())
.build());
}
}

Import

ALB Server Group can be imported using the id, e.g.

$ pulumi import alicloud:alb/serverGroup:ServerGroup example <id>

Constructors

Link copied to clipboard
fun ServerGroupArgs(dryRun: Output<Boolean>? = null, healthCheckConfig: Output<ServerGroupHealthCheckConfigArgs>? = null, protocol: Output<String>? = null, resourceGroupId: Output<String>? = null, scheduler: Output<String>? = null, serverGroupName: Output<String>? = null, serverGroupType: Output<String>? = null, servers: Output<List<ServerGroupServerArgs>>? = null, stickySessionConfig: Output<ServerGroupStickySessionConfigArgs>? = null, tags: Output<Map<String, Any>>? = null, vpcId: Output<String>? = null)

Functions

Link copied to clipboard
open override fun toJava(): ServerGroupArgs

Properties

Link copied to clipboard
val dryRun: Output<Boolean>? = null

The dry run.

Link copied to clipboard

The configuration of health checks. See health_check_config below for details.

Link copied to clipboard
val protocol: Output<String>? = null

The server protocol. Valid values: HTTPS, HTTP.

Link copied to clipboard
val resourceGroupId: Output<String>? = null

The ID of the resource group.

Link copied to clipboard
val scheduler: Output<String>? = null

The scheduling algorithm. Valid values: Sch, Wlc, Wrr.

Link copied to clipboard
val serverGroupName: Output<String>? = null

The name of the resource.

Link copied to clipboard
val serverGroupType: Output<String>? = null

The type of the server group. Valid values:

Link copied to clipboard
val servers: Output<List<ServerGroupServerArgs>>? = null

The backend server. See servers below for details.

Link copied to clipboard

The configuration of the sticky session. See sticky_session_config below for details.

Link copied to clipboard
val tags: Output<Map<String, Any>>? = null

A mapping of tags to assign to the resource.

Link copied to clipboard
val vpcId: Output<String>? = null

The ID of the VPC that you want to access.