@@ -23,7 +23,8 @@ data "git-commit" "cwd-head" { }
2323locals {
2424 git_commit = data. git-commit . cwd-head . hash
2525 timestamp = formatdate (" YYMMDD-hhmm" , timestamp ())
26- image_version = var. image_version == " " ? " ${ local . timestamp } -${ substr (local. git_commit , 0 , 8 )} " : var. image_version
26+ image_version = var. image_version == " auto" ? " ${ local . timestamp } -${ substr (local. git_commit , 0 , 8 )} " : var. image_version
27+ image_name = replace (var. image_name , '/ ', '- ')
2728}
2829
2930# Path pointing to root of repository - automatically set by environment variable PKR_VAR_repo_root
@@ -157,14 +158,14 @@ variable "inventory_groups" {
157158
158159variable "image_name" {
159160 type = string
160- description = " Built image name"
161+ description = " Built image name. Any '/' are replaced with '-'. "
161162 default = " openhpc"
162163}
163164
164165variable "image_version" {
165166 type = string
166- description = " Suffix for built image names. If not supplied a timestamp+git commit is used "
167- default = " "
167+ description = " Suffix for built image names. Default special value 'auto' uses a timestamp+git commit"
168+ default = " auto "
168169}
169170
170171source "openstack" "openhpc" {
@@ -202,7 +203,7 @@ build {
202203
203204 source "source.openstack.openhpc" {
204205 name = " rocky-latest"
205- image_name = " ${ var . image_name } - ${ local . image_version } "
206+ image_name = join ( " - " , [ local . image_name , local . image_version ])
206207 }
207208
208209 provisioner "ansible" {
0 commit comments