github.com/hobbeswalsh/terraform@v0.3.7-0.20150619183303-ad17cf55a0fa/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 * `floating_ip` - (Optional) A *Compute* Floating IP that will be associated 51 with the Instance. The Floating IP must be provisioned already. 52 53 * `user_data` - (Optional) The user data to provide when launching the instance. 54 Changing this creates a new server. 55 56 * `security_groups` - (Optional) An array of one or more security group names 57 to associate with the server. Changing this results in adding/removing 58 security groups from the existing server. 59 60 * `availability_zone` - (Optional) The availability zone in which to create 61 the server. Changing this creates a new server. 62 63 * `network` - (Optional) An array of one or more networks to attach to the 64 instance. The network object structure is documented below. Changing this 65 creates a new server. 66 67 * `metadata` - (Optional) Metadata key/value pairs to make available from 68 within the instance. Changing this updates the existing server metadata. 69 70 * `config_drive` - (Optional) Whether to use the config_drive feature to 71 configure the instance. Changing this creates a new server. 72 73 * `admin_pass` - (Optional) The administrative password to assign to the server. 74 Changing this changes the root password on the existing server. 75 76 * `key_pair` - (Optional) The name of a key pair to put on the server. The key 77 pair must already be created and associated with the tenant's account. 78 Changing this creates a new server. 79 80 * `block_device` - (Optional) The object for booting by volume. The block_device 81 object structure is documented below. Changing this creates a new server. 82 83 * `volume` - (Optional) Attach an existing volume to the instance. The volume 84 structure is described below. 85 86 The `network` block supports: 87 88 * `uuid` - (Required unless `port` or `name` is provided) The network UUID to 89 attach to the server. 90 91 * `name` - (Required unless `uuid` or `port` is provided) The human-readable 92 name of the network. 93 94 * `port` - (Required unless `uuid` or `name` is provided) The port UUID of a 95 network to attach to the server. 96 97 * `fixed_ip_v4` - (Optional) Specifies a fixed IPv4 address to be used on this 98 network. 99 100 The `block_device` block supports: 101 102 * `uuid` - (Required) The UUID of the image, volume, or snapshot. 103 104 * `source_type` - (Required) The source type of the device. Must be one of 105 "image", "volume", or "snapshot". 106 107 * `volume_size` - (Optional) The size of the volume to create (in gigabytes). 108 109 * `boot_index` - (Optional) The boot index of the volume. It defaults to 0. 110 111 * `destination_type` - (Optional) The type that gets created. Possible values 112 are "volume" and "local". 113 114 The `volume` block supports: 115 116 * `volume_id` - (Required) The UUID of the volume to attach. 117 118 * `device` - (Optional) The device that the volume will be attached as. For 119 example: `/dev/vdc`. Omit this option to allow the volume to be 120 auto-assigned a device. 121 122 ## Attributes Reference 123 124 The following attributes are exported: 125 126 * `region` - See Argument Reference above. 127 * `name` - See Argument Reference above. 128 * `access_ip_v4` - The first detected Fixed IPv4 address _or_ the 129 Floating IP. 130 * `access_ip_v6` - The first detected Fixed IPv6 address. 131 * `metadata` - See Argument Reference above. 132 * `security_groups` - See Argument Reference above. 133 * `flavor_id` - See Argument Reference above. 134 * `flavor_name` - See Argument Reference above. 135 * `network/uuid` - See Argument Reference above. 136 * `network/name` - See Argument Reference above. 137 * `network/port` - See Argument Reference above. 138 * `network/fixed_ip_v4` - The Fixed IPv4 address of the Instance on that 139 network. 140 * `network/fixed_ip_v6` - The Fixed IPv6 address of the Instance on that 141 network. 142 * `network/mac` - The MAC address of the NIC on that network. 143 144 ## Notes 145 146 If you configure the instance to have multiple networks, be aware that only 147 the first network can be associated with a Floating IP. So the first network 148 in the instance resource _must_ be the network that you have configured to 149 communicate with your floating IP / public network via a Neutron Router.