|
| 1 | +--- |
| 2 | +layout: "openstack" |
| 3 | +page_title: "OpenStack: openstack_compute_instance" |
| 4 | +sidebar_current: "docs-openstack-resource-compute-instance" |
| 5 | +description: |- |
| 6 | + Manages a VM instance resource within OpenStack. |
| 7 | +--- |
| 8 | + |
| 9 | +# openstack\_compute\_instance |
| 10 | + |
| 11 | +Manages a VM instance resource within OpenStack. |
| 12 | + |
| 13 | +## Example Usage |
| 14 | + |
| 15 | +``` |
| 16 | +resource "openstack_compute_instance" "test-server" { |
| 17 | + name = "tf-test" |
| 18 | + image_ref = "ad091b52-742f-469e-8f3c-fd81cadf0743" |
| 19 | + flavor_ref = "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 | +* `name` - (Required) A unique name for the resource. |
| 33 | + |
| 34 | +* `image_ref` - (Required) The image reference (ID) for the desired image for |
| 35 | + the server. Changing this creates a new server. |
| 36 | + |
| 37 | +* `flavor_ref` - (Required) The flavor reference (ID) for the desired flavor |
| 38 | + for the server. Changing this resizes the existing server. |
| 39 | + |
| 40 | +* `security_groups` - (Optional) An array of one or more security group names |
| 41 | + to associate with the server. Changing this results in adding/removing |
| 42 | + security groups from the existing server. |
| 43 | + |
| 44 | +* `availability_zone` - (Optional) The availability zone in which to create |
| 45 | + the server. Changing this creates a new server. |
| 46 | + |
| 47 | +* `networks` - (Optional) An array of one or more networks to attach to the |
| 48 | + instance. The network object structure is documented below. |
| 49 | + |
| 50 | +* `metadata` - (Optional) Metadata key/value pairs to make available from |
| 51 | + within the instance. Changing this updates the existing server metadata. |
| 52 | + |
| 53 | +* `admin_pass` - (Optional) The administrative password to assign to the server. |
| 54 | + Changing this changes the root password on the existing server. |
| 55 | + |
| 56 | +* `key_pair` - (Optional) The name of a key pair to put on the server. The key |
| 57 | + pair must already be created and associated with the tenant's account. |
| 58 | + Changing this creates a new server. |
| 59 | + |
| 60 | +The `network` block supports: |
| 61 | + |
| 62 | +* `uuid` - (Required unless `port` is provided) The network UUID to attach to |
| 63 | + the server. |
| 64 | + |
| 65 | +* `port` - (Required unless `uuid` is provided) The port UUID of a network to |
| 66 | + attach to the server. |
| 67 | + |
| 68 | +* `fixed_ip` - (Optional) Specifies a fixed IP address to be used on this |
| 69 | + network. |
| 70 | + |
| 71 | +## Attributes Reference |
| 72 | + |
| 73 | +The following attributes are exported: |
| 74 | + |
| 75 | +* `name` - See Argument Reference above. |
| 76 | +* `access_ip_v4` - See Argument Reference above. |
| 77 | +* `access_ip_v6` - See Argument Reference above. |
| 78 | +* `metadata` - See Argument Reference above. |
| 79 | +* `security_groups` - See Argument Reference above. |
| 80 | +* `flavor_ref` - See Argument Reference above. |
0 commit comments