alicloud logo
Alibaba Cloud v3.34.0, Mar 17 23

alicloud.ess.AlbServerGroupAttachment

Attaches/Detaches alb server group to a specified scaling group.

For information about alb server group attachment, see AttachAlbServerGroups.

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

NOTE: Alb server group attachment is defined uniquely by scaling_group_id, alb_server_group_id, port.

NOTE: Resource alicloud.ess.AlbServerGroupAttachment don’t support modification.

NOTE: Resource alicloud.ess.AlbServerGroupAttachment is available in 1.158.0+.

Example Usage

Coming soon!

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.alb.ServerGroup;
import com.pulumi.alicloud.alb.ServerGroupArgs;
import com.pulumi.alicloud.ess.ScalingGroup;
import com.pulumi.alicloud.ess.ScalingGroupArgs;
import com.pulumi.alicloud.ess.ScalingConfiguration;
import com.pulumi.alicloud.ess.ScalingConfigurationArgs;
import com.pulumi.alicloud.alb.inputs.ServerGroupHealthCheckConfigArgs;
import com.pulumi.alicloud.alb.inputs.ServerGroupStickySessionConfigArgs;
import com.pulumi.alicloud.ess.AlbServerGroupAttachment;
import com.pulumi.alicloud.ess.AlbServerGroupAttachmentArgs;
import com.pulumi.resources.CustomResourceOptions;
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("testAccEssAlbServerGroupsAttachment");
        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 defaultServerGroup = new ServerGroup("defaultServerGroup", ServerGroupArgs.builder()        
            .loadBalancerId(alicloud_slb_load_balancer.default().id())
            .name("test")
            .build());

        var defaultScalingGroup = new ScalingGroup("defaultScalingGroup", ScalingGroupArgs.builder()        
            .minSize("2")
            .maxSize("2")
            .scalingGroupName(name)
            .vswitchIds(defaultSwitch.id())
            .build());

        var defaultScalingConfiguration = new ScalingConfiguration("defaultScalingConfiguration", ScalingConfigurationArgs.builder()        
            .scalingGroupId(defaultScalingGroup.id())
            .imageId(data.alicloud_images().default().images()[0].id())
            .instanceType(data.alicloud_instance_types().default().instance_types()[0].id())
            .securityGroupId(alicloud_security_group.default().id())
            .forceDelete(true)
            .active(true)
            .enable(true)
            .build());

        var defaultAlb_serverGroupServerGroup = new ServerGroup("defaultAlb/serverGroupServerGroup", ServerGroupArgs.builder()        
            .serverGroupName(name)
            .vpcId(defaultNetwork.id())
            .healthCheckConfig(ServerGroupHealthCheckConfigArgs.builder()
                .healthCheckEnabled("false")
                .build())
            .stickySessionConfig(ServerGroupStickySessionConfigArgs.builder()
                .stickySessionEnabled(true)
                .cookie("tf-testAcc")
                .stickySessionType("Server")
                .build())
            .build());

        var defaultAlbServerGroupAttachment = new AlbServerGroupAttachment("defaultAlbServerGroupAttachment", AlbServerGroupAttachmentArgs.builder()        
            .scalingGroupId(defaultScalingGroup.id())
            .albServerGroupId(defaultServerGroup.id())
            .port(9000)
            .weight(50)
            .forceAttach(true)
            .build(), CustomResourceOptions.builder()
                .dependsOn("alicloud_ess_scaling_configuration.default")
                .build());

    }
}

Coming soon!

Coming soon!

configuration:
  name:
    type: string
    default: testAccEssAlbServerGroupsAttachment
resources:
  defaultNetwork:
    type: alicloud:vpc:Network
    properties:
      cidrBlock: 172.16.0.0/16
  defaultSwitch:
    type: alicloud:vpc:Switch
    properties:
      vpcId: ${defaultNetwork.id}
      cidrBlock: 172.16.0.0/24
      zoneId: ${defaultZones.zones[0].id}
  defaultServerGroup:
    type: alicloud:alb:ServerGroup
    properties:
      loadBalancerId: ${alicloud_slb_load_balancer.default.id}
      name: test
  defaultScalingGroup:
    type: alicloud:ess:ScalingGroup
    properties:
      minSize: '2'
      maxSize: '2'
      scalingGroupName: ${name}
      vswitchIds:
        - ${defaultSwitch.id}
  defaultScalingConfiguration:
    type: alicloud:ess:ScalingConfiguration
    properties:
      scalingGroupId: ${defaultScalingGroup.id}
      imageId: ${data.alicloud_images.default.images[0].id}
      instanceType: ${data.alicloud_instance_types.default.instance_types[0].id}
      securityGroupId: ${alicloud_security_group.default.id}
      forceDelete: true
      active: true
      enable: true
  defaultAlb/serverGroupServerGroup:
    type: alicloud:alb:ServerGroup
    properties:
      serverGroupName: ${name}
      vpcId: ${defaultNetwork.id}
      healthCheckConfig:
        healthCheckEnabled: 'false'
      stickySessionConfig:
        stickySessionEnabled: true
        cookie: tf-testAcc
        stickySessionType: Server
  defaultAlbServerGroupAttachment:
    type: alicloud:ess:AlbServerGroupAttachment
    properties:
      scalingGroupId: ${defaultScalingGroup.id}
      albServerGroupId: ${defaultServerGroup.id}
      port: 9000
      weight: 50
      forceAttach: true
    options:
      dependson:
        - alicloud_ess_scaling_configuration.default
variables:
  defaultZones:
    fn::invoke:
      Function: alicloud:getZones
      Arguments:
        availableDiskCategory: cloud_efficiency
        availableResourceCreation: VSwitch

Create AlbServerGroupAttachment Resource

new AlbServerGroupAttachment(name: string, args: AlbServerGroupAttachmentArgs, opts?: CustomResourceOptions);
@overload
def AlbServerGroupAttachment(resource_name: str,
                             opts: Optional[ResourceOptions] = None,
                             alb_server_group_id: Optional[str] = None,
                             force_attach: Optional[bool] = None,
                             port: Optional[int] = None,
                             scaling_group_id: Optional[str] = None,
                             weight: Optional[int] = None)
@overload
def AlbServerGroupAttachment(resource_name: str,
                             args: AlbServerGroupAttachmentArgs,
                             opts: Optional[ResourceOptions] = None)
func NewAlbServerGroupAttachment(ctx *Context, name string, args AlbServerGroupAttachmentArgs, opts ...ResourceOption) (*AlbServerGroupAttachment, error)
public AlbServerGroupAttachment(string name, AlbServerGroupAttachmentArgs args, CustomResourceOptions? opts = null)
public AlbServerGroupAttachment(String name, AlbServerGroupAttachmentArgs args)
public AlbServerGroupAttachment(String name, AlbServerGroupAttachmentArgs args, CustomResourceOptions options)
type: alicloud:ess:AlbServerGroupAttachment
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

name string
The unique name of the resource.
args AlbServerGroupAttachmentArgs
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 AlbServerGroupAttachmentArgs
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 AlbServerGroupAttachmentArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args AlbServerGroupAttachmentArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name String
The unique name of the resource.
args AlbServerGroupAttachmentArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

AlbServerGroupAttachment 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 AlbServerGroupAttachment resource accepts the following input properties:

AlbServerGroupId string

ID of Alb Server Group.

Port int

The port will be used for Alb Server Group backend server.

ScalingGroupId string

ID of the scaling group.

Weight int

The weight of an ECS instance attached to the Alb Server Group.

ForceAttach bool

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

AlbServerGroupId string

ID of Alb Server Group.

Port int

The port will be used for Alb Server Group backend server.

ScalingGroupId string

ID of the scaling group.

Weight int

The weight of an ECS instance attached to the Alb Server Group.

ForceAttach bool

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

albServerGroupId String

ID of Alb Server Group.

port Integer

The port will be used for Alb Server Group backend server.

scalingGroupId String

ID of the scaling group.

weight Integer

The weight of an ECS instance attached to the Alb Server Group.

forceAttach Boolean

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

albServerGroupId string

ID of Alb Server Group.

port number

The port will be used for Alb Server Group backend server.

scalingGroupId string

ID of the scaling group.

weight number

The weight of an ECS instance attached to the Alb Server Group.

forceAttach boolean

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

alb_server_group_id str

ID of Alb Server Group.

port int

The port will be used for Alb Server Group backend server.

scaling_group_id str

ID of the scaling group.

weight int

The weight of an ECS instance attached to the Alb Server Group.

force_attach bool

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

albServerGroupId String

ID of Alb Server Group.

port Number

The port will be used for Alb Server Group backend server.

scalingGroupId String

ID of the scaling group.

weight Number

The weight of an ECS instance attached to the Alb Server Group.

forceAttach Boolean

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

Outputs

All input properties are implicitly available as output properties. Additionally, the AlbServerGroupAttachment 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 AlbServerGroupAttachment Resource

Get an existing AlbServerGroupAttachment 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?: AlbServerGroupAttachmentState, opts?: CustomResourceOptions): AlbServerGroupAttachment
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        alb_server_group_id: Optional[str] = None,
        force_attach: Optional[bool] = None,
        port: Optional[int] = None,
        scaling_group_id: Optional[str] = None,
        weight: Optional[int] = None) -> AlbServerGroupAttachment
func GetAlbServerGroupAttachment(ctx *Context, name string, id IDInput, state *AlbServerGroupAttachmentState, opts ...ResourceOption) (*AlbServerGroupAttachment, error)
public static AlbServerGroupAttachment Get(string name, Input<string> id, AlbServerGroupAttachmentState? state, CustomResourceOptions? opts = null)
public static AlbServerGroupAttachment get(String name, Output<String> id, AlbServerGroupAttachmentState 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:
AlbServerGroupId string

ID of Alb Server Group.

ForceAttach bool

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

Port int

The port will be used for Alb Server Group backend server.

ScalingGroupId string

ID of the scaling group.

Weight int

The weight of an ECS instance attached to the Alb Server Group.

AlbServerGroupId string

ID of Alb Server Group.

ForceAttach bool

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

Port int

The port will be used for Alb Server Group backend server.

ScalingGroupId string

ID of the scaling group.

Weight int

The weight of an ECS instance attached to the Alb Server Group.

albServerGroupId String

ID of Alb Server Group.

forceAttach Boolean

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

port Integer

The port will be used for Alb Server Group backend server.

scalingGroupId String

ID of the scaling group.

weight Integer

The weight of an ECS instance attached to the Alb Server Group.

albServerGroupId string

ID of Alb Server Group.

forceAttach boolean

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

port number

The port will be used for Alb Server Group backend server.

scalingGroupId string

ID of the scaling group.

weight number

The weight of an ECS instance attached to the Alb Server Group.

alb_server_group_id str

ID of Alb Server Group.

force_attach bool

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

port int

The port will be used for Alb Server Group backend server.

scaling_group_id str

ID of the scaling group.

weight int

The weight of an ECS instance attached to the Alb Server Group.

albServerGroupId String

ID of Alb Server Group.

forceAttach Boolean

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

port Number

The port will be used for Alb Server Group backend server.

scalingGroupId String

ID of the scaling group.

weight Number

The weight of an ECS instance attached to the Alb Server Group.

Import

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

 $ pulumi import alicloud:ess/albServerGroupAttachment:AlbServerGroupAttachment example asg-xxx:sgp-xxx:5000

Package Details

Repository
Alibaba Cloud pulumi/pulumi-alicloud
License
Apache-2.0
Notes

This Pulumi package is based on the alicloud Terraform Provider.