Skip to content
Snippets Groups Projects
Commit f4ee59f4 authored by František Řezníček's avatar František Řezníček
Browse files

refactor: add worker nodes fixed ips into locals (make locals separate file)

parent beaf0fb4
No related branches found
No related tags found
No related merge requests found
......@@ -47,17 +47,6 @@ resource "openstack_compute_instance_v2" "control_nodes" {
delete_on_termination = true
}
}
locals {
all_instances = flatten([
for group in var.worker_nodes : [
for i in range(group.count) : {
name = "${var.infra_name}-${group.name}-${i + 1}"
flavor = group.flavor
volume_size = group.volume_size
}
]
])
}
resource "openstack_compute_instance_v2" "worker_nodes" {
......
locals {
all_instances = flatten([
for group in var.worker_nodes : [
for i in range(group.count) : {
name = "${var.infra_name}-${group.name}-${i + 1}"
flavor = group.flavor
volume_size = group.volume_size
ip_address = format("%s.%d", regex("[0-9]+\\.[0-9]+\\.[0-9]+", var.internal_network_cidr), 21 + i)
}
]
])
}
......@@ -77,7 +77,7 @@ resource "openstack_networking_port_v2" "worker_ports" {
security_group_ids = [openstack_networking_secgroup_v2.secgroup_default.id]
fixed_ip {
subnet_id = openstack_networking_subnet_v2.subnet_default[0].id
ip_address = format("%s.%d", regex("[0-9]+\\.[0-9]+\\.[0-9]+", var.internal_network_cidr), 21 + count.index)
ip_address = each.value.ip_address
}
allowed_address_pairs {
ip_address = var.kube_vip
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment