hashicorp / hashicorp/packer-plugin-amazon
Unable to call packer validate with secrets passed as environment variables
- Dominant language
- Go
- Stars
- 91
- Forks
- 141
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 3
Description
#### Overview of the Issue
With a HCL2 format packer file like the following:
```
variable "environment" {
description = "Environment we're creating images in"
default = "test"
type = string
}
data "amazon-secretsmanager" "my_secret" {
name = "my_secret_id_${var.environment}"
}
locals {
my_secret_string = data.amazon-secretsmanager.my_secret.secret_string
}
source "amazon-ebs" "this" {
....
}
build {
....
provisioner "shell" {
...
environment_vars = ["MY_ENV_VAR=${local.my_secret_string}"]
}
}
```
Running a ```packer build``` is successful; but, running ```packer validate``` fails with:
```
Error: Failed preparing provisioner-block "shell" ""
on packer_build.pkr.hcl line 168:
(source code not available)
1 error(s) occurred:
* Environment variable not in format 'key=value':
```
### Packer version
v1.7.9
packer-plugin-amazon: 1.0.8
### Operating system and Environment details
Ubuntu 20.04LTS in WSL2 amd64.
Building AWS AMIs with ```amazon-ebs``` source.
Contributor guide
Assessment
This issue has not been assessed yet.