volcengine.ecs.DeploymentSetAssociate
Explore with Pulumi AI
Provides a resource to manage ecs deployment set associate
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 fooInstance = new Volcengine.Ecs.Instance("fooInstance", new()
{
InstanceName = "acc-test-ecs",
ImageId = fooImages.Apply(imagesResult => imagesResult.Images[0]?.ImageId),
InstanceType = "ecs.g1.large",
Password = "93f0cb0614Aab12",
InstanceChargeType = "PostPaid",
SystemVolumeType = "ESSD_PL0",
SystemVolumeSize = 40,
SubnetId = fooSubnet.Id,
SecurityGroupIds = new[]
{
fooSecurityGroup.Id,
},
});
var fooState = new Volcengine.Ecs.State("fooState", new()
{
InstanceId = fooInstance.Id,
Action = "Stop",
StoppedMode = "KeepCharging",
});
var fooDeploymentSet = new Volcengine.Ecs.DeploymentSet("fooDeploymentSet", new()
{
DeploymentSetName = "acc-test-ecs-ds",
Description = "acc-test",
Granularity = "switch",
Strategy = "Availability",
});
var fooDeploymentSetAssociate = new Volcengine.Ecs.DeploymentSetAssociate("fooDeploymentSetAssociate", new()
{
DeploymentSetId = fooDeploymentSet.Id,
InstanceId = fooInstance.Id,
}, new CustomResourceOptions
{
DependsOn = new[]
{
fooState,
},
});
});
package main
import (
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"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
}
fooInstance, err := ecs.NewInstance(ctx, "fooInstance", &ecs.InstanceArgs{
InstanceName: pulumi.String("acc-test-ecs"),
ImageId: *pulumi.String(fooImages.Images[0].ImageId),
InstanceType: pulumi.String("ecs.g1.large"),
Password: pulumi.String("93f0cb0614Aab12"),
InstanceChargeType: pulumi.String("PostPaid"),
SystemVolumeType: pulumi.String("ESSD_PL0"),
SystemVolumeSize: pulumi.Int(40),
SubnetId: fooSubnet.ID(),
SecurityGroupIds: pulumi.StringArray{
fooSecurityGroup.ID(),
},
})
if err != nil {
return err
}
fooState, err := ecs.NewState(ctx, "fooState", &ecs.StateArgs{
InstanceId: fooInstance.ID(),
Action: pulumi.String("Stop"),
StoppedMode: pulumi.String("KeepCharging"),
})
if err != nil {
return err
}
fooDeploymentSet, err := ecs.NewDeploymentSet(ctx, "fooDeploymentSet", &ecs.DeploymentSetArgs{
DeploymentSetName: pulumi.String("acc-test-ecs-ds"),
Description: pulumi.String("acc-test"),
Granularity: pulumi.String("switch"),
Strategy: pulumi.String("Availability"),
})
if err != nil {
return err
}
_, err = ecs.NewDeploymentSetAssociate(ctx, "fooDeploymentSetAssociate", &ecs.DeploymentSetAssociateArgs{
DeploymentSetId: fooDeploymentSet.ID(),
InstanceId: fooInstance.ID(),
}, pulumi.DependsOn([]pulumi.Resource{
fooState,
}))
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.ecs.Instance;
import com.pulumi.volcengine.ecs.InstanceArgs;
import com.pulumi.volcengine.ecs.State;
import com.pulumi.volcengine.ecs.StateArgs;
import com.pulumi.volcengine.ecs.DeploymentSet;
import com.pulumi.volcengine.ecs.DeploymentSetArgs;
import com.pulumi.volcengine.ecs.DeploymentSetAssociate;
import com.pulumi.volcengine.ecs.DeploymentSetAssociateArgs;
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 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 fooInstance = new Instance("fooInstance", InstanceArgs.builder()
.instanceName("acc-test-ecs")
.imageId(fooImages.applyValue(imagesResult -> imagesResult.images()[0].imageId()))
.instanceType("ecs.g1.large")
.password("93f0cb0614Aab12")
.instanceChargeType("PostPaid")
.systemVolumeType("ESSD_PL0")
.systemVolumeSize(40)
.subnetId(fooSubnet.id())
.securityGroupIds(fooSecurityGroup.id())
.build());
var fooState = new State("fooState", StateArgs.builder()
.instanceId(fooInstance.id())
.action("Stop")
.stoppedMode("KeepCharging")
.build());
var fooDeploymentSet = new DeploymentSet("fooDeploymentSet", DeploymentSetArgs.builder()
.deploymentSetName("acc-test-ecs-ds")
.description("acc-test")
.granularity("switch")
.strategy("Availability")
.build());
var fooDeploymentSetAssociate = new DeploymentSetAssociate("fooDeploymentSetAssociate", DeploymentSetAssociateArgs.builder()
.deploymentSetId(fooDeploymentSet.id())
.instanceId(fooInstance.id())
.build(), CustomResourceOptions.builder()
.dependsOn(fooState)
.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_instance = volcengine.ecs.Instance("fooInstance",
instance_name="acc-test-ecs",
image_id=foo_images.images[0].image_id,
instance_type="ecs.g1.large",
password="93f0cb0614Aab12",
instance_charge_type="PostPaid",
system_volume_type="ESSD_PL0",
system_volume_size=40,
subnet_id=foo_subnet.id,
security_group_ids=[foo_security_group.id])
foo_state = volcengine.ecs.State("fooState",
instance_id=foo_instance.id,
action="Stop",
stopped_mode="KeepCharging")
foo_deployment_set = volcengine.ecs.DeploymentSet("fooDeploymentSet",
deployment_set_name="acc-test-ecs-ds",
description="acc-test",
granularity="switch",
strategy="Availability")
foo_deployment_set_associate = volcengine.ecs.DeploymentSetAssociate("fooDeploymentSetAssociate",
deployment_set_id=foo_deployment_set.id,
instance_id=foo_instance.id,
opts=pulumi.ResourceOptions(depends_on=[foo_state]))
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 fooInstance = new volcengine.ecs.Instance("fooInstance", {
instanceName: "acc-test-ecs",
imageId: fooImages.then(fooImages => fooImages.images?.[0]?.imageId),
instanceType: "ecs.g1.large",
password: "93f0cb0614Aab12",
instanceChargeType: "PostPaid",
systemVolumeType: "ESSD_PL0",
systemVolumeSize: 40,
subnetId: fooSubnet.id,
securityGroupIds: [fooSecurityGroup.id],
});
const fooState = new volcengine.ecs.State("fooState", {
instanceId: fooInstance.id,
action: "Stop",
stoppedMode: "KeepCharging",
});
const fooDeploymentSet = new volcengine.ecs.DeploymentSet("fooDeploymentSet", {
deploymentSetName: "acc-test-ecs-ds",
description: "acc-test",
granularity: "switch",
strategy: "Availability",
});
const fooDeploymentSetAssociate = new volcengine.ecs.DeploymentSetAssociate("fooDeploymentSetAssociate", {
deploymentSetId: fooDeploymentSet.id,
instanceId: fooInstance.id,
}, {
dependsOn: [fooState],
});
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}
fooInstance:
type: volcengine:ecs:Instance
properties:
instanceName: acc-test-ecs
imageId: ${fooImages.images[0].imageId}
instanceType: ecs.g1.large
password: 93f0cb0614Aab12
instanceChargeType: PostPaid
systemVolumeType: ESSD_PL0
systemVolumeSize: 40
subnetId: ${fooSubnet.id}
securityGroupIds:
- ${fooSecurityGroup.id}
fooState:
type: volcengine:ecs:State
properties:
instanceId: ${fooInstance.id}
action: Stop
stoppedMode: KeepCharging
fooDeploymentSet:
type: volcengine:ecs:DeploymentSet
properties:
deploymentSetName: acc-test-ecs-ds
description: acc-test
granularity: switch
strategy: Availability
fooDeploymentSetAssociate:
type: volcengine:ecs:DeploymentSetAssociate
properties:
deploymentSetId: ${fooDeploymentSet.id}
instanceId: ${fooInstance.id}
options:
dependson:
- ${fooState}
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 DeploymentSetAssociate Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new DeploymentSetAssociate(name: string, args: DeploymentSetAssociateArgs, opts?: CustomResourceOptions);
@overload
def DeploymentSetAssociate(resource_name: str,
args: DeploymentSetAssociateArgs,
opts: Optional[ResourceOptions] = None)
@overload
def DeploymentSetAssociate(resource_name: str,
opts: Optional[ResourceOptions] = None,
deployment_set_id: Optional[str] = None,
instance_id: Optional[str] = None)
func NewDeploymentSetAssociate(ctx *Context, name string, args DeploymentSetAssociateArgs, opts ...ResourceOption) (*DeploymentSetAssociate, error)
public DeploymentSetAssociate(string name, DeploymentSetAssociateArgs args, CustomResourceOptions? opts = null)
public DeploymentSetAssociate(String name, DeploymentSetAssociateArgs args)
public DeploymentSetAssociate(String name, DeploymentSetAssociateArgs args, CustomResourceOptions options)
type: volcengine:ecs:DeploymentSetAssociate
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 DeploymentSetAssociateArgs
- 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 DeploymentSetAssociateArgs
- 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 DeploymentSetAssociateArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args DeploymentSetAssociateArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args DeploymentSetAssociateArgs
- 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 deploymentSetAssociateResource = new Volcengine.Ecs.DeploymentSetAssociate("deploymentSetAssociateResource", new()
{
DeploymentSetId = "string",
InstanceId = "string",
});
example, err := ecs.NewDeploymentSetAssociate(ctx, "deploymentSetAssociateResource", &ecs.DeploymentSetAssociateArgs{
DeploymentSetId: pulumi.String("string"),
InstanceId: pulumi.String("string"),
})
var deploymentSetAssociateResource = new DeploymentSetAssociate("deploymentSetAssociateResource", DeploymentSetAssociateArgs.builder()
.deploymentSetId("string")
.instanceId("string")
.build());
deployment_set_associate_resource = volcengine.ecs.DeploymentSetAssociate("deploymentSetAssociateResource",
deployment_set_id="string",
instance_id="string")
const deploymentSetAssociateResource = new volcengine.ecs.DeploymentSetAssociate("deploymentSetAssociateResource", {
deploymentSetId: "string",
instanceId: "string",
});
type: volcengine:ecs:DeploymentSetAssociate
properties:
deploymentSetId: string
instanceId: string
DeploymentSetAssociate 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 DeploymentSetAssociate resource accepts the following input properties:
- Deployment
Set stringId - The ID of ECS DeploymentSet Associate.
- Instance
Id string - The ID of ECS Instance.
- Deployment
Set stringId - The ID of ECS DeploymentSet Associate.
- Instance
Id string - The ID of ECS Instance.
- deployment
Set StringId - The ID of ECS DeploymentSet Associate.
- instance
Id String - The ID of ECS Instance.
- deployment
Set stringId - The ID of ECS DeploymentSet Associate.
- instance
Id string - The ID of ECS Instance.
- deployment_
set_ strid - The ID of ECS DeploymentSet Associate.
- instance_
id str - The ID of ECS Instance.
- deployment
Set StringId - The ID of ECS DeploymentSet Associate.
- instance
Id String - The ID of ECS Instance.
Outputs
All input properties are implicitly available as output properties. Additionally, the DeploymentSetAssociate 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 DeploymentSetAssociate Resource
Get an existing DeploymentSetAssociate 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?: DeploymentSetAssociateState, opts?: CustomResourceOptions): DeploymentSetAssociate
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
deployment_set_id: Optional[str] = None,
instance_id: Optional[str] = None) -> DeploymentSetAssociate
func GetDeploymentSetAssociate(ctx *Context, name string, id IDInput, state *DeploymentSetAssociateState, opts ...ResourceOption) (*DeploymentSetAssociate, error)
public static DeploymentSetAssociate Get(string name, Input<string> id, DeploymentSetAssociateState? state, CustomResourceOptions? opts = null)
public static DeploymentSetAssociate get(String name, Output<String> id, DeploymentSetAssociateState 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.
- Deployment
Set stringId - The ID of ECS DeploymentSet Associate.
- Instance
Id string - The ID of ECS Instance.
- Deployment
Set stringId - The ID of ECS DeploymentSet Associate.
- Instance
Id string - The ID of ECS Instance.
- deployment
Set StringId - The ID of ECS DeploymentSet Associate.
- instance
Id String - The ID of ECS Instance.
- deployment
Set stringId - The ID of ECS DeploymentSet Associate.
- instance
Id string - The ID of ECS Instance.
- deployment_
set_ strid - The ID of ECS DeploymentSet Associate.
- instance_
id str - The ID of ECS Instance.
- deployment
Set StringId - The ID of ECS DeploymentSet Associate.
- instance
Id String - The ID of ECS Instance.
Import
ECS deployment set associate can be imported using the id, e.g.
$ pulumi import volcengine:ecs/deploymentSetAssociate:DeploymentSetAssociate default dps-ybti5tkpkv2udbfolrft:i-mizl7m1kqccg5smt1bdpijuj
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.