We'll take you through a full migration of a simple Terragrunt project to a Terraspace project. You'll be able to run terragrunt apply
and terraspace up
and see no changes. This allows you to test things out incrementally.
This unique approach of using the same Terraform statefile was inspired by this community post: Migrating from terragrunt - Root modules?
The starting terraspace project structure we'll use is pretty typical:
terragrunt-project
├── terragrunt.hcl
├── us-east-1
│ ├── dev
│ │ └── demo
│ │ └── terragrunt.hcl
│ └── prod
│ └── demo
│ └── terragrunt.hcl
└── us-west-2
├── dev
│ └── demo
│ └── terragrunt.hcl
└── prod
└── demo
└── terragrunt.hcl
To deploy different environments to multiple regions:
cd us-east-1/dev/demo && terragrunt apply
cd us-east-1/prod/demo && terragrunt apply
cd us-west-2/dev/demo && terragrunt apply
cd us-west-2/prod/demo && terragrunt apply
The terraspace project structure is:
terraspace-project
├── app
│ └── stacks
│ └── demo
│ ├── main.tf
│ └── variables.tf
└── config
└── terraform
├── backend.tf
└── provider.tf
To deploy different environments to multiple regions:
TS_ENV=dev AWS_REGION=us-east-1 terraspace up demo
TS_ENV=dev AWS_REGION=us-east-1 terraspace up demo
TS_ENV=prod AWS_REGION=us-west-2 terraspace up demo
TS_ENV=prod AWS_REGION=us-west-2 terraspace up demo
If you're running through the example yourself, change the s3 bucket in the code one that is available:
This is also documented in their respective READMEs.
Links:
- Terraspace Docs: Terraspace vs Terragrunt
- Terragrunt Project Example Repo: boltops-learn/terragrunt-project
- Terraspace Project Example Repo: boltops-learn/terraspace-project
Terraspace and Terragrunt
19m
Explore lesson as part of a learning path
Get full access to these great resources
All for less than the price of coffee a day