The Amazon plugin is able to fetch data from AWS. To achieve this, the plugin comes with data sources to retrieve AMI and secrets information. Packer supports the following data sources at the moment:
- amazon-ami – Filter and fetch an Amazon AMI to output all the AMI information.
- amazon-secretsmanager – Retrieve information about a Secrets Manager secret version, including its secret value.
- amazon-parameterstore – Retrieve information about a parameter in SSM.
The Secrets Manager data source provides information about a Secrets Manager secret version, including its secret value. Data sources is a feature exclusively available to HCL2 templates.
data "amazon-secretsmanager" "basic-example" {
name = "packer_test_secret"
key = "packer_test_key"
version_stage = "example"
}
# usage example of the data source output
locals {
value = data.amazon-secretsmanager.basic-example.value
secret_string = data.amazon-secretsmanager.basic-example.secret_string
version_id = data.amazon-secretsmanager.basic-example.version_id
secret_value = jsondecode(data.amazon-secretsmanager.basic-example.secret_string)["packer_test_key"]
}
data "amazon-secretsmanager" "basic-example" {
name = "packer_test_secret"
key = "packer_test_key"
assume_role {
role_arn = "arn:aws:iam::ACCOUNT_ID:role/ROLE_NAME"
session_name = "SESSION_NAME"
external_id = "EXTERNAL_ID"
}
}
I’m a DevOps/SRE/DevSecOps/Cloud Expert passionate about sharing knowledge and experiences. I am working at Cotocus. I blog tech insights at DevOps School, travel stories at Holiday Landmark, stock market tips at Stocks Mantra, health and fitness guidance at My Medic Plus, product reviews at I reviewed , and SEO strategies at Wizbrand.
Please find my social handles as below;
Rajesh Kumar Personal Website
Rajesh Kumar at YOUTUBE
Rajesh Kumar at INSTAGRAM
Rajesh Kumar at X
Rajesh Kumar at FACEBOOK
Rajesh Kumar at LINKEDIN
Rajesh Kumar at PINTEREST
Rajesh Kumar at QUORA
Rajesh Kumar at WIZBRAND