UNPKG

@pulumi/aws

Version:

A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.

187 lines (186 loc) 8.84 kB
import * as pulumi from "@pulumi/pulumi"; /** * Provides an AWS EBS Volume Attachment as a top level resource, to attach and * detach volumes from AWS Instances. * * > **NOTE on EBS block devices:** If you use `ebsBlockDevice` on an `aws.ec2.Instance`, this provider will assume management over the full set of non-root EBS block devices for the instance, and treats additional block devices as drift. For this reason, `ebsBlockDevice` cannot be mixed with external `aws.ebs.Volume` + `aws.ec2.VolumeAttachment` resources for a given instance. * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const web = new aws.ec2.Instance("web", { * ami: "ami-21f78e11", * availabilityZone: "us-west-2a", * instanceType: aws.ec2.InstanceType.T2_Micro, * tags: { * Name: "HelloWorld", * }, * }); * const example = new aws.ebs.Volume("example", { * availabilityZone: "us-west-2a", * size: 1, * }); * const ebsAtt = new aws.ec2.VolumeAttachment("ebs_att", { * deviceName: "/dev/sdh", * volumeId: example.id, * instanceId: web.id, * }); * ``` * * ## Import * * Using `pulumi import`, import EBS Volume Attachments using `DEVICE_NAME:VOLUME_ID:INSTANCE_ID`. For example: * * ```sh * $ pulumi import aws:ec2/volumeAttachment:VolumeAttachment example /dev/sdh:vol-049df61146c4d7901:i-12345678 * ``` */ export declare class VolumeAttachment extends pulumi.CustomResource { /** * Get an existing VolumeAttachment 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?: VolumeAttachmentState, opts?: pulumi.CustomResourceOptions): VolumeAttachment; /** * Returns true if the given object is an instance of VolumeAttachment. 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 VolumeAttachment; /** * The device name to expose to the instance (for * example, `/dev/sdh` or `xvdh`). See [Device Naming on Linux Instances](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/device_naming.html#available-ec2-device-names) and [Device Naming on Windows Instances](https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/device_naming.html#available-ec2-device-names) for more information. */ readonly deviceName: pulumi.Output<string>; /** * Set to `true` if you want to force the * volume to detach. Useful if previous attempts failed, but use this option only * as a last resort, as this can result in **data loss**. See * [Detaching an Amazon EBS Volume from an Instance](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-detaching-volume.html) for more information. */ readonly forceDetach: pulumi.Output<boolean | undefined>; /** * ID of the Instance to attach to */ readonly instanceId: pulumi.Output<string>; /** * Region where this resource will be [managed](https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints). Defaults to the Region set in the provider configuration. */ readonly region: pulumi.Output<string>; /** * Set this to true if you do not wish * to detach the volume from the instance to which it is attached at destroy * time, and instead just remove the attachment from this provider state. This is * useful when destroying an instance which has volumes created by some other * means attached. */ readonly skipDestroy: pulumi.Output<boolean | undefined>; /** * Set this to true to ensure that the target instance is stopped * before trying to detach the volume. Stops the instance, if it is not already stopped. */ readonly stopInstanceBeforeDetaching: pulumi.Output<boolean | undefined>; /** * ID of the Volume to be attached */ readonly volumeId: pulumi.Output<string>; /** * Create a VolumeAttachment 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: VolumeAttachmentArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering VolumeAttachment resources. */ export interface VolumeAttachmentState { /** * The device name to expose to the instance (for * example, `/dev/sdh` or `xvdh`). See [Device Naming on Linux Instances](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/device_naming.html#available-ec2-device-names) and [Device Naming on Windows Instances](https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/device_naming.html#available-ec2-device-names) for more information. */ deviceName?: pulumi.Input<string>; /** * Set to `true` if you want to force the * volume to detach. Useful if previous attempts failed, but use this option only * as a last resort, as this can result in **data loss**. See * [Detaching an Amazon EBS Volume from an Instance](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-detaching-volume.html) for more information. */ forceDetach?: pulumi.Input<boolean>; /** * ID of the Instance to attach to */ instanceId?: pulumi.Input<string>; /** * Region where this resource will be [managed](https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints). Defaults to the Region set in the provider configuration. */ region?: pulumi.Input<string>; /** * Set this to true if you do not wish * to detach the volume from the instance to which it is attached at destroy * time, and instead just remove the attachment from this provider state. This is * useful when destroying an instance which has volumes created by some other * means attached. */ skipDestroy?: pulumi.Input<boolean>; /** * Set this to true to ensure that the target instance is stopped * before trying to detach the volume. Stops the instance, if it is not already stopped. */ stopInstanceBeforeDetaching?: pulumi.Input<boolean>; /** * ID of the Volume to be attached */ volumeId?: pulumi.Input<string>; } /** * The set of arguments for constructing a VolumeAttachment resource. */ export interface VolumeAttachmentArgs { /** * The device name to expose to the instance (for * example, `/dev/sdh` or `xvdh`). See [Device Naming on Linux Instances](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/device_naming.html#available-ec2-device-names) and [Device Naming on Windows Instances](https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/device_naming.html#available-ec2-device-names) for more information. */ deviceName: pulumi.Input<string>; /** * Set to `true` if you want to force the * volume to detach. Useful if previous attempts failed, but use this option only * as a last resort, as this can result in **data loss**. See * [Detaching an Amazon EBS Volume from an Instance](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-detaching-volume.html) for more information. */ forceDetach?: pulumi.Input<boolean>; /** * ID of the Instance to attach to */ instanceId: pulumi.Input<string>; /** * Region where this resource will be [managed](https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints). Defaults to the Region set in the provider configuration. */ region?: pulumi.Input<string>; /** * Set this to true if you do not wish * to detach the volume from the instance to which it is attached at destroy * time, and instead just remove the attachment from this provider state. This is * useful when destroying an instance which has volumes created by some other * means attached. */ skipDestroy?: pulumi.Input<boolean>; /** * Set this to true to ensure that the target instance is stopped * before trying to detach the volume. Stops the instance, if it is not already stopped. */ stopInstanceBeforeDetaching?: pulumi.Input<boolean>; /** * ID of the Volume to be attached */ volumeId: pulumi.Input<string>; }