Skip to content

Commit ad86692

Browse files
committed
add environment_name to nodename template
1 parent 404ea65 commit ad86692

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@ locals {
33
nodename = templatestring(
44
var.cluster_nodename_template,
55
{
6-
node="control",
7-
cluster_name=var.cluster_name,
8-
cluster_domain_suffix=var.cluster_domain_suffix
6+
node = "control",
7+
cluster_name = var.cluster_name,
8+
cluster_domain_suffix = var.cluster_domain_suffix,
9+
environment_name = basename(var.environment_root)
910
}
1011
)
1112
}

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,10 @@ locals {
1818
for n in var.nodes: n => templatestring(
1919
var.nodename_template,
2020
{
21-
node=n,
22-
cluster_name=var.cluster_name,
23-
cluster_domain_suffix=var.cluster_domain_suffix
21+
node = n,
22+
cluster_name = var.cluster_name,
23+
cluster_domain_suffix = var.cluster_domain_suffix,
24+
environment_name = basename(var.environment_root)
2425
}
2526
)
2627
}

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,8 @@ variable "cluster_nodename_template" {
190190
$${cluster_domain_suffix}: From var.cluster_domain_suffix
191191
$${node}: The current entry in the "nodes" parameter for nodes
192192
defined by var.compute and var.login, or "control" for the control
193-
node.
193+
node
194+
$${environment_name}: The last element of the current environment's path
194195
EOT
195196
type = string
196197
default = "$${cluster_name}-$${node}.$${cluster_name}.$${cluster_domain_suffix}"

0 commit comments

Comments
 (0)