Why env0
Solutions
Infrastructure as Code (IaC) Automation Teams and GovernanceManaged Self-Service env0 for the Enterprise
DocumentationPricing
Resources
Case StudiesIn the NewsVideosWebinars
Blog
Login
Get a Demo
FREE TRIALContact us
Dec 21, 2020

DRY those IaC configurations with env0 and Terragrunt! | env0

Tim Davis
DevOps Advocate

Hello, env0 and Terragrunt fans alike! It’s new-feature-day, yet again! But this time, we have something really special for you. We’re giving you the ability to completely change the game on the Infrastructure as Code files that you use to deploy and manage environments with our platform! Introducing remote-run support for Terragrunt workflows, now available in env0! Remote-run workflows allow for everyone on the team to be able to have visibility into the deployments of others on the team and removes the visibility issues of locally-run workflows. Also, env0 allows you to manage these environments from deploy to destroy. Running Terragrunt on env0 allows you to empower your workflows with Policies & Governance and RBAC.

But, what if you aren’t very familiar with Terragrunt and its benefits yet? Well, let’s talk about it!

What is Terragrunt?

Terragrunt is a thin wrapper that provides extra tools for keeping your configurations DRY (Don’t Repeat Yourself), working with multiple Terraform modules, and managing remote state.

But, what does keeping your configurations “dry” mean? Having dry configs allows you to sanitize your terraform configuration files for use in multiple environments at once. Let’s say your code looks like this:

└── live
   ├── prod
   │   ├── app
   │   │   └── main.tf
   │   ├── mysql
   │   │   └── main.tf
   │   └── vpc
   │       └── main.tf
   ├── qa
   │   ├── app
   │   │   └── main.tf
   │   ├── mysql
   │   │   └── main.tf
   │   └── vpc
   │       └── main.tf
   └── stage
       ├── app
       │   └── main.tf
       ├── mysql
       │   └── main.tf
       └── vpc
           └── main.tf

Each one of the environments have multiple components. In a traditional Terraform environment, you would have multiple sets of the same configuration files, that are all almost the same, but you have to edit the specific config info for each of the different environments. With Terragrunt, you can have “remote terraform configurations” where you store the clean terraform files in a separate repo, and then just call on it in remotely from any place you need it, and only put the Terragrunt configs for each specific environment in their corresponding place.

└── live
   ├── prod
   │   ├── app
   │   │   └── terragrunt.hcl
   │   ├── mysql
   │   │   └── terragrunt.hcl
   │   └── vpc
   │       └── terragrunt.hcl
   ├── qa
   │   ├── app
   │   │   └── terragrunt.hcl
   │   ├── mysql
   │   │   └── terragrunt.hcl
   │   └── vpc
   │       └── terragrunt.hcl
   └── stage
       ├── app
       │   └── terragrunt.hcl
       ├── mysql
       │   └── terragrunt.hcl
       └── vpc
           └── terragrunt.hcl

This kind of operation can be very helpful when you have a lot of different environments or very complex environments at scale. For more information on Terragrunt, check out our friends at Gruntwork. You can also find them on GitHub.

How do I use Terragrunt in env0?

This is the easiest part! You can set up your templates with your existing Terragrunt repo’s the same way you set up your Terraform repo’s today. Just click Create New Template as you normally would, and then select Terragrunt.

Image for post

From there, the template creation process is exactly the same as it is with your usual Terraform files. For more info on templates in env0, check out the docs here.

For more content about env0, be sure to follow us on Twitter, LinkedIn, and subscribe to our YouTube channel!

Interested in learning more about env0?
Request a Demo
SHARE
You may also like
Day 0 Environment Creation
Share outputs between IaC stacks
Chris' Corner - March 2023
Go back to blog
CNCF Member Badge
Company
About UsIn the NewsPress ReleasesCase StudiesAdditional ResourcesCareers
Developer and DevOps
APITerraform ProviderTerratag Open Source
Terraform Cloud AlternativeDIY AlternativeAtlantis Alternative
FREE TRIAL
Follow Us
Terms of ServicePrivacy PolicySecuritySystem Status
© Copyright env0 2023
This website uses cookies. We use cookies to ensure that we give you the best experience on our website. Learn More
PreferencesDenyAccept
Privacy Preference Center
When you visit websites, they may store or retrieve data in your browser. This storage is often necessary for the basic functionality of the website. The storage may be used for marketing, analytics, and personalization of the site, such as storing your preferences. Privacy is important to us, so you have the option of disabling certain types of storage that may not be necessary for the basic functioning of the website. Blocking categories may impact your experience on the website.
Reject all cookiesAllow all cookies
Manage Consent Preferences by Category
Essential
Always Active
These items are required to enable basic website functionality.
Marketing
These items are used to deliver advertising that is more relevant to you and your interests. They may also be used to limit the number of times you see an advertisement and measure the effectiveness of advertising campaigns. Advertising networks usually place them with the website operator’s permission.
Personalization
These items allow the website to remember choices you make (such as your user name, language, or the region you are in) and provide enhanced, more personal features. For example, a website may provide you with local weather reports or traffic news by storing data about your current location.
Analytics
These items help the website operator understand how its website performs, how visitors interact with the site, and whether there may be technical issues. This storage type usually doesn’t collect information that identifies a visitor.
Confirm my preferences and close