github.com/turtlemonvh/terraform@v0.6.9-0.20151204001754-8e40b6b855e8/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 and not booting 39 from a volume) The image ID of the desired image for the server. Changing 40 this creates a new server. 41 42 * `image_name` - (Optional; Required if `image_id` is empty and not booting 43 from a volume) The name of the desired image for the server. Changing this 44 creates a new server. 45 46 * `flavor_id` - (Optional; Required if `flavor_name` is empty) The flavor ID of 47 the desired flavor for the server. Changing this resizes the existing server. 48 49 * `flavor_name` - (Optional; Required if `flavor_id` is empty) The name of the 50 desired flavor for the server. Changing this resizes the existing server. 51 52 * `floating_ip` - (Optional) A *Compute* Floating IP that will be associated 53 with the Instance. The Floating IP must be provisioned already. 54 55 * `user_data` - (Optional) The user data to provide when launching the instance. 56 Changing this creates a new server. 57 58 * `security_groups` - (Optional) An array of one or more security group names 59 to associate with the server. Changing this results in adding/removing 60 security groups from the existing server. 61 62 * `availability_zone` - (Optional) The availability zone in which to create 63 the server. Changing this creates a new server. 64 65 * `network` - (Optional) An array of one or more networks to attach to the 66 instance. The network object structure is documented below. Changing this 67 creates a new server. 68 69 * `metadata` - (Optional) Metadata key/value pairs to make available from 70 within the instance. Changing this updates the existing server metadata. 71 72 * `config_drive` - (Optional) Whether to use the config_drive feature to 73 configure the instance. Changing this creates a new server. 74 75 * `admin_pass` - (Optional) The administrative password to assign to the server. 76 Changing this changes the root password on the existing server. 77 78 * `key_pair` - (Optional) The name of a key pair to put on the server. The key 79 pair must already be created and associated with the tenant's account. 80 Changing this creates a new server. 81 82 * `block_device` - (Optional) The object for booting by volume. The block_device 83 object structure is documented below. Changing this creates a new server. 84 85 * `volume` - (Optional) Attach an existing volume to the instance. The volume 86 structure is described below. 87 88 * `scheduler_hints` - (Optional) Provider the Nova scheduler with hints on how 89 the instance should be launched. The available hints are described below. 90 91 The `network` block supports: 92 93 * `uuid` - (Required unless `port` or `name` is provided) The network UUID to 94 attach to the server. 95 96 * `name` - (Required unless `uuid` or `port` is provided) The human-readable 97 name of the network. 98 99 * `port` - (Required unless `uuid` or `name` is provided) The port UUID of a 100 network to attach to the server. 101 102 * `fixed_ip_v4` - (Optional) Specifies a fixed IPv4 address to be used on this 103 network. 104 105 The `block_device` block supports: 106 107 * `uuid` - (Required) The UUID of the image, volume, or snapshot. 108 109 * `source_type` - (Required) The source type of the device. Must be one of 110 "image", "volume", or "snapshot". 111 112 * `volume_size` - (Optional) The size of the volume to create (in gigabytes). 113 114 * `boot_index` - (Optional) The boot index of the volume. It defaults to 0. 115 116 * `destination_type` - (Optional) The type that gets created. Possible values 117 are "volume" and "local". 118 119 The `volume` block supports: 120 121 * `volume_id` - (Required) The UUID of the volume to attach. 122 123 * `device` - (Optional) The device that the volume will be attached as. For 124 example: `/dev/vdc`. Omit this option to allow the volume to be 125 auto-assigned a device. 126 127 The `scheduler_hints` block supports: 128 129 * `group` - (Optional) A UUID of a Server Group. The instance will be placed 130 into that group. 131 132 * `different_host` - (Optional) A list of instance UUIDs. The instance will 133 be scheduled on a different host than all other instances. 134 135 * `same_host` - (Optional) A list of instance UUIDs. The instance will be 136 scheduled on the same host of those specified. 137 138 * `query` - (Optional) A conditional query that a compute node must pass in 139 order to host an instance. 140 141 * `target_cell` - (Optional) The name of a cell to host the instance. 142 143 * `build_near_host_ip` - (Optional) An IP Address in CIDR form. The instance 144 will be placed on a compute node that is in the same subnet. 145 146 ## Attributes Reference 147 148 The following attributes are exported: 149 150 * `region` - See Argument Reference above. 151 * `name` - See Argument Reference above. 152 * `access_ip_v4` - The first detected Fixed IPv4 address _or_ the 153 Floating IP. 154 * `access_ip_v6` - The first detected Fixed IPv6 address. 155 * `metadata` - See Argument Reference above. 156 * `security_groups` - See Argument Reference above. 157 * `flavor_id` - See Argument Reference above. 158 * `flavor_name` - See Argument Reference above. 159 * `network/uuid` - See Argument Reference above. 160 * `network/name` - See Argument Reference above. 161 * `network/port` - See Argument Reference above. 162 * `network/fixed_ip_v4` - The Fixed IPv4 address of the Instance on that 163 network. 164 * `network/fixed_ip_v6` - The Fixed IPv6 address of the Instance on that 165 network. 166 * `network/mac` - The MAC address of the NIC on that network. 167 168 ## Notes 169 170 If you configure the instance to have multiple networks, be aware that only 171 the first network can be associated with a Floating IP. So the first network 172 in the instance resource _must_ be the network that you have configured to 173 communicate with your floating IP / public network via a Neutron Router.