alicloud.ess.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 sameVPC
.
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;
return await Deployment.RunAsync(() =>
{
var config = new Config();
var name = config.Get("name") ?? "testAccEssVserverGroupsAttachment";
var defaultZones = AliCloud.GetZones.Invoke(new()
{
AvailableDiskCategory = "cloud_efficiency",
AvailableResourceCreation = "VSwitch",
});
var defaultNetwork = new AliCloud.Vpc.Network("defaultNetwork", new()
{
CidrBlock = "172.16.0.0/16",
});
var defaultSwitch = new AliCloud.Vpc.Switch("defaultSwitch", new()
{
VpcId = defaultNetwork.Id,
CidrBlock = "172.16.0.0/24",
ZoneId = defaultZones.Apply(getZonesResult => getZonesResult.Zones[0]?.Id),
});
var defaultApplicationLoadBalancer = new AliCloud.Slb.ApplicationLoadBalancer("defaultApplicationLoadBalancer", new()
{
LoadBalancerName = name,
VswitchId = defaultSwitch.Id,
});
var defaultServerGroup = new AliCloud.Slb.ServerGroup("defaultServerGroup", new()
{
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()
{
LoadBalancerId = new[]
{
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()
{
MinSize = 2,
MaxSize = 2,
ScalingGroupName = name,
VswitchIds = new[]
{
defaultSwitch.Id,
},
});
var defaultScalingGroupVServerGroups = new AliCloud.Ess.ScalingGroupVServerGroups("defaultScalingGroupVServerGroups", new()
{
ScalingGroupId = defaultScalingGroup.Id,
VserverGroups = new[]
{
new AliCloud.Ess.Inputs.ScalingGroupVServerGroupsVserverGroupArgs
{
LoadbalancerId = defaultApplicationLoadBalancer.Id,
VserverAttributes = new[]
{
new AliCloud.Ess.Inputs.ScalingGroupVServerGroupsVserverGroupVserverAttributeArgs
{
VserverGroupId = defaultServerGroup.Id,
Port = 100,
Weight = 60,
},
},
},
},
});
});
Coming soon!
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.vpc.Network;
import com.pulumi.alicloud.vpc.NetworkArgs;
import com.pulumi.alicloud.vpc.Switch;
import com.pulumi.alicloud.vpc.SwitchArgs;
import com.pulumi.alicloud.slb.ApplicationLoadBalancer;
import com.pulumi.alicloud.slb.ApplicationLoadBalancerArgs;
import com.pulumi.alicloud.slb.ServerGroup;
import com.pulumi.alicloud.slb.ServerGroupArgs;
import com.pulumi.alicloud.slb.Listener;
import com.pulumi.alicloud.slb.ListenerArgs;
import com.pulumi.alicloud.ess.ScalingGroup;
import com.pulumi.alicloud.ess.ScalingGroupArgs;
import com.pulumi.alicloud.ess.ScalingGroupVServerGroups;
import com.pulumi.alicloud.ess.ScalingGroupVServerGroupsArgs;
import com.pulumi.alicloud.ess.inputs.ScalingGroupVServerGroupsVserverGroupArgs;
import com.pulumi.codegen.internal.KeyedValue;
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("testAccEssVserverGroupsAttachment");
final var defaultZones = AlicloudFunctions.getZones(GetZonesArgs.builder()
.availableDiskCategory("cloud_efficiency")
.availableResourceCreation("VSwitch")
.build());
var defaultNetwork = new Network("defaultNetwork", NetworkArgs.builder()
.cidrBlock("172.16.0.0/16")
.build());
var defaultSwitch = new Switch("defaultSwitch", SwitchArgs.builder()
.vpcId(defaultNetwork.id())
.cidrBlock("172.16.0.0/24")
.zoneId(defaultZones.applyValue(getZonesResult -> getZonesResult.zones()[0].id()))
.build());
var defaultApplicationLoadBalancer = new ApplicationLoadBalancer("defaultApplicationLoadBalancer", ApplicationLoadBalancerArgs.builder()
.loadBalancerName(name)
.vswitchId(defaultSwitch.id())
.build());
var defaultServerGroup = new ServerGroup("defaultServerGroup", ServerGroupArgs.builder()
.loadBalancerId(defaultApplicationLoadBalancer.id())
.build());
for (var i = 0; i < 2; i++) {
new Listener("defaultListener-" + i, ListenerArgs.builder()
.loadBalancerId(defaultApplicationLoadBalancer.stream().map(element -> element.id()).collect(toList())[range.value()])
.backendPort("22")
.frontendPort("22")
.protocol("tcp")
.bandwidth("10")
.healthCheckType("tcp")
.build());
}
var defaultScalingGroup = new ScalingGroup("defaultScalingGroup", ScalingGroupArgs.builder()
.minSize("2")
.maxSize("2")
.scalingGroupName(name)
.vswitchIds(defaultSwitch.id())
.build());
var defaultScalingGroupVServerGroups = new ScalingGroupVServerGroups("defaultScalingGroupVServerGroups", ScalingGroupVServerGroupsArgs.builder()
.scalingGroupId(defaultScalingGroup.id())
.vserverGroups(ScalingGroupVServerGroupsVserverGroupArgs.builder()
.loadbalancerId(defaultApplicationLoadBalancer.id())
.vserverAttributes(ScalingGroupVServerGroupsVserverGroupVserverAttributeArgs.builder()
.vserverGroupId(defaultServerGroup.id())
.port("100")
.weight("60")
.build())
.build())
.build());
}
}
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 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:
- Scaling
Group stringId ID of the scaling group.
- Vserver
Groups List<Pulumi.Ali Cloud. Ess. Inputs. Scaling Group VServer Groups Vserver Group Args> 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 stringId ID of the scaling group.
- Vserver
Groups []ScalingGroup VServer Groups Vserver Group Args 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 StringId ID of the scaling group.
- vserver
Groups List<ScalingGroup VServer Groups Vserver Group Args> 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 stringId ID of the scaling group.
- vserver
Groups ScalingGroup VServer Groups Vserver Group Args[] 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_ strid ID of the scaling group.
- vserver_
groups Sequence[ScalingGroup VServer Groups Vserver Group Args] 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 StringId ID of the scaling group.
- vserver
Groups 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 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.
- 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 stringId ID of the scaling group.
- Vserver
Groups List<Pulumi.Ali Cloud. Ess. Inputs. Scaling Group VServer Groups Vserver Group Args> 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 stringId ID of the scaling group.
- Vserver
Groups []ScalingGroup VServer Groups Vserver Group Args 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 StringId ID of the scaling group.
- vserver
Groups List<ScalingGroup VServer Groups Vserver Group Args> 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 stringId ID of the scaling group.
- vserver
Groups ScalingGroup VServer Groups Vserver Group Args[] 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_ strid ID of the scaling group.
- vserver_
groups Sequence[ScalingGroup VServer Groups Vserver Group Args] 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 StringId ID of the scaling group.
- vserver
Groups List<Property Map> A list of vserver groups attached on scaling group. See Block vserver_group below for details.
Supporting Types
ScalingGroupVServerGroupsVserverGroup
ScalingGroupVServerGroupsVserverGroupVserverAttribute
- Port int
- Vserver
Group stringId - Weight int
- Port int
- Vserver
Group stringId - Weight int
- port Integer
- vserver
Group StringId - weight Integer
- port number
- vserver
Group stringId - weight number
- port int
- vserver_
group_ strid - weight int
- port Number
- vserver
Group StringId - 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
- Alibaba Cloud pulumi/pulumi-alicloud
- License
- Apache-2.0
- Notes
This Pulumi package is based on the
alicloud
Terraform Provider.