atmos terraform output
Use this command to read Terraform output values for an Atmos component in a stack from the state file.
Usage
Execute the terraform output command like this:
atmos terraform output <component> -s <stack> [options]
This command reads output values from the Terraform state file and prints them. Output values are useful for passing information between different Terraform configurations or to external systems.
Atmos provides standard setup for this command including automatic terraform init, workspace selection, and variable file generation. The output retrieval itself is handled by native Terraform.
Configuration
Configure default behavior for terraform output in your atmos.yaml:
components:
terraform:
# Auto-generate backend configuration
auto_generate_backend_file: true
These settings can also be controlled via environment variables:
export ATMOS_COMPONENTS_TERRAFORM_AUTO_GENERATE_BACKEND_FILE=true
Examples
Show All Outputs
# Display all outputs for a component
atmos terraform output vpc -s dev
Get Specific Output
# Get a specific output value
atmos terraform output vpc -s dev vpc_id
JSON Format
# Get outputs in JSON format
atmos terraform output vpc -s dev -json
Raw Output
# Get raw output value (useful for scripts)
atmos terraform output vpc -s dev -raw vpc_id
Arguments
component(required)Atmos component name.
Flags
--stack/-s(required)Atmos stack name where the component is defined.
--skip-init(optional)Skip running
terraform initbefore executing the command.atmos terraform output vpc -s dev --skip-init--dry-run(optional)Show what would be executed without actually running the command.
atmos terraform output vpc -s dev --dry-run
Native Terraform Flags
-jsonOutput in JSON format.
atmos terraform output vpc -s dev -json-rawOutput raw string value (for single outputs).
atmos terraform output vpc -s dev -raw vpc_id-state=PATHPath to the state file to read.
atmos terraform output vpc -s dev -state=terraform.tfstate
Related Commands
atmos terraform plan- Generate execution planatmos terraform apply- Apply changesatmos terraform init- Initialize working directory