Skip to main content
EXAMPLE

Terragrunt

Run an existing Terragrunt unit as an Atmos Terraform component. This example uses OpenTofu, local state, and a built-in `terraform_data` resource. It requires no cloud credentials.

TerraformComponentsStacks
cloudposse / atmos

Try it out

Copy the example into a new directory and make it your own:

atmos init examples/terragrunt
cd terragrunt

Follow the README for prerequisites and next steps.

See it in action

RECORDED DEMO
terragrunt
 
Recorded from this example
Real commands. Real output.
README.md1.7 KB
View on GitHub

Terragrunt

Run an existing Terragrunt unit as an Atmos Terraform component. This example uses OpenTofu, local state, and a built-in terraform_data resource. It requires no cloud credentials.

Discover and plan

With Atmos and OpenTofu installed, run these commands from the example directory:

atmos list instances
atmos terraform plan demo -s live

On first use, atmos list instances installs the plugin declared in atmos.yaml, writes .atmos.plugins.lock.yaml, and lists component demo in stack live. You can also run atmos plugin install to install it up front. Commit the lockfile before running in CI so Atmos can restore the same release.

The plan shows one resource to add. Its input is HELLO FROM TERRAGRUNT, which the unit computes with the HCL upper function.

Apply and clean up

atmos terraform apply demo -s live
atmos terraform output demo -s live -- -raw greeting
atmos terraform destroy demo -s live

Use in your own project

To add the plugin to your project's atmos.yaml and install it, run:

atmos plugin install oci://ghcr.io/cloudposse/atmos/plugins/terragrunt \
--as=terragrunt --version='^0.1.0'

See Enable Terragrunt support to configure discovery for your project's units.