Skip to content

Commit 3c9d509

Browse files
committed
Now allows AZ to be specified for non-BM instances
1 parent 2d80af3 commit 3c9d509

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ locals {
2525
}
2626
)
2727
}
28+
29+
baremetal_az = var.availability_zone != null ? var.availability_zone : "nova"
2830
}
2931

3032
resource "openstack_blockstorage_volume_v3" "compute" {
@@ -115,7 +117,7 @@ resource "openstack_compute_instance_v2" "compute_fixed_image" {
115117
fqdn: ${local.fqdns[each.key]}
116118
EOF
117119

118-
availability_zone = var.match_ironic_node ? "${var.availability_zone}::${var.baremetal_nodes[each.key]}" : null
120+
availability_zone = var.match_ironic_node ? "${local.baremetal_az}::${var.baremetal_nodes[each.key]}" : var.availability_zone
119121

120122
lifecycle {
121123
ignore_changes = [
@@ -170,7 +172,7 @@ resource "openstack_compute_instance_v2" "compute" {
170172
fqdn: ${local.fqdns[each.key]}
171173
EOF
172174

173-
availability_zone = var.match_ironic_node ? "${var.availability_zone}::${var.baremetal_nodes[each.key]}" : null
175+
availability_zone = var.match_ironic_node ? "${local.baremetal_az}::${var.baremetal_nodes[each.key]}" : var.availability_zone
174176

175177
}
176178

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,8 @@ variable "match_ironic_node" {
150150

151151
variable "availability_zone" {
152152
type = string
153-
description = "Name of availability zone - ignored unless match_ironic_node is true"
154-
default = "nova"
155-
nullable = false
153+
description = "Name of availability zone. If undefined, defaults to 'nova' if match_ironic_node is true, defered to OpenStack otherwise"
154+
default = null
156155
}
157156

158157
variable "baremetal_nodes" {

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,8 @@ variable "login" {
7979
For any networks not specified here the cloud will
8080
select addresses.
8181
match_ironic_node: Set true to launch instances on the Ironic node of the same name as each cluster node
82-
availability_zone: Name of availability zone - ignored unless match_ironic_node is true (default: "nova")
82+
availability_zone: Name of availability zone"Name of availability zone. If undefined, defaults to 'nova'
83+
if match_ironic_node is true, defered to OpenStack otherwise"
8384
gateway_ip: Address to add default route via
8485
nodename_template: Overrides variable cluster_nodename_template
8586
EOF
@@ -122,7 +123,8 @@ variable "compute" {
122123
For any networks not specified here the cloud will
123124
select addresses.
124125
match_ironic_node: Set true to launch instances on the Ironic node of the same name as each cluster node
125-
availability_zone: Name of availability zone - ignored unless match_ironic_node is true (default: "nova")
126+
availability_zone: Name of availability zone. "Name of availability zone. If undefined, defaults to 'nova'
127+
if match_ironic_node is true, defered to OpenStack otherwise"
126128
gateway_ip: Address to add default route via
127129
nodename_template: Overrides variable cluster_nodename_template
128130

0 commit comments

Comments
 (0)