1. Packages
  2. Alibaba Cloud Provider
  3. API Docs
  4. ecs
  5. EcsDiskAttachment
Alibaba Cloud v3.66.0 published on Friday, Nov 15, 2024 by Pulumi

alicloud.ecs.EcsDiskAttachment

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.66.0 published on Friday, Nov 15, 2024 by Pulumi

    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.

    NOTE: Available since v1.122.0+.

    Example Usage

    Basic usage

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    
    const config = new pulumi.Config();
    const name = config.get("name") || "tf-example";
    const default = alicloud.getZones({
        availableResourceCreation: "Instance",
    });
    const defaultGetInstanceTypes = _default.then(_default => alicloud.ecs.getInstanceTypes({
        availabilityZone: _default.zones?.[0]?.id,
        instanceTypeFamily: "ecs.sn1ne",
    }));
    const defaultNetwork = new alicloud.vpc.Network("default", {
        vpcName: name,
        cidrBlock: "10.4.0.0/16",
    });
    const defaultSwitch = new alicloud.vpc.Switch("default", {
        vpcId: defaultNetwork.id,
        cidrBlock: "10.4.0.0/24",
        zoneId: _default.then(_default => _default.zones?.[0]?.id),
    });
    const defaultSecurityGroup = new alicloud.ecs.SecurityGroup("default", {
        name: "tf-example",
        description: "New security group",
        vpcId: defaultNetwork.id,
    });
    const defaultGetImages = alicloud.ecs.getImages({
        nameRegex: "^ubuntu_18.*64",
        mostRecent: true,
        owners: "system",
    });
    const defaultInstance = new alicloud.ecs.Instance("default", {
        availabilityZone: _default.then(_default => _default.zones?.[0]?.id),
        instanceName: name,
        hostName: name,
        imageId: defaultGetImages.then(defaultGetImages => defaultGetImages.images?.[0]?.id),
        instanceType: defaultGetInstanceTypes.then(defaultGetInstanceTypes => defaultGetInstanceTypes.instanceTypes?.[0]?.id),
        securityGroups: [defaultSecurityGroup.id],
        vswitchId: defaultSwitch.id,
    });
    const disk = alicloud.getZones({
        availableResourceCreation: "VSwitch",
    });
    const defaultEcsDisk = new alicloud.ecs.EcsDisk("default", {
        zoneId: disk.then(disk => disk.zones?.[0]?.id),
        category: "cloud_efficiency",
        deleteAutoSnapshot: true,
        description: "Test For Terraform",
        diskName: name,
        enableAutoSnapshot: true,
        encrypted: true,
        size: 500,
        tags: {
            Created: "TF",
            Environment: "Acceptance-test",
        },
    });
    const defaultEcsDiskAttachment = new alicloud.ecs.EcsDiskAttachment("default", {
        diskId: defaultEcsDisk.id,
        instanceId: defaultInstance.id,
    });
    
    import pulumi
    import pulumi_alicloud as alicloud
    
    config = pulumi.Config()
    name = config.get("name")
    if name is None:
        name = "tf-example"
    default = alicloud.get_zones(available_resource_creation="Instance")
    default_get_instance_types = alicloud.ecs.get_instance_types(availability_zone=default.zones[0].id,
        instance_type_family="ecs.sn1ne")
    default_network = alicloud.vpc.Network("default",
        vpc_name=name,
        cidr_block="10.4.0.0/16")
    default_switch = alicloud.vpc.Switch("default",
        vpc_id=default_network.id,
        cidr_block="10.4.0.0/24",
        zone_id=default.zones[0].id)
    default_security_group = alicloud.ecs.SecurityGroup("default",
        name="tf-example",
        description="New security group",
        vpc_id=default_network.id)
    default_get_images = alicloud.ecs.get_images(name_regex="^ubuntu_18.*64",
        most_recent=True,
        owners="system")
    default_instance = alicloud.ecs.Instance("default",
        availability_zone=default.zones[0].id,
        instance_name=name,
        host_name=name,
        image_id=default_get_images.images[0].id,
        instance_type=default_get_instance_types.instance_types[0].id,
        security_groups=[default_security_group.id],
        vswitch_id=default_switch.id)
    disk = alicloud.get_zones(available_resource_creation="VSwitch")
    default_ecs_disk = alicloud.ecs.EcsDisk("default",
        zone_id=disk.zones[0].id,
        category="cloud_efficiency",
        delete_auto_snapshot=True,
        description="Test For Terraform",
        disk_name=name,
        enable_auto_snapshot=True,
        encrypted=True,
        size=500,
        tags={
            "Created": "TF",
            "Environment": "Acceptance-test",
        })
    default_ecs_disk_attachment = alicloud.ecs.EcsDiskAttachment("default",
        disk_id=default_ecs_disk.id,
        instance_id=default_instance.id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud"
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/ecs"
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/vpc"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		cfg := config.New(ctx, "")
    		name := "tf-example"
    		if param := cfg.Get("name"); param != "" {
    			name = param
    		}
    		_default, err := alicloud.GetZones(ctx, &alicloud.GetZonesArgs{
    			AvailableResourceCreation: pulumi.StringRef("Instance"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		defaultGetInstanceTypes, err := ecs.GetInstanceTypes(ctx, &ecs.GetInstanceTypesArgs{
    			AvailabilityZone:   pulumi.StringRef(_default.Zones[0].Id),
    			InstanceTypeFamily: pulumi.StringRef("ecs.sn1ne"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		defaultNetwork, err := vpc.NewNetwork(ctx, "default", &vpc.NetworkArgs{
    			VpcName:   pulumi.String(name),
    			CidrBlock: pulumi.String("10.4.0.0/16"),
    		})
    		if err != nil {
    			return err
    		}
    		defaultSwitch, err := vpc.NewSwitch(ctx, "default", &vpc.SwitchArgs{
    			VpcId:     defaultNetwork.ID(),
    			CidrBlock: pulumi.String("10.4.0.0/24"),
    			ZoneId:    pulumi.String(_default.Zones[0].Id),
    		})
    		if err != nil {
    			return err
    		}
    		defaultSecurityGroup, err := ecs.NewSecurityGroup(ctx, "default", &ecs.SecurityGroupArgs{
    			Name:        pulumi.String("tf-example"),
    			Description: pulumi.String("New security group"),
    			VpcId:       defaultNetwork.ID(),
    		})
    		if err != nil {
    			return err
    		}
    		defaultGetImages, err := ecs.GetImages(ctx, &ecs.GetImagesArgs{
    			NameRegex:  pulumi.StringRef("^ubuntu_18.*64"),
    			MostRecent: pulumi.BoolRef(true),
    			Owners:     pulumi.StringRef("system"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		defaultInstance, err := ecs.NewInstance(ctx, "default", &ecs.InstanceArgs{
    			AvailabilityZone: pulumi.String(_default.Zones[0].Id),
    			InstanceName:     pulumi.String(name),
    			HostName:         pulumi.String(name),
    			ImageId:          pulumi.String(defaultGetImages.Images[0].Id),
    			InstanceType:     pulumi.String(defaultGetInstanceTypes.InstanceTypes[0].Id),
    			SecurityGroups: pulumi.StringArray{
    				defaultSecurityGroup.ID(),
    			},
    			VswitchId: defaultSwitch.ID(),
    		})
    		if err != nil {
    			return err
    		}
    		disk, err := alicloud.GetZones(ctx, &alicloud.GetZonesArgs{
    			AvailableResourceCreation: pulumi.StringRef("VSwitch"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		defaultEcsDisk, err := ecs.NewEcsDisk(ctx, "default", &ecs.EcsDiskArgs{
    			ZoneId:             pulumi.String(disk.Zones[0].Id),
    			Category:           pulumi.String("cloud_efficiency"),
    			DeleteAutoSnapshot: pulumi.Bool(true),
    			Description:        pulumi.String("Test For Terraform"),
    			DiskName:           pulumi.String(name),
    			EnableAutoSnapshot: pulumi.Bool(true),
    			Encrypted:          pulumi.Bool(true),
    			Size:               pulumi.Int(500),
    			Tags: pulumi.StringMap{
    				"Created":     pulumi.String("TF"),
    				"Environment": pulumi.String("Acceptance-test"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		_, err = ecs.NewEcsDiskAttachment(ctx, "default", &ecs.EcsDiskAttachmentArgs{
    			DiskId:     defaultEcsDisk.ID(),
    			InstanceId: defaultInstance.ID(),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    
    return await Deployment.RunAsync(() => 
    {
        var config = new Config();
        var name = config.Get("name") ?? "tf-example";
        var @default = AliCloud.GetZones.Invoke(new()
        {
            AvailableResourceCreation = "Instance",
        });
    
        var defaultGetInstanceTypes = AliCloud.Ecs.GetInstanceTypes.Invoke(new()
        {
            AvailabilityZone = @default.Apply(getZonesResult => getZonesResult.Zones[0]?.Id),
            InstanceTypeFamily = "ecs.sn1ne",
        });
    
        var defaultNetwork = new AliCloud.Vpc.Network("default", new()
        {
            VpcName = name,
            CidrBlock = "10.4.0.0/16",
        });
    
        var defaultSwitch = new AliCloud.Vpc.Switch("default", new()
        {
            VpcId = defaultNetwork.Id,
            CidrBlock = "10.4.0.0/24",
            ZoneId = @default.Apply(@default => @default.Apply(getZonesResult => getZonesResult.Zones[0]?.Id)),
        });
    
        var defaultSecurityGroup = new AliCloud.Ecs.SecurityGroup("default", new()
        {
            Name = "tf-example",
            Description = "New security group",
            VpcId = defaultNetwork.Id,
        });
    
        var defaultGetImages = AliCloud.Ecs.GetImages.Invoke(new()
        {
            NameRegex = "^ubuntu_18.*64",
            MostRecent = true,
            Owners = "system",
        });
    
        var defaultInstance = new AliCloud.Ecs.Instance("default", new()
        {
            AvailabilityZone = @default.Apply(@default => @default.Apply(getZonesResult => getZonesResult.Zones[0]?.Id)),
            InstanceName = name,
            HostName = name,
            ImageId = defaultGetImages.Apply(getImagesResult => getImagesResult.Images[0]?.Id),
            InstanceType = defaultGetInstanceTypes.Apply(getInstanceTypesResult => getInstanceTypesResult.InstanceTypes[0]?.Id),
            SecurityGroups = new[]
            {
                defaultSecurityGroup.Id,
            },
            VswitchId = defaultSwitch.Id,
        });
    
        var disk = AliCloud.GetZones.Invoke(new()
        {
            AvailableResourceCreation = "VSwitch",
        });
    
        var defaultEcsDisk = new AliCloud.Ecs.EcsDisk("default", new()
        {
            ZoneId = disk.Apply(getZonesResult => getZonesResult.Zones[0]?.Id),
            Category = "cloud_efficiency",
            DeleteAutoSnapshot = true,
            Description = "Test For Terraform",
            DiskName = name,
            EnableAutoSnapshot = true,
            Encrypted = true,
            Size = 500,
            Tags = 
            {
                { "Created", "TF" },
                { "Environment", "Acceptance-test" },
            },
        });
    
        var defaultEcsDiskAttachment = new AliCloud.Ecs.EcsDiskAttachment("default", new()
        {
            DiskId = defaultEcsDisk.Id,
            InstanceId = defaultInstance.Id,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.alicloud.AlicloudFunctions;
    import com.pulumi.alicloud.inputs.GetZonesArgs;
    import com.pulumi.alicloud.ecs.EcsFunctions;
    import com.pulumi.alicloud.ecs.inputs.GetInstanceTypesArgs;
    import com.pulumi.alicloud.vpc.Network;
    import com.pulumi.alicloud.vpc.NetworkArgs;
    import com.pulumi.alicloud.vpc.Switch;
    import com.pulumi.alicloud.vpc.SwitchArgs;
    import com.pulumi.alicloud.ecs.SecurityGroup;
    import com.pulumi.alicloud.ecs.SecurityGroupArgs;
    import com.pulumi.alicloud.ecs.inputs.GetImagesArgs;
    import com.pulumi.alicloud.ecs.Instance;
    import com.pulumi.alicloud.ecs.InstanceArgs;
    import com.pulumi.alicloud.ecs.EcsDisk;
    import com.pulumi.alicloud.ecs.EcsDiskArgs;
    import com.pulumi.alicloud.ecs.EcsDiskAttachment;
    import com.pulumi.alicloud.ecs.EcsDiskAttachmentArgs;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            final var config = ctx.config();
            final var name = config.get("name").orElse("tf-example");
            final var default = AlicloudFunctions.getZones(GetZonesArgs.builder()
                .availableResourceCreation("Instance")
                .build());
    
            final var defaultGetInstanceTypes = EcsFunctions.getInstanceTypes(GetInstanceTypesArgs.builder()
                .availabilityZone(default_.zones()[0].id())
                .instanceTypeFamily("ecs.sn1ne")
                .build());
    
            var defaultNetwork = new Network("defaultNetwork", NetworkArgs.builder()
                .vpcName(name)
                .cidrBlock("10.4.0.0/16")
                .build());
    
            var defaultSwitch = new Switch("defaultSwitch", SwitchArgs.builder()
                .vpcId(defaultNetwork.id())
                .cidrBlock("10.4.0.0/24")
                .zoneId(default_.zones()[0].id())
                .build());
    
            var defaultSecurityGroup = new SecurityGroup("defaultSecurityGroup", SecurityGroupArgs.builder()
                .name("tf-example")
                .description("New security group")
                .vpcId(defaultNetwork.id())
                .build());
    
            final var defaultGetImages = EcsFunctions.getImages(GetImagesArgs.builder()
                .nameRegex("^ubuntu_18.*64")
                .mostRecent(true)
                .owners("system")
                .build());
    
            var defaultInstance = new Instance("defaultInstance", InstanceArgs.builder()
                .availabilityZone(default_.zones()[0].id())
                .instanceName(name)
                .hostName(name)
                .imageId(defaultGetImages.applyValue(getImagesResult -> getImagesResult.images()[0].id()))
                .instanceType(defaultGetInstanceTypes.applyValue(getInstanceTypesResult -> getInstanceTypesResult.instanceTypes()[0].id()))
                .securityGroups(defaultSecurityGroup.id())
                .vswitchId(defaultSwitch.id())
                .build());
    
            final var disk = AlicloudFunctions.getZones(GetZonesArgs.builder()
                .availableResourceCreation("VSwitch")
                .build());
    
            var defaultEcsDisk = new EcsDisk("defaultEcsDisk", EcsDiskArgs.builder()
                .zoneId(disk.applyValue(getZonesResult -> getZonesResult.zones()[0].id()))
                .category("cloud_efficiency")
                .deleteAutoSnapshot("true")
                .description("Test For Terraform")
                .diskName(name)
                .enableAutoSnapshot("true")
                .encrypted("true")
                .size("500")
                .tags(Map.ofEntries(
                    Map.entry("Created", "TF"),
                    Map.entry("Environment", "Acceptance-test")
                ))
                .build());
    
            var defaultEcsDiskAttachment = new EcsDiskAttachment("defaultEcsDiskAttachment", EcsDiskAttachmentArgs.builder()
                .diskId(defaultEcsDisk.id())
                .instanceId(defaultInstance.id())
                .build());
    
        }
    }
    
    configuration:
      # Create a new ECS disk-attachment and use it attach one disk to a new instance.
      name:
        type: string
        default: tf-example
    resources:
      defaultNetwork:
        type: alicloud:vpc:Network
        name: default
        properties:
          vpcName: ${name}
          cidrBlock: 10.4.0.0/16
      defaultSwitch:
        type: alicloud:vpc:Switch
        name: default
        properties:
          vpcId: ${defaultNetwork.id}
          cidrBlock: 10.4.0.0/24
          zoneId: ${default.zones[0].id}
      defaultSecurityGroup:
        type: alicloud:ecs:SecurityGroup
        name: default
        properties:
          name: tf-example
          description: New security group
          vpcId: ${defaultNetwork.id}
      defaultInstance:
        type: alicloud:ecs:Instance
        name: default
        properties:
          availabilityZone: ${default.zones[0].id}
          instanceName: ${name}
          hostName: ${name}
          imageId: ${defaultGetImages.images[0].id}
          instanceType: ${defaultGetInstanceTypes.instanceTypes[0].id}
          securityGroups:
            - ${defaultSecurityGroup.id}
          vswitchId: ${defaultSwitch.id}
      defaultEcsDisk:
        type: alicloud:ecs:EcsDisk
        name: default
        properties:
          zoneId: ${disk.zones[0].id}
          category: cloud_efficiency
          deleteAutoSnapshot: 'true'
          description: Test For Terraform
          diskName: ${name}
          enableAutoSnapshot: 'true'
          encrypted: 'true'
          size: '500'
          tags:
            Created: TF
            Environment: Acceptance-test
      defaultEcsDiskAttachment:
        type: alicloud:ecs:EcsDiskAttachment
        name: default
        properties:
          diskId: ${defaultEcsDisk.id}
          instanceId: ${defaultInstance.id}
    variables:
      default:
        fn::invoke:
          Function: alicloud:getZones
          Arguments:
            availableResourceCreation: Instance
      defaultGetInstanceTypes:
        fn::invoke:
          Function: alicloud:ecs:getInstanceTypes
          Arguments:
            availabilityZone: ${default.zones[0].id}
            instanceTypeFamily: ecs.sn1ne
      defaultGetImages:
        fn::invoke:
          Function: alicloud:ecs:getImages
          Arguments:
            nameRegex: ^ubuntu_18.*64
            mostRecent: true
            owners: system
      disk:
        fn::invoke:
          Function: alicloud:getZones
          Arguments:
            availableResourceCreation: VSwitch
    

    Create EcsDiskAttachment Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new EcsDiskAttachment(name: string, args: EcsDiskAttachmentArgs, opts?: CustomResourceOptions);
    @overload
    def EcsDiskAttachment(resource_name: str,
                          args: EcsDiskAttachmentArgs,
                          opts: Optional[ResourceOptions] = None)
    
    @overload
    def EcsDiskAttachment(resource_name: str,
                          opts: Optional[ResourceOptions] = None,
                          disk_id: Optional[str] = None,
                          instance_id: Optional[str] = None,
                          bootable: Optional[bool] = None,
                          delete_with_instance: Optional[bool] = None,
                          key_pair_name: Optional[str] = None,
                          password: Optional[str] = None)
    func NewEcsDiskAttachment(ctx *Context, name string, args EcsDiskAttachmentArgs, opts ...ResourceOption) (*EcsDiskAttachment, error)
    public EcsDiskAttachment(string name, EcsDiskAttachmentArgs args, CustomResourceOptions? opts = null)
    public EcsDiskAttachment(String name, EcsDiskAttachmentArgs args)
    public EcsDiskAttachment(String name, EcsDiskAttachmentArgs args, CustomResourceOptions options)
    
    type: alicloud:ecs:EcsDiskAttachment
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args EcsDiskAttachmentArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args EcsDiskAttachmentArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args EcsDiskAttachmentArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args EcsDiskAttachmentArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args EcsDiskAttachmentArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var ecsDiskAttachmentResource = new AliCloud.Ecs.EcsDiskAttachment("ecsDiskAttachmentResource", new()
    {
        DiskId = "string",
        InstanceId = "string",
        Bootable = false,
        DeleteWithInstance = false,
        KeyPairName = "string",
        Password = "string",
    });
    
    example, err := ecs.NewEcsDiskAttachment(ctx, "ecsDiskAttachmentResource", &ecs.EcsDiskAttachmentArgs{
    	DiskId:             pulumi.String("string"),
    	InstanceId:         pulumi.String("string"),
    	Bootable:           pulumi.Bool(false),
    	DeleteWithInstance: pulumi.Bool(false),
    	KeyPairName:        pulumi.String("string"),
    	Password:           pulumi.String("string"),
    })
    
    var ecsDiskAttachmentResource = new EcsDiskAttachment("ecsDiskAttachmentResource", EcsDiskAttachmentArgs.builder()
        .diskId("string")
        .instanceId("string")
        .bootable(false)
        .deleteWithInstance(false)
        .keyPairName("string")
        .password("string")
        .build());
    
    ecs_disk_attachment_resource = alicloud.ecs.EcsDiskAttachment("ecsDiskAttachmentResource",
        disk_id="string",
        instance_id="string",
        bootable=False,
        delete_with_instance=False,
        key_pair_name="string",
        password="string")
    
    const ecsDiskAttachmentResource = new alicloud.ecs.EcsDiskAttachment("ecsDiskAttachmentResource", {
        diskId: "string",
        instanceId: "string",
        bootable: false,
        deleteWithInstance: false,
        keyPairName: "string",
        password: "string",
    });
    
    type: alicloud:ecs:EcsDiskAttachment
    properties:
        bootable: false
        deleteWithInstance: false
        diskId: string
        instanceId: string
        keyPairName: string
        password: string
    

    EcsDiskAttachment Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    The EcsDiskAttachment resource accepts the following input properties:

    DiskId string
    ID of the Disk to be attached.
    InstanceId string
    ID of the Instance to attach to.
    Bootable bool
    Whether to mount as a system disk. Default to: false.
    DeleteWithInstance bool
    Indicates whether the disk is released together with the instance. Default to: false.
    KeyPairName string
    The name of key pair
    Password string
    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.
    DiskId string
    ID of the Disk to be attached.
    InstanceId string
    ID of the Instance to attach to.
    Bootable bool
    Whether to mount as a system disk. Default to: false.
    DeleteWithInstance bool
    Indicates whether the disk is released together with the instance. Default to: false.
    KeyPairName string
    The name of key pair
    Password string
    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.
    diskId String
    ID of the Disk to be attached.
    instanceId String
    ID of the Instance to attach to.
    bootable Boolean
    Whether to mount as a system disk. Default to: false.
    deleteWithInstance Boolean
    Indicates whether the disk is released together with the instance. Default to: false.
    keyPairName String
    The name of key pair
    password String
    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.
    diskId string
    ID of the Disk to be attached.
    instanceId string
    ID of the Instance to attach to.
    bootable boolean
    Whether to mount as a system disk. Default to: false.
    deleteWithInstance boolean
    Indicates whether the disk is released together with the instance. Default to: false.
    keyPairName string
    The name of key pair
    password string
    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.
    disk_id str
    ID of the Disk to be attached.
    instance_id str
    ID of the Instance to attach to.
    bootable bool
    Whether to mount as a system disk. Default to: false.
    delete_with_instance bool
    Indicates whether the disk is released together with the instance. Default to: false.
    key_pair_name str
    The name of key pair
    password str
    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.
    diskId String
    ID of the Disk to be attached.
    instanceId String
    ID of the Instance to attach to.
    bootable Boolean
    Whether to mount as a system disk. Default to: false.
    deleteWithInstance Boolean
    Indicates whether the disk is released together with the instance. Default to: false.
    keyPairName String
    The name of key pair
    password String
    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.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the EcsDiskAttachment resource produces the following output properties:

    Device string
    The name of the cloud disk device.
    Id string
    The provider-assigned unique ID for this managed resource.
    Device string
    The name of the cloud disk device.
    Id string
    The provider-assigned unique ID for this managed resource.
    device String
    The name of the cloud disk device.
    id String
    The provider-assigned unique ID for this managed resource.
    device string
    The name of the cloud disk device.
    id string
    The provider-assigned unique ID for this managed resource.
    device str
    The name of the cloud disk device.
    id str
    The provider-assigned unique ID for this managed resource.
    device String
    The name of the cloud disk device.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing EcsDiskAttachment Resource

    Get an existing EcsDiskAttachment resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: EcsDiskAttachmentState, opts?: CustomResourceOptions): EcsDiskAttachment
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            bootable: Optional[bool] = None,
            delete_with_instance: Optional[bool] = None,
            device: Optional[str] = None,
            disk_id: Optional[str] = None,
            instance_id: Optional[str] = None,
            key_pair_name: Optional[str] = None,
            password: Optional[str] = None) -> EcsDiskAttachment
    func GetEcsDiskAttachment(ctx *Context, name string, id IDInput, state *EcsDiskAttachmentState, opts ...ResourceOption) (*EcsDiskAttachment, error)
    public static EcsDiskAttachment Get(string name, Input<string> id, EcsDiskAttachmentState? state, CustomResourceOptions? opts = null)
    public static EcsDiskAttachment get(String name, Output<String> id, EcsDiskAttachmentState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    Bootable bool
    Whether to mount as a system disk. Default to: false.
    DeleteWithInstance bool
    Indicates whether the disk is released together with the instance. Default to: false.
    Device string
    The name of the cloud disk device.
    DiskId string
    ID of the Disk to be attached.
    InstanceId string
    ID of the Instance to attach to.
    KeyPairName string
    The name of key pair
    Password string
    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.
    Bootable bool
    Whether to mount as a system disk. Default to: false.
    DeleteWithInstance bool
    Indicates whether the disk is released together with the instance. Default to: false.
    Device string
    The name of the cloud disk device.
    DiskId string
    ID of the Disk to be attached.
    InstanceId string
    ID of the Instance to attach to.
    KeyPairName string
    The name of key pair
    Password string
    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.
    bootable Boolean
    Whether to mount as a system disk. Default to: false.
    deleteWithInstance Boolean
    Indicates whether the disk is released together with the instance. Default to: false.
    device String
    The name of the cloud disk device.
    diskId String
    ID of the Disk to be attached.
    instanceId String
    ID of the Instance to attach to.
    keyPairName String
    The name of key pair
    password String
    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.
    bootable boolean
    Whether to mount as a system disk. Default to: false.
    deleteWithInstance boolean
    Indicates whether the disk is released together with the instance. Default to: false.
    device string
    The name of the cloud disk device.
    diskId string
    ID of the Disk to be attached.
    instanceId string
    ID of the Instance to attach to.
    keyPairName string
    The name of key pair
    password string
    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.
    bootable bool
    Whether to mount as a system disk. Default to: false.
    delete_with_instance bool
    Indicates whether the disk is released together with the instance. Default to: false.
    device str
    The name of the cloud disk device.
    disk_id str
    ID of the Disk to be attached.
    instance_id str
    ID of the Instance to attach to.
    key_pair_name str
    The name of key pair
    password str
    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.
    bootable Boolean
    Whether to mount as a system disk. Default to: false.
    deleteWithInstance Boolean
    Indicates whether the disk is released together with the instance. Default to: false.
    device String
    The name of the cloud disk device.
    diskId String
    ID of the Disk to be attached.
    instanceId String
    ID of the Instance to attach to.
    keyPairName String
    The name of key pair
    password String
    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.

    Import

    The disk attachment can be imported using the id, e.g.

    $ pulumi import alicloud:ecs/ecsDiskAttachment:EcsDiskAttachment example d-abc12345678:i-abc12355
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    Alibaba Cloud pulumi/pulumi-alicloud
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the alicloud Terraform Provider.
    alicloud logo
    Alibaba Cloud v3.66.0 published on Friday, Nov 15, 2024 by Pulumi