github.com/recobe182/terraform@v0.8.5-0.20170117231232-49ab22a935b7/website/source/docs/providers/openstack/r/compute_volume_attach_v2.html.markdown (about) 1 --- 2 layout: "openstack" 3 page_title: "OpenStack: openstack_compute_volume_attach_v2" 4 sidebar_current: "docs-openstack-resource-compute-volume-attach-v2" 5 description: |- 6 Attaches a Block Storage Volume to an Instance. 7 --- 8 9 # openstack\_compute\_volume_attach_v2 10 11 Attaches a Block Storage Volume to an Instance using the OpenStack 12 Compute (Nova) v2 API. 13 14 ## Example Usage 15 16 ``` 17 resource "openstack_blockstorage_volume_v2" "volume_1" { 18 name = "volume_1" 19 size = 1 20 } 21 22 resource "openstack_compute_instance_v2" "instance_1" { 23 name = "instance_1" 24 security_groups = ["default"] 25 } 26 27 resource "openstack_compute_volume_attach_v2" "va_1" { 28 instance_id = "${openstack_compute_instance_v2.instance_1.id}" 29 volume_id = "${openstack_blockstorage_volume_v2.volume_1.id}" 30 } 31 ``` 32 33 ## Argument Reference 34 35 The following arguments are supported: 36 37 * `region` - (Required) The region in which to obtain the V2 Compute client. 38 A Compute client is needed to create a volume attachment. If omitted, the 39 `OS_REGION_NAME` environment variable is used. Changing this creates a 40 new volume attachment. 41 42 * `instance_id` - (Required) The ID of the Instance to attach the Volume to. 43 44 * `volume_id` - (Required) The ID of the Volume to attach to an Instance. 45 46 ## Attributes Reference 47 48 The following attributes are exported: 49 50 * `region` - See Argument Reference above. 51 * `instance_id` - See Argument Reference above. 52 * `volume_id` - See Argument Reference above. 53 * `device` - The device of the volume attachment (ex: `/dev/vdc`). 54 _NOTE_: This is the device reported by the Compute API and the real device 55 might actually differ depending on the hypervisor being used. This should 56 not be used as an authoritative piece of information. 57 58 ## Import 59 60 Volume Attachments can be imported using the Instance ID and Volume ID 61 separated by a slash, e.g. 62 63 ``` 64 $ terraform import openstack_compute_volume_attach_v2.va_1 89c60255-9bd6-460c-822a-e2b959ede9d2/45670584-225f-46c3-b33e-6707b589b666 65 ```