@@ -23,7 +23,8 @@ data "git-commit" "cwd-head" { }
23
23
locals {
24
24
git_commit = data. git-commit . cwd-head . hash
25
25
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 , '/ ', '- ')
27
28
}
28
29
29
30
# Path pointing to root of repository - automatically set by environment variable PKR_VAR_repo_root
@@ -157,14 +158,14 @@ variable "inventory_groups" {
157
158
158
159
variable "image_name" {
159
160
type = string
160
- description = " Built image name"
161
+ description = " Built image name. Any '/' are replaced with '-'. "
161
162
default = " openhpc"
162
163
}
163
164
164
165
variable "image_version" {
165
166
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 "
168
169
}
169
170
170
171
source "openstack" "openhpc" {
@@ -202,7 +203,7 @@ build {
202
203
203
204
source "source.openstack.openhpc" {
204
205
name = " rocky-latest"
205
- image_name = " ${ var . image_name } - ${ local . image_version } "
206
+ image_name = join ( " - " , [ local . image_name , local . image_version ])
206
207
}
207
208
208
209
provisioner "ansible" {
0 commit comments