Alibaba Cloud

Pulumi Official
Package maintained by Pulumi
v3.21.0 published on Tuesday, Jun 14, 2022 by Pulumi

ScalingGroupVServerGroups

Attaches/Detaches vserver groups to a specified scaling group.

NOTE: The load balancer of which vserver groups belongs to must be in active status.

NOTE: If scaling group’s network type is VPC, the vserver groups must be in the same VPC.

NOTE: A scaling group can have at most 5 vserver groups attached by default.

NOTE: Vserver groups and the default group of loadbalancer share the same backend server quota.

NOTE: When attach vserver groups to scaling group, existing ECS instances will be added to vserver groups; Instead, ECS instances will be removed from vserver group when detach.

NOTE: Detach action will be executed before attach action.

NOTE: Vserver group is defined uniquely by loadbalancer_id, vserver_group_id, port.

NOTE: Modifing weight attribute means detach vserver group first and then, attach with new weight parameter.

NOTE: Resource alicloud.ess.ScalingGroupVServerGroups is available in 1.53.0+.

Block vserver_group

the vserver_group supports the following:

  • loadbalancer_id - (Required) Loadbalancer server ID of VServer Group.
  • vserver_attributes - (Required) A list of VServer Group attributes. See Block vserver_attribute below for details.

Block vserver_attribute

  • vserver_group_id - (Required) ID of VServer Group.
  • port - (Required) - The port will be used for VServer Group backend server.
  • weight - (Required) The weight of an ECS instance attached to the VServer Group.

Example Usage

using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;

class MyStack : Stack
{
    public MyStack()
    {
        var config = new Config();
        var name = config.Get("name") ?? "testAccEssVserverGroupsAttachment";
        var defaultZones = Output.Create(AliCloud.GetZones.InvokeAsync(new AliCloud.GetZonesArgs
        {
            AvailableDiskCategory = "cloud_efficiency",
            AvailableResourceCreation = "VSwitch",
        }));
        var defaultNetwork = new AliCloud.Vpc.Network("defaultNetwork", new AliCloud.Vpc.NetworkArgs
        {
            CidrBlock = "172.16.0.0/16",
        });
        var defaultSwitch = new AliCloud.Vpc.Switch("defaultSwitch", new AliCloud.Vpc.SwitchArgs
        {
            VpcId = defaultNetwork.Id,
            CidrBlock = "172.16.0.0/24",
            ZoneId = defaultZones.Apply(defaultZones => defaultZones.Zones?[0]?.Id),
        });
        var defaultApplicationLoadBalancer = new AliCloud.Slb.ApplicationLoadBalancer("defaultApplicationLoadBalancer", new AliCloud.Slb.ApplicationLoadBalancerArgs
        {
            LoadBalancerName = name,
            VswitchId = defaultSwitch.Id,
        });
        var defaultServerGroup = new AliCloud.Slb.ServerGroup("defaultServerGroup", new AliCloud.Slb.ServerGroupArgs
        {
            LoadBalancerId = defaultApplicationLoadBalancer.Id,
        });
        var defaultListener = new List<AliCloud.Slb.Listener>();
        for (var rangeIndex = 0; rangeIndex < 2; rangeIndex++)
        {
            var range = new { Value = rangeIndex };
            defaultListener.Add(new AliCloud.Slb.Listener($"defaultListener-{range.Value}", new AliCloud.Slb.ListenerArgs
            {
                LoadBalancerId = 
                {
                    defaultApplicationLoadBalancer,
                }.Select(__item => __item.Id).ToList()[range.Value],
                BackendPort = 22,
                FrontendPort = 22,
                Protocol = "tcp",
                Bandwidth = 10,
                HealthCheckType = "tcp",
            }));
        }
        var defaultScalingGroup = new AliCloud.Ess.ScalingGroup("defaultScalingGroup", new AliCloud.Ess.ScalingGroupArgs
        {
            MinSize = 2,
            MaxSize = 2,
            ScalingGroupName = name,
            VswitchIds = 
            {
                defaultSwitch.Id,
            },
        });
        var defaultScalingGroupVServerGroups = new AliCloud.Ess.ScalingGroupVServerGroups("defaultScalingGroupVServerGroups", new AliCloud.Ess.ScalingGroupVServerGroupsArgs
        {
            ScalingGroupId = defaultScalingGroup.Id,
            VserverGroups = 
            {
                new AliCloud.Ess.Inputs.ScalingGroupVServerGroupsVserverGroupArgs
                {
                    LoadbalancerId = defaultApplicationLoadBalancer.Id,
                    VserverAttributes = 
                    {
                        new AliCloud.Ess.Inputs.ScalingGroupVServerGroupsVserverGroupVserverAttributeArgs
                        {
                            VserverGroupId = defaultServerGroup.Id,
                            Port = 100,
                            Weight = 60,
                        },
                    },
                },
            },
        });
    }

}

