OpenStack Compute Terraform Module
module "compute" {
source = "./modules/terraform-openstack-modules/terraform-openstack-compute"
name = "my-instance"
key_pair_name = "my-keypair"
availability_zone = "az-a"
image_id = "46c8e29f-3b36-4751-8624-6a40a6c9bc0c"
server_groups_ids = ["70d20f6a-2944-4eab-8788-40953dadd155"]
is_public = true
tags = {
Environment = "staging"
}
ports = [
{
name = "internal",
network_id = "cd9e4ef6-55bd-413f-aa11-13ab557c4607",
subnet_id = "48cd68e6-2eb8-4130-b63a-a89a4fdd3f2b",
security_group_ids = ["70d20f6a-2944-4eab-8788-40953dadd155"],
admin_state_up = true,
}
]
}
data "openstack_compute_availability_zones_v2" "all" {}
module "compute" {
source = "./modules/terraform-openstack-modules/terraform-openstack-compute"
count = 3
name = format("my-instance-%02d", count.index)
key_pair_name = "my-keypair"
availability_zone = element(data.openstack_compute_availability_zones_v2.all.names, count.index)
image_id = "46c8e29f-3b36-4751-8624-6a40a6c9bc0c"
server_groups_ids = ["70d20f6a-2944-4eab-8788-40953dadd155"]
is_public = true
tags = {
Environment = "staging"
}
ports = [
{
name = "internal",
network_id = "cd9e4ef6-55bd-413f-aa11-13ab557c4607",
subnet_id = "48cd68e6-2eb8-4130-b63a-a89a4fdd3f2b",
security_group_ids = ["70d20f6a-2944-4eab-8788-40953dadd155"],
admin_state_up = true,
}
]
}
No modules.
Name |
Description |
Type |
Default |
Required |
availability_zone |
AZ to start the instance in |
string |
null |
no |
block_device_delete_on_termination |
Delete block device when instance is shut down |
bool |
true |
no |
block_device_volume_size |
Volume size (in GB) of the block device |
number |
20 |
no |
flavor_name |
The flavor of the instance to start |
string |
"m1_c1_m2_d20" |
no |
image_id |
ID of the image to use |
string |
n/a |
yes |
is_public |
Connect the instance to public network |
bool |
false |
no |
key_pair_name |
Key name of the Key Pair to use for the instance |
string |
null |
no |
name |
Name to be used on instance created |
string |
n/a |
yes |
ports |
List of ports to bound to the instance |
list(object({ name = string network_id = string subnet_id = string admin_state_up = bool security_group_ids = list(string) })) |
n/a |
yes |
public_ip_network |
The name of the network who give floating IPs |
string |
"public" |
no |
server_groups_ids |
IDs of server groups |
list(string) |
[] |
no |
stop_before_destroy |
Stop the instance before destroying it |
bool |
true |
no |
tags |
A map of tags to add to all resources |
map(string) |
{} |
no |
Name |
Description |
id |
The ID of the instance |
instance_state |
The state of the instance. One of: pending , running , shutting-down , terminated , stopping , stopped or error |
private_ip |
The private IP address assigned to the instance. |
public_ip |
The public IP address assigned to the instance |