Your First Stack
Let's create the simplest possible Atmos stack—no imports, no inheritance, no complexity. Just a component plus configuration that works.
Think of this like "Hello World" for Atmos. We'll take one Terraform component and configure it with one stack file. That's it.
Prerequisites
- Atmos installed
- Basic Terraform knowledge
- A Terraform component (or create a simple one)
Step 1: Create a Simple Component
First, create a basic Terraform component. We'll use a simple example that creates an S3 bucket:
components/terraform/s3-bucket/main.tf
components/terraform/s3-bucket/versions.tf
tip
This is just an example. You can use any existing Terraform root module you have—Atmos works with vanilla Terraform.
Step 2: Create an Atmos Configuration
Create atmos.yaml in your repository root:
atmos.yaml
This tells Atmos:
- Where to find Terraform components (
components/terraform/) - Where to find stack configurations (
stacks/) - How to name stacks (using the
stagevariable)
Step 3: Create Your First Stack
Now create a stack configuration for development:
stacks/dev.yaml
Let's break this down:
vars(top level): Variables available to all components in this stackcomponents.terraform.my-bucket: This is a component instance—a configured instance of thes3-bucketcomponentmetadata.component: Points to the actual Terraform component incomponents/terraform/s3-bucketvars(component level): Variables specific to this component instance
Step 4: Deploy Your Stack
If the plan looks good:
atmos terraform apply my-bucket -s dev
What Just Happened?
Atmos did several things automatically:
- Found the component: Located
components/terraform/s3-bucketbased onmetadata.component - Merged variables: Combined global
varswith component-specificvars - Generated tfvars: Created a
.tfvarsfile with:bucket_name = "my-dev-bucket-12345"
environment = "development"
stage = "dev"
region = "us-east-1" - Ran Terraform: Executed
terraform applyin the component directory