Skip to content
Snippets Groups Projects
Commit d7510249 authored by František Dvořák's avatar František Dvořák
Browse files

Name server and volume instances in OpenStack with the domain suffix

parent 307912e5
No related branches found
No related tags found
No related merge requests found
Pipeline #567 passed
......@@ -97,7 +97,7 @@ resource "local_file" "localkey" {
resource "openstack_compute_instance_v2" "server" {
count = var.n + 1
name = data.template_file.user_data_common[count.index].vars.host
name = format("%s.%s", data.template_file.user_data_common[count.index].vars.host, var.domain)
flavor_name = var.flavor
image_name = var.image
key_pair = var.ssh
......@@ -125,7 +125,7 @@ EOF
resource "openstack_blockstorage_volume_v3" "volume" {
count = var.volumes * var.n
name = format("%s%s", data.template_file.user_data_common[floor(count.index / var.volumes) + 1].vars.host, local.ord[count.index % var.volumes])
name = format("%s%s.%s", data.template_file.user_data_common[floor(count.index / var.volumes) + 1].vars.host, local.ord[count.index % var.volumes], var.domain)
size = var.volume_size
}
......@@ -164,7 +164,7 @@ output "config" {
output "hosts" {
value = {
for instance in openstack_compute_instance_v2.server:
instance.name => length(instance.network) >= 1 ? instance.network[0].fixed_ip_v4 : null
data.template_file.user_data_common[index(openstack_compute_instance_v2.server[*].id, instance.id)].vars.host => length(instance.network) >= 1 ? instance.network[0].fixed_ip_v4 : null
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment