Skip to main content
atmos terraform plan
 
00:00.0 / 00:00.0
README.md2.2 KB
View on GitHub

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:

StackFileStrategyStack Name
devstacks/dev.yamlKeep existing .tfvars via !includedev (from filename)
prodstacks/prod.yamlConvert to native YAMLproduction (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 stacks
atmos list stacks

# Dev stack (uses !include for tfvars)
atmos terraform plan vpc -s dev
atmos describe component vpc -s dev

# Prod stack (explicit name, converted to YAML)
atmos terraform plan vpc -s production
atmos describe component vpc -s production

# This will NOT work (filename is not the canonical name):
# atmos terraform plan vpc -s prod