Skip to main content

atmos packer output

Packer
purpose

Use this command to get an output from a Packer manifest. Manifests are generated by Packer when executing packer build commands (if configured in the Packer template and Atmos stack). YQ expressions and functions are supported to get any section or attribute from the manifest.

Usage​

Execute the packer output command like this:

atmos packer output <component> --stack <stack> --query <yq-expression>
note

atmos packer output command is specific to Atmos (Packer itself does not have an output command). The command is used to get an output from a Packer manifest. Manifests are generated by Packer when executing packer build commands (if configured in the Packer template and Atmos stack).

Arguments​

component (required)

Atmos Packer component.

Flags​

--stack (alias -s)(required)

Atmos stack.

--query (alias -q)(optional)

YQ expression to get sections and attributes from a Packer manifest.

Examples​

atmos packer output aws/bastion -s prod
atmos packer output aws/bastion -s prod --query '.builds[0].artifact_id'
atmos packer output aws/bastion -s prod -q '.builds[0].artifact_id | split(":")[1]'

atmos packer output aws/bastion -s prod

> atmos packer output aws/bastion -s prod

builds:
- artifact_id: us-east-2:ami-0c2ca16b7fcac7529
build_time: 1.753281956e+09
builder_type: amazon-ebs
custom_data: null
files: null
name: al2023
packer_run_uuid: 5114a723-92f6-060f-bae4-3ac2d0324557
- artifact_id: us-east-2:ami-0b2b3b68aa3c5ada8
build_time: 1.7540253e+09
builder_type: amazon-ebs
custom_data: null
files: null
name: al2023
packer_run_uuid: a57874d1-c478-63d7-cfde-9d91e513eb9a
last_run_uuid: a57874d1-c478-63d7-cfde-9d91e513eb9a

atmos packer output aws/bastion -s prod --query '.builds[0].artifact_id'

# Use a YQ expression to get a specific section or attribute from the Packer manifest,
# in this case, the `artifact_id` from the first build.

> atmos packer output aws/bastion -s nonprod --query '.builds[0].artifact_id'

us-east-2:ami-0c2ca16b7fcac7529

atmos packer output aws/bastion -s nonprod -q '.builds[0].artifact_id | split(:)[1]'

# Use a YQ expression to get a specific section or attribute from the Packer manifest,
# in this case, the AMI (second part after the `:`) from the `artifact_id` from the first build.

> atmos packer output aws/bastion -s nonprod -q '.builds[0].artifact_id | split(":")[1]'

ami-0c2ca16b7fcac7529