hashicorp / hashicorp/packer-plugin-azure

Randomly generated SSH Password not set unless communicator type is explicitly set to ssh

Open
#415 3 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Go
Stars
63
Forks
103
PR merge metrics
No merged PRs in 30d

Description

When filing a bug, please include the following headings if possible. Any
example text in this template can be deleted.

#### Overview of the Issue
The build variable `Password` returns an empty string if it's not explicitly set using the `ssh_password` option. When `ssh_password` is set it works fine.

#### Reproduction Steps

Steps to reproduce this issue

### Plugin and Packer version
packer: `v1.10.0`
Plugin: `v2.1.3`

From `packer version`

### Simplified Packer Buildfile

If the file is longer than a few dozen lines, please include the URL to the
[gist](https://gist.github.com/) of the log or use the [Github detailed
format](https://gist.github.com/ericclemmons/b146fe5da72ca1f706b2ef72a20ac39d)
instead of posting it directly in the issue.

```
build {
sources = [
"..."
]

provisioner "shell" {
script = "scripts/setup.sh"
execute_command = "chmod +x {{ .Path }}; {{ .Vars }} bash -x -l '{{ .Path }}'"
environment_vars = [
"ROOT_PSSWD=${build.Password}",
"USER_ID=${build.User}",
"BUILD_ID=${build.ID}",
]
}
}
```
setup.sh
```
echo "PASSWORD = ${ROOT_PSSWD}"
```
output
```
PASSWORD=
```

### Operating system and Environment details

OS, Architecture, and any other information you can provide about the
environment.

### Log Fragments and crash.log files

```
azure-arm...: temp admin user: 'user'
azure-arm... temp admin password: '22wlrlNpqTPw6yrDKwwUaxdtL9eta34q'
```

Set the env var `PACKER_LOG=1` for maximum log detail.

```
Remote command exited with '1': chmod +x /tmp/script_7867.sh; BUILD_ID='ERR_ID_NOT_IMPLEMENTED_BY_BUILDER' C_FORCE_ROOT='True'
ROOT_PSSWD='' bash -x -l '/tmp/script_7867.sh'
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.