I apologize in advance if this question has been asked and answered already. I did a few searches and couldn’t seem to find any information on it.
I’m trying to embed a source or build variable into a variable, and am struggling to wrap my head around how to get that to work.
example:
variable singlesession {
type = object({
custom = object({
type = object({
osname = string
})
})
})
default = {
singlesession = {
custom = {
osname = "windows-10-singlesession"
}
}
}
}
source "azure-arm" "singlesession" {
communicator = "winrm"
winrm_use_ssl = false
winrm_insecure = false
winrm_use_ntlm = false
winrm_timeout = "10m"
winrm_username = "packer"
winrm_host = "127.0.0.1"
}
build {
name = "windows-10"
source "azure-arm.singlesession" {
}
shared_image_gallery_destination = {
image_name = "id-${var.${source.name}.custom.osname}"
}
I’m trying to build out a variables file that will work for multiple windows 10 builds that need to be customized based off of some sort of application suite set. I know, not great, but it’s what it is.
Maybe I’m trying to make it more complicated than it needs to be. If all else fails, I’ll just punt and declare/define separate variables for each of the builds in the source blocks.
Thanks in advance.