Skip to content

Commit ccc0fb5

Browse files
committed
add validation for login too
1 parent 63afe0d commit ccc0fb5

File tree

3 files changed

+34
-17
lines changed

3 files changed

+34
-17
lines changed

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,20 @@ module "compute" {
4040
# input dict validation:
4141
group_name = each.key
4242
group_keys = keys(each.value)
43+
allowed_keys = [
44+
"nodes",
45+
"flavor",
46+
"image_id",
47+
"extra_networks",
48+
"vnic_types",
49+
"compute_init_enable",
50+
"ignore_image_changes",
51+
"volume_backed_instances",
52+
"root_volume_size",
53+
"extra_volumes",
54+
"match_ironic_node",
55+
"availability_zone",
56+
"gateway_ip",
57+
"nodename_template",
58+
]
4359
}

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,20 @@ module "login" {
4343
# input dict validation:
4444
group_name = each.key
4545
group_keys = keys(each.value)
46+
allowed_keys = [
47+
"nodes",
48+
"flavor",
49+
"image_id",
50+
"extra_networks",
51+
"vnic_types",
52+
"volume_backed_instances",
53+
"root_volume_size",
54+
"extra_volumes",
55+
"fip_addresses",
56+
"fip_network",
57+
"match_ironic_node",
58+
"availability_zone",
59+
"gateway_ip",
60+
"nodename_template",
61+
]
4662
}

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

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -149,27 +149,12 @@ variable "group_keys" {
149149
type = list
150150
validation {
151151
condition = length(setsubtract(var.group_keys, var.allowed_keys)) == 0
152-
error_message = "Compute group ${var.group_name} in var.compute contains invalid key(s): ${
152+
error_message = "Node group ${var.group_name} contains invalid key(s): ${
153153
join(", ", setsubtract(var.group_keys, var.allowed_keys))}"
154154
}
155155
}
156156

157157
variable "allowed_keys" {
158158
type = list
159-
default = [
160-
"nodes",
161-
"flavor",
162-
"image_id",
163-
"extra_networks",
164-
"vnic_types",
165-
"compute_init_enable",
166-
"ignore_image_changes",
167-
"volume_backed_instances",
168-
"root_volume_size",
169-
"extra_volumes",
170-
"match_ironic_node",
171-
"availability_zone",
172-
"gateway_ip",
173-
"nodename_template"
174-
]
159+
# don't provide a default here as allowed keys may depend on module use
175160
}

0 commit comments

Comments
 (0)