hashicorp / hashicorp/packer-plugin-amazon

Data Sources: "amazon-parameterstore", "amazon-ami", and "amazon-secretsmanager" missing all possible configurations items: "region" optional override

Open
#548 0 comments 1 reaction 0 assignees View on GitHub
bug
Dominant language
Go
Stars
91
Forks
141
Avg merge
2d 18h
Merged PRs (30d)
3

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 Amazon "data" sources documentation (links below) is missing all the possible (optional) settings that are valid, such as `region`. This is critical, say if you have local `aws configure` "default region" set or your local environment has either `AWS_DEFAULT_REGION` or `AWS_REGION` env var set. Users need to know when reading the documentation that they can set various optional overrides such as "region" when retrieving an AMI ID via "amazon-ami" or "parameterstore" (for example).

https://developer.hashicorp.com/packer/integrations/hashicorp/amazon/latest/components/data-source/parameterstore#optional
https://developer.hashicorp.com/packer/integrations/hashicorp/amazon/latest/components/data-source/secretsmanager#optional
https://developer.hashicorp.com/packer/integrations/hashicorp/amazon/latest/components/data-source/ami#configuration-reference

#### Reproduction Steps

Create a `*.pkr.hcl` file with this contents:

```
data "amazon-parameterstore" "base-ami" {
name = "/aws/service/canonical/ubuntu/server/24.04/stable/current/amd64/hvm/ebs-gp3/ami-id"
}
```

set via `aws configure` or ENV VAR, so that the AWS region is pointing at say `us-east-1` and execute the hcl file. This is the AWS region it will use. Now add this line:

```
data "amazon-parameterstore" "base-ami" {
name = "/aws/service/canonical/ubuntu/server/24.04/stable/current/amd64/hvm/ebs-gp3/ami-id"
region = "eu-west-1"
}
```

Execute again. You will now retrieve the AMI-id from AWS region: `eu-west-1` but your local environment is set to: `us-east-1`. Users need to see this by reading about the configuration settings that are possible as optional via the public facing documentation.

Crawling the source code, you can see what is possible:
https://github.com/hashicorp/packer-plugin-amazon/blob/main/datasource/parameterstore/data.hcl2spec.go#L71

All the Amazon "data" sources need fixing up with the additional (optional) setting(s) exposed via the public docs.

### Plugin and Packer version

`Packer v1.12.0`

### Simplified Packer Buildfile

N/A

### Operating system and Environment details

N/A

### Log Fragments and crash.log files

N/A

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.