Getting Started»
Warning
Terragrunt support is currently in beta and has some important limitations to take into consideration. Please see our documentation here for more information.
This documentation will be using an example repository Spacelift provides here. This repository contains two different examples, but in this guide we will use the single-stack example.
Creating a new stack»
In Spacelift, go ahead and click the Create stack button to create a new Stack.
Naming the stack»
Once in the stack creation wizard, Give your stack a name such as terragrunt-example then press Continue to configure the source code settings for the stack.
Linking to the Terragrunt code»
On the Connect to source code screen, Select Raw Git as your Provider, and provide the following URL: https://github.com/spacelift-io-examples/terragrunt-examples.git and a Project Root of single-project.
Pressing continue on this page will take you through to the vendor configuration page.
This page has quite a few options but the ones that we will be using for this example are as follows:
Press Create & continue to finish the backend configuration and move through to defining stack behavior. For this example nothing else needs to be configured, so you can click on Skip to summary and then click on Confirm to finish creating your stack.
Deploying the stack»
Spacelift will take you to the Runs view for the Stack you've just created. Once on this page, press the Trigger button to trigger a new Run.
You should now be taken through the process of deploying your stack. This takes you through multiple stages of a run, moving through initialization, planning and ending up in an unconfirmed state.
Examining the planned changes»
In this unconfirmed state we have time to review what is going to change if we were to continue and confirm and apply. By pressing the changes +2
button at the top of the page, we are taken to an overview of the planned changes.
For this stack we should see that 2 resources are being created and we can see what values these resources and outputs are expected to have. This view is very useful to see at a glance what is going to happen as a result of your deployment.
Confirming and applying the changes»
Info
Due to security reasons and limitations of Terragrunt and its mocked outputs, Spacelift does not use the planfile in the applying as there is a possibility to deploy mock values.
Once you're happy with the changes, press the Confirm button to allow the run to continue and begin the applying phase of the run.
Conclusion»
You have now successfully deployed a Terragrunt stack using Spacelift! Congratulations.
For further reading, we recommend looking into using the Run all
setting to enable you to deploy multiple projects using terragrunt run-all
by reading our documentation here. We also recommend that if you are looking into using Terragrunt with Spacelift that you read our page on the Limitations of Terragrunt.