github.com/danp/terraform@v0.9.5-0.20170426144147-39d740081351/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 ```hcl 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 * `device` - (Optional) The device of the volume attachment (ex: `/dev/vdc`). 47 _NOTE_: Being able to specify a device is dependent upon the hypervisor in 48 use. There is a chance that the device specified in Terraform will not be 49 the same device the hypervisor chose. If this happens, Terraform will wish 50 to update the device upon subsequent applying which will cause the volume 51 to be detached and reattached indefinitely. Please use with caution. 52 53 ## Attributes Reference 54 55 The following attributes are exported: 56 57 * `region` - See Argument Reference above. 58 * `instance_id` - See Argument Reference above. 59 * `volume_id` - See Argument Reference above. 60 * `device` - See Argument Reference above. _NOTE_: The correctness of this 61 information is dependent upon the hypervisor in use. In some cases, this 62 should not be used as an authoritative piece of information. 63 64 ## Import 65 66 Volume Attachments can be imported using the Instance ID and Volume ID 67 separated by a slash, e.g. 68 69 ``` 70 $ terraform import openstack_compute_volume_attach_v2.va_1 89c60255-9bd6-460c-822a-e2b959ede9d2/45670584-225f-46c3-b33e-6707b589b666 71 ```