hashicorp / hashicorp/packer

Add pwsh provisioner to linux

Open
#12,429 7 comments 3 reactions 1 assignee Claimed by @tenthirtyam View on GitHub
enhancement stage/needs-discussion stage/thinking
Dominant language
Go
Stars
15.8k
Forks
3.3k
PR merge metrics
PR metrics pending

Description

#### Community Note

* Please vote on this issue by adding a 👍 [reaction](https://blog.github.com/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/) to the original issue to help the community and maintainers prioritize this request
* Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
* If you are interested in working on this issue or have submitted a pull request, please leave a comment

Please search the existing issues for relevant feature requests, and use the
reaction feature
(https://blog.github.com/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/)
to add upvotes to pre-existing requests.

#### Description

Add support for using the powershell provisioner on linux. I'm currently using the standard shell provisioner and changing the run command like so:
```
provisioner "shell" {
execute_command = "sudo sh -c '{{ .Vars }} pwsh -f {{ .Path }}'"
scripts = ["${path.root}/scripts/Install-stuff.ps1"]
}
```
This doesn't seem to work when specifying `inline`.

#### Use Case(s)

When building linux images using pwsh as the primary scripting language instead of bash.

#### Potential configuration
I'd love it if something like this worked:
```
provisioner "pwsh" {
inline = [ "Write-Host \"Hello from PowerShell\""]
}
```

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.