"use strict";
// *** WARNING: this file was generated by pulumi-language-nodejs. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    var desc = Object.getOwnPropertyDescriptor(m, k);
    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
      desc = { enumerable: true, get: function() { return m[k]; } };
    }
    Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
    __setModuleDefault(result, mod);
    return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.VolumeAttachment = void 0;
const pulumi = __importStar(require("@pulumi/pulumi"));
const utilities = __importStar(require("../utilities"));
/**
 * 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
 * ```
 */
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, id, state, opts) {
        return new VolumeAttachment(name, state, { ...opts, id: id });
    }
    /** @internal */
    static __pulumiType = 'aws:ec2/volumeAttachment: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) {
        if (obj === undefined || obj === null) {
            return false;
        }
        return obj['__pulumiType'] === VolumeAttachment.__pulumiType;
    }
    constructor(name, argsOrState, opts) {
        let resourceInputs = {};
        opts = opts || {};
        if (opts.id) {
            const state = argsOrState;
            resourceInputs["deviceName"] = state?.deviceName;
            resourceInputs["forceDetach"] = state?.forceDetach;
            resourceInputs["instanceId"] = state?.instanceId;
            resourceInputs["region"] = state?.region;
            resourceInputs["skipDestroy"] = state?.skipDestroy;
            resourceInputs["stopInstanceBeforeDetaching"] = state?.stopInstanceBeforeDetaching;
            resourceInputs["volumeId"] = state?.volumeId;
        }
        else {
            const args = argsOrState;
            if (args?.deviceName === undefined && !opts.urn) {
                throw new Error("Missing required property 'deviceName'");
            }
            if (args?.instanceId === undefined && !opts.urn) {
                throw new Error("Missing required property 'instanceId'");
            }
            if (args?.volumeId === undefined && !opts.urn) {
                throw new Error("Missing required property 'volumeId'");
            }
            resourceInputs["deviceName"] = args?.deviceName;
            resourceInputs["forceDetach"] = args?.forceDetach;
            resourceInputs["instanceId"] = args?.instanceId;
            resourceInputs["region"] = args?.region;
            resourceInputs["skipDestroy"] = args?.skipDestroy;
            resourceInputs["stopInstanceBeforeDetaching"] = args?.stopInstanceBeforeDetaching;
            resourceInputs["volumeId"] = args?.volumeId;
        }
        opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
        super(VolumeAttachment.__pulumiType, name, resourceInputs, opts);
    }
}
exports.VolumeAttachment = VolumeAttachment;
//# sourceMappingURL=volumeAttachment.js.map