github.com/cbroglie/terraform@v0.7.0-rc3.0.20170410193827-735dfc416d46/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 ```hcl 18 resource "alicloud_security_group" "ecs_sg" { 19 name = "terraform-test-group" 20 description = "New security group" 21 } 22 23 resource "alicloud_disk" "ecs_disk" { 24 availability_zone = "cn-beijing-a" 25 size = "50" 26 27 tags { 28 Name = "TerraformTest-disk" 29 } 30 } 31 32 resource "alicloud_instance" "ecs_instance" { 33 image_id = "ubuntu_140405_64_40G_cloudinit_20161115.vhd" 34 instance_type = "ecs.s1.small" 35 availability_zone = "cn-beijing-a" 36 security_groups = ["${alicloud_security_group.ecs_sg.id}"] 37 instance_name = "Hello" 38 instance_network_type = "classic" 39 internet_charge_type = "PayByBandwidth" 40 41 tags { 42 Name = "TerraformTest-instance" 43 } 44 } 45 46 resource "alicloud_disk_attachment" "ecs_disk_att" { 47 disk_id = "${alicloud_disk.ecs_disk.id}" 48 instance_id = "${alicloud_instance.ecs_instance.id}" 49 device_name = "/dev/xvdb" 50 } 51 ``` 52 ## Argument Reference 53 54 The following arguments are supported: 55 56 * `instance_id` - (Required, Forces new resource) ID of the Instance to attach to. 57 * `disk_id` - (Required, Forces new resource) ID of the Disk to be attached. 58 * `device_name` - (Required, Forces new resource) The device name to expose to the instance (for example, /dev/xvdb). 59 60 ## Attributes Reference 61 62 The following attributes are exported: 63 64 * `instance_id` - ID of the Instance. 65 * `disk_id` - ID of the Disk. 66 * `device_name` - The device name exposed to the instance.