
Roni Frantchi
Director of Engineering
Today, we’re excited to announce that env0 is open sourcing Terratag - a CLI tool that enables users of Terraform to automatically create and maintain tagging across their entire set of AWS, Azure, and GCP resources. It enables you to easily add dynamic tags to your existing Infrastructure-as-Code and benefit from some of the cross-resource tag applications you wish you had thought of when you had just started writing your Terraform, saving you tons of time and making future updates easy.
Tagging is every cloud provider’s way of enabling you to organize and manage your cloud resources - for everything from automations to cost insights, tagging enables it all. But the actual process of tagging today is broken, requiring too much manual work with too many mistakes during it. That’s why we built Terratag to automate it all. We wanted to solve this task not just for env0 users, but for the whole developer community. Our hope is that making Terratag available for everyone will help more organizations adopt infrastructure-as-code for software development.
All major cloud providers allow for tagging (or labeling) cloud resources. Moreover, they all encourage you to do so in order to benefit from their complementary services; allowing you to manage budgets, set up powerful automation algorithms, and unlock insights offered both by the cloud providers themselves, and independent third parties.
Harnessing powerful infrastructure-as-code frameworks such as Terraform to define and tag your cloud resources allows for useful dynamic tag applications on various verticals. Nevertheless, it’s important to use the right tag for the right job. Some of the most common tags include:
Here’s an example of how one would tag a cloud resource using Terraform:
resource "aws_vpc" "example" {
# ... other configuration ...
tags = {
Name = "MyVPC"
Owner = "Operaions"
Environment = "${var.environment}"
Project = "${var.project}"
}
}
Pretty powerful, yet simple, right?
And things tend to remain simple, at first.
Having only a few cloud resources makes it very easy to add both static and dynamic tags to these resources. However, as your infrastructure grows, having to repeat those same tags over and over for tens or hundreds of cloud resources can become a hassle to maintain. But that’s just the tip of the iceberg. Manual tagging processes fail on other important ways:
Infrastructure-as-code is, well, just code. And such is the case with any code - code repetition makes it harder to fix errors, apply enhancements, make adjustments and maintain readability.
Lack of proper layering or aspect control makes it harder to retrofit existing solutions.
A cross-cutting concern calls for a cross-cutting solution.
Terratag is a CLI tool allowing for tags or labels to be applied across an entire set of targeted Terraform files directory.
It generates Terraform files with your custom tags added to any GCP, AWS or Azure cloud resources:
$ terratag -dir=ops -tags={\"environment\": \"$ENVIRONMENT\",\"project\": \"$PROJECT\"}
Using Terratag as a step before terraform planning or terraform applying allows you to dynamically inject the powerful metadata of tags or labels across a set of resources - freeing you and your team from the burden of remembering to constantly apply cross-cutting tags to new resources or maintain and modify tags on existing resources.
Now you can also easily add dynamic tags to your existing IaC and benefit from some of the cross-resource tag applications you wish you had thought of when you had just started writing your Terraform code.
env0 is a management platform that lets your team run their own cloud environments, governed by your policies and with complete visibility & cost management.
We use Terratag to drive our Cost Management and Resource modules. We automatically inject dynamic tags for your managed Environments and Projects - allowing us to provide you with powerful insights such as viewing your entire multi-cloud cost per environment to date, over time, and much, much more.
With env0, there’s no need to deal with your own management system or build Terratag into your setup, we handle it all for you automatically.
At env0, we love open source, which is why we’re making Terratag available to all.
Check out our Terratag repo on GitHub. Issues, suggestions, requests and of course, Pull Requests, are very welcome!
Custom workflows let you model any process you have.
Improve collaboration so your teams are always on the same page with your Infrastructure as Code
Visualize the effect of IaC changes before and after deployment.
Custom workflows let you model any process you have.
Improve collaboration so your teams are always on the same page with your Infrastructure as Code
Visualize the effect of IaC changes before and after deployment.
env0 is the best way to deploy, scale, and manage your Terraform and other Infrastructure as Code tools.