"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! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.VolumeAttachment = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
 * Attaches an Amazon EBS volume to a running instance and exposes it to the instance with the specified device name.
 *  Before this resource can be deleted (and therefore the volume detached), you must first unmount the volume in the instance. Failure to do so results in the volume being stuck in the busy state while it is trying to detach, which could possibly damage the file system or the data it contains.
 *  If an Amazon EBS volume is the root device of an instance, it cannot be detached while the instance is in the "running" state. To detach the root volume, stop the instance first.
 *  If the root volume is detached from an instance with an MKT product code, then the product codes from that volume are no longer associated with the instance.
 */
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 opts Optional settings to control the behavior of the CustomResource.
     */
    static get(name, id, opts) {
        return new VolumeAttachment(name, undefined, { ...opts, id: id });
    }
    /**
     * 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;
    }
    /**
     * 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, args, opts) {
        let resourceInputs = {};
        opts = opts || {};
        if (!opts.id) {
            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["device"] = args?.device;
            resourceInputs["ebsCardIndex"] = args?.ebsCardIndex;
            resourceInputs["instanceId"] = args?.instanceId;
            resourceInputs["volumeId"] = args?.volumeId;
        }
        else {
            resourceInputs["device"] = undefined /*out*/;
            resourceInputs["ebsCardIndex"] = undefined /*out*/;
            resourceInputs["instanceId"] = undefined /*out*/;
            resourceInputs["volumeId"] = undefined /*out*/;
        }
        opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
        const replaceOnChanges = { replaceOnChanges: ["device", "ebsCardIndex", "instanceId", "volumeId"] };
        opts = pulumi.mergeOptions(opts, replaceOnChanges);
        super(VolumeAttachment.__pulumiType, name, resourceInputs, opts);
    }
}
exports.VolumeAttachment = VolumeAttachment;
/** @internal */
VolumeAttachment.__pulumiType = 'aws-native:ec2:VolumeAttachment';
//# sourceMappingURL=volumeAttachment.js.map