hashicorp / packer-plugin-amazon

Packer plugin for Amazon AMI Builder
https://www.packer.io/docs/builders/amazon
Mozilla Public License 2.0
75 stars 112 forks source link

Build.Password is not set when using SSH on windows #444

Open boussaffawalid opened 11 months ago

boussaffawalid commented 11 months ago

Overview of the Issue

When using the new SSH on Windows functionality, it doesn't appear to be setting build.Password (that is recommend here).

It seems to be the same issue as https://github.com/hashicorp/packer-plugin-azure/issues/267

Reproduction Steps

using this provisioner

  provisioner "powershell" {
    environment_vars  = ["WINDOWSPASS=${build.Password}"]
    scripts     = [demo.ps1"]
  }

with a demo.ps1

Write-Host "Windows Administrator password is: $Env:WINDOWSPASS"
Current output
 Using SSH communicator to connect: x.x.x.x
 Waiting for SSH to become available...
 Connected to SSH!
 Provisioning with Powershell...
 Provisioning with powershell script: demo.ps1
 Windows Administrator password is:

Windows password is empty!

Plugin and Packer version

packer version: Packer v1.10.0 packer-plugin-amazon version: 1.2.8