@volcengine/pulumi
Version:
A Pulumi package for creating and managing volcengine cloud resources.
252 lines • 13.9 kB
JavaScript
;
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.Instance = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* ## 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
* ```
*/
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, id, state, opts) {
return new Instance(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* 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) {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === Instance.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["autoRenew"] = state ? state.autoRenew : undefined;
resourceInputs["autoRenewPeriod"] = state ? state.autoRenewPeriod : undefined;
resourceInputs["cpuOptions"] = state ? state.cpuOptions : undefined;
resourceInputs["cpus"] = state ? state.cpus : undefined;
resourceInputs["createdAt"] = state ? state.createdAt : undefined;
resourceInputs["dataVolumes"] = state ? state.dataVolumes : undefined;
resourceInputs["deploymentSetId"] = state ? state.deploymentSetId : undefined;
resourceInputs["deploymentSetIdComputed"] = state ? state.deploymentSetIdComputed : undefined;
resourceInputs["description"] = state ? state.description : undefined;
resourceInputs["eipAddress"] = state ? state.eipAddress : undefined;
resourceInputs["eipId"] = state ? state.eipId : undefined;
resourceInputs["gpuDevices"] = state ? state.gpuDevices : undefined;
resourceInputs["hostName"] = state ? state.hostName : undefined;
resourceInputs["hpcClusterId"] = state ? state.hpcClusterId : undefined;
resourceInputs["imageId"] = state ? state.imageId : undefined;
resourceInputs["includeDataVolumes"] = state ? state.includeDataVolumes : undefined;
resourceInputs["instanceChargeType"] = state ? state.instanceChargeType : undefined;
resourceInputs["instanceId"] = state ? state.instanceId : undefined;
resourceInputs["instanceName"] = state ? state.instanceName : undefined;
resourceInputs["instanceType"] = state ? state.instanceType : undefined;
resourceInputs["ipv6AddressCount"] = state ? state.ipv6AddressCount : undefined;
resourceInputs["ipv6Addresses"] = state ? state.ipv6Addresses : undefined;
resourceInputs["isGpu"] = state ? state.isGpu : undefined;
resourceInputs["keepImageCredential"] = state ? state.keepImageCredential : undefined;
resourceInputs["keyPairId"] = state ? state.keyPairId : undefined;
resourceInputs["keyPairName"] = state ? state.keyPairName : undefined;
resourceInputs["memorySize"] = state ? state.memorySize : undefined;
resourceInputs["networkInterfaceId"] = state ? state.networkInterfaceId : undefined;
resourceInputs["osName"] = state ? state.osName : undefined;
resourceInputs["osType"] = state ? state.osType : undefined;
resourceInputs["password"] = state ? state.password : undefined;
resourceInputs["period"] = state ? state.period : undefined;
resourceInputs["primaryIpAddress"] = state ? state.primaryIpAddress : undefined;
resourceInputs["projectName"] = state ? state.projectName : undefined;
resourceInputs["secondaryNetworkInterfaces"] = state ? state.secondaryNetworkInterfaces : undefined;
resourceInputs["securityEnhancementStrategy"] = state ? state.securityEnhancementStrategy : undefined;
resourceInputs["securityGroupIds"] = state ? state.securityGroupIds : undefined;
resourceInputs["spotPriceLimit"] = state ? state.spotPriceLimit : undefined;
resourceInputs["spotStrategy"] = state ? state.spotStrategy : undefined;
resourceInputs["status"] = state ? state.status : undefined;
resourceInputs["stoppedMode"] = state ? state.stoppedMode : undefined;
resourceInputs["subnetId"] = state ? state.subnetId : undefined;
resourceInputs["systemVolumeId"] = state ? state.systemVolumeId : undefined;
resourceInputs["systemVolumeSize"] = state ? state.systemVolumeSize : undefined;
resourceInputs["systemVolumeType"] = state ? state.systemVolumeType : undefined;
resourceInputs["tags"] = state ? state.tags : undefined;
resourceInputs["updatedAt"] = state ? state.updatedAt : undefined;
resourceInputs["userData"] = state ? state.userData : undefined;
resourceInputs["vpcId"] = state ? state.vpcId : undefined;
resourceInputs["zoneId"] = state ? state.zoneId : undefined;
}
else {
const args = argsOrState;
if ((!args || args.imageId === undefined) && !opts.urn) {
throw new Error("Missing required property 'imageId'");
}
if ((!args || args.instanceType === undefined) && !opts.urn) {
throw new Error("Missing required property 'instanceType'");
}
if ((!args || args.securityGroupIds === undefined) && !opts.urn) {
throw new Error("Missing required property 'securityGroupIds'");
}
if ((!args || args.subnetId === undefined) && !opts.urn) {
throw new Error("Missing required property 'subnetId'");
}
if ((!args || args.systemVolumeSize === undefined) && !opts.urn) {
throw new Error("Missing required property 'systemVolumeSize'");
}
if ((!args || args.systemVolumeType === undefined) && !opts.urn) {
throw new Error("Missing required property 'systemVolumeType'");
}
resourceInputs["autoRenew"] = args ? args.autoRenew : undefined;
resourceInputs["autoRenewPeriod"] = args ? args.autoRenewPeriod : undefined;
resourceInputs["cpuOptions"] = args ? args.cpuOptions : undefined;
resourceInputs["dataVolumes"] = args ? args.dataVolumes : undefined;
resourceInputs["deploymentSetId"] = args ? args.deploymentSetId : undefined;
resourceInputs["description"] = args ? args.description : undefined;
resourceInputs["eipAddress"] = args ? args.eipAddress : undefined;
resourceInputs["eipId"] = args ? args.eipId : undefined;
resourceInputs["hostName"] = args ? args.hostName : undefined;
resourceInputs["hpcClusterId"] = args ? args.hpcClusterId : undefined;
resourceInputs["imageId"] = args ? args.imageId : undefined;
resourceInputs["includeDataVolumes"] = args ? args.includeDataVolumes : undefined;
resourceInputs["instanceChargeType"] = args ? args.instanceChargeType : undefined;
resourceInputs["instanceName"] = args ? args.instanceName : undefined;
resourceInputs["instanceType"] = args ? args.instanceType : undefined;
resourceInputs["ipv6AddressCount"] = args ? args.ipv6AddressCount : undefined;
resourceInputs["ipv6Addresses"] = args ? args.ipv6Addresses : undefined;
resourceInputs["keepImageCredential"] = args ? args.keepImageCredential : undefined;
resourceInputs["keyPairName"] = args ? args.keyPairName : undefined;
resourceInputs["password"] = (args === null || args === void 0 ? void 0 : args.password) ? pulumi.secret(args.password) : undefined;
resourceInputs["period"] = args ? args.period : undefined;
resourceInputs["primaryIpAddress"] = args ? args.primaryIpAddress : undefined;
resourceInputs["projectName"] = args ? args.projectName : undefined;
resourceInputs["secondaryNetworkInterfaces"] = args ? args.secondaryNetworkInterfaces : undefined;
resourceInputs["securityEnhancementStrategy"] = args ? args.securityEnhancementStrategy : undefined;
resourceInputs["securityGroupIds"] = args ? args.securityGroupIds : undefined;
resourceInputs["spotPriceLimit"] = args ? args.spotPriceLimit : undefined;
resourceInputs["spotStrategy"] = args ? args.spotStrategy : undefined;
resourceInputs["subnetId"] = args ? args.subnetId : undefined;
resourceInputs["systemVolumeSize"] = args ? args.systemVolumeSize : undefined;
resourceInputs["systemVolumeType"] = args ? args.systemVolumeType : undefined;
resourceInputs["tags"] = args ? args.tags : undefined;
resourceInputs["userData"] = args ? args.userData : undefined;
resourceInputs["zoneId"] = args ? args.zoneId : undefined;
resourceInputs["cpus"] = undefined /*out*/;
resourceInputs["createdAt"] = undefined /*out*/;
resourceInputs["deploymentSetIdComputed"] = undefined /*out*/;
resourceInputs["gpuDevices"] = undefined /*out*/;
resourceInputs["instanceId"] = undefined /*out*/;
resourceInputs["isGpu"] = undefined /*out*/;
resourceInputs["keyPairId"] = undefined /*out*/;
resourceInputs["memorySize"] = undefined /*out*/;
resourceInputs["networkInterfaceId"] = undefined /*out*/;
resourceInputs["osName"] = undefined /*out*/;
resourceInputs["osType"] = undefined /*out*/;
resourceInputs["status"] = undefined /*out*/;
resourceInputs["stoppedMode"] = undefined /*out*/;
resourceInputs["systemVolumeId"] = undefined /*out*/;
resourceInputs["updatedAt"] = undefined /*out*/;
resourceInputs["vpcId"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
const secretOpts = { additionalSecretOutputs: ["password"] };
opts = pulumi.mergeOptions(opts, secretOpts);
super(Instance.__pulumiType, name, resourceInputs, opts);
}
}
exports.Instance = Instance;
/** @internal */
Instance.__pulumiType = 'volcengine:ecs/instance:Instance';
//# sourceMappingURL=instance.js.map