github.com/danp/terraform@v0.9.5-0.20170426144147-39d740081351/website/source/docs/providers/alicloud/r/disk_attachment.html.markdown (about) 1 --- 2 layout: "alicloud" 3 page_title: "Alicloud: alicloud_disk_attachment" 4 sidebar_current: "docs-alicloud-resource-disk-attachment" 5 description: |- 6 Provides a ECS Disk Attachment resource. 7 --- 8 9 # alicloud\_disk\_attachment 10 11 Provides an Alicloud ECS Disk Attachment as a resource, to attach and detach disks from ECS Instances. 12 13 ## Example Usage 14 15 Basic usage 16 17 ``` 18 # Create a new ECS disk-attachment and use it attach one disk to a new instance. 19 20 resource "alicloud_security_group" "ecs_sg" { 21 name = "terraform-test-group" 22 description = "New security group" 23 } 24 25 resource "alicloud_disk" "ecs_disk" { 26 availability_zone = "cn-beijing-a" 27 size = "50" 28 29 tags { 30 Name = "TerraformTest-disk" 31 } 32 } 33 34 resource "alicloud_instance" "ecs_instance" { 35 image_id = "ubuntu_140405_64_40G_cloudinit_20161115.vhd" 36 instance_type = "ecs.s1.small" 37 availability_zone = "cn-beijing-a" 38 security_groups = ["${alicloud_security_group.ecs_sg.id}"] 39 instance_name = "Hello" 40 instance_network_type = "classic" 41 internet_charge_type = "PayByBandwidth" 42 43 tags { 44 Name = "TerraformTest-instance" 45 } 46 } 47 48 resource "alicloud_disk_attachment" "ecs_disk_att" { 49 disk_id = "${alicloud_disk.ecs_disk.id}" 50 instance_id = "${alicloud_instance.ecs_instance.id}" 51 device_name = "/dev/xvdb" 52 } 53 ``` 54 ## Argument Reference 55 56 The following arguments are supported: 57 58 * `instance_id` - (Required, Forces new resource) ID of the Instance to attach to. 59 * `disk_id` - (Required, Forces new resource) ID of the Disk to be attached. 60 * `device_name` - (Required, Forces new resource) The device name to expose to the instance (for example, /dev/xvdb). 61 62 ## Attributes Reference 63 64 The following attributes are exported: 65 66 * `instance_id` - ID of the Instance. 67 * `disk_id` - ID of the Disk. 68 * `device_name` - The device name exposed to the instance.