Coming soon!

Coming soon!

import pulumi
import pulumi_alicloud as alicloud

config = pulumi.Config()
name = config.get("name")
if name is None:
    name = "testAccEssVserverGroupsAttachment"
default_zones = alicloud.get_zones(available_disk_category="cloud_efficiency",
    available_resource_creation="VSwitch")
default_network = alicloud.vpc.Network("defaultNetwork", cidr_block="172.16.0.0/16")
default_switch = alicloud.vpc.Switch("defaultSwitch",
    vpc_id=default_network.id,
    cidr_block="172.16.0.0/24",
    zone_id=default_zones.zones[0].id)
default_application_load_balancer = alicloud.slb.ApplicationLoadBalancer("defaultApplicationLoadBalancer",
    load_balancer_name=name,
    vswitch_id=default_switch.id)
default_server_group = alicloud.slb.ServerGroup("defaultServerGroup", load_balancer_id=default_application_load_balancer.id)
default_listener = []
for range in [{"value": i} for i in range(0, 2)]:
    default_listener.append(alicloud.slb.Listener(f"defaultListener-{range['value']}",
        load_balancer_id=[__item.id for __item in [default_application_load_balancer]][range["value"]],
        backend_port=22,
        frontend_port=22,
        protocol="tcp",
        bandwidth=10,
        health_check_type="tcp"))
default_scaling_group = alicloud.ess.ScalingGroup("defaultScalingGroup",
    min_size=2,
    max_size=2,
    scaling_group_name=name,
    vswitch_ids=[default_switch.id])
default_scaling_group_v_server_groups = alicloud.ess.ScalingGroupVServerGroups("defaultScalingGroupVServerGroups",
    scaling_group_id=default_scaling_group.id,
    vserver_groups=[alicloud.ess.ScalingGroupVServerGroupsVserverGroupArgs(
        loadbalancer_id=default_application_load_balancer.id,
        vserver_attributes=[alicloud.ess.ScalingGroupVServerGroupsVserverGroupVserverAttributeArgs(
            vserver_group_id=default_server_group.id,
            port=100,
            weight=60,
        )],
    )])
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";

const config = new pulumi.Config();
const name = config.get("name") || "testAccEssVserverGroupsAttachment";
const defaultZones = alicloud.getZones({
    availableDiskCategory: "cloud_efficiency",
    availableResourceCreation: "VSwitch",
});
const defaultNetwork = new alicloud.vpc.Network("defaultNetwork", {cidrBlock: "172.16.0.0/16"});
const defaultSwitch = new alicloud.vpc.Switch("defaultSwitch", {
    vpcId: defaultNetwork.id,
    cidrBlock: "172.16.0.0/24",
    zoneId: defaultZones.then(defaultZones => defaultZones.zones?[0]?.id),
});
const defaultApplicationLoadBalancer = new alicloud.slb.ApplicationLoadBalancer("defaultApplicationLoadBalancer", {
    loadBalancerName: name,
    vswitchId: defaultSwitch.id,
});
const defaultServerGroup = new alicloud.slb.ServerGroup("defaultServerGroup", {loadBalancerId: defaultApplicationLoadBalancer.id});
const defaultListener: alicloud.slb.Listener[];
for (const range = {value: 0}; range.value < 2; range.value++) {
    defaultListener.push(new alicloud.slb.Listener(`defaultListener-${range.value}`, {
        loadBalancerId: [defaultApplicationLoadBalancer].map(__item => __item.id)[range.value],
        backendPort: 22,
        frontendPort: 22,
        protocol: "tcp",
        bandwidth: 10,
        healthCheckType: "tcp",
    }));
}
const defaultScalingGroup = new alicloud.ess.ScalingGroup("defaultScalingGroup", {
    minSize: 2,
    maxSize: 2,
    scalingGroupName: name,
    vswitchIds: [defaultSwitch.id],
});
const defaultScalingGroupVServerGroups = new alicloud.ess.ScalingGroupVServerGroups("defaultScalingGroupVServerGroups", {
    scalingGroupId: defaultScalingGroup.id,
    vserverGroups: [{
        loadbalancerId: defaultApplicationLoadBalancer.id,
        vserverAttributes: [{
            vserverGroupId: defaultServerGroup.id,
            port: 100,
            weight: 60,
        }],
    }],
});

Coming soon!

Create a ScalingGroupVServerGroups Resource

new ScalingGroupVServerGroups(name: string, args: ScalingGroupVServerGroupsArgs, opts?: CustomResourceOptions);
@overload
def ScalingGroupVServerGroups(resource_name: str,
                              opts: Optional[ResourceOptions] = None,
                              force: Optional[bool] = None,
                              scaling_group_id: Optional[str] = None,
                              vserver_groups: Optional[Sequence[ScalingGroupVServerGroupsVserverGroupArgs]] = None)
@overload
def ScalingGroupVServerGroups(resource_name: str,
                              args: ScalingGroupVServerGroupsArgs,
                              opts: Optional[ResourceOptions] = None)
func NewScalingGroupVServerGroups(ctx *Context, name string, args ScalingGroupVServerGroupsArgs, opts ...ResourceOption) (*ScalingGroupVServerGroups, error)
public ScalingGroupVServerGroups(string name, ScalingGroupVServerGroupsArgs args, CustomResourceOptions? opts = null)
public ScalingGroupVServerGroups(String name, ScalingGroupVServerGroupsArgs args)
public ScalingGroupVServerGroups(String name, ScalingGroupVServerGroupsArgs args, CustomResourceOptions options)
type: alicloud:ess:ScalingGroupVServerGroups
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

name string
The unique name of the resource.
args ScalingGroupVServerGroupsArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
args ScalingGroupVServerGroupsArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args ScalingGroupVServerGroupsArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args ScalingGroupVServerGroupsArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name String
The unique name of the resource.
args ScalingGroupVServerGroupsArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

ScalingGroupVServerGroups Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

The ScalingGroupVServerGroups resource accepts the following input properties:

ScalingGroupId string

ID of the scaling group.

VserverGroups List<Pulumi.AliCloud.Ess.Inputs.ScalingGroupVServerGroupsVserverGroupArgs>

A list of vserver groups attached on scaling group. See Block vserver_group below for details.

Force bool

If instances of scaling group are attached/removed from slb backend server when attach/detach vserver group from scaling group. Default to true.

ScalingGroupId string

ID of the scaling group.

VserverGroups []ScalingGroupVServerGroupsVserverGroupArgs

A list of vserver groups attached on scaling group. See Block vserver_group below for details.

Force bool

If instances of scaling group are attached/removed from slb backend server when attach/detach vserver group from scaling group. Default to true.

scalingGroupId String

ID of the scaling group.

vserverGroups List<ScalingGroupVServerGroupsVserverGroupArgs>

A list of vserver groups attached on scaling group. See Block vserver_group below for details.

force Boolean

If instances of scaling group are attached/removed from slb backend server when attach/detach vserver group from scaling group. Default to true.

scalingGroupId string

ID of the scaling group.

vserverGroups ScalingGroupVServerGroupsVserverGroupArgs[]

A list of vserver groups attached on scaling group. See Block vserver_group below for details.

force boolean

If instances of scaling group are attached/removed from slb backend server when attach/detach vserver group from scaling group. Default to true.

scaling_group_id str

ID of the scaling group.

vserver_groups Sequence[ScalingGroupVServerGroupsVserverGroupArgs]

A list of vserver groups attached on scaling group. See Block vserver_group below for details.

force bool

If instances of scaling group are attached/removed from slb backend server when attach/detach vserver group from scaling group. Default to true.

scalingGroupId String

ID of the scaling group.

vserverGroups List<Property Map>

A list of vserver groups attached on scaling group. See Block vserver_group below for details.

force Boolean

If instances of scaling group are attached/removed from slb backend server when attach/detach vserver group from scaling group. Default to true.

Outputs

All input properties are implicitly available as output properties. Additionally, the ScalingGroupVServerGroups resource produces the following output properties:

Id string

The provider-assigned unique ID for this managed resource.

Id string

The provider-assigned unique ID for this managed resource.

id String

The provider-assigned unique ID for this managed resource.

id string

The provider-assigned unique ID for this managed resource.

id str

The provider-assigned unique ID for this managed resource.

id String

The provider-assigned unique ID for this managed resource.

Look up an Existing ScalingGroupVServerGroups Resource

Get an existing ScalingGroupVServerGroups resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: ScalingGroupVServerGroupsState, opts?: CustomResourceOptions): ScalingGroupVServerGroups
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        force: Optional[bool] = None,
        scaling_group_id: Optional[str] = None,
        vserver_groups: Optional[Sequence[ScalingGroupVServerGroupsVserverGroupArgs]] = None) -> ScalingGroupVServerGroups
func GetScalingGroupVServerGroups(ctx *Context, name string, id IDInput, state *ScalingGroupVServerGroupsState, opts ...ResourceOption) (*ScalingGroupVServerGroups, error)
public static ScalingGroupVServerGroups Get(string name, Input<string> id, ScalingGroupVServerGroupsState? state, CustomResourceOptions? opts = null)
public static ScalingGroupVServerGroups get(String name, Output<String> id, ScalingGroupVServerGroupsState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
Force bool

If instances of scaling group are attached/removed from slb backend server when attach/detach vserver group from scaling group. Default to true.

ScalingGroupId string

ID of the scaling group.

VserverGroups List<Pulumi.AliCloud.Ess.Inputs.ScalingGroupVServerGroupsVserverGroupArgs>

A list of vserver groups attached on scaling group. See Block vserver_group below for details.

Force bool

If instances of scaling group are attached/removed from slb backend server when attach/detach vserver group from scaling group. Default to true.

ScalingGroupId string

ID of the scaling group.

VserverGroups []ScalingGroupVServerGroupsVserverGroupArgs

A list of vserver groups attached on scaling group. See Block vserver_group below for details.

force Boolean

If instances of scaling group are attached/removed from slb backend server when attach/detach vserver group from scaling group. Default to true.

scalingGroupId String

ID of the scaling group.

vserverGroups List<ScalingGroupVServerGroupsVserverGroupArgs>

A list of vserver groups attached on scaling group. See Block vserver_group below for details.

force boolean

If instances of scaling group are attached/removed from slb backend server when attach/detach vserver group from scaling group. Default to true.

scalingGroupId string

ID of the scaling group.

vserverGroups ScalingGroupVServerGroupsVserverGroupArgs[]

A list of vserver groups attached on scaling group. See Block vserver_group below for details.

force bool

If instances of scaling group are attached/removed from slb backend server when attach/detach vserver group from scaling group. Default to true.

scaling_group_id str

ID of the scaling group.

vserver_groups Sequence[ScalingGroupVServerGroupsVserverGroupArgs]

A list of vserver groups attached on scaling group. See Block vserver_group below for details.

force Boolean

If instances of scaling group are attached/removed from slb backend server when attach/detach vserver group from scaling group. Default to true.

scalingGroupId String

ID of the scaling group.

vserverGroups List<Property Map>

A list of vserver groups attached on scaling group. See Block vserver_group below for details.

Supporting Types

ScalingGroupVServerGroupsVserverGroup

ScalingGroupVServerGroupsVserverGroupVserverAttribute

port Integer
vserverGroupId String
weight Integer
port number
vserverGroupId string
weight number
port Number
vserverGroupId String
weight Number

Import

ESS vserver groups can be imported using the id, e.g.

 $ pulumi import alicloud:ess/scalingGroupVServerGroups:ScalingGroupVServerGroups example abc123456

Package Details

Repository
https://github.com/pulumi/pulumi-alicloud
License
Apache-2.0
Notes

This Pulumi package is based on the alicloud Terraform Provider.