UNPKG

@volcengine/pulumi

Version:

A Pulumi package for creating and managing volcengine cloud resources.

687 lines (686 loc) 27.9 kB
import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; /** * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as volcengine from "@pulumi/volcengine"; * import * as volcengine from "@volcengine/pulumi"; * * const fooZones = volcengine.ecs.getZones({}); * // create vpc * const fooVpc = new volcengine.vpc.Vpc("fooVpc", { * vpcName: "acc-test-vpc", * cidrBlock: "172.16.0.0/16", * }); * // create subnet * 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, * }); * // create security group * const fooSecurityGroup = new volcengine.vpc.SecurityGroup("fooSecurityGroup", { * securityGroupName: "acc-test-security-group", * vpcId: fooVpc.id, * }); * const fooImages = volcengine.ecs.getImages({ * osType: "Linux", * visibility: "public", * instanceTypeId: "ecs.g1.large", * }); * // create ecs instance * const fooInstance = new volcengine.ecs.Instance("fooInstance", { * instanceName: "acc-test-ecs", * description: "acc-test", * hostName: "tf-acc-test", * 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], * projectName: "default", * tags: [{ * key: "k1", * value: "v1", * }], * }); * // create ebs data volume * const fooVolume = new volcengine.ebs.Volume("fooVolume", { * volumeName: "acc-test-volume", * volumeType: "ESSD_PL0", * description: "acc-test", * kind: "data", * size: 40, * zoneId: fooZones.then(fooZones => fooZones.zones?.[0]?.id), * volumeChargeType: "PostPaid", * projectName: "default", * }); * // attach ebs data volume to ecs instance * const fooVolumeAttach = new volcengine.ebs.VolumeAttach("fooVolumeAttach", { * instanceId: fooInstance.id, * volumeId: fooVolume.id, * }); * // create eip * const fooAddress = new volcengine.eip.Address("fooAddress", {billingType: "PostPaidByTraffic"}); * // associate eip to ecs instance * const fooAssociate = new volcengine.eip.Associate("fooAssociate", { * allocationId: fooAddress.id, * instanceId: fooInstance.id, * instanceType: "EcsInstance", * }); * ``` * * ## Import * * ECS Instance can be imported using the id, e.g. * If Import,The data_volumes is sort by volume name * * ```sh * $ pulumi import volcengine:ecs/instance:Instance default i-mizl7m1kqccg5smt1bdpijuj * ``` */ export declare class Instance extends pulumi.CustomResource { /** * Get an existing Instance resource's state with the given name, ID, and optional extra * properties used to qualify the lookup. * * @param name The _unique_ name of the resulting resource. * @param id The _unique_ provider ID of the resource to lookup. * @param state Any extra arguments used during the lookup. * @param opts Optional settings to control the behavior of the CustomResource. */ static get(name: string, id: pulumi.Input<pulumi.ID>, state?: InstanceState, opts?: pulumi.CustomResourceOptions): Instance; /** * Returns true if the given object is an instance of Instance. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj: any): obj is Instance; /** * The auto renew flag of ECS instance.Only effective when instanceChargeType is PrePaid. Default is true.When importing resources, this attribute will not be imported. If this attribute is set, please use lifecycle and ignoreChanges ignore changes in fields. */ readonly autoRenew: pulumi.Output<boolean | undefined>; /** * The auto renew period of ECS instance.Only effective when instanceChargeType is PrePaid. Default is 1.When importing resources, this attribute will not be imported. If this attribute is set, please use lifecycle and ignoreChanges ignore changes in fields. */ readonly autoRenewPeriod: pulumi.Output<number | undefined>; /** * The option of cpu,only support for ebm. */ readonly cpuOptions: pulumi.Output<outputs.ecs.InstanceCpuOptions>; /** * The number of ECS instance CPU cores. */ readonly cpus: pulumi.Output<number>; /** * The create time of ECS instance. */ readonly createdAt: pulumi.Output<string>; /** * The data volumes collection of ECS instance. */ readonly dataVolumes: pulumi.Output<outputs.ecs.InstanceDataVolume[]>; /** * The ID of Ecs Deployment Set. This field only used to associate a deployment set to the ECS instance. Setting this field to null means disassociating the instance from the deployment set. * The current deployment set id of the ECS instance is the `deploymentSetIdComputed` field. */ readonly deploymentSetId: pulumi.Output<string | undefined>; /** * The ID of Ecs Deployment Set. Computed field. */ readonly deploymentSetIdComputed: pulumi.Output<string>; /** * The description of ECS instance. */ readonly description: pulumi.Output<string>; /** * The config of the eip which will be automatically created and assigned to this instance. `Prepaid` type eip cannot be created in this way, please use `volcengine.eip.Address`. * When importing resources, this attribute will not be imported. If this attribute is set, please use lifecycle and ignoreChanges ignore changes in fields. */ readonly eipAddress: pulumi.Output<outputs.ecs.InstanceEipAddress | undefined>; /** * The id of an existing Available EIP which will be automatically assigned to this instance. * It is not recommended to use this field, it is recommended to use `volcengine.eip.Associate` resource to bind EIP. */ readonly eipId: pulumi.Output<string | undefined>; /** * The GPU device info of Instance. */ readonly gpuDevices: pulumi.Output<outputs.ecs.InstanceGpuDevice[]>; /** * The host name of ECS instance. */ readonly hostName: pulumi.Output<string>; /** * The hpc cluster ID of ECS instance. */ readonly hpcClusterId: pulumi.Output<string | undefined>; /** * The Image ID of ECS instance. */ readonly imageId: pulumi.Output<string>; /** * The include data volumes flag of ECS instance.Only effective when change instance charge type.include_data_volumes. */ readonly includeDataVolumes: pulumi.Output<boolean | undefined>; /** * The charge type of ECS instance, the value can be `PrePaid` or `PostPaid`. */ readonly instanceChargeType: pulumi.Output<string>; /** * The ID of ECS instance. */ readonly instanceId: pulumi.Output<string>; /** * The name of ECS instance. */ readonly instanceName: pulumi.Output<string>; /** * The instance type of ECS instance. */ readonly instanceType: pulumi.Output<string>; /** * The number of IPv6 addresses to be automatically assigned from within the CIDR block of the subnet that hosts the ENI. Valid values: 1 to 10. */ readonly ipv6AddressCount: pulumi.Output<number>; /** * One or more IPv6 addresses selected from within the CIDR block of the subnet that hosts the ENI. Support up to 10. * You cannot specify both the ipv6Addresses and ipv6AddressCount parameters. */ readonly ipv6Addresses: pulumi.Output<string[]>; /** * The Flag of GPU instance.If the instance is GPU,The flag is true. */ readonly isGpu: pulumi.Output<boolean>; /** * Whether to keep the mirror settings. Only custom images and shared images support this field. * When the value of this field is true, the Password and KeyPairName cannot be specified. * When importing resources, this attribute will not be imported. If this attribute is set, please use lifecycle and ignoreChanges ignore changes in fields. */ readonly keepImageCredential: pulumi.Output<boolean | undefined>; /** * The ssh key ID of ECS instance. */ readonly keyPairId: pulumi.Output<string>; /** * The ssh key name of ECS instance. This field can be modified only when the `imageId` is modified. */ readonly keyPairName: pulumi.Output<string | undefined>; /** * The memory size of ECS instance. */ readonly memorySize: pulumi.Output<number>; /** * The ID of primary networkInterface. */ readonly networkInterfaceId: pulumi.Output<string>; /** * The os name of ECS instance. */ readonly osName: pulumi.Output<string>; /** * The os type of ECS instance. */ readonly osType: pulumi.Output<string>; /** * The password of ECS instance. */ readonly password: pulumi.Output<string | undefined>; /** * The period of ECS instance.Only effective when instanceChargeType is PrePaid. Default is 12. Unit is Month. */ readonly period: pulumi.Output<number | undefined>; /** * The private ip address of primary networkInterface. */ readonly primaryIpAddress: pulumi.Output<string>; /** * The ProjectName of the ecs instance. */ readonly projectName: pulumi.Output<string>; /** * The secondary networkInterface detail collection of ECS instance. */ readonly secondaryNetworkInterfaces: pulumi.Output<outputs.ecs.InstanceSecondaryNetworkInterface[]>; /** * The security enhancement strategy of ECS instance. The value can be Active or InActive. Default is Active.When importing resources, this attribute will not be imported. If this attribute is set, please use lifecycle and ignoreChanges ignore changes in fields. */ readonly securityEnhancementStrategy: pulumi.Output<string | undefined>; /** * The security group ID set of primary networkInterface. */ readonly securityGroupIds: pulumi.Output<string[]>; /** * The maximum hourly price for spot instances supports up to three decimal places. This parameter only takes effect when SpotStrategy=SpotWithPriceLimit. */ readonly spotPriceLimit: pulumi.Output<number | undefined>; /** * The spot strategy will autoremove instance in some conditions.Please make sure you can maintain instance lifecycle before auto remove.The spot strategy of ECS instance, values: * NoSpot (default): indicates creating a normal pay-as-you-go instance. * SpotAsPriceGo: spot instance with system automatically bidding and following the current market price. * SpotWithPriceLimit: spot instance with a set upper limit for bidding price. */ readonly spotStrategy: pulumi.Output<string>; /** * The status of ECS instance. */ readonly status: pulumi.Output<string>; /** * The stop mode of ECS instance. */ readonly stoppedMode: pulumi.Output<string>; /** * The subnet ID of primary networkInterface. */ readonly subnetId: pulumi.Output<string>; /** * The ID of system volume. */ readonly systemVolumeId: pulumi.Output<string>; /** * The size of system volume. The value range of the system volume size is ESSD_PL0: 20~2048, ESSD_FlexPL: 20~2048, PTSSD: 10~500. */ readonly systemVolumeSize: pulumi.Output<number>; /** * The type of system volume, the value is `PTSSD` or `ESSD_PL0` or `ESSD_PL1` or `ESSD_PL2` or `ESSD_FlexPL`. */ readonly systemVolumeType: pulumi.Output<string>; /** * Tags. */ readonly tags: pulumi.Output<outputs.ecs.InstanceTag[] | undefined>; /** * The update time of ECS instance. */ readonly updatedAt: pulumi.Output<string>; /** * The user data of ECS instance, this field must be encrypted with base64. */ readonly userData: pulumi.Output<string>; /** * The VPC ID of ECS instance. */ readonly vpcId: pulumi.Output<string>; /** * The available zone ID of ECS instance. */ readonly zoneId: pulumi.Output<string>; /** * Create a Instance resource with the given unique name, arguments, and options. * * @param name The _unique_ name of the resource. * @param args The arguments to use to populate this resource's properties. * @param opts A bag of options that control this resource's behavior. */ constructor(name: string, args: InstanceArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering Instance resources. */ export interface InstanceState { /** * The auto renew flag of ECS instance.Only effective when instanceChargeType is PrePaid. Default is true.When importing resources, this attribute will not be imported. If this attribute is set, please use lifecycle and ignoreChanges ignore changes in fields. */ autoRenew?: pulumi.Input<boolean>; /** * The auto renew period of ECS instance.Only effective when instanceChargeType is PrePaid. Default is 1.When importing resources, this attribute will not be imported. If this attribute is set, please use lifecycle and ignoreChanges ignore changes in fields. */ autoRenewPeriod?: pulumi.Input<number>; /** * The option of cpu,only support for ebm. */ cpuOptions?: pulumi.Input<inputs.ecs.InstanceCpuOptions>; /** * The number of ECS instance CPU cores. */ cpus?: pulumi.Input<number>; /** * The create time of ECS instance. */ createdAt?: pulumi.Input<string>; /** * The data volumes collection of ECS instance. */ dataVolumes?: pulumi.Input<pulumi.Input<inputs.ecs.InstanceDataVolume>[]>; /** * The ID of Ecs Deployment Set. This field only used to associate a deployment set to the ECS instance. Setting this field to null means disassociating the instance from the deployment set. * The current deployment set id of the ECS instance is the `deploymentSetIdComputed` field. */ deploymentSetId?: pulumi.Input<string>; /** * The ID of Ecs Deployment Set. Computed field. */ deploymentSetIdComputed?: pulumi.Input<string>; /** * The description of ECS instance. */ description?: pulumi.Input<string>; /** * The config of the eip which will be automatically created and assigned to this instance. `Prepaid` type eip cannot be created in this way, please use `volcengine.eip.Address`. * When importing resources, this attribute will not be imported. If this attribute is set, please use lifecycle and ignoreChanges ignore changes in fields. */ eipAddress?: pulumi.Input<inputs.ecs.InstanceEipAddress>; /** * The id of an existing Available EIP which will be automatically assigned to this instance. * It is not recommended to use this field, it is recommended to use `volcengine.eip.Associate` resource to bind EIP. */ eipId?: pulumi.Input<string>; /** * The GPU device info of Instance. */ gpuDevices?: pulumi.Input<pulumi.Input<inputs.ecs.InstanceGpuDevice>[]>; /** * The host name of ECS instance. */ hostName?: pulumi.Input<string>; /** * The hpc cluster ID of ECS instance. */ hpcClusterId?: pulumi.Input<string>; /** * The Image ID of ECS instance. */ imageId?: pulumi.Input<string>; /** * The include data volumes flag of ECS instance.Only effective when change instance charge type.include_data_volumes. */ includeDataVolumes?: pulumi.Input<boolean>; /** * The charge type of ECS instance, the value can be `PrePaid` or `PostPaid`. */ instanceChargeType?: pulumi.Input<string>; /** * The ID of ECS instance. */ instanceId?: pulumi.Input<string>; /** * The name of ECS instance. */ instanceName?: pulumi.Input<string>; /** * The instance type of ECS instance. */ instanceType?: pulumi.Input<string>; /** * The number of IPv6 addresses to be automatically assigned from within the CIDR block of the subnet that hosts the ENI. Valid values: 1 to 10. */ ipv6AddressCount?: pulumi.Input<number>; /** * One or more IPv6 addresses selected from within the CIDR block of the subnet that hosts the ENI. Support up to 10. * You cannot specify both the ipv6Addresses and ipv6AddressCount parameters. */ ipv6Addresses?: pulumi.Input<pulumi.Input<string>[]>; /** * The Flag of GPU instance.If the instance is GPU,The flag is true. */ isGpu?: pulumi.Input<boolean>; /** * Whether to keep the mirror settings. Only custom images and shared images support this field. * When the value of this field is true, the Password and KeyPairName cannot be specified. * When importing resources, this attribute will not be imported. If this attribute is set, please use lifecycle and ignoreChanges ignore changes in fields. */ keepImageCredential?: pulumi.Input<boolean>; /** * The ssh key ID of ECS instance. */ keyPairId?: pulumi.Input<string>; /** * The ssh key name of ECS instance. This field can be modified only when the `imageId` is modified. */ keyPairName?: pulumi.Input<string>; /** * The memory size of ECS instance. */ memorySize?: pulumi.Input<number>; /** * The ID of primary networkInterface. */ networkInterfaceId?: pulumi.Input<string>; /** * The os name of ECS instance. */ osName?: pulumi.Input<string>; /** * The os type of ECS instance. */ osType?: pulumi.Input<string>; /** * The password of ECS instance. */ password?: pulumi.Input<string>; /** * The period of ECS instance.Only effective when instanceChargeType is PrePaid. Default is 12. Unit is Month. */ period?: pulumi.Input<number>; /** * The private ip address of primary networkInterface. */ primaryIpAddress?: pulumi.Input<string>; /** * The ProjectName of the ecs instance. */ projectName?: pulumi.Input<string>; /** * The secondary networkInterface detail collection of ECS instance. */ secondaryNetworkInterfaces?: pulumi.Input<pulumi.Input<inputs.ecs.InstanceSecondaryNetworkInterface>[]>; /** * The security enhancement strategy of ECS instance. The value can be Active or InActive. Default is Active.When importing resources, this attribute will not be imported. If this attribute is set, please use lifecycle and ignoreChanges ignore changes in fields. */ securityEnhancementStrategy?: pulumi.Input<string>; /** * The security group ID set of primary networkInterface. */ securityGroupIds?: pulumi.Input<pulumi.Input<string>[]>; /** * The maximum hourly price for spot instances supports up to three decimal places. This parameter only takes effect when SpotStrategy=SpotWithPriceLimit. */ spotPriceLimit?: pulumi.Input<number>; /** * The spot strategy will autoremove instance in some conditions.Please make sure you can maintain instance lifecycle before auto remove.The spot strategy of ECS instance, values: * NoSpot (default): indicates creating a normal pay-as-you-go instance. * SpotAsPriceGo: spot instance with system automatically bidding and following the current market price. * SpotWithPriceLimit: spot instance with a set upper limit for bidding price. */ spotStrategy?: pulumi.Input<string>; /** * The status of ECS instance. */ status?: pulumi.Input<string>; /** * The stop mode of ECS instance. */ stoppedMode?: pulumi.Input<string>; /** * The subnet ID of primary networkInterface. */ subnetId?: pulumi.Input<string>; /** * The ID of system volume. */ systemVolumeId?: pulumi.Input<string>; /** * The size of system volume. The value range of the system volume size is ESSD_PL0: 20~2048, ESSD_FlexPL: 20~2048, PTSSD: 10~500. */ systemVolumeSize?: pulumi.Input<number>; /** * The type of system volume, the value is `PTSSD` or `ESSD_PL0` or `ESSD_PL1` or `ESSD_PL2` or `ESSD_FlexPL`. */ systemVolumeType?: pulumi.Input<string>; /** * Tags. */ tags?: pulumi.Input<pulumi.Input<inputs.ecs.InstanceTag>[]>; /** * The update time of ECS instance. */ updatedAt?: pulumi.Input<string>; /** * The user data of ECS instance, this field must be encrypted with base64. */ userData?: pulumi.Input<string>; /** * The VPC ID of ECS instance. */ vpcId?: pulumi.Input<string>; /** * The available zone ID of ECS instance. */ zoneId?: pulumi.Input<string>; } /** * The set of arguments for constructing a Instance resource. */ export interface InstanceArgs { /** * The auto renew flag of ECS instance.Only effective when instanceChargeType is PrePaid. Default is true.When importing resources, this attribute will not be imported. If this attribute is set, please use lifecycle and ignoreChanges ignore changes in fields. */ autoRenew?: pulumi.Input<boolean>; /** * The auto renew period of ECS instance.Only effective when instanceChargeType is PrePaid. Default is 1.When importing resources, this attribute will not be imported. If this attribute is set, please use lifecycle and ignoreChanges ignore changes in fields. */ autoRenewPeriod?: pulumi.Input<number>; /** * The option of cpu,only support for ebm. */ cpuOptions?: pulumi.Input<inputs.ecs.InstanceCpuOptions>; /** * The data volumes collection of ECS instance. */ dataVolumes?: pulumi.Input<pulumi.Input<inputs.ecs.InstanceDataVolume>[]>; /** * The ID of Ecs Deployment Set. This field only used to associate a deployment set to the ECS instance. Setting this field to null means disassociating the instance from the deployment set. * The current deployment set id of the ECS instance is the `deploymentSetIdComputed` field. */ deploymentSetId?: pulumi.Input<string>; /** * The description of ECS instance. */ description?: pulumi.Input<string>; /** * The config of the eip which will be automatically created and assigned to this instance. `Prepaid` type eip cannot be created in this way, please use `volcengine.eip.Address`. * When importing resources, this attribute will not be imported. If this attribute is set, please use lifecycle and ignoreChanges ignore changes in fields. */ eipAddress?: pulumi.Input<inputs.ecs.InstanceEipAddress>; /** * The id of an existing Available EIP which will be automatically assigned to this instance. * It is not recommended to use this field, it is recommended to use `volcengine.eip.Associate` resource to bind EIP. */ eipId?: pulumi.Input<string>; /** * The host name of ECS instance. */ hostName?: pulumi.Input<string>; /** * The hpc cluster ID of ECS instance. */ hpcClusterId?: pulumi.Input<string>; /** * The Image ID of ECS instance. */ imageId: pulumi.Input<string>; /** * The include data volumes flag of ECS instance.Only effective when change instance charge type.include_data_volumes. */ includeDataVolumes?: pulumi.Input<boolean>; /** * The charge type of ECS instance, the value can be `PrePaid` or `PostPaid`. */ instanceChargeType?: pulumi.Input<string>; /** * The name of ECS instance. */ instanceName?: pulumi.Input<string>; /** * The instance type of ECS instance. */ instanceType: pulumi.Input<string>; /** * The number of IPv6 addresses to be automatically assigned from within the CIDR block of the subnet that hosts the ENI. Valid values: 1 to 10. */ ipv6AddressCount?: pulumi.Input<number>; /** * One or more IPv6 addresses selected from within the CIDR block of the subnet that hosts the ENI. Support up to 10. * You cannot specify both the ipv6Addresses and ipv6AddressCount parameters. */ ipv6Addresses?: pulumi.Input<pulumi.Input<string>[]>; /** * Whether to keep the mirror settings. Only custom images and shared images support this field. * When the value of this field is true, the Password and KeyPairName cannot be specified. * When importing resources, this attribute will not be imported. If this attribute is set, please use lifecycle and ignoreChanges ignore changes in fields. */ keepImageCredential?: pulumi.Input<boolean>; /** * The ssh key name of ECS instance. This field can be modified only when the `imageId` is modified. */ keyPairName?: pulumi.Input<string>; /** * The password of ECS instance. */ password?: pulumi.Input<string>; /** * The period of ECS instance.Only effective when instanceChargeType is PrePaid. Default is 12. Unit is Month. */ period?: pulumi.Input<number>; /** * The private ip address of primary networkInterface. */ primaryIpAddress?: pulumi.Input<string>; /** * The ProjectName of the ecs instance. */ projectName?: pulumi.Input<string>; /** * The secondary networkInterface detail collection of ECS instance. */ secondaryNetworkInterfaces?: pulumi.Input<pulumi.Input<inputs.ecs.InstanceSecondaryNetworkInterface>[]>; /** * The security enhancement strategy of ECS instance. The value can be Active or InActive. Default is Active.When importing resources, this attribute will not be imported. If this attribute is set, please use lifecycle and ignoreChanges ignore changes in fields. */ securityEnhancementStrategy?: pulumi.Input<string>; /** * The security group ID set of primary networkInterface. */ securityGroupIds: pulumi.Input<pulumi.Input<string>[]>; /** * The maximum hourly price for spot instances supports up to three decimal places. This parameter only takes effect when SpotStrategy=SpotWithPriceLimit. */ spotPriceLimit?: pulumi.Input<number>; /** * The spot strategy will autoremove instance in some conditions.Please make sure you can maintain instance lifecycle before auto remove.The spot strategy of ECS instance, values: * NoSpot (default): indicates creating a normal pay-as-you-go instance. * SpotAsPriceGo: spot instance with system automatically bidding and following the current market price. * SpotWithPriceLimit: spot instance with a set upper limit for bidding price. */ spotStrategy?: pulumi.Input<string>; /** * The subnet ID of primary networkInterface. */ subnetId: pulumi.Input<string>; /** * The size of system volume. The value range of the system volume size is ESSD_PL0: 20~2048, ESSD_FlexPL: 20~2048, PTSSD: 10~500. */ systemVolumeSize: pulumi.Input<number>; /** * The type of system volume, the value is `PTSSD` or `ESSD_PL0` or `ESSD_PL1` or `ESSD_PL2` or `ESSD_FlexPL`. */ systemVolumeType: pulumi.Input<string>; /** * Tags. */ tags?: pulumi.Input<pulumi.Input<inputs.ecs.InstanceTag>[]>; /** * The user data of ECS instance, this field must be encrypted with base64. */ userData?: pulumi.Input<string>; /** * The available zone ID of ECS instance. */ zoneId?: pulumi.Input<string>; }