// *** 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! ***

using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Threading.Tasks;
using Pulumi.Serialization;

namespace Pulumi.AliCloud.Ecs
{
    /// <summary>
    /// Provides an Alicloud ECS Disk Attachment as a resource, to attach and detach disks from ECS Instances.
    /// 
    /// For information about ECS Disk Attachment and how to use it, see [What is Disk Attachment](https://www.alibabacloud.com/help/en/doc-detail/25515.htm).
    /// 
    /// &gt; **NOTE:** Available in v1.122.0+.
    /// 
    /// ## Example Usage
    /// 
    /// Basic usage
    /// 
    /// ```csharp
    /// using System.Collections.Generic;
    /// using Pulumi;
    /// using AliCloud = Pulumi.AliCloud;
    /// 
    /// return await Deployment.RunAsync(() =&gt; 
    /// {
    ///     // Create a new ECS disk-attachment and use it attach one disk to a new instance.
    ///     var ecsSg = new AliCloud.Ecs.SecurityGroup("ecsSg", new()
    ///     {
    ///         Description = "New security group",
    ///     });
    /// 
    ///     var ecsDisk = new AliCloud.Ecs.EcsDisk("ecsDisk", new()
    ///     {
    ///         ZoneId = "cn-beijing-a",
    ///         Size = 50,
    ///         Tags = 
    ///         {
    ///             { "Name", "TerraformTest-disk" },
    ///         },
    ///     });
    /// 
    ///     var ecsInstance = new AliCloud.Ecs.Instance("ecsInstance", new()
    ///     {
    ///         ImageId = "ubuntu_18_04_64_20G_alibase_20190624.vhd",
    ///         InstanceType = "ecs.n4.small",
    ///         AvailabilityZone = "cn-beijing-a",
    ///         SecurityGroups = new[]
    ///         {
    ///             ecsSg.Id,
    ///         },
    ///         InstanceName = "Hello",
    ///         InternetChargeType = "PayByBandwidth",
    ///         Tags = 
    ///         {
    ///             { "Name", "TerraformTest-instance" },
    ///         },
    ///     });
    /// 
    ///     var ecsDiskAtt = new AliCloud.Ecs.EcsDiskAttachment("ecsDiskAtt", new()
    ///     {
    ///         DiskId = ecsDisk.Id,
    ///         InstanceId = ecsInstance.Id,
    ///     });
    /// 
    /// });
    /// ```
    /// 
    /// ## Import
    /// 
    /// The disk attachment can be imported using the id, e.g.
    /// 
    /// ```sh
    ///  $ pulumi import alicloud:ecs/ecsDiskAttachment:EcsDiskAttachment example d-abc12345678:i-abc12355
    /// ```
    /// </summary>
    [AliCloudResourceType("alicloud:ecs/ecsDiskAttachment:EcsDiskAttachment")]
    public partial class EcsDiskAttachment : global::Pulumi.CustomResource
    {
        /// <summary>
        /// Whether to mount as a system disk. Default to: `false`.
        /// </summary>
        [Output("bootable")]
        public Output<bool?> Bootable { get; private set; } = null!;

        /// <summary>
        /// Indicates whether the disk is released together with the instance. Default to: `false`.
        /// </summary>
        [Output("deleteWithInstance")]
        public Output<bool?> DeleteWithInstance { get; private set; } = null!;

        [Output("device")]
        public Output<string> Device { get; private set; } = null!;

        /// <summary>
        /// ID of the Disk to be attached.
        /// </summary>
        [Output("diskId")]
        public Output<string> DiskId { get; private set; } = null!;

        /// <summary>
        /// ID of the Instance to attach to.
        /// </summary>
        [Output("instanceId")]
        public Output<string> InstanceId { get; private set; } = null!;

        /// <summary>
        /// The name of key pair
        /// </summary>
        [Output("keyPairName")]
        public Output<string?> KeyPairName { get; private set; } = null!;

        /// <summary>
        /// When mounting the system disk, setting the user name and password of the instance is only effective for the administrator and root user names, and other user names are not effective.
        /// </summary>
        [Output("password")]
        public Output<string?> Password { get; private set; } = null!;


        /// <summary>
        /// Create a EcsDiskAttachment resource with the given unique name, arguments, and options.
        /// </summary>
        ///
        /// <param name="name">The unique name of the resource</param>
        /// <param name="args">The arguments used to populate this resource's properties</param>
        /// <param name="options">A bag of options that control this resource's behavior</param>
        public EcsDiskAttachment(string name, EcsDiskAttachmentArgs args, CustomResourceOptions? options = null)
            : base("alicloud:ecs/ecsDiskAttachment:EcsDiskAttachment", name, args ?? new EcsDiskAttachmentArgs(), MakeResourceOptions(options, ""))
        {
        }

        private EcsDiskAttachment(string name, Input<string> id, EcsDiskAttachmentState? state = null, CustomResourceOptions? options = null)
            : base("alicloud:ecs/ecsDiskAttachment:EcsDiskAttachment", name, state, MakeResourceOptions(options, id))
        {
        }

        private static CustomResourceOptions MakeResourceOptions(CustomResourceOptions? options, Input<string>? id)
        {
            var defaultOptions = new CustomResourceOptions
            {
                Version = Utilities.Version,
                PluginDownloadURL = "github://api.github.com/rhysmdnz/pulumi-alicloud",
            };
            var merged = CustomResourceOptions.Merge(defaultOptions, options);
            // Override the ID if one was specified for consistency with other language SDKs.
            merged.Id = id ?? merged.Id;
            return merged;
        }
        /// <summary>
        /// Get an existing EcsDiskAttachment resource's state with the given name, ID, and optional extra
        /// properties used to qualify the lookup.
        /// </summary>
        ///
        /// <param name="name">The unique name of the resulting resource.</param>
        /// <param name="id">The unique provider ID of the resource to lookup.</param>
        /// <param name="state">Any extra arguments used during the lookup.</param>
        /// <param name="options">A bag of options that control this resource's behavior</param>
        public static EcsDiskAttachment Get(string name, Input<string> id, EcsDiskAttachmentState? state = null, CustomResourceOptions? options = null)
        {
            return new EcsDiskAttachment(name, id, state, options);
        }
    }

    public sealed class EcsDiskAttachmentArgs : global::Pulumi.ResourceArgs
    {
        /// <summary>
        /// Whether to mount as a system disk. Default to: `false`.
        /// </summary>
        [Input("bootable")]
        public Input<bool>? Bootable { get; set; }

        /// <summary>
        /// Indicates whether the disk is released together with the instance. Default to: `false`.
        /// </summary>
        [Input("deleteWithInstance")]
        public Input<bool>? DeleteWithInstance { get; set; }

        /// <summary>
        /// ID of the Disk to be attached.
        /// </summary>
        [Input("diskId", required: true)]
        public Input<string> DiskId { get; set; } = null!;

        /// <summary>
        /// ID of the Instance to attach to.
        /// </summary>
        [Input("instanceId", required: true)]
        public Input<string> InstanceId { get; set; } = null!;

        /// <summary>
        /// The name of key pair
        /// </summary>
        [Input("keyPairName")]
        public Input<string>? KeyPairName { get; set; }

        /// <summary>
        /// When mounting the system disk, setting the user name and password of the instance is only effective for the administrator and root user names, and other user names are not effective.
        /// </summary>
        [Input("password")]
        public Input<string>? Password { get; set; }

        public EcsDiskAttachmentArgs()
        {
        }
        public static new EcsDiskAttachmentArgs Empty => new EcsDiskAttachmentArgs();
    }

    public sealed class EcsDiskAttachmentState : global::Pulumi.ResourceArgs
    {
        /// <summary>
        /// Whether to mount as a system disk. Default to: `false`.
        /// </summary>
        [Input("bootable")]
        public Input<bool>? Bootable { get; set; }

        /// <summary>
        /// Indicates whether the disk is released together with the instance. Default to: `false`.
        /// </summary>
        [Input("deleteWithInstance")]
        public Input<bool>? DeleteWithInstance { get; set; }

        [Input("device")]
        public Input<string>? Device { get; set; }

        /// <summary>
        /// ID of the Disk to be attached.
        /// </summary>
        [Input("diskId")]
        public Input<string>? DiskId { get; set; }

        /// <summary>
        /// ID of the Instance to attach to.
        /// </summary>
        [Input("instanceId")]
        public Input<string>? InstanceId { get; set; }

        /// <summary>
        /// The name of key pair
        /// </summary>
        [Input("keyPairName")]
        public Input<string>? KeyPairName { get; set; }

        /// <summary>
        /// When mounting the system disk, setting the user name and password of the instance is only effective for the administrator and root user names, and other user names are not effective.
        /// </summary>
        [Input("password")]
        public Input<string>? Password { get; set; }

        public EcsDiskAttachmentState()
        {
        }
        public static new EcsDiskAttachmentState Empty => new EcsDiskAttachmentState();
    }
}
