Open qburst-nikhilsoman opened 2 years ago
I get a similar error from trying to use Powershell provisioner over SSH. I'm trying to install Chocolatey using the PS snippet from their instructions. But, I think I've found a workaround for my problem. Can you try:
ssh_pty = true
In your source
block?
@nywilken @create-atl-delete I've used the above user_data_file and successfully authenticated via SSH over SSM on Windows. However, my PowerShell scripts are not executing on the packer builder instance. It looks like an issue with the shell with the SSH communicator in the PowerShell provisioner. What my PowerShell script does is download a couple of packages (like MSEdge browser and Symon) and install them on the instance. I'm getting the following error while doing the packer build:
I've tried the
execute_command
specified in the Packer documentation, but getting the same error.My PowerShell script:
Used the following Packer template:
user_data_file (openssh-user-data.ps1 in the template above):
The same PowerShell script worked with the WinRM communicator. Is there any issue in executing PowerShell script through the SSH communicator?
Originally posted by @qburst-nikhilsoman in https://github.com/hashicorp/packer-plugin-amazon/issues/123#issuecomment-1157893313