Skip to content

Commit de86177

Browse files
committed
support changing security groups for additional nodes
1 parent 998246d commit de86177

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

environments/skeleton/{{cookiecutter.environment}}/tofu/additional.tf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ module "additional" {
3131
match_ironic_node = lookup(each.value, "match_ironic_node", null)
3232
availability_zone = lookup(each.value, "availability_zone", null)
3333
ip_addresses = lookup(each.value, "ip_addresses", null)
34+
security_group_ids = lookup(each.value, "security_group_ids", [for o in data.openstack_networking_secgroup_v2.nonlogin: o.id])
3435

3536
# can't be set for additional nodes
3637
compute_init_enable = []
@@ -40,7 +41,6 @@ module "additional" {
4041
# not using openstack_compute_instance_v2.control.access_ip_v4 to avoid
4142
# updates to node metadata on deletion/recreation of the control node:
4243
control_address = openstack_networking_port_v2.control[var.cluster_networks[0].network].all_fixed_ips[0]
43-
security_group_ids = [for o in data.openstack_networking_secgroup_v2.nonlogin: o.id]
4444
baremetal_nodes = data.external.baremetal_nodes.result
4545

4646
# input dict validation:
@@ -63,5 +63,6 @@ module "additional" {
6363
"ip_addresses",
6464
"gateway_ip",
6565
"nodename_template",
66+
"security_group_ids",
6667
]
6768
}

environments/skeleton/{{cookiecutter.environment}}/tofu/node_group/variables.tf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@ variable "extra_volumes" {
7272
}
7373

7474
variable "security_group_ids" {
75-
type = list
75+
type = list(string)
76+
nullable = false
7677
}
7778

7879
variable "control_address" {

environments/skeleton/{{cookiecutter.environment}}/tofu/variables.tf

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,12 @@ variable "additional_nodegroups" {
143143
will not run slurmd.
144144
145145
Keys are names of groups.
146-
Values are a mapping as for the "login" variable.
146+
Values are a mapping as for the "login" variable, with the addition of
147+
the optional entry:
148+
149+
security_group_ids: List of strings giving IDs of security groups
150+
to apply. If not specified the groups from the
151+
variable nonlogin_security_groups are applied.
147152
148153
Nodes are added to the following inventory groups:
149154
- $group_name

0 commit comments

Comments
 (0)