github.com/tarrant/terraform@v0.3.8-0.20150402012457-f68c9eee638e/website/source/docs/providers/openstack/r/compute_instance_v2.html.markdown (about) 1 --- 2 layout: "openstack" 3 page_title: "OpenStack: openstack_compute_instance_v2" 4 sidebar_current: "docs-openstack-resource-compute-instance-v2" 5 description: |- 6 Manages a V2 VM instance resource within OpenStack. 7 --- 8 9 # openstack\_compute\_instance_v2 10 11 Manages a V2 VM instance resource within OpenStack. 12 13 ## Example Usage 14 15 ``` 16 resource "openstack_compute_instance_v2" "test-server" { 17 name = "tf-test" 18 image_id = "ad091b52-742f-469e-8f3c-fd81cadf0743" 19 flavor_id = "3" 20 metadata { 21 this = "that" 22 } 23 key_pair = "my_key_pair_name" 24 security_groups = ["test-group-1"] 25 } 26 ``` 27 28 ## Argument Reference 29 30 The following arguments are supported: 31 32 * `region` - (Required) The region in which to create the server instance. If 33 omitted, the `OS_REGION_NAME` environment variable is used. Changing this 34 creates a new server. 35 36 * `name` - (Required) A unique name for the resource. 37 38 * `image_id` - (Optional; Required if `image_name` is empty) The image ID of 39 the desired image for the server. Changing this creates a new server. 40 41 * `image_name` - (Optional; Required if `image_id` is empty) The name of the 42 desired image for the server. Changing this creates a new server. 43 44 * `flavor_id` - (Optional; Required if `flavor_name` is empty) The flavor ID of 45 the desired flavor for the server. Changing this resizes the existing server. 46 47 * `flavor_name` - (Optional; Required if `flavor_id` is empty) The name of the 48 desired flavor for the server. Changing this resizes the existing server. 49 50 * `security_groups` - (Optional) An array of one or more security group names 51 to associate with the server. Changing this results in adding/removing 52 security groups from the existing server. 53 54 * `availability_zone` - (Optional) The availability zone in which to create 55 the server. Changing this creates a new server. 56 57 * `network` - (Optional) An array of one or more networks to attach to the 58 instance. The network object structure is documented below. Changing this 59 creates a new server. 60 61 * `metadata` - (Optional) Metadata key/value pairs to make available from 62 within the instance. Changing this updates the existing server metadata. 63 64 * `admin_pass` - (Optional) The administrative password to assign to the server. 65 Changing this changes the root password on the existing server. 66 67 * `key_pair` - (Optional) The name of a key pair to put on the server. The key 68 pair must already be created and associated with the tenant's account. 69 Changing this creates a new server. 70 71 * `block_device` - (Optional) The object for booting by volume. The block_device 72 object structure is documented below. Changing this creates a new server. 73 74 * `volume` - (Optional) Attach an existing volume to the instance. The volume 75 structure is described below. 76 77 The `network` block supports: 78 79 * `uuid` - (Required unless `port` is provided) The network UUID to attach to 80 the server. 81 82 * `port` - (Required unless `uuid` is provided) The port UUID of a network to 83 attach to the server. 84 85 * `fixed_ip` - (Optional) Specifies a fixed IP address to be used on this 86 network. 87 88 The `block_device` block supports: 89 90 * `uuid` - (Required) The UUID of the image, volume, or snapshot. 91 92 * `source_type` - (Required) The source type of the device. Must be one of 93 "image", "volume", or "snapshot". 94 95 * `volume_size` - (Optional) The size of the volume to create (in gigabytes). 96 97 * `boot_index` - (Optional) The boot index of the volume. It defaults to 0. 98 99 * `destination_type` - (Optional) The type that gets created. Possible values 100 are "volume" and "local". 101 102 The `volume` block supports: 103 104 * `volume_id` - (Required) The UUID of the volume to attach. 105 106 * `device` - (Optional) The device that the volume will be attached as. For 107 example: `/dev/vdc`. Omit this option to allow the volume to be 108 auto-assigned a device. 109 110 ## Attributes Reference 111 112 The following attributes are exported: 113 114 * `region` - See Argument Reference above. 115 * `name` - See Argument Reference above. 116 * `access_ip_v4` - See Argument Reference above. 117 * `access_ip_v6` - See Argument Reference above. 118 * `metadata` - See Argument Reference above. 119 * `security_groups` - See Argument Reference above. 120 * `flavor_ref` - See Argument Reference above.