github.com/andresvia/terraform@v0.6.15-0.20160412045437-d51c75946785/website/source/docs/providers/aws/r/volume_attachment.html.markdown (about) 1 --- 2 layout: "aws" 3 page_title: "AWS: aws_volume_attachment" 4 sidebar_current: "docs-aws-resource-volume-attachment" 5 description: |- 6 Provides an AWS EBS Volume Attachment 7 --- 8 9 # aws\_volume\_attachment 10 11 Provides an AWS EBS Volume Attachment as a top level resource, to attach and 12 detach volumes from AWS Instances. 13 14 ~> **NOTE on EBS block devices:** If you use `ebs_block_device` on an `aws_instance`, Terraform will assume management over the full set of non-root EBS block devices for the instance, and treats additional block devices as drift. For this reason, `ebs_block_device` cannot be mixed with external `aws_ebs_volume` + `aws_ebs_volume_attachment` resources for a given instance. 15 16 ## Example Usage 17 18 ``` 19 resource "aws_volume_attachment" "ebs_att" { 20 device_name = "/dev/sdh" 21 volume_id = "${aws_ebs_volume.example.id}" 22 instance_id = "${aws_instance.web.id}" 23 } 24 25 resource "aws_instance" "web" { 26 ami = "ami-21f78e11" 27 availability_zone = "us-west-2a" 28 instance_type = "t1.micro" 29 tags { 30 Name = "HelloWorld" 31 } 32 } 33 34 resource "aws_ebs_volume" "example" { 35 availability_zone = "us-west-2a" 36 size = 1 37 } 38 ``` 39 40 ## Argument Reference 41 42 The following arguments are supported: 43 44 * `device_name` - (Required) The device name to expose to the instance (for 45 example, `/dev/sdh` or `xvdh`) 46 * `instance_id` - (Required) ID of the Instance to attach to 47 * `volume_id` - (Required) ID of the Volume to be attached 48 * `force_detach` - (Optional, Boolean) Set to `true` if you want to force the 49 volume to detach. Useful if previous attempts failed, but use this option only 50 as a last resort, as this can result in **data loss**. See 51 [Detaching an Amazon EBS Volume from an Instance][1] for more information. 52 53 ## Attributes Reference 54 55 * `device_name` - The device name exposed to the instance 56 * `instance_id` - ID of the Instance 57 * `volume_id` - ID of the Volume 58 59 [1]: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-detaching-volume.html