atmos packer
Use these subcommands to interact with HashiCorp Packer to build automated machine images.
Usage
For more details on the Packer commands and options, refer to Packer Commands.
Path-Based Component Resolution
Atmos supports using filesystem paths instead of component names for convenience. This allows you to navigate to a component directory and use . to reference it:
This automatically resolves the path to the component name configured in your stack, eliminating the need to remember exact component names.
Supported path formats:
.- Current directory./component- Relative path from current directory../other-component- Relative path to sibling directory/absolute/path/to/component- Absolute path
Requirements:
- Must be inside a component directory under the configured base path
- Must specify
--stackflag - Component must exist in the specified stack configuration
- The component path must resolve to a unique component name - If multiple components in the stack reference the same component path, you must use the unique component name instead of the path
Path-based resolution only works when the component path resolves to a single unique component in the stack.
For example, if both bastion/prod and bastion/dev reference components/packer/aws/bastion:
cd components/packer/aws/bastion
atmos packer build . --stack prod # ❌ Error: ambiguous - which component?
Instead, you must use the unique component names:
atmos packer build bastion/prod --stack prod # ✓ Explicit and unambiguous
atmos packer build bastion/dev --stack dev # ✓ Explicit and unambiguous
Atmos Flags
--stack(alias-s)Atmos stack.
--template(alias-t)(optional)Packer template. It can be specified in the
settings.packer.templatesection in the Atmos component manifest, or on the command line via the flag--template <template>(shorthand-t). The command line flag takes precedence oversettings.packer.template.--query(alias-q)(optional)YQ expression to get sections and attributes from a Packer manifest. Used in the
atmos packer outputcommand.
Examples
Component Name Examples
Path-Based Examples
Configure Packer
Learn how to configure Packer components in your atmos.yaml, including templates and component settings.
Arguments
atmos-component(required)Atmos component name or filesystem path.
Supports both:- Component names:
aws/bastion,gcp/web-server - Filesystem paths:
.(current directory),./aws/bastion,components/packer/aws/bastion
When using paths, Atmos automatically resolves the path to the component name based on your stack configuration. See Path-Based Component Resolution above.
- Component names:
Subcommands
📄️ build
Use this command to process a Packer template configured for an Atmos component in a stack, and build it to generate a set of artifacts.
📄️ init
Use this command to initialize Packer and install plugins according to an HCL template configuration for an Atmos component in a stack.
📄️ inspect
Use this command to inspect the various components that a Packer template configured for an Atmos component in a stack defines.
📄️ output
Use this command to get an output from a Packer manifest.
📄️ validate
Use this command to validate the syntax and configuration of a Packer template configured for an Atmos component in a stack.
📄️ version
Use this command to display the currently installed Packer version.