Parallels / packer-plugin-parallels

Packer plugin for Parallels Builder
https://www.packer.io/docs/builders/parallels
Mozilla Public License 2.0
12 stars 14 forks source link

Timestamp template isn't replaced anywhere #39

Closed jkmassel closed 2 years ago

jkmassel commented 2 years ago

Overview of the Issue

The {{timestamp}} variable shows up in the VM list in Parallels.

Reproduction Steps

See build notes below,

packer build

Plugin and Packer version

Packer v1.8.0

Simplified Packer Buildfile

packer {
  required_plugins {
    parallels = {
      version = ">= 1.0.0"
      source  = "github.com/hashicorp/parallels"
    }
  }
}

source "parallels-pvm" "macos-vm-builder" {
  source_path = "macos-12-3-template.pvm"
  [...]
}

build {
  sources = [
    "source.parallels-pvm.macos-vm-builder"
  ]

  provisioner "ansible" {
    playbook_file = "..."
}

Operating system and Environment details

macOS, Parallels 17.1.2, Intel x86

nywilken commented 2 years ago

Hi @jkmassel I'm not sure I understand the error you are reporting. But if you are trying to include a timestamp within the HCL template I would recommend using the HCL to generate an appropriate timestamp, as {{timestamp}} is function interpolation supported in JSON templates. I've provided an example on how you could create a local variable to hold the timestamp data, which you can then use within your template configuration below.

locals { timestamp = regex_replace(timestamp(), "[- TZ:]", "") }

source "parallels-pvm" "macos-vm-builder" {
  source_path = "macos-12-3-template.pvm" 
  some_config_arg = "${local.timestamp}"
}

If I made a mistake in understanding your error can you please provide a redacted debug log via PACKER_LOG=1 packer build template.pkr.hcl for us to review. Cheers!

nywilken commented 2 years ago

Hi there 👋 , I'm going to close this issue since there hasn't been any updates to it. But if you are still running into issues please feel free to leave a comment on the issue and we will gladly reopen.