volcengine.autoscaling.ScalingConfigurationAttachment
Explore with Pulumi AI
Provides a resource to manage scaling configuration attachment
Example Usage
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Volcengine = Pulumi.Volcengine;
return await Deployment.RunAsync(() =>
{
var fooZones = Volcengine.Ecs.Zones.Invoke();
var fooVpc = new Volcengine.Vpc.Vpc("fooVpc", new()
{
VpcName = "acc-test-vpc",
CidrBlock = "172.16.0.0/16",
});
var fooSubnet = new Volcengine.Vpc.Subnet("fooSubnet", new()
{
SubnetName = "acc-test-subnet",
CidrBlock = "172.16.0.0/24",
ZoneId = fooZones.Apply(zonesResult => zonesResult.Zones[0]?.Id),
VpcId = fooVpc.Id,
});
var fooSecurityGroup = new Volcengine.Vpc.SecurityGroup("fooSecurityGroup", new()
{
SecurityGroupName = "acc-test-security-group",
VpcId = fooVpc.Id,
});
var fooImages = Volcengine.Ecs.Images.Invoke(new()
{
OsType = "Linux",
Visibility = "public",
InstanceTypeId = "ecs.g1.large",
});
var fooScalingGroup = new Volcengine.Autoscaling.ScalingGroup("fooScalingGroup", new()
{
ScalingGroupName = "acc-test-scaling-group",
SubnetIds = new[]
{
fooSubnet.Id,
},
MultiAzPolicy = "BALANCE",
DesireInstanceNumber = 0,
MinInstanceNumber = 0,
MaxInstanceNumber = 1,
InstanceTerminatePolicy = "OldestInstance",
DefaultCooldown = 10,
});
var fooScalingConfiguration = new Volcengine.Autoscaling.ScalingConfiguration("fooScalingConfiguration", new()
{
ImageId = fooImages.Apply(imagesResult => imagesResult.Images[0]?.ImageId),
InstanceName = "acc-test-instance",
InstanceTypes = new[]
{
"ecs.g1.large",
},
Password = "93f0cb0614Aab12",
ScalingConfigurationName = "acc-test-scaling-config",
ScalingGroupId = fooScalingGroup.Id,
SecurityGroupIds = new[]
{
fooSecurityGroup.Id,
},
Volumes = new[]
{
new Volcengine.Autoscaling.Inputs.ScalingConfigurationVolumeArgs
{
VolumeType = "ESSD_PL0",
Size = 50,
DeleteWithInstance = true,
},
},
});
var fooScalingConfigurationAttachment = new Volcengine.Autoscaling.ScalingConfigurationAttachment("fooScalingConfigurationAttachment", new()
{
ScalingConfigurationId = fooScalingConfiguration.Id,
});
});
package main
import (
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/volcengine/pulumi-volcengine/sdk/go/volcengine/autoscaling"
"github.com/volcengine/pulumi-volcengine/sdk/go/volcengine/ecs"
"github.com/volcengine/pulumi-volcengine/sdk/go/volcengine/vpc"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
fooZones, err := ecs.Zones(ctx, nil, nil)
if err != nil {
return err
}
fooVpc, err := vpc.NewVpc(ctx, "fooVpc", &vpc.VpcArgs{
VpcName: pulumi.String("acc-test-vpc"),
CidrBlock: pulumi.String("172.16.0.0/16"),
})
if err != nil {
return err
}
fooSubnet, err := vpc.NewSubnet(ctx, "fooSubnet", &vpc.SubnetArgs{
SubnetName: pulumi.String("acc-test-subnet"),
CidrBlock: pulumi.String("172.16.0.0/24"),
ZoneId: *pulumi.String(fooZones.Zones[0].Id),
VpcId: fooVpc.ID(),
})
if err != nil {
return err
}
fooSecurityGroup, err := vpc.NewSecurityGroup(ctx, "fooSecurityGroup", &vpc.SecurityGroupArgs{
SecurityGroupName: pulumi.String("acc-test-security-group"),
VpcId: fooVpc.ID(),
})
if err != nil {
return err
}
fooImages, err := ecs.Images(ctx, &ecs.ImagesArgs{
OsType: pulumi.StringRef("Linux"),
Visibility: pulumi.StringRef("public"),
InstanceTypeId: pulumi.StringRef("ecs.g1.large"),
}, nil)
if err != nil {
return err
}
fooScalingGroup, err := autoscaling.NewScalingGroup(ctx, "fooScalingGroup", &autoscaling.ScalingGroupArgs{
ScalingGroupName: pulumi.String("acc-test-scaling-group"),
SubnetIds: pulumi.StringArray{
fooSubnet.ID(),
},
MultiAzPolicy: pulumi.String("BALANCE"),
DesireInstanceNumber: pulumi.Int(0),
MinInstanceNumber: pulumi.Int(0),
MaxInstanceNumber: pulumi.Int(1),
InstanceTerminatePolicy: pulumi.String("OldestInstance"),
DefaultCooldown: pulumi.Int(10),
})
if err != nil {
return err
}
fooScalingConfiguration, err := autoscaling.NewScalingConfiguration(ctx, "fooScalingConfiguration", &autoscaling.ScalingConfigurationArgs{
ImageId: *pulumi.String(fooImages.Images[0].ImageId),
InstanceName: pulumi.String("acc-test-instance"),
InstanceTypes: pulumi.StringArray{
pulumi.String("ecs.g1.large"),
},
Password: pulumi.String("93f0cb0614Aab12"),
ScalingConfigurationName: pulumi.String("acc-test-scaling-config"),
ScalingGroupId: fooScalingGroup.ID(),
SecurityGroupIds: pulumi.StringArray{
fooSecurityGroup.ID(),
},
Volumes: autoscaling.ScalingConfigurationVolumeArray{
&autoscaling.ScalingConfigurationVolumeArgs{
VolumeType: pulumi.String("ESSD_PL0"),
Size: pulumi.Int(50),
DeleteWithInstance: pulumi.Bool(true),
},
},
})
if err != nil {
return err
}
_, err = autoscaling.NewScalingConfigurationAttachment(ctx, "fooScalingConfigurationAttachment", &autoscaling.ScalingConfigurationAttachmentArgs{
ScalingConfigurationId: fooScalingConfiguration.ID(),
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.volcengine.ecs.EcsFunctions;
import com.pulumi.volcengine.ecs.inputs.ZonesArgs;
import com.pulumi.volcengine.vpc.Vpc;
import com.pulumi.volcengine.vpc.VpcArgs;
import com.pulumi.volcengine.vpc.Subnet;
import com.pulumi.volcengine.vpc.SubnetArgs;
import com.pulumi.volcengine.vpc.SecurityGroup;
import com.pulumi.volcengine.vpc.SecurityGroupArgs;
import com.pulumi.volcengine.ecs.inputs.ImagesArgs;
import com.pulumi.volcengine.autoscaling.ScalingGroup;
import com.pulumi.volcengine.autoscaling.ScalingGroupArgs;
import com.pulumi.volcengine.autoscaling.ScalingConfiguration;
import com.pulumi.volcengine.autoscaling.ScalingConfigurationArgs;
import com.pulumi.volcengine.autoscaling.inputs.ScalingConfigurationVolumeArgs;
import com.pulumi.volcengine.autoscaling.ScalingConfigurationAttachment;
import com.pulumi.volcengine.autoscaling.ScalingConfigurationAttachmentArgs;
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 fooZones = EcsFunctions.Zones();
var fooVpc = new Vpc("fooVpc", VpcArgs.builder()
.vpcName("acc-test-vpc")
.cidrBlock("172.16.0.0/16")
.build());
var fooSubnet = new Subnet("fooSubnet", SubnetArgs.builder()
.subnetName("acc-test-subnet")
.cidrBlock("172.16.0.0/24")
.zoneId(fooZones.applyValue(zonesResult -> zonesResult.zones()[0].id()))
.vpcId(fooVpc.id())
.build());
var fooSecurityGroup = new SecurityGroup("fooSecurityGroup", SecurityGroupArgs.builder()
.securityGroupName("acc-test-security-group")
.vpcId(fooVpc.id())
.build());
final var fooImages = EcsFunctions.Images(ImagesArgs.builder()
.osType("Linux")
.visibility("public")
.instanceTypeId("ecs.g1.large")
.build());
var fooScalingGroup = new ScalingGroup("fooScalingGroup", ScalingGroupArgs.builder()
.scalingGroupName("acc-test-scaling-group")
.subnetIds(fooSubnet.id())
.multiAzPolicy("BALANCE")
.desireInstanceNumber(0)
.minInstanceNumber(0)
.maxInstanceNumber(1)
.instanceTerminatePolicy("OldestInstance")
.defaultCooldown(10)
.build());
var fooScalingConfiguration = new ScalingConfiguration("fooScalingConfiguration", ScalingConfigurationArgs.builder()
.imageId(fooImages.applyValue(imagesResult -> imagesResult.images()[0].imageId()))
.instanceName("acc-test-instance")
.instanceTypes("ecs.g1.large")
.password("93f0cb0614Aab12")
.scalingConfigurationName("acc-test-scaling-config")
.scalingGroupId(fooScalingGroup.id())
.securityGroupIds(fooSecurityGroup.id())
.volumes(ScalingConfigurationVolumeArgs.builder()
.volumeType("ESSD_PL0")
.size(50)
.deleteWithInstance(true)
.build())
.build());
var fooScalingConfigurationAttachment = new ScalingConfigurationAttachment("fooScalingConfigurationAttachment", ScalingConfigurationAttachmentArgs.builder()
.scalingConfigurationId(fooScalingConfiguration.id())
.build());
}
}
import pulumi
import pulumi_volcengine as volcengine
foo_zones = volcengine.ecs.zones()
foo_vpc = volcengine.vpc.Vpc("fooVpc",
vpc_name="acc-test-vpc",
cidr_block="172.16.0.0/16")
foo_subnet = volcengine.vpc.Subnet("fooSubnet",
subnet_name="acc-test-subnet",
cidr_block="172.16.0.0/24",
zone_id=foo_zones.zones[0].id,
vpc_id=foo_vpc.id)
foo_security_group = volcengine.vpc.SecurityGroup("fooSecurityGroup",
security_group_name="acc-test-security-group",
vpc_id=foo_vpc.id)
foo_images = volcengine.ecs.images(os_type="Linux",
visibility="public",
instance_type_id="ecs.g1.large")
foo_scaling_group = volcengine.autoscaling.ScalingGroup("fooScalingGroup",
scaling_group_name="acc-test-scaling-group",
subnet_ids=[foo_subnet.id],
multi_az_policy="BALANCE",
desire_instance_number=0,
min_instance_number=0,
max_instance_number=1,
instance_terminate_policy="OldestInstance",
default_cooldown=10)
foo_scaling_configuration = volcengine.autoscaling.ScalingConfiguration("fooScalingConfiguration",
image_id=foo_images.images[0].image_id,
instance_name="acc-test-instance",
instance_types=["ecs.g1.large"],
password="93f0cb0614Aab12",
scaling_configuration_name="acc-test-scaling-config",
scaling_group_id=foo_scaling_group.id,
security_group_ids=[foo_security_group.id],
volumes=[volcengine.autoscaling.ScalingConfigurationVolumeArgs(
volume_type="ESSD_PL0",
size=50,
delete_with_instance=True,
)])
foo_scaling_configuration_attachment = volcengine.autoscaling.ScalingConfigurationAttachment("fooScalingConfigurationAttachment", scaling_configuration_id=foo_scaling_configuration.id)
import * as pulumi from "@pulumi/pulumi";
import * as volcengine from "@pulumi/volcengine";
import * as volcengine from "@volcengine/pulumi";
const fooZones = volcengine.ecs.Zones({});
const fooVpc = new volcengine.vpc.Vpc("fooVpc", {
vpcName: "acc-test-vpc",
cidrBlock: "172.16.0.0/16",
});
const fooSubnet = new volcengine.vpc.Subnet("fooSubnet", {
subnetName: "acc-test-subnet",
cidrBlock: "172.16.0.0/24",
zoneId: fooZones.then(fooZones => fooZones.zones?.[0]?.id),
vpcId: fooVpc.id,
});
const fooSecurityGroup = new volcengine.vpc.SecurityGroup("fooSecurityGroup", {
securityGroupName: "acc-test-security-group",
vpcId: fooVpc.id,
});
const fooImages = volcengine.ecs.Images({
osType: "Linux",
visibility: "public",
instanceTypeId: "ecs.g1.large",
});
const fooScalingGroup = new volcengine.autoscaling.ScalingGroup("fooScalingGroup", {
scalingGroupName: "acc-test-scaling-group",
subnetIds: [fooSubnet.id],
multiAzPolicy: "BALANCE",
desireInstanceNumber: 0,
minInstanceNumber: 0,
maxInstanceNumber: 1,
instanceTerminatePolicy: "OldestInstance",
defaultCooldown: 10,
});
const fooScalingConfiguration = new volcengine.autoscaling.ScalingConfiguration("fooScalingConfiguration", {
imageId: fooImages.then(fooImages => fooImages.images?.[0]?.imageId),
instanceName: "acc-test-instance",
instanceTypes: ["ecs.g1.large"],
password: "93f0cb0614Aab12",
scalingConfigurationName: "acc-test-scaling-config",
scalingGroupId: fooScalingGroup.id,
securityGroupIds: [fooSecurityGroup.id],
volumes: [{
volumeType: "ESSD_PL0",
size: 50,
deleteWithInstance: true,
}],
});
const fooScalingConfigurationAttachment = new volcengine.autoscaling.ScalingConfigurationAttachment("fooScalingConfigurationAttachment", {scalingConfigurationId: fooScalingConfiguration.id});
resources:
fooVpc:
type: volcengine:vpc:Vpc
properties:
vpcName: acc-test-vpc
cidrBlock: 172.16.0.0/16
fooSubnet:
type: volcengine:vpc:Subnet
properties:
subnetName: acc-test-subnet
cidrBlock: 172.16.0.0/24
zoneId: ${fooZones.zones[0].id}
vpcId: ${fooVpc.id}
fooSecurityGroup:
type: volcengine:vpc:SecurityGroup
properties:
securityGroupName: acc-test-security-group
vpcId: ${fooVpc.id}
fooScalingGroup:
type: volcengine:autoscaling:ScalingGroup
properties:
scalingGroupName: acc-test-scaling-group
subnetIds:
- ${fooSubnet.id}
multiAzPolicy: BALANCE
desireInstanceNumber: 0
minInstanceNumber: 0
maxInstanceNumber: 1
instanceTerminatePolicy: OldestInstance
defaultCooldown: 10
fooScalingConfiguration:
type: volcengine:autoscaling:ScalingConfiguration
properties:
imageId: ${fooImages.images[0].imageId}
instanceName: acc-test-instance
instanceTypes:
- ecs.g1.large
password: 93f0cb0614Aab12
scalingConfigurationName: acc-test-scaling-config
scalingGroupId: ${fooScalingGroup.id}
securityGroupIds:
- ${fooSecurityGroup.id}
volumes:
- volumeType: ESSD_PL0
size: 50
deleteWithInstance: true
fooScalingConfigurationAttachment:
type: volcengine:autoscaling:ScalingConfigurationAttachment
properties:
scalingConfigurationId: ${fooScalingConfiguration.id}
variables:
fooZones:
fn::invoke:
Function: volcengine:ecs:Zones
Arguments: {}
fooImages:
fn::invoke:
Function: volcengine:ecs:Images
Arguments:
osType: Linux
visibility: public
instanceTypeId: ecs.g1.large
Create ScalingConfigurationAttachment Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new ScalingConfigurationAttachment(name: string, args: ScalingConfigurationAttachmentArgs, opts?: CustomResourceOptions);
@overload
def ScalingConfigurationAttachment(resource_name: str,
args: ScalingConfigurationAttachmentArgs,
opts: Optional[ResourceOptions] = None)
@overload
def ScalingConfigurationAttachment(resource_name: str,
opts: Optional[ResourceOptions] = None,
scaling_configuration_id: Optional[str] = None)
func NewScalingConfigurationAttachment(ctx *Context, name string, args ScalingConfigurationAttachmentArgs, opts ...ResourceOption) (*ScalingConfigurationAttachment, error)
public ScalingConfigurationAttachment(string name, ScalingConfigurationAttachmentArgs args, CustomResourceOptions? opts = null)
public ScalingConfigurationAttachment(String name, ScalingConfigurationAttachmentArgs args)
public ScalingConfigurationAttachment(String name, ScalingConfigurationAttachmentArgs args, CustomResourceOptions options)
type: volcengine:autoscaling:ScalingConfigurationAttachment
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args ScalingConfigurationAttachmentArgs
- 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 ScalingConfigurationAttachmentArgs
- 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 ScalingConfigurationAttachmentArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args ScalingConfigurationAttachmentArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args ScalingConfigurationAttachmentArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var scalingConfigurationAttachmentResource = new Volcengine.Autoscaling.ScalingConfigurationAttachment("scalingConfigurationAttachmentResource", new()
{
ScalingConfigurationId = "string",
});
example, err := autoscaling.NewScalingConfigurationAttachment(ctx, "scalingConfigurationAttachmentResource", &autoscaling.ScalingConfigurationAttachmentArgs{
ScalingConfigurationId: pulumi.String("string"),
})
var scalingConfigurationAttachmentResource = new ScalingConfigurationAttachment("scalingConfigurationAttachmentResource", ScalingConfigurationAttachmentArgs.builder()
.scalingConfigurationId("string")
.build());
scaling_configuration_attachment_resource = volcengine.autoscaling.ScalingConfigurationAttachment("scalingConfigurationAttachmentResource", scaling_configuration_id="string")
const scalingConfigurationAttachmentResource = new volcengine.autoscaling.ScalingConfigurationAttachment("scalingConfigurationAttachmentResource", {scalingConfigurationId: "string"});
type: volcengine:autoscaling:ScalingConfigurationAttachment
properties:
scalingConfigurationId: string
ScalingConfigurationAttachment Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The ScalingConfigurationAttachment resource accepts the following input properties:
- Scaling
Configuration stringId - The id of the scaling configuration.
- Scaling
Configuration stringId - The id of the scaling configuration.
- scaling
Configuration StringId - The id of the scaling configuration.
- scaling
Configuration stringId - The id of the scaling configuration.
- scaling_
configuration_ strid - The id of the scaling configuration.
- scaling
Configuration StringId - The id of the scaling configuration.
Outputs
All input properties are implicitly available as output properties. Additionally, the ScalingConfigurationAttachment 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 ScalingConfigurationAttachment Resource
Get an existing ScalingConfigurationAttachment 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?: ScalingConfigurationAttachmentState, opts?: CustomResourceOptions): ScalingConfigurationAttachment
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
scaling_configuration_id: Optional[str] = None) -> ScalingConfigurationAttachment
func GetScalingConfigurationAttachment(ctx *Context, name string, id IDInput, state *ScalingConfigurationAttachmentState, opts ...ResourceOption) (*ScalingConfigurationAttachment, error)
public static ScalingConfigurationAttachment Get(string name, Input<string> id, ScalingConfigurationAttachmentState? state, CustomResourceOptions? opts = null)
public static ScalingConfigurationAttachment get(String name, Output<String> id, ScalingConfigurationAttachmentState 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.
- Scaling
Configuration stringId - The id of the scaling configuration.
- Scaling
Configuration stringId - The id of the scaling configuration.
- scaling
Configuration StringId - The id of the scaling configuration.
- scaling
Configuration stringId - The id of the scaling configuration.
- scaling_
configuration_ strid - The id of the scaling configuration.
- scaling
Configuration StringId - The id of the scaling configuration.
Import
Scaling Configuration attachment can be imported using the scaling_configuration_id e.g. The launch template and scaling configuration cannot take effect at the same time.
$ pulumi import volcengine:autoscaling/scalingConfigurationAttachment:ScalingConfigurationAttachment default enable:scc-ybrurj4uw6gh9zecj327
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- volcengine volcengine/pulumi-volcengine
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
volcengine
Terraform Provider.