diff --git a/docs/production.md b/docs/production.md index 7876af126..36f8143b0 100644 --- a/docs/production.md +++ b/docs/production.md @@ -109,13 +109,13 @@ and referenced from the `site` and `production` environments, e.g.: resource "openstack_networking_port_v2" "control" { ... fixed_ip { - subnet_id = data.openstack_networking_subnet_v2.cluster_subnet.id - ip_address = var.control_ip_address + subnet_id = data.openstack_networking_subnet_v2.cluster_subnet.id + ip_address = (var.control_ip_addresses != {})? var.control_ip_addresses[each.key]: null } } ``` - Note the variable `control_ip_address` is new. + Note the variable `control_ip_addresses` is new. Using fixed IPs will require either using admin credentials or policy changes. diff --git a/environments/skeleton/{{cookiecutter.environment}}/tofu/control.tf b/environments/skeleton/{{cookiecutter.environment}}/tofu/control.tf index b4308f93d..f04f17b7b 100644 --- a/environments/skeleton/{{cookiecutter.environment}}/tofu/control.tf +++ b/environments/skeleton/{{cookiecutter.environment}}/tofu/control.tf @@ -11,7 +11,8 @@ resource "openstack_networking_port_v2" "control" { admin_state_up = "true" fixed_ip { - subnet_id = data.openstack_networking_subnet_v2.cluster_subnet[each.key].id + subnet_id = data.openstack_networking_subnet_v2.cluster_subnet[each.key].id + ip_address = (var.control_ip_addresses != {})? var.control_ip_addresses[each.key]: null } no_security_groups = lookup(each.value, "no_security_groups", false) diff --git a/environments/skeleton/{{cookiecutter.environment}}/tofu/variables.tf b/environments/skeleton/{{cookiecutter.environment}}/tofu/variables.tf index 155d8c582..99509df2d 100644 --- a/environments/skeleton/{{cookiecutter.environment}}/tofu/variables.tf +++ b/environments/skeleton/{{cookiecutter.environment}}/tofu/variables.tf @@ -24,6 +24,12 @@ variable "key_pair" { description = "Name of an existing keypair in OpenStack" } +variable "control_ip_addresses" { + type = map(string) + description = "Mapping of networks to fixed IP addresses used by control node" + default = {} +} + variable "control_node_flavor" { type = string description = "Flavor name for control node"