Native Terraform Migration
This example demonstrates migrating from [native Terraform](https://atmos.tools/cli/commands/terraform/usage) (with [`.tfvars` files](https://atmos.tools/stacks/vars)) to Atmos.
Try it out
- Install Atmos
- Try the example
Copy the example into a new directory and make it your own:
atmos init examples/native-terraform
cd native-terraform
Follow the README for prerequisites and next steps.
See it in action
RECORDED DEMO Native Terraform Migration Example
This example demonstrates migrating from native Terraform (with .tfvars files) to Atmos.
Overview
The example shows two migration strategies side by side:
| Stack | File | Strategy | Stack Name |
|---|---|---|---|
dev | stacks/dev.yaml | Keep existing .tfvars via !include | dev (from filename) |
prod | stacks/prod.yaml | Convert to native YAML | production (explicit name) |
Directory Structure
├── atmos.yaml # Atmos configuration├── components/terraform/vpc/ # Your Terraform root module│ ├── main.tf│ ├── variables.tf│ ├── outputs.tf│ └── envs/ # Existing .tfvars files│ ├── dev.tfvars│ └── prod.tfvars└── stacks/├── _defaults.yaml # Shared defaults (imported by both stacks)├── dev.yaml # Uses !include for existing tfvars└── prod.yaml # Fully converted to YAML
Key Concepts
!include for .tfvars
The dev stack uses !include to import existing .tfvars files directly:
components:terraform:vpc:vars: !include ../components/terraform/vpc/envs/dev.tfvars
This is the fastest migration path — your existing variable files keep working.
Stack Names
The prod stack uses an explicit name field to override the filename:
name: production
This means you reference it as atmos terraform plan vpc -s production, not -s prod.
Imports
Both stacks import shared defaults from _defaults.yaml:
import:- _defaults
Usage
# List all stacksatmos list stacks# Dev stack (uses !include for tfvars)atmos terraform plan vpc -s devatmos describe component vpc -s dev# Prod stack (explicit name, converted to YAML)atmos terraform plan vpc -s productionatmos describe component vpc -s production# This will NOT work (filename is not the canonical name):# atmos terraform plan vpc -s prod