Published: Oct 19, 2022 by Isaac Johnson
At Hashiconf 2022 they announced a new HCP (Hashi Cloud Platform) product ; HCP Packer. While the bulk of announcements and presentations revolved around Terraform and Vault, their largest products, I was intrigued by what HCP Packer might offer.
While it is in Beta, I figured now would be a good time to sign up and kick the tires on this new HCP Offering.
Today we’ll setup HCP Packer, build a simple hello-world linux container to send to HCP Packer, we’ll explore some of the limitations and we’ll wrap by building a local Windows VM with Packer, setting it up for Azure then sending to Azure to use as a VM Image Template (whether that can tie into HCP Packer, you’ll have to read along to see).
Let’s get started!
Creating an HCP Packer instance
You can create an account or sign in to HCP Cloud if you already have an account at https://portal.cloud.hashicorp.com/sign-in.
Next, we can sign up for HCP Packer
And create our first registry
We next need an IAM user
Instead of a user, we need to create a Service Principal
We’ll call it packer
and give it Contributor access
Click ‘Create Service Principal Key’
This will give us an ID and Secret to save for later
Local Packer
Before we continue, let’s get Packer setup
$ curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo apt-key add -
[sudo] password for builder:
OK
$ sudo apt-add-repository "deb [arch=amd64] https://apt.releases.hashicorp.com $(lsb_release -cs) main"
Get:1 http://security.ubuntu.com/ubuntu focal-security InRelease [114 kB]
Hit:2 http://archive.ubuntu.com/ubuntu focal InRelease
Get:3 http://archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]
Get:4 https://apt.releases.hashicorp.com focal InRelease [16.3 kB]
Get:5 https://packages.cloud.google.com/apt cloud-sdk InRelease [6751 B]
... snip ...
Get:30 http://archive.ubuntu.com/ubuntu focal-updates/universe Translation-en [220 kB]
Get:31 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 c-n-f Metadata [21.8 kB]
Fetched 10.5 MB in 5s (2196 kB/s)
Reading package lists... Done
Now we can install it
$ sudo apt-get update && sudo apt-get install packer
Hit:1 http://archive.ubuntu.com/ubuntu focal InRelease
Hit:2 http://security.ubuntu.com/ubuntu focal-security InRelease
Hit:3 http://archive.ubuntu.com/ubuntu focal-updates InRelease
Hit:4 https://packages.cloud.google.com/apt cloud-sdk InRelease
Hit:5 http://archive.ubuntu.com/ubuntu focal-backports InRelease
Hit:6 https://apt.releases.hashicorp.com focal InRelease
Hit:7 https://packages.microsoft.com/repos/azure-cli focal InRelease
Hit:8 https://packages.microsoft.com/repos/code stable InRelease
Reading package lists... Done
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
libgbm1 libjs-sphinxdoc libjs-underscore libsecret-1-0 libsecret-common libwayland-server0 python-pkginfo-doc
python3-adal python3-aiohttp python3-applicationinsights python3-argcomplete python3-async-timeout
python3-azext-devops python3-azure python3-azure-cli python3-azure-cli-core python3-azure-cli-telemetry
python3-azure-cosmos python3-azure-cosmosdb-table python3-azure-datalake-store python3-azure-functions-devops-build
python3-azure-multiapi-storage python3-azure-storage python3-bcrypt python3-cffi python3-fabric
python3-humanfriendly python3-invoke python3-isodate python3-javaproperties python3-jsmin python3-jsondiff
python3-knack python3-mock python3-msal python3-msal-extensions python3-msrest python3-msrestazure python3-multidict
python3-paramiko python3-pbr python3-pkginfo python3-ply python3-portalocker python3-psutil python3-pycparser
python3-requests-oauthlib python3-scp python3-sshtunnel python3-tabulate python3-tz python3-uamqp
python3-vsts-cd-manager python3-websocket python3-xmltodict python3-yarl
Use 'sudo apt autoremove' to remove them.
The following NEW packages will be installed:
packer
0 upgraded, 1 newly installed, 0 to remove and 231 not upgraded.
Need to get 34.4 MB of archives.
After this operation, 156 MB of additional disk space will be used.
Get:1 https://apt.releases.hashicorp.com focal/main amd64 packer amd64 1.8.3-1 [34.4 MB]
Fetched 34.4 MB in 7s (5038 kB/s)
Selecting previously unselected package packer.
(Reading database ... 180305 files and directories currently installed.)
Preparing to unpack .../packer_1.8.3-1_amd64.deb ...
Unpacking packer (1.8.3-1) ...
Setting up packer (1.8.3-1) ...
$ packer version
Packer v1.8.3
Next we’ll do a small local test using docker
builder@DESKTOP-72D2D9T:~/Workspaces$ cd packerTest/
builder@DESKTOP-72D2D9T:~/Workspaces/packerTest$ vi docker-ubuntu.pkr.hcl
builder@DESKTOP-72D2D9T:~/Workspaces/packerTest$ cat docker-ubuntu.pkr.hcl
packer {
required_plugins {
docker = {
version = ">= 0.0.7"
source = "github.com/hashicorp/docker"
}
}
}
source "docker" "ubuntu" {
image = "ubuntu:focal"
commit = true
}
build {
name = "freshbrewed-packer"
sources = [
"source.docker.ubuntu"
]
}
Next I’ll do packer init
$ packer init .
Installed plugin github.com/hashicorp/docker v1.0.8 in "/home/builder/.config/packer/plugins/github.com/hashicorp/docker/packer-plugin-docker_v1.0.8_x5.0_linux_amd64"
and to check and validate the hcl, I’ll use packer fmt
$ packer fmt .
docker-ubuntu.pkr.hcl
$ packer validate .
The configuration is valid.
We can now build it locally
builder@DESKTOP-72D2D9T:~/Workspaces/packerTest$ packer build .
freshbrewed-packer.docker.ubuntu: output will be in this color.
==> freshbrewed-packer.docker.ubuntu: Creating a temporary directory for sharing data...
==> freshbrewed-packer.docker.ubuntu: Pulling Docker image: ubuntu:focal
freshbrewed-packer.docker.ubuntu: focal: Pulling from library/ubuntu
freshbrewed-packer.docker.ubuntu: fb0b3276a519: Pulling fs layer
freshbrewed-packer.docker.ubuntu: fb0b3276a519: Verifying Checksum
freshbrewed-packer.docker.ubuntu: fb0b3276a519: Download complete
freshbrewed-packer.docker.ubuntu: fb0b3276a519: Pull complete
freshbrewed-packer.docker.ubuntu: Digest: sha256:9c2004872a3a9fcec8cc757ad65c042de1dad4da27de4c70739a6e36402213e3
freshbrewed-packer.docker.ubuntu: Status: Downloaded newer image for ubuntu:focal
freshbrewed-packer.docker.ubuntu: docker.io/library/ubuntu:focal
==> freshbrewed-packer.docker.ubuntu: Starting docker container...
freshbrewed-packer.docker.ubuntu: Run command: docker run -v /home/builder/.config/packer/tmp1092818684:/packer-files -d -i -t --entrypoint=/bin/sh -- ubuntu:focal
freshbrewed-packer.docker.ubuntu: Container ID: 1a027553005f4c94501eaab9b6847769e11ce2d7441a6d2749305c3b3e97aafb
==> freshbrewed-packer.docker.ubuntu: Using docker communicator to connect: 172.17.0.3
==> freshbrewed-packer.docker.ubuntu: Committing the container
freshbrewed-packer.docker.ubuntu: Image ID: sha256:d72f4615c7e0fa07402b31ee25faa625d1fe25fb09613b31f9985e0442ce648c
==> freshbrewed-packer.docker.ubuntu: Killing the container: 1a027553005f4c94501eaab9b6847769e11ce2d7441a6d2749305c3b3e97aafb
Build 'freshbrewed-packer.docker.ubuntu' finished after 12 seconds 18 milliseconds.
==> Wait completed after 12 seconds 18 milliseconds
==> Builds finished. The artifacts of successful builds are:
--> freshbrewed-packer.docker.ubuntu: Imported Docker image: sha256:d72f4615c7e0fa07402b31ee25faa625d1fe25fb09613b31f9985e0442ce648c
##
Now I’ll set my HCP Packer variables
builder@DESKTOP-72D2D9T:~/Workspaces/packerTest$ export HCP_CLIENT_ID=v********************w
builder@DESKTOP-72D2D9T:~/Workspaces/packerTest$ export HCP_CLIENT_SECRET=o****************************************************h
Then I need to add an hcp_packer_registry
block in order to push to HCP Packer
$ cat docker-ubuntu.pkr.hcl
packer {
required_plugins {
docker = {
version = ">= 0.0.7"
source = "github.com/hashicorp/docker"
}
}
}
source "docker" "ubuntu" {
image = "ubuntu:focal"
commit = true
}
build {
name = "freshbrewed-packer"
hcp_packer_registry {
bucket_name = "learn-packer-ubuntu"
description = <<EOT
Some nice description about the image being published to HCP Packer Registry.
EOT
bucket_labels = {
"owner" = "sre-team"
"os" = "Ubuntu",
"ubuntu-version" = "Focal 20.04",
}
}
sources = [
"source.docker.ubuntu"
]
}
Next, we need to git init
this repo or set an env var to make it unique (HCP_PACKER_BUILD_FINGERPRINT).
builder@DESKTOP-72D2D9T:~/Workspaces/packerTest$ git init
Initialized empty Git repository in /home/builder/Workspaces/packerTest/.git/
builder@DESKTOP-72D2D9T:~/Workspaces/packerTest$ git checkout -b main
Switched to a new branch 'main'
builder@DESKTOP-72D2D9T:~/Workspaces/packerTest$ git add docker-ubuntu.pkr.hcl
builder@DESKTOP-72D2D9T:~/Workspaces/packerTest$ git commit -m "first"
[main (root-commit) 0becd23] first
1 file changed, 33 insertions(+)
create mode 100644 docker-ubuntu.pkr.hcl
We can then validate our HCL
builder@DESKTOP-72D2D9T:~/Workspaces/packerTest$ packer validate .
The configuration is valid.
Now when I build, it should push to HCP Packer
builder@DESKTOP-72D2D9T:~/Workspaces/packerTest$ packer build .
freshbrewed-packer.docker.ubuntu: output will be in this color.
==> freshbrewed-packer.docker.ubuntu: Publishing build details for docker.ubuntu to the HCP Packer registry
==> freshbrewed-packer.docker.ubuntu: Creating a temporary directory for sharing data...
==> freshbrewed-packer.docker.ubuntu: Pulling Docker image: ubuntu:focal
freshbrewed-packer.docker.ubuntu: focal: Pulling from library/ubuntu
freshbrewed-packer.docker.ubuntu: Digest: sha256:9c2004872a3a9fcec8cc757ad65c042de1dad4da27de4c70739a6e36402213e3
freshbrewed-packer.docker.ubuntu: Status: Image is up to date for ubuntu:focal
freshbrewed-packer.docker.ubuntu: docker.io/library/ubuntu:focal
==> freshbrewed-packer.docker.ubuntu: Starting docker container...
freshbrewed-packer.docker.ubuntu: Run command: docker run -v /home/builder/.config/packer/tmp3448529403:/packer-files -d -i -t --entrypoint=/bin/sh -- ubuntu:focal
freshbrewed-packer.docker.ubuntu: Container ID: 6cc9c84cf32a3136feeb70179877536b97c3f2e4e5a16a8bcdae03c2a8437e2a
==> freshbrewed-packer.docker.ubuntu: Using docker communicator to connect: 172.17.0.3
==> freshbrewed-packer.docker.ubuntu: Committing the container
freshbrewed-packer.docker.ubuntu: Image ID: sha256:fe39b91ce18bfad14ca384debc1f9080d7e443b87edae4aadbc469409b0fa4e8
==> freshbrewed-packer.docker.ubuntu: Killing the container: 6cc9c84cf32a3136feeb70179877536b97c3f2e4e5a16a8bcdae03c2a8437e2a
==> freshbrewed-packer.docker.ubuntu: Running post-processor:
Build 'freshbrewed-packer.docker.ubuntu' finished after 4 seconds 994 milliseconds.
==> Wait completed after 4 seconds 994 milliseconds
==> Builds finished. The artifacts of successful builds are:
--> freshbrewed-packer.docker.ubuntu: Imported Docker image: sha256:fe39b91ce18bfad14ca384debc1f9080d7e443b87edae4aadbc469409b0fa4e8
--> freshbrewed-packer.docker.ubuntu: Published metadata to HCP Packer registry packer/learn-packer-ubuntu/iterations/01GFA260B3RCRZPZDRMTTKZ18F
Going back to HCP Packer, we can see our image
If we click the ID we can see details
Cost
Before we continue, let’s be clear about what the Free tier gives us
We get 10 images in a month and 250 requests on those. That’s enough to test the system but likely not enough for any real production
Packer for Windows
To do the packer for Windows, We’ll need to install Packer on Windows, not just WSL
I’ll download the Amd64 binary from the downloads page
To keep it simple, I’ll just copy the binary in the zip to System32
Now I can clone the common templates GIT repo and also check that packer is found in the path.
C:\Users\isaac\Workspaces>git clone https://github.com/marcinbojko/hv-packer.git
Cloning into 'hv-packer'...
remote: Enumerating objects: 1109, done.
remote: Counting objects: 100% (246/246), done.
remote: Compressing objects: 100% (125/125), done.
remote: Total 1109 (delta 181), reused 164 (delta 120), pack-reused 863
Receiving objects: 100% (1109/1109), 4.37 MiB | 15.28 MiB/s, done.
Resolving deltas: 100% (762/762), done.
C:\Users\isaac\Workspaces>cd hv-packer
C:\Users\isaac\Workspaces\hv-packer>packer version
Packer v1.8.3
I’ll switch to a powershell prompt. Note, we need to be in an Administrator Prompt, not just user (or we’ll get an error)
--> hyperv-iso.vm: Failed creating Hyper-V driver: Current user is not a member of 'Hyper-V Administrators' or 'Administrators' group
Also, one cannot build an image without the actual ISO. These are easy to download from Microsoft (long ago we had to have MSDN seats).
For instance, I’ll download the Windows Server 2016 ISO from https://www.microsoft.com/en-us/evalcenter/download-windows-server-2016
These example templates will expect ISOs in an ISO subfolder (./iso)
After I moved the file into the new folder, I updated the hcl pkvars file to use it
Note: I know the Checksum is wrong, but I’ll let Packer tell me the right one
PS C:\Users\isaac\Workspaces\hv-packer> .\hv_win2016_std.ps1
Template and var file found
Building: Windows Server 2016 Standard Gen-2
Warning: A shutdown_command was not specified. With
... snip ...
==> hyperv-iso.vm: Checksum did not match, removing C:\Users\isaac\Workspaces\hv-packer\packer_cache\b445b3613f0f13924030e719d009b945f066664e.iso
==> hyperv-iso.vm: Failed to remove cache file. Please remove manually: C:\Users\isaac\Workspaces\hv-packer\packer_cache\b445b3613f0f13924030e719d009b945f066664e.iso
==> hyperv-iso.vm: error downloading ISO: [Checksums did not match for C:/Users/isaac/Workspaces/hv-packer/iso/Windows_Server_2016_Datacenter_EVAL_en-us_14393_refresh.ISO.
==> hyperv-iso.vm: Expected: 47919ce8b4993f531ca1fa3f85941f4a72b47ebaa4d3a321fecf83ca9d17e6b8
==> hyperv-iso.vm: Got: 1ce702a578a3cb1ac3d14873980838590f06d5b7101c5daaccbac9d73f1fb50f
==> hyperv-iso.vm: *sha256.digest]
==> hyperv-iso.vm: Deleting output directory...
==> hyperv-iso.vm: Deleting build directory...
... snip ...
I’ll set that “expected” SHA into the pkvars file now
then run again
S C:\Users\isaac\Workspaces\hv-packer> .\hv_win2016_std.ps1
Template and var file found
Building: Windows Server 2016 Standard Gen-2
Warning: A shutdown_command was not specified. Without a shutdown command, Packer
will forcibly halt the virtual machine, which may result in data loss.
on ./templates/hv_win2016_g2.pkr.hcl line 72:
(source code not available)
The configuration is valid.
Packer v1.8.3
Warning: A shutdown_command was not specified. Without a shutdown command, Packer
will forcibly halt the virtual machine, which may result in data loss.
on ./templates/hv_win2016_g2.pkr.hcl line 72:
(source code not available)
hyperv-iso.vm: output will be in this color.
==> hyperv-iso.vm: Creating build directory...
==> hyperv-iso.vm: Retrieving ISO
==> hyperv-iso.vm: Trying .\iso\Windows_Server_2016_Datacenter_EVAL_en-us_14393_refresh.ISO
==> hyperv-iso.vm: Trying ./iso/Windows_Server_2016_Datacenter_EVAL_en-us_14393_refresh.ISO?checksum=sha256%3A47919ce8b4993f531ca1fa3f85941f4a72b47ebaa4d3a321fecf83ca9d17e6b8
==> hyperv-iso.vm: Checksum did not match, removing C:\Users\isaac\Workspaces\hv-packer\packer_cache\b445b3613f0f13924030e719d009b945f066664e.iso
==> hyperv-iso.vm: Failed to remove cache file. Please remove manually: C:\Users\isaac\Workspaces\hv-packer\packer_cache\b445b3613f0f13924030e719d009b945f066664e.iso
==> hyperv-iso.vm: error downloading ISO: [Checksums did not match for C:/Users/isaac/Workspaces/hv-packer/iso/Windows_Server_2016_Datacenter_EVAL_en-us_14393_refresh.ISO. ==> hyperv-iso.vm: Expected: 47919ce8b4993f531ca1fa3f85941f4a72b47ebaa4d3a321fecf83ca9d17e6b8 ==> hyperv-iso.vm: Got: 1ce702a578a3cb1ac3d14873980838590f06d5b7101c5daaccbac9d73f1fb50f ==> hyperv-iso.vm: *sha256.digest] ==> hyperv-iso.vm: Deleting output directory... ==> hyperv-iso.vm: Deleting build directory...
Build 'hyperv-iso.vm' errored after 16 seconds 19 milliseconds: error downloading ISO: [Checksums did not match for C:/Users/isaac/Workspaces/hv-packer/iso/Windows_Server_2016_Datacenter_EVAL_en-us_14393_refresh.ISO.
Expected: 47919ce8b4993f531ca1fa3f85941f4a72b47ebaa4d3a321fecf83ca9d17e6b8
Got: 1ce702a578a3cb1ac3d14873980838590f06d5b7101c5daaccbac9d73f1fb50f
*sha256.digest]
==> Wait completed after 16 seconds 19 milliseconds
==> Some builds didn't complete successfully and had errors:
--> hyperv-iso.vm: error downloading ISO: [Checksums did not match for C:/Users/isaac/Workspaces/hv-packer/iso/Windows_Server_2016_Datacenter_EVAL_en-us_14393_refresh.ISO.
Expected: 47919ce8b4993f531ca1fa3f85941f4a72b47ebaa4d3a321fecf83ca9d17e6b8
Got: 1ce702a578a3cb1ac3d14873980838590f06d5b7101c5daaccbac9d73f1fb50f
*sha256.digest]
==> Builds finished but no artifacts were created.
[INFO] - Elapsed Time: 21.9273352 seconds
PS C:\Users\isaac\Workspaces\hv-packer>
PS C:\Users\isaac\Workspaces\hv-packer>
PS C:\Users\isaac\Workspaces\hv-packer> .\hv_win2016_std.ps1
Template and var file found
Building: Windows Server 2016 Standard Gen-2
Warning: A shutdown_command was not specified. Without a shutdown command, Packer
will forcibly halt the virtual machine, which may result in data loss.
on ./templates/hv_win2016_g2.pkr.hcl line 72:
(source code not available)
The configuration is valid.
Packer v1.8.3
Warning: A shutdown_command was not specified. Without a shutdown command, Packer
will forcibly halt the virtual machine, which may result in data loss.
on ./templates/hv_win2016_g2.pkr.hcl line 72:
(source code not available)
hyperv-iso.vm: output will be in this color.
==> hyperv-iso.vm: Creating build directory...
==> hyperv-iso.vm: Retrieving ISO
==> hyperv-iso.vm: Trying .\iso\Windows_Server_2016_Datacenter_EVAL_en-us_14393_refresh.ISO
==> hyperv-iso.vm: Trying ./iso/Windows_Server_2016_Datacenter_EVAL_en-us_14393_refresh.ISO?checksum=sha256%3A1ce702a578a3cb1ac3d14873980838590f06d5b7101c5daaccbac9d73f1fb50f
==> hyperv-iso.vm: ./iso/Windows_Server_2016_Datacenter_EVAL_en-us_14393_refresh.ISO?checksum=sha256%3A1ce702a578a3cb1ac3d14873980838590f06d5b7101c5daaccbac9d73f1fb50f => C:/Users/isaac/Workspaces/hv-packer/iso/Windows_Server_2016_Datacenter_EVAL_en-us_14393_refresh.ISO
==> hyperv-iso.vm: Creating switch 'vSwitch' if required...
==> hyperv-iso.vm: switch 'vSwitch' already exists. Will not delete on cleanup...
==> hyperv-iso.vm: Creating virtual machine...
==> hyperv-iso.vm: Enabling Integration Service...
==> hyperv-iso.vm: Setting boot drive to os dvd drive C:/Users/isaac/Workspaces/hv-packer/iso/Windows_Server_2016_Datacenter_EVAL_en-us_14393_refresh.ISO ...
==> hyperv-iso.vm: Mounting os dvd drive C:/Users/isaac/Workspaces/hv-packer/iso/Windows_Server_2016_Datacenter_EVAL_en-us_14393_refresh.ISO ...
==> hyperv-iso.vm: Skipping mounting Integration Services Setup Disk...
==> hyperv-iso.vm: Mounting secondary DVD images...
==> hyperv-iso.vm: Mounting secondary dvd drive ./extra/files/gen2-2016/secondary.iso ...
==> hyperv-iso.vm: Configuring vlan...
==> hyperv-iso.vm: Determine Host IP for HyperV machine...
==> hyperv-iso.vm: Error getting host adapter ip address: No ip address.
==> hyperv-iso.vm: Clean up secondary dvd drives...
==> hyperv-iso.vm: Clean up os dvd drive...
==> hyperv-iso.vm: Unregistering and deleting virtual machine...
==> hyperv-iso.vm: Deleting output directory...
==> hyperv-iso.vm: Deleting build directory...
Build 'hyperv-iso.vm' errored after 36 seconds 549 milliseconds: Error getting host adapter ip address: No ip address.
==> Wait completed after 36 seconds 549 milliseconds
==> Some builds didn't complete successfully and had errors:
--> hyperv-iso.vm: Error getting host adapter ip address: No ip address.
==> Builds finished but no artifacts were created.
[INFO] - Elapsed Time: 42.7182511 seconds
It got closer, but still didn’t like the lack of IP. It’s actually an active bug
I moved back to packer 1.7.10 and got past the error
We can see it prepare the Windows VM
While this seemed to get farther, I hit an error on Choco installs
hyperv-iso.vm: Phase 1 [INFO] - installing Chocolatey, attempt 1 of 99
hyperv-iso.vm: Bypass
hyperv-iso.vm: VERBOSE: Performing the operation "Set-ExecutionPolicy" on target "Bypass".
hyperv-iso.vm: Phase 1 [WARN]- Chocolatey install problem, attempt 1 of 99
hyperv-iso.vm: Phase 1 [INFO] - installing Chocolatey, attempt 2 of 99
hyperv-iso.vm: Bypass
hyperv-iso.vm: VERBOSE: Performing the operation "Set-ExecutionPolicy" on target "Bypass".
hyperv-iso.vm: Phase 1 [WARN]- Chocolatey install problem, attempt 2 of 99
hyperv-iso.vm: Phase 1 [INFO] - installing Chocolatey, attempt 3 of 99
... snip ...
hyperv-iso.vm: VERBOSE: Performing the operation "Set-ExecutionPolicy" on target "Bypass".
hyperv-iso.vm: Phase 1 [WARN]- Chocolatey install problem, attempt 98 of 99
hyperv-iso.vm: Phase 1 [ERROR] - Chocolatey install problem, critical, exiting
==> hyperv-iso.vm: Provisioning step had errors: Running the cleanup provisioner, if present...
==> hyperv-iso.vm: Disconnecting from vmconnect...
==> hyperv-iso.vm: Clean up secondary dvd drives...
==> hyperv-iso.vm: Clean up os dvd drive...
==> hyperv-iso.vm: Unregistering and deleting virtual machine...
==> hyperv-iso.vm: Deleting output directory...
==> hyperv-iso.vm: Deleting build directory...
Build 'hyperv-iso.vm' errored after 6 minutes 31 seconds: Script exited with non-zero exit status: 1.Allowed exit codes are: [0]
==> Wait completed after 6 minutes 31 seconds
==> Some builds didn't complete successfully and had errors:
--> hyperv-iso.vm: Script exited with non-zero exit status: 1.Allowed exit codes are: [0]
==> Builds finished but no artifacts were created.
[INFO] - Elapsed Time: 395.7795746 seconds
It took a while to figure out, but the vSwitch was set to Internal Only in Hyper-V (and we don’t recreate it). I set it to use my Ethernet NIC
Summary of had to change to get Win 2016 to work
I had to move down to Packer v1.7.10
PS C:\Users\isaac\Workspaces\hv-packer> packer version
Packer v1.7.10
Your version of Packer is out of date! The latest version
is 1.8.3. You can update by downloading from www.packer.io/downloads
I had to move the vSwitch to connect to an external network (so it could download packages)
And change the phase-2.ps1 to --ignore-checksums
due to a known issue with ‘sysinternals` having a bad checksum on its zip.
Lastly, the ISO image is different from what is in the GIT repo, so change the URL and checksum
iso_url=".\\iso\\Windows_Server_2016_Datacenter_EVAL_en-us_14393_refresh.ISO"
iso_checksum_type="sha256"
iso_checksum="1ce702a578a3cb1ac3d14873980838590f06d5b7101c5daaccbac9d73f1fb50f"
Note, i did add a debug line in phase1 so i could see the errors
The verbose output from setting debug logs:
PS C:\Users\isaac\Workspaces\hv-packer> set PACKER_LOG=1
Made it far too long to capture, but here is the tail end of the build log
PS C:\Users\isaac\Workspaces\hv-packer> .\hv_win2016_std.ps1
... snip ...
hyperv-iso.vm:
hyperv-iso.vm: [===========================70.4%======== ]
hyperv-iso.vm:
hyperv-iso.vm: [===========================70.4%======== ]
hyperv-iso.vm:
hyperv-iso.vm: [===========================70.4%======== ]
hyperv-iso.vm:
hyperv-iso.vm: [===========================70.4%======== ]
hyperv-iso.vm:
hyperv-iso.vm: [===========================70.4%======== ]
hyperv-iso.vm:
hyperv-iso.vm: [===========================70.4%======== ]
hyperv-iso.vm:
hyperv-iso.vm: [===========================70.4%======== ]
hyperv-iso.vm:
hyperv-iso.vm: [===========================70.4%======== ]
hyperv-iso.vm:
hyperv-iso.vm: [===========================70.4%======== ]
hyperv-iso.vm:
hyperv-iso.vm: [===========================70.4%======== ]
hyperv-iso.vm:
hyperv-iso.vm: [===========================70.4%======== ]
hyperv-iso.vm:
hyperv-iso.vm: [===========================70.4%======== ]
hyperv-iso.vm:
hyperv-iso.vm: [===========================70.4%======== ]
hyperv-iso.vm:
hyperv-iso.vm: [===========================70.4%======== ]
hyperv-iso.vm:
hyperv-iso.vm: [===========================70.4%======== ]
hyperv-iso.vm:
hyperv-iso.vm: [===========================70.4%======== ]
hyperv-iso.vm:
hyperv-iso.vm: [===========================70.4%======== ]
hyperv-iso.vm:
hyperv-iso.vm: [===========================70.4%======== ]
hyperv-iso.vm:
hyperv-iso.vm: [===========================70.4%======== ]
hyperv-iso.vm:
hyperv-iso.vm: [===========================70.4%======== ]
hyperv-iso.vm:
hyperv-iso.vm: [===========================70.4%======== ]
hyperv-iso.vm:
hyperv-iso.vm: [===========================70.4%======== ]
hyperv-iso.vm:
hyperv-iso.vm: [===========================70.4%======== ]
hyperv-iso.vm:
hyperv-iso.vm: [===========================70.4%======== ]
hyperv-iso.vm:
hyperv-iso.vm: [===========================70.4%======== ]
hyperv-iso.vm:
hyperv-iso.vm: [===========================70.4%======== ]
hyperv-iso.vm:
hyperv-iso.vm: [===========================70.4%======== ]
hyperv-iso.vm:
hyperv-iso.vm: [===========================70.4%======== ]
hyperv-iso.vm:
hyperv-iso.vm: [===========================70.4%======== ]
hyperv-iso.vm:
hyperv-iso.vm: [===========================70.4%======== ]
hyperv-iso.vm:
hyperv-iso.vm: [===========================70.4%======== ]
hyperv-iso.vm:
hyperv-iso.vm: [===========================70.4%======== ]
hyperv-iso.vm:
hyperv-iso.vm: [===========================70.4%======== ]
hyperv-iso.vm:
hyperv-iso.vm: [===========================70.4%======== ]
hyperv-iso.vm:
hyperv-iso.vm: [===========================70.4%======== ]
hyperv-iso.vm:
hyperv-iso.vm: [===========================70.4%======== ]
hyperv-iso.vm:
hyperv-iso.vm: [===========================70.4%======== ]
hyperv-iso.vm:
hyperv-iso.vm: [===========================70.4%======== ]
hyperv-iso.vm:
hyperv-iso.vm: [===========================70.4%======== ]
hyperv-iso.vm:
hyperv-iso.vm: [===========================70.4%======== ]
hyperv-iso.vm:
hyperv-iso.vm: [===========================70.4%======== ]
hyperv-iso.vm:
hyperv-iso.vm: [===========================70.4%======== ]
hyperv-iso.vm:
hyperv-iso.vm: [===========================70.4%======== ]
hyperv-iso.vm:
hyperv-iso.vm: [===========================70.4%======== ]
hyperv-iso.vm:
hyperv-iso.vm: [===========================70.4%======== ]
hyperv-iso.vm:
hyperv-iso.vm: [===========================70.4%======== ]
hyperv-iso.vm:
hyperv-iso.vm: [===========================70.4%======== ]
hyperv-iso.vm:
hyperv-iso.vm: [===========================70.4%======== ]
hyperv-iso.vm:
hyperv-iso.vm: [===========================70.4%======== ]
hyperv-iso.vm:
hyperv-iso.vm: [===========================70.4%======== ]
hyperv-iso.vm:
hyperv-iso.vm: [===========================70.4%======== ]
hyperv-iso.vm:
hyperv-iso.vm: [===========================70.4%======== ]
hyperv-iso.vm:
hyperv-iso.vm: [===========================70.4%======== ]
hyperv-iso.vm:
hyperv-iso.vm: [===========================70.4%======== ]
hyperv-iso.vm:
hyperv-iso.vm: [===========================70.4%======== ]
hyperv-iso.vm:
hyperv-iso.vm: [===========================70.4%======== ]
hyperv-iso.vm:
hyperv-iso.vm: [===========================70.4%======== ]
hyperv-iso.vm:
hyperv-iso.vm: [===========================70.4%======== ]
hyperv-iso.vm:
hyperv-iso.vm: [===========================70.4%======== ]
hyperv-iso.vm:
hyperv-iso.vm: [===========================70.4%======== ]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: [==========================100.0%==========================]
hyperv-iso.vm:
hyperv-iso.vm: Error: 2
hyperv-iso.vm:
hyperv-iso.vm: The system cannot find the file specified.
hyperv-iso.vm:
hyperv-iso.vm: The DISM log file can be found at C:\Windows\Logs\DISM\dism.log
hyperv-iso.vm:
hyperv-iso.vm: Deployment Image Servicing and Management tool
hyperv-iso.vm: Version: 10.0.14393.4169
hyperv-iso.vm:
hyperv-iso.vm: Image Version: 10.0.14393.4169
hyperv-iso.vm:
hyperv-iso.vm: Service Pack Cleanup cannot proceed: No Service Pack backup files were found.
hyperv-iso.vm: The operation completed successfully.
hyperv-iso.vm: Phase-5d [INFO]: Cleaning TEMP
hyperv-iso.vm: Phase-5d [INFO] Defragging..
hyperv-iso.vm: VERBOSE: Invoking defragmentation on Windows (C:)...
hyperv-iso.vm: VERBOSE: Analysis: 0% complete...
hyperv-iso.vm: VERBOSE: Analysis: 40% complete...
hyperv-iso.vm: VERBOSE: Analysis: 41% complete...
hyperv-iso.vm: VERBOSE: Analysis: 44% complete...
hyperv-iso.vm: VERBOSE: Analysis: 47% complete...
hyperv-iso.vm: VERBOSE: Analysis: 59% complete...
hyperv-iso.vm: VERBOSE: Analysis: 68% complete...
hyperv-iso.vm: VERBOSE: Analysis: 76% complete...
hyperv-iso.vm: VERBOSE: Analysis: 85% complete...
hyperv-iso.vm: VERBOSE: Analysis: 86% complete...
hyperv-iso.vm: VERBOSE: Analysis: 100% complete.
hyperv-iso.vm: VERBOSE:
hyperv-iso.vm: Pre-Optimization Report:
hyperv-iso.vm: VERBOSE:
hyperv-iso.vm:
hyperv-iso.vm: Volume Information:
hyperv-iso.vm: VERBOSE: Volume size = 77.55 GB
hyperv-iso.vm: VERBOSE: Cluster size = 4 KB
hyperv-iso.vm: VERBOSE: Used space = 13.88 GB
hyperv-iso.vm: VERBOSE: Free space = 63.67 GB
hyperv-iso.vm: VERBOSE:
hyperv-iso.vm:
hyperv-iso.vm: Fragmentation:
hyperv-iso.vm: VERBOSE: Total fragmented space = 19%
hyperv-iso.vm: VERBOSE: Average fragments per file = 1.07
hyperv-iso.vm: VERBOSE: Movable files and folders = 94185
hyperv-iso.vm: VERBOSE: Unmovable files and folders = 5
hyperv-iso.vm: VERBOSE:
hyperv-iso.vm:
hyperv-iso.vm: Files:
hyperv-iso.vm: VERBOSE: Fragmented files = 576
hyperv-iso.vm: VERBOSE: Total file fragments = 6737
hyperv-iso.vm: VERBOSE:
hyperv-iso.vm:
hyperv-iso.vm: Folders:
hyperv-iso.vm: VERBOSE: Total folders = 6792
hyperv-iso.vm: VERBOSE: Fragmented folders = 441
hyperv-iso.vm: VERBOSE: Total folder fragments = 1543
hyperv-iso.vm: VERBOSE:
hyperv-iso.vm:
hyperv-iso.vm: Free space:
hyperv-iso.vm: VERBOSE: Free space count = 15834
hyperv-iso.vm: VERBOSE: Average free space size = 4.10 MB
hyperv-iso.vm: VERBOSE: Largest free space size = 49.56 GB
hyperv-iso.vm: VERBOSE:
hyperv-iso.vm:
hyperv-iso.vm: Master File Table (MFT):
hyperv-iso.vm: VERBOSE: MFT size = 252.25 MB
hyperv-iso.vm: VERBOSE: MFT record count = 258303
hyperv-iso.vm: VERBOSE: MFT usage = 100%
hyperv-iso.vm: VERBOSE: Total MFT fragments = 2
hyperv-iso.vm: VERBOSE: Note: File fragments larger than 64MB are not included in the fragmentation statistics.
hyperv-iso.vm: VERBOSE: Performing pass 1:
hyperv-iso.vm: VERBOSE: Defragmentation: 0% complete...
hyperv-iso.vm: VERBOSE: Defragmentation: 1% complete...
hyperv-iso.vm: VERBOSE: Defragmentation: 2% complete...
hyperv-iso.vm: VERBOSE: Defragmentation: 3% complete...
hyperv-iso.vm: VERBOSE: Defragmentation: 6% complete...
hyperv-iso.vm: VERBOSE: Defragmentation: 7% complete...
hyperv-iso.vm: VERBOSE: Defragmentation: 8% complete...
hyperv-iso.vm: VERBOSE: Defragmentation: 9% complete...
hyperv-iso.vm: VERBOSE: Defragmentation: 12% complete...
hyperv-iso.vm: VERBOSE: Defragmentation: 13% complete...
hyperv-iso.vm: VERBOSE: Defragmentation: 14% complete...
hyperv-iso.vm: VERBOSE: Defragmentation: 17% complete...
hyperv-iso.vm: VERBOSE: Defragmentation: 20% complete...
hyperv-iso.vm: VERBOSE: Defragmentation: 23% complete...
hyperv-iso.vm: VERBOSE: Defragmentation: 24% complete...
hyperv-iso.vm: VERBOSE: Defragmentation: 26% complete...
hyperv-iso.vm: VERBOSE: Defragmentation: 27% complete...
hyperv-iso.vm: VERBOSE: Defragmentation: 29% complete...
hyperv-iso.vm: VERBOSE: Defragmentation: 30% complete...
hyperv-iso.vm: VERBOSE: Defragmentation: 63% complete...
hyperv-iso.vm: VERBOSE: Defragmentation: 64% complete...
hyperv-iso.vm: VERBOSE: Defragmentation: 65% complete...
hyperv-iso.vm: VERBOSE: Defragmentation: 66% complete...
hyperv-iso.vm: VERBOSE: Defragmentation: 67% complete...
hyperv-iso.vm: VERBOSE: Defragmentation: 68% complete...
hyperv-iso.vm: VERBOSE: Defragmentation: 72% complete...
hyperv-iso.vm: VERBOSE: Defragmentation: 74% complete...
hyperv-iso.vm: VERBOSE: Defragmentation: 79% complete...
hyperv-iso.vm: VERBOSE: Defragmentation: 92% complete...
hyperv-iso.vm: VERBOSE: Defragmentation: 94% complete...
hyperv-iso.vm: VERBOSE: Defragmentation: 95% complete...
hyperv-iso.vm: VERBOSE: Defragmentation: 97% complete...
hyperv-iso.vm: VERBOSE: Defragmentation: 99% complete...
hyperv-iso.vm: VERBOSE: Defragmentation: 100% complete.
hyperv-iso.vm: VERBOSE: Free Space Consolidation: 0% complete...
hyperv-iso.vm: VERBOSE: Free Space Consolidation: 1% complete...
hyperv-iso.vm: VERBOSE: Free Space Consolidation: 2% complete...
hyperv-iso.vm: VERBOSE: Free Space Consolidation: 3% complete...
hyperv-iso.vm: VERBOSE: Free Space Consolidation: 4% complete...
hyperv-iso.vm: VERBOSE: Free Space Consolidation: 5% complete...
hyperv-iso.vm: VERBOSE: Free Space Consolidation: 6% complete...
hyperv-iso.vm: VERBOSE: Free Space Consolidation: 7% complete...
hyperv-iso.vm: VERBOSE: Free Space Consolidation: 8% complete...
hyperv-iso.vm: VERBOSE: Free Space Consolidation: 9% complete...
hyperv-iso.vm: VERBOSE: Free Space Consolidation: 10% complete...
hyperv-iso.vm: VERBOSE: Free Space Consolidation: 11% complete...
hyperv-iso.vm: VERBOSE: Free Space Consolidation: 13% complete...
hyperv-iso.vm: VERBOSE: Free Space Consolidation: 14% complete...
hyperv-iso.vm: VERBOSE: Free Space Consolidation: 15% complete...
hyperv-iso.vm: VERBOSE: Free Space Consolidation: 19% complete...
hyperv-iso.vm: VERBOSE: Free Space Consolidation: 20% complete...
hyperv-iso.vm: VERBOSE: Free Space Consolidation: 21% complete...
hyperv-iso.vm: VERBOSE: Free Space Consolidation: 26% complete...
hyperv-iso.vm: VERBOSE: Free Space Consolidation: 28% complete...
hyperv-iso.vm: VERBOSE: Free Space Consolidation: 29% complete...
hyperv-iso.vm: VERBOSE: Free Space Consolidation: 30% complete...
hyperv-iso.vm: VERBOSE: Free Space Consolidation: 31% complete...
hyperv-iso.vm: VERBOSE: Free Space Consolidation: 32% complete...
hyperv-iso.vm: VERBOSE: Free Space Consolidation: 33% complete...
hyperv-iso.vm: VERBOSE: Free Space Consolidation: 37% complete...
hyperv-iso.vm: VERBOSE: Free Space Consolidation: 44% complete...
hyperv-iso.vm: VERBOSE: Free Space Consolidation: 46% complete...
hyperv-iso.vm: VERBOSE: Free Space Consolidation: 47% complete...
hyperv-iso.vm: VERBOSE: Free Space Consolidation: 48% complete...
hyperv-iso.vm: VERBOSE: Free Space Consolidation: 49% complete...
hyperv-iso.vm: VERBOSE: Free Space Consolidation: 50% complete...
hyperv-iso.vm: VERBOSE: Free Space Consolidation: 51% complete...
hyperv-iso.vm: VERBOSE: Free Space Consolidation: 52% complete...
hyperv-iso.vm: VERBOSE: Free Space Consolidation: 53% complete...
hyperv-iso.vm: VERBOSE: Free Space Consolidation: 54% complete...
hyperv-iso.vm: VERBOSE: Free Space Consolidation: 55% complete...
hyperv-iso.vm: VERBOSE: Free Space Consolidation: 56% complete...
hyperv-iso.vm: VERBOSE: Free Space Consolidation: 57% complete...
hyperv-iso.vm: VERBOSE: Free Space Consolidation: 58% complete...
hyperv-iso.vm: VERBOSE: Free Space Consolidation: 59% complete...
hyperv-iso.vm: VERBOSE: Free Space Consolidation: 60% complete...
hyperv-iso.vm: VERBOSE: Free Space Consolidation: 61% complete...
hyperv-iso.vm: VERBOSE: Free Space Consolidation: 62% complete...
hyperv-iso.vm: VERBOSE: Free Space Consolidation: 63% complete...
hyperv-iso.vm: VERBOSE: Free Space Consolidation: 64% complete...
hyperv-iso.vm: VERBOSE: Free Space Consolidation: 65% complete...
hyperv-iso.vm: VERBOSE: Free Space Consolidation: 66% complete...
hyperv-iso.vm: VERBOSE: Free Space Consolidation: 67% complete...
hyperv-iso.vm: VERBOSE: Free Space Consolidation: 68% complete...
hyperv-iso.vm: VERBOSE: Free Space Consolidation: 69% complete... hyperv-iso.vm: VERBOSE: Free Space Consolidation: 100% complete. hyperv-iso.vm: VERBOSE: Performing pass 2: hyperv-iso.vm: VERBOSE: Defragmentation: 2% complete... hyperv-iso.vm: VERBOSE: Defragmentation: 15% complete... hyperv-iso.vm: VERBOSE: Defragmentation: 30% complete...
hyperv-iso.vm: VERBOSE: Defragmentation: 100% complete...
hyperv-iso.vm: VERBOSE: Defragmentation: 100% complete.
hyperv-iso.vm: VERBOSE: Free Space Consolidation: 0% complete...
hyperv-iso.vm: VERBOSE: Free Space Consolidation: 5% complete...
hyperv-iso.vm: VERBOSE: Free Space Consolidation: 8% complete...
hyperv-iso.vm: VERBOSE: Free Space Consolidation: 27% complete...
hyperv-iso.vm: VERBOSE: Free Space Consolidation: 28% complete...
hyperv-iso.vm: VERBOSE: Free Space Consolidation: 29% complete...
hyperv-iso.vm: VERBOSE: Free Space Consolidation: 30% complete...
hyperv-iso.vm: VERBOSE: Free Space Consolidation: 46% complete...
hyperv-iso.vm: VERBOSE: Free Space Consolidation: 47% complete...
hyperv-iso.vm: VERBOSE: Free Space Consolidation: 48% complete...
hyperv-iso.vm: VERBOSE: Free Space Consolidation: 49% complete...
hyperv-iso.vm: VERBOSE: Free Space Consolidation: 50% complete...
hyperv-iso.vm: VERBOSE: Free Space Consolidation: 100% complete.
hyperv-iso.vm: VERBOSE: Performing pass 3:
hyperv-iso.vm: VERBOSE: Free Space Consolidation: 0% complete...
hyperv-iso.vm: VERBOSE: Free Space Consolidation: 100% complete.
hyperv-iso.vm: VERBOSE: Performing pass 1:
hyperv-iso.vm: VERBOSE: Retrim: 0% complete...
hyperv-iso.vm: VERBOSE: Retrim: 36% complete...
hyperv-iso.vm: VERBOSE: Retrim: 100% complete.
hyperv-iso.vm: VERBOSE:
hyperv-iso.vm: Post Defragmentation Report:
hyperv-iso.vm: VERBOSE:
hyperv-iso.vm:
hyperv-iso.vm: Volume Information:
hyperv-iso.vm: VERBOSE: Volume size = 77.55 GB
hyperv-iso.vm: VERBOSE: Cluster size = 4 KB
hyperv-iso.vm: VERBOSE: Used space = 13.88 GB
hyperv-iso.vm: VERBOSE: Free space = 63.67 GB
hyperv-iso.vm: VERBOSE:
hyperv-iso.vm:
hyperv-iso.vm: Fragmentation:
hyperv-iso.vm: VERBOSE: Total fragmented space = 0%
hyperv-iso.vm: VERBOSE: Average fragments per file = 1.00
hyperv-iso.vm: VERBOSE: Movable files and folders = 94181
hyperv-iso.vm: VERBOSE: Unmovable files and folders = 5
hyperv-iso.vm: VERBOSE:
hyperv-iso.vm:
hyperv-iso.vm: Files:
hyperv-iso.vm: VERBOSE: Fragmented files = 0
hyperv-iso.vm: VERBOSE: Total file fragments = 0
hyperv-iso.vm: VERBOSE:
hyperv-iso.vm:
hyperv-iso.vm: Folders:
hyperv-iso.vm: VERBOSE: Total folders = 6792
hyperv-iso.vm: VERBOSE: Fragmented folders = 0
hyperv-iso.vm: VERBOSE: Total folder fragments = 0
hyperv-iso.vm: VERBOSE:
hyperv-iso.vm:
hyperv-iso.vm: Free space:
hyperv-iso.vm: VERBOSE: Free space count = 8
hyperv-iso.vm: VERBOSE: Average free space size = 15.88 GB
hyperv-iso.vm: VERBOSE: Largest free space size = 56.49 GB
hyperv-iso.vm: VERBOSE:
hyperv-iso.vm:
hyperv-iso.vm: Master File Table (MFT):
hyperv-iso.vm: VERBOSE: MFT size = 252.25 MB
hyperv-iso.vm: VERBOSE: MFT record count = 258303
hyperv-iso.vm: VERBOSE: MFT usage = 100%
hyperv-iso.vm: VERBOSE: Total MFT fragments = 2
hyperv-iso.vm: VERBOSE: Note: File fragments larger than 64MB are not included in the fragmentation statistics.
hyperv-iso.vm: Phase-5d [INFO] Zeroing out empty space...
hyperv-iso.vm: Phase 5d [INFO] Zeroing took: 34.1883089 seconds
hyperv-iso.vm: Phase-5d [END]
==> hyperv-iso.vm: Provisioning with Powershell...
==> hyperv-iso.vm: Provisioning with powershell script: C:\Users\isaac\AppData\Local\Temp\powershell-provisioner622431180
hyperv-iso.vm: Phase-5-Deprovisioning
==> hyperv-iso.vm: Forcibly halting virtual machine...
==> hyperv-iso.vm: Waiting for vm to be powered down...
==> hyperv-iso.vm: Unmount/delete secondary dvd drives...
==> hyperv-iso.vm: Delete secondary dvd drives controller 0 location 2 ...
==> hyperv-iso.vm: Unmount/delete Integration Services dvd drive...
==> hyperv-iso.vm: Unmount/delete os dvd drive...
==> hyperv-iso.vm: Delete os dvd drives controller 0 location 1 ...
==> hyperv-iso.vm: Compacting disks...
hyperv-iso.vm: Compacting disk: packer-windows2016-g2.vhdx
hyperv-iso.vm: Disk size reduced by: 52.8%
==> hyperv-iso.vm: Skipping export of virtual machine...
==> hyperv-iso.vm: Collating build artifacts...
==> hyperv-iso.vm: Disconnecting from vmconnect...
==> hyperv-iso.vm: Unregistering and deleting virtual machine...
==> hyperv-iso.vm: Deleting build directory...
Build 'hyperv-iso.vm' finished after 2 hours 9 minutes.
==> Wait completed after 2 hours 9 minutes
==> Builds finished. The artifacts of successful builds are:
--> hyperv-iso.vm: VM files in directory: output-windows-g2
[INFO] - Elapsed Time: 7787.2684129 seconds
Which created a 12.7Gb VHDX file in the output folder
Next, I’ll update the HCL to include HCL Packer
hcp_packer_registry {
bucket_name = "learn-packer-windows"
description = <<EOT
A Windows 2016 Image built locally.
EOT
bucket_labels = {
"owner" = "sre-team"
"os" = "Windows",
"ubuntu-version" = "Server 2016",
}
and then set my env vars before invoking the powershell again
PS C:\Users\isaac\Workspaces\hv-packer> $env:HCP_CLIENT_ID = 'vtR2gk4DqMbXXHNQYiG9haHVdrmnwHzw'
PS C:\Users\isaac\Workspaces\hv-packer> $env:HCP_CLIENT_SECRET = 'oLb8eEga6KBsRkVeVPKpHznmGcbLDYt6ppsUjy-PX7D1SGBfPBgCKfpf4Xcxh7dh'
PS C:\Users\isaac\Workspaces\hv-packer> .\hv_win2016_std.ps1
However, upon completon it did not update HCP Packer
==> hyperv-iso.vm: Deleting build directory...
==> hyperv-iso.vm: Running post-processor:
Build 'hyperv-iso.vm' errored after 2 hours 12 minutes: 1 error(s) occurred:
* Post-processor failed: [TRACE] failed to update Packer registry with image artifacts for "hyperv-iso.vm": setting a build to DONE with no published images is not currently supported.
==> Wait completed after 2 hours 12 minutes
==> Some builds didn't complete successfully and had errors:
--> hyperv-iso.vm: 1 error(s) occurred:
* Post-processor failed: [TRACE] failed to update Packer registry with image artifacts for "hyperv-iso.vm": setting a build to DONE with no published images is not currently supported.
==> Builds finished but no artifacts were created.
[INFO] - Elapsed Time: 7948.2458506 seconds
The error is because we didn’t publish the artifact to a known Image Repository.
We can dig into the diagram from the HCP Packer docs
Essentially, HCP Packer just stores Metadata, not the actual binaries. It’s more like a ‘tfstate’ store for images.
Azure VM
Let’s say we wish to build our Packer template up to use in Azure.
There are some documented steps that need to be performed.
This is an optimum chance to use Packer to handle this all for us.
Here I created a new script (scripts/phase-4.ps1)
# Phase 4 - stuff to prep for Azure VM
# Uncomment next line to skip this
# exit 0
param(
[Parameter()]
[ValidateNotNullOrEmpty()]
[string]$Version="7.14.0",
[Parameter()]
[ValidateNotNullOrEmpty()]
[ValidateSet('true','false','$true','$false','0','1')]
[boolean]$AddPrivateChoco=$true,
[Parameter()]
[ValidateNotNullOrEmpty()]
[string]$PuppetMaster="foreman.example.com"
)
Write-Output "Phase 4 [START] - Start of Phase 4"
$Powercfg="$Env:windir\System32\powercfg.exe"
try {
Write-Output "Phase 4 [INFO] - Remove the WinHTTP proxy"
$ErrorActionPreference = "Stop"
netsh.exe winhttp reset proxy
}
catch {
Write-Output "Phase 4 [ERROR] - Remove the WinHTTP proxy failed"
exit (1)
}
try {
Set-StorageSetting -NewDiskPolicy OnlineAll
Get-StorageSetting | Select-Object NewDiskPolicy
}
catch {
Write-Output "Phase 4 [ERROR] - Setting SAN Policy to Online All"
exit (1)
}
try {
Set-ItemProperty -Path HKLM:\SYSTEM\CurrentControlSet\Control\TimeZoneInformation -Name RealTimeIsUniversal -Value 1 -Type DWord -Force
Set-Service -Name w32time -StartupType Automatic
}
catch {
Write-Output "Phase 4 [ERROR] - Setting UTC and Windows Time Service to Automatic"
exit (1)
}
try {
Write-Output "Phase 4 [INFO] - Set Profile Power to High Performance"
if (Test-Path -Path $Powercfg) {
Write-Output "Phase 4 [INFO] - Powercfg found in: $Powercfg"
powercfg.exe /setactive SCHEME_MIN
powercfg /setacvalueindex SCHEME_CURRENT SUB_VIDEO VIDEOIDLE 0
}
else {
Write-Output "Phase 4 [INFO] - Powercfg not found"
}
}
catch {
Write-Output "Phase 4 [ERROR] - Powercfg check failed"
exit (1)
}
try {
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment' -Name TEMP -Value "%SystemRoot%\TEMP" -Type ExpandString -Force
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment' -Name TMP -Value "%SystemRoot%\TEMP" -Type ExpandString -Force
}
catch {
Write-Output "Phase 4 [ERROR] - Setting TEMP Dirs to Default"
exit (1)
}
try {
Get-Service -Name BFE, Dhcp, Dnscache, IKEEXT, iphlpsvc, nsi, mpssvc, RemoteRegistry |
Where-Object StartType -ne Automatic |
Set-Service -StartupType Automatic
Get-Service -Name Netlogon, Netman, TermService |
Where-Object StartType -ne Manual |
Set-Service -StartupType Manual
}
catch {
Write-Output "Phase 4 [ERROR] - Setting Windows Services to Default Automatic and Manual"
exit (1)
}
try {
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server' -Name fDenyTSConnections -Value 0 -Type DWord -Force
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services' -Name fDenyTSConnections -Value 0 -Type DWord -Force
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\Winstations\RDP-Tcp' -Name PortNumber -Value 3389 -Type DWord -Force
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\Winstations\RDP-Tcp' -Name LanAdapter -Value 0 -Type DWord -Force
}
catch {
Write-Output "Phase 4 [ERROR] - Enabling RDC"
exit (1)
}
try {
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services' -Name KeepAliveEnable -Value 1 -Type DWord -Force
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services' -Name KeepAliveInterval -Value 1 -Type DWord -Force
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\Winstations\RDP-Tcp' -Name KeepAliveTimeout -Value 1 -Type DWord -Force
}
catch {
Write-Output "Phase 4 [ERROR] - Setting Keep Alive"
exit (1)
}
try {
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services' -Name fDisableAutoReconnect -Value 0 -Type DWord -Force
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\Winstations\RDP-Tcp' -Name fInheritReconnectSame -Value 1 -Type DWord -Force
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\Winstations\RDP-Tcp' -Name fReconnectSame -Value 0 -Type DWord -Force
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\Winstations\RDP-Tcp' -Name MaxInstanceCount -Value 4294967295 -Type DWord -Force
}
catch {
Write-Output "Phase 4 [ERROR] - Setting Reconnect Options"
exit (1)
}
try {
if ((Get-Item -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp').Property -contains 'SSLCertificateSHA1Hash')
{
Remove-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp' -Name SSLCertificateSHA1Hash -Force
}
}
catch {
Write-Output "Phase 4 [ERROR] - Removing any self-signed listener"
exit (1)
}
try {
Set-NetFirewallProfile -Profile Domain, Public, Private -Enabled True
}
catch {
Write-Output "Phase 4 [ERROR] - Windows Firewall Settings"
exit (1)
}
try {
Enable-PSRemoting -Force
Set-NetFirewallRule -Name WINRM-HTTP-In-TCP, WINRM-HTTP-In-TCP-PUBLIC -Enabled True
}
catch {
Write-Output "Phase 4 [ERROR] - Enable PS Remote services"
exit (1)
}
try {
Set-NetFirewallRule -Group '@FirewallAPI.dll,-28752' -Enabled True
Set-NetFirewallRule -Name FPS-ICMP4-ERQ-In -Enabled True
}
catch {
Write-Output "Phase 4 [ERROR] - Enable RDP and Ping"
exit (1)
}
try {
New-NetFirewallRule -DisplayName AzurePlatform -Direction Inbound -RemoteAddress 168.63.129.16 -Profile Any -Action Allow -EdgeTraversalPolicy Allow
New-NetFirewallRule -DisplayName AzurePlatform -Direction Outbound -RemoteAddress 168.63.129.16 -Profile Any -Action Allow
}
catch {
Write-Output "Phase 4 [ERROR] - Azure Platform Network Allowed"
exit (1)
}
Write-Output "Phase 4 [END] - End of Phase 4"
exit 0
Then I added it to the build block in templates\hv_win2016_g2.pkr.hcl
provisioner "powershell" {
elevated_password = "password"
elevated_user = "Administrator"
script = "./extra/scripts/phase-4.ps1"
}
I’ll kick a fresh build:
It took a while - For me 2.25 hours.. so plan for a bit of a wait.
==> hyperv-iso.vm: Unmount/delete os dvd drive...
==> hyperv-iso.vm: Delete os dvd drives controller 0 location 1 ...
==> hyperv-iso.vm: Compacting disks...
hyperv-iso.vm: Compacting disk: packer-windows2016-g2.vhdx
hyperv-iso.vm: Disk size reduced by: 52.1%
==> hyperv-iso.vm: Skipping export of virtual machine...
==> hyperv-iso.vm: Collating build artifacts...
==> hyperv-iso.vm: Disconnecting from vmconnect...
==> hyperv-iso.vm: Unregistering and deleting virtual machine...
==> hyperv-iso.vm: Deleting build directory...
Build 'hyperv-iso.vm' finished after 2 hours 15 minutes.
==> Wait completed after 2 hours 15 minutes
==> Builds finished. The artifacts of successful builds are:
--> hyperv-iso.vm: VM files in directory: output-windows-g2
[INFO] - Elapsed Time: 8109.7369058 seconds
Next, I’ll want to login to Azure and select my Subscription
PS C:\Users\isaac\Workspaces\hv-packer> Connect-AzAccount
WARNING: TenantId '15d19784-ad58-4a57-a66f-ad1c0f826a45' contains more than one active subscription. First one will be selected for further use. To select another subscription, use Set-AzContext.
To override which subscription Connect-AzAccount selects by default, use `Update-AzConfig -DefaultSubscriptionForLogin 00000000-0000-0000-0000-000000000000`. Go to https://go.microsoft.com/fwlink/?linkid=2200610 for more
information.
Account SubscriptionName TenantId Environment
....
PS C:\Users\isaac\Workspaces\hv-packer> Get-AzSubscription
Name Id TenantId State
---- -- -------- -----
Visual Studio Enterprise Subscription asdf-asdf-asdf-asdf-asdf-asdf-asdf qwer-qwer-qwer-wer-qwerqw-re Enabled
Select-AzSubscription -SubscriptionId "asdf-asdf-asdf-asdf-asdf-asdf-asdf "
Name Account SubscriptionName Environment TenantId
---- ------- ---------------- ----------- --------
Visual Studio Enterprise Subscription...
I’ll create an RG to host the file(s)
PS C:\Users\isaac\Workspaces\hv-packer> New-AzResourceGroup -Name myVmTestRG -Location "West US"
ResourceGroupName : myVmTestRG
Location : westus
ProvisioningState : Succeeded
Tags :
ResourceId : /subscriptions/asdf-asdf-asdf-asdf-asdf/resourceGroups/myVmTestRG
I’ll create a storage account in the RG to use
PS C:\Users\isaac\Workspaces\hv-packer> New-AzStorageAccount -ResourceGroupName myVmTestRG -Location "West US" -SkuName "Standard_LRS" -Kind "Storage" -Name fbvmstgaccw1
StorageAccountName ResourceGroupName PrimaryLocation SkuName Kind AccessTier CreationTime ProvisioningState EnableHttpsTrafficOnly LargeFileShares
------------------ ----------------- --------------- ------- ---- ---------- ------------ ----------------- ---------------------- ---------------
fbvmstgaccw1 myVmTestRG westus Standard_LRS Storage 10/18/2022 4:25:51 PM Succeeded True
We can then convert to a VHD and upload in 1 step
PS C:\Users\isaac\Workspaces\hv-packer> $urlOfUploadedImageVhd = "https://fbvmstgaccw1.blob.core.windows.net/mycontainer/PakcerBuiltVHD.vhd"
PS C:\Users\isaac\Workspaces\hv-packer> $rgName = "myVmTestRG"
PS C:\Users\isaac\Workspaces\hv-packer> Add-AzVhd -ResourceGroupName $rgName -Destination $urlOfUploadedImageVhd -LocalFilePath "C:\Users\isaac\Workspaces\hv-packer\output-windows-g2\Virtual Hard Disks\packer-windows2016-g2.vhdx"
WARNING: The VHDX file needs to be converted to VHD. During the conversion process, the cmdlet will temporarily create a resized file in the same directory as the provided VHDX file.
We can log into Azure and see the VHD was uploaded.
Clearly it is much larged as a VHD (78.13Gb) than as a VHDX (12.9Gb)
Following this guide we’ll next make our Azure VM
Next, we make a Subnet and then VNet
PS C:\Users\isaac\Workspaces\hv-packer> $subnetName = "mvVMSubnet"
PS C:\Users\isaac\Workspaces\hv-packer> $singleSubnet = New-AzVirtualNetworkSubnetConfig -Name $subnetName -AddressPrefix 10.0.0.0/24
WARNING: Upcoming breaking changes in the cmdlet 'New-AzVirtualNetworkSubnetConfig' :
Update Property Name
Cmdlet invocation changes :
Old Way : -ResourceId
New Way : -NatGatewayId
Update Property Name
Cmdlet invocation changes :
Old Way : -InputObject
New Way : -NatGateway
Note : Go to https://aka.ms/azps-changewarnings for steps to suppress this breaking change warning, and other information on breaking changes in Azure PowerShell.
PS C:\Users\isaac\Workspaces\hv-packer> $location = "WestUS"
PS C:\Users\isaac\Workspaces\hv-packer> $vnetName = "myVnet"
PS C:\Users\isaac\Workspaces\hv-packer> $vnet = New-AzVirtualNetwork -Name $vnetName -ResourceGroupName myVmTestRG -Location $location -AddressPrefix 10.0.0.0/16 -Subnet $singleSubnet
Then I’ll create a Public IP so we can reach it
PS C:\Users\isaac\Workspaces\hv-packer> $rgName = "myVmTestRG"
PS C:\Users\isaac\Workspaces\hv-packer> $ipName = "myPip"
PS C:\Users\isaac\Workspaces\hv-packer>
PS C:\Users\isaac\Workspaces\hv-packer> $pip = New-AzPublicIpAddress -Name $ipName -ResourceGroupName $rgName -Location $location -AllocationMethod Dynamic
WARNING: Upcoming breaking changes in the cmdlet 'New-AzPublicIpAddress' :
Default behaviour of Zone will be changed
Cmdlet invocation changes :
Old Way : Sku = Standard means the Standard Public IP is zone-redundant.
New Way : Sku = Standard and Zone = {} means the Standard Public IP has no zones. If you want to create a zone-redundant Public IP address, please specify all the zones in the region. For example, Zone = ['1', '2',
'3'].
Note : Go to https://aka.ms/azps-changewarnings for steps to suppress this breaking change warning, and other information on breaking changes in Azure PowerShell.
And a NIC for the VM that uses the Public IP
PS C:\Users\isaac\Workspaces\hv-packer> $nicName = "myNic"
PS C:\Users\isaac\Workspaces\hv-packer> $nic = New-AzNetworkInterface -Name $nicName -ResourceGroupName $rgName -Location $location -SubnetId $vnet.Subnets[0].Id -PublicIpAddressId $pip.Id
We add an NSG with an RDP Inbound rule and lastly capture the completed VNet into a variable
PS C:\Users\isaac\Workspaces\hv-packer> $nsgName = "myNsg"
PS C:\Users\isaac\Workspaces\hv-packer> $rdpRule = New-AzNetworkSecurityRuleConfig -Name myRdpRule -Description "Allow RDP" -Access Allow -Protocol Tcp -Direction Inbound -Priority 110 -SourceAddressPrefix Internet -SourcePortRange * -DestinationAddressPrefix * -DestinationPortRange 3389
PS C:\Users\isaac\Workspaces\hv-packer> $nsg = New-AzNetworkSecurityGroup -ResourceGroupName $rgName -Location $location -Name $nsgName -SecurityRules $rdpRule
PS C:\Users\isaac\Workspaces\hv-packer> $vnet = Get-AzVirtualNetwork -ResourceGroupName $rgName -Name $vnetName
Creating the VM
Now let’s interactively create a credential then set our VM variable values
PS C:\Users\isaac\Workspaces\hv-packer> $cred = Get-Credential
cmdlet Get-Credential at command pipeline position 1
Supply values for the following parameters:
Credential
PS C:\Users\isaac\Workspaces\hv-packer> $storageAccName = "fbvmstgaccw1"
PS C:\Users\isaac\Workspaces\hv-packer> $vmName = "myFBTestVM"
PS C:\Users\isaac\Workspaces\hv-packer> $vmSize = "Standard_D2_v4"
PS C:\Users\isaac\Workspaces\hv-packer> $computerName = "myComputer"
PS C:\Users\isaac\Workspaces\hv-packer> $osDiskName = "myOsDisk"
PS C:\Users\isaac\Workspaces\hv-packer> $skuName = "Standard_LRS"
PS C:\Users\isaac\Workspaces\hv-packer> $storageAcc = Get-AzStorageAccount -ResourceGroupName $rgName -AccountName $storageAccName
PS C:\Users\isaac\Workspaces\hv-packer> $vmConfig = New-AzVMConfig -VMName $vmName -VMSize $vmSize
PS C:\Users\isaac\Workspaces\hv-packer> $vm = Set-AzVMOperatingSystem -VM $vmConfig -Windows -ComputerName $computerName -Credential $cred -ProvisionVMAgent -EnableAutoUpdate
PS C:\Users\isaac\Workspaces\hv-packer> $vm = Add-AzVMNetworkInterface -VM $vm -Id $nic.Id
PS C:\Users\isaac\Workspaces\hv-packer> $osDiskUri = '{0}vhds/{1}-{2}.vhd' -f $storageAcc.PrimaryEndpoints.Blob.ToString(), $vmName.ToLower(), $osDiskName
PS C:\Users\isaac\Workspaces\hv-packer> $vm = Set-AzVMOSDisk -VM $vm -Name $osDiskName -VhdUri $osDiskUri -CreateOption fromImage -SourceImageUri $urlOfUploadedImageVhd -Windows
Lastly, after all that fun fun powershell, make the VM:
PS C:\Users\isaac\Workspaces\hv-packer> New-AzVM -ResourceGroupName $rgName -Location $location -VM $vm
New-AzVM : Long running operation failed with status 'Failed'. Additional Info:'OS Provisioning for VM 'myFBTestVM' did not finish in the allotted time. The VM may still finish provisioning
successfully. Please check provisioning state later. Also, make sure the image has been properly prepared (generalized).
* Instructions for Windows: https://azure.microsoft.com/documentation/articles/virtual-machines-windows-upload-image/
* Instructions for Linux: https://azure.microsoft.com/documentation/articles/virtual-machines-linux-capture-image/
* If you are deploying more than 20 Virtual Machines concurrently, consider moving your custom image to shared image gallery. Please refer to https://aka.ms/movetosig for the same.'
ErrorCode: OSProvisioningTimedOut
ErrorMessage: OS Provisioning for VM 'myFBTestVM' did not finish in the allotted time. The VM may still finish provisioning successfully. Please check provisioning state later. Also, make sure the
image has been properly prepared (generalized).
* Instructions for Windows: https://azure.microsoft.com/documentation/articles/virtual-machines-windows-upload-image/
* Instructions for Linux: https://azure.microsoft.com/documentation/articles/virtual-machines-linux-capture-image/
* If you are deploying more than 20 Virtual Machines concurrently, consider moving your custom image to shared image gallery. Please refer to https://aka.ms/movetosig for the same.
ErrorTarget:
StartTime: 10/18/2022 8:31:41 PM
EndTime: 10/18/2022 9:11:37 PM
OperationID: a372d8f4-45b3-44c0-9bf6-5cc57262c41d
Status: Failed
At line:1 char:1
+ New-AzVM -ResourceGroupName $rgName -Location $location -VM $vm
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [New-AzVM], ComputeCloudException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.Compute.NewAzureVMCommand
I had all sorts of issues.
First, I had to get an exception to a company policy forbidding custom images
PS C:\Users\isaac\Workspaces\hv-packer> New-AzVM -ResourceGroupName $rgName -Location $location -VM $vm
New-AzVM : Resource 'myFBTestVM' was disallowed by policy. Reasons: 'You must use a...
ErrorCode: RequestDisallowedByPolicy
ErrorMessage: Resource 'myFBTestVM' was disallowed by policy. Reasons: 'You must use a ...
Then the Virtual Network’s subnet didn’t actually tie to the NSG so RDP was blocked. I had to go set that manually:
Applying…
Then when I checked the Boot diagnostics, it complained there was no OS
So I checked the HD and found it had created a fresh VHD instead of using the provided one
When I attempted to Stop the Host or Migrate (redeploy), that failed. So I was unable to Stop the VM.
Attempt 2
I pivoted to using the UI. I’ll assume either my company policy blocked some initial setup or an error happened (I realized later in Get-Credentials I needed a longer password for Win 2016), or the underlying host had an issue, or, you know, Gremlins.
and picking my disk
under Networking, I picked my existing VNet and NSG
In Monitoring, I chose to use the Storage Account I had already created
Lastly, I confirmed and clicked create
Once launched, the Boot Diagnostics looked way better
Connecting with RDP now worked.
If we wanted a sanity check that indeed this is the image we built, we can browse the file system and see some of the files we installed during the Packer build process
The issue I see, when it comes to HCP Packer, is that because we uploaded manually after a build:
PS C:\Users\isaac\Workspaces\hv-packer> Add-AzVhd -ResourceGroupName $rgName -Destination $urlOfUploadedImageVhd -LocalFilePath "C:\Users\isaac\Workspaces\hv-packer\output-windows-g2\Virtual Hard Disks\packer-windows2016-g2.vhdx"
Our image was not tracked in our HCL. And this means we won’t track in HCP Packer. Moreover, HCP Packer won’t track an image built locally.
==> Some builds didn't complete successfully and had errors:
--> hyperv-iso.vm: 1 error(s) occurred:
* Post-processor failed: [TRACE] failed to update Packer registry with image artifacts for "hyperv-iso.vm": setting a build to DONE with no published images is not currently supported.
==> Builds finished but no artifacts were created.
[INFO] - Elapsed Time: 7948.2458506 seconds
What we do have running now is a VM using the Packer built Hard Drive (VHD). But ideally, we want this as an image.
We can use sysprep to make this even more durable, but I’ll skip that for now.
Just click “Capture” on the VM Overview page
I’ll set the gallery
The VM Definition
and I’ll set version to 1.0.0
I’ll move to finalize and click create
And when done, I have a Template (VM Image) I can use to create more VMs or even a Virtual Machine Scale Set (VMSS)
Cleanup
Last month I had to explain a US$160 cloud bill to my better half because I neglected to cleanup resources. So let us not make a similar mistake.
We can see everything we built out is in one resource group
Deleting the Resource Group should empty our account of all the things - VMs, Disks, Image Galleries etc.
Packer Workflow
The idea of Packer is that we can build an immutable flow. That is, pull only from the “blessed” images.
That flow might look like a base image with a security layer to form our orgs “common” image, or “Golden” if it passes all checks and is “blessed” by DevSecOps
Then we add to that the App and Data layers to make a Project Teams image.
Future features: Log Streaming
They also highlighted a week or so ago at Hashiconf that integration with Datadog and Cloudwatch would be coming soon so events in HCP Packer could be tracked externally.
Summary
I plan to explore HCP Packer a bit more when some of the features like Log Streaming are added.
Essentially, it is a managed metadata tracker that can tie to Terraform Cloud (and likely Terraform Enterprise soon).
However, it’s raison-d’etre is hard to figure out…
Had it handled building packer images then I might be interested in a managed “image builder”. But it doesn’t do that. If it tracked images I built manually and uploaded, that too would have solved some potential needs.
However, it seems it works for Docker containers - which frankly I don’t need - I have ECR, ACR and GAR/GCR (not to mention Harbor) for that kind of thing - and all those tools also support Image scanning, replication and tagging.
It says it will handle tracking cloud builds, which I did not test here in this post, but that would use the provided Azure, AWS, etc cloud to create, provision and save the image with tags.
However, if I have a pipeline setup to do this activity (the cloud packer build and push) - such as an Azure DevOps, Github Action, etc - I would have my tagging and tracking set there. I would want the traceability to come from tags applied on merges, PRs, etc - not from Promotion/Demotion in a disconnected hosted UI.
I guess, at the end of the day, I can’t really see a reason for HCP Packer. My images are tracked in code; be it Terraform, Deployments YAMLs, charts or CR Tags. Adding a UI tool just would seem a regression at this point.
Side Note
Hashiconf was awesome. If you look quick, you’ll see me in the Red Shirt at the end as they capture the winning goal (yes, the other team won, but i had two zones to cover!) - HC2022 recap video here