UNPKG

@huaweicloudos/pulumi

Version:

A Pulumi package for creating and managing Huaweicloud cloud resources.

174 lines (173 loc) 6.33 kB
import * as pulumi from "@pulumi/pulumi"; /** * Attaches a volume to an ECS Instance. * * ## Example Usage * ### Basic attachment of a single volume to a single instance * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as pulumi from "@huaweicloudos/pulumi"; * * const config = new pulumi.Config(); * const securityGroupId = config.requireObject("securityGroupId"); * const myvol = new huaweicloud.evs.Volume("myvol", { * availabilityZone: "cn-north-4a", * volumeType: "SAS", * size: 10, * }); * const myinstance = new huaweicloud.ecs.Instance("myinstance", { * imageId: "ad091b52-742f-469e-8f3c-fd81cadf0743", * flavorId: "s6.small.1", * keyPair: "my_key_pair_name", * securityGroupIds: [securityGroupId], * availabilityZone: "cn-north-4a", * networks: [{ * uuid: "55534eaa-533a-419d-9b40-ec427ea7195a", * }], * }); * const attached = new huaweicloud.ecs.VolumeAttach("attached", { * instanceId: myinstance.id, * volumeId: myvol.id, * }); * ``` * ### Attaching multiple volumes to a single instance * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as pulumi from "@huaweicloudos/pulumi"; * * export = async () => { * const config = new pulumi.Config(); * const securityGroupId = config.requireObject("securityGroupId"); * const myvol: huaweicloud.evs.Volume[]; * for (const range = {value: 0}; range.value < 2; range.value++) { * myvol.push(new huaweicloud.evs.Volume(`myvol-${range.value}`, { * availabilityZone: "cn-north-4a", * volumeType: "SAS", * size: 10, * })); * } * const myinstance = new huaweicloud.ecs.Instance("myinstance", { * imageId: "ad091b52-742f-469e-8f3c-fd81cadf0743", * flavorId: "s6.small.1", * keyPair: "my_key_pair_name", * securityGroupIds: [securityGroupId], * availabilityZone: "cn-north-4a", * }); * const attachments: huaweicloud.ecs.VolumeAttach[]; * for (const range = {value: 0}; range.value < 2; range.value++) { * attachments.push(new huaweicloud.ecs.VolumeAttach(`attachments-${range.value}`, { * instanceId: myinstance.id, * volumeId: myvol.map(__item => __item.id)[range.value], * })); * } * const volume_devices = attachments.map(__item => __item.device); * return { * "volume devices": volume_devices, * }; * } * ``` * * ## Import * * Volume Attachments can be imported using the Instance ID and Volume ID separated by a slash, e.g. * * ```sh * $ pulumi import huaweicloud:Ecs/volumeAttach:VolumeAttach va_1 89c60255-9bd6-460c-822a-e2b959ede9d2/45670584-225f-46c3-b33e-6707b589b666 * ``` */ export declare class VolumeAttach extends pulumi.CustomResource { /** * Get an existing VolumeAttach 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?: VolumeAttachState, opts?: pulumi.CustomResourceOptions): VolumeAttach; /** * Returns true if the given object is an instance of VolumeAttach. 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 VolumeAttach; /** * Specifies the device of the volume attachment (ex: `/dev/vdc`). */ readonly device: pulumi.Output<string>; /** * Specifies the ID of the Instance to attach the Volume to. */ readonly instanceId: pulumi.Output<string>; /** * PCI address of the block device. */ readonly pciAddress: pulumi.Output<string>; /** * Specifies the region in which to create the volume resource. If omitted, the * provider-level region will be used. Changing this creates a new resource. */ readonly region: pulumi.Output<string>; /** * Specifies the ID of the Volume to attach to an Instance. */ readonly volumeId: pulumi.Output<string>; /** * Create a VolumeAttach 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: VolumeAttachArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering VolumeAttach resources. */ export interface VolumeAttachState { /** * Specifies the device of the volume attachment (ex: `/dev/vdc`). */ device?: pulumi.Input<string>; /** * Specifies the ID of the Instance to attach the Volume to. */ instanceId?: pulumi.Input<string>; /** * PCI address of the block device. */ pciAddress?: pulumi.Input<string>; /** * Specifies the region in which to create the volume resource. If omitted, the * provider-level region will be used. Changing this creates a new resource. */ region?: pulumi.Input<string>; /** * Specifies the ID of the Volume to attach to an Instance. */ volumeId?: pulumi.Input<string>; } /** * The set of arguments for constructing a VolumeAttach resource. */ export interface VolumeAttachArgs { /** * Specifies the device of the volume attachment (ex: `/dev/vdc`). */ device?: pulumi.Input<string>; /** * Specifies the ID of the Instance to attach the Volume to. */ instanceId: pulumi.Input<string>; /** * Specifies the region in which to create the volume resource. If omitted, the * provider-level region will be used. Changing this creates a new resource. */ region?: pulumi.Input<string>; /** * Specifies the ID of the Volume to attach to an Instance. */ volumeId: pulumi.Input<string>; }