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

fix: fixed-ip addresses for VMs on internal openstack subnet is now portable...

fix: fixed-ip addresses for VMs on internal openstack subnet is now portable and will work even when subnet cidr is significantly changed
parent 3388a25f
No related branches found
No related tags found
No related merge requests found
......@@ -16,6 +16,6 @@ resource "openstack_networking_port_v2" "bastion_port" {
security_group_ids = [openstack_networking_secgroup_v2.secgroup_default.id]
fixed_ip {
subnet_id = var.internal_subnet_creation_enable ? openstack_networking_subnet_v2.subnet_default[0].id : data.openstack_networking_subnet_v2.internal_shared_personal_subnet[0].id
ip_address = format("%s.%d", substr(var.internal_network_cidr, 0, length(var.internal_network_cidr)-5), 100)
ip_address = format("%s.%d", regex("[0-9]+\\.[0-9]+\\.[0-9]+", var.internal_network_cidr), 100)
}
}
......@@ -48,6 +48,6 @@ resource "openstack_networking_port_v2" "nodes_ports" {
security_group_ids = [openstack_networking_secgroup_v2.secgroup_default.id]
fixed_ip {
subnet_id = var.internal_subnet_creation_enable ? openstack_networking_subnet_v2.subnet_default[0].id : data.openstack_networking_subnet_v2.internal_shared_personal_subnet[0].id
ip_address = format("%s.%d", substr(var.internal_network_cidr, 0, length(var.internal_network_cidr)-5), 101 + count.index)
ip_address = format("%s.%d", regex("[0-9]+\\.[0-9]+\\.[0-9]+", var.internal_network_cidr), 101 + count.index)
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment