> ## Documentation Index
> Fetch the complete documentation index at: https://docs.envzero.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Terratag project

> Terratag is the env zero CLI tool for applying consistent tags to AWS, GCP, and Azure resources across Terraform and Terragrunt codebases automatically.

[Terratag](https://www.terratag.io/) is a CLI tool developed by env zero that applies tags or labels across your Infrastructure-as-Code (IaC) codebase.

Terratag automatically applies consistent tags to AWS, GCP, and Azure resources across your Terraform or Terragrunt files.

## Getting started

Visit the [official Terratag website](https://www.terratag.io/) to download the binary and view additional documentation.

> [card] [Visit Terratag](https://www.terratag.io/)
>
> Download Terratag and view full documentation

## CLI flags

All flags can also be set via environment variables using the pattern `TERRATAG_<FLAG_NAME_UPPERCASE>` (for example, `-tags` can be set with `TERRATAG_TAGS`). Command-line flags take precedence over environment variables.

| Flag | Default | Description |
| :- | :- | :- |
| `-tags` | *(required)* | Tags to apply, as a valid JSON object. Example: `'{"env":"prod","team":"platform"}'` |
| `-dir` | `.` | Directory to recursively search for `.tf` files |
| `-type` | `terraform` | IaC type. Valid values: `terraform`, `terragrunt`, `terragrunt-run-all` |
| `-filter` | `.*` | Apply tags only to resource types matching this regex |
| `-skip` | *(none)* | Exclude resource types matching this regex from tagging |
| `-skipTerratagFiles` | `true` | Skip files that were previously tagged by Terratag |
| `-rename` | `true` | Rename tagged files to `<basename>.terratag.tf`. Set to `false` to edit files in place |
| `-keep-existing-tags` | `false` | Preserve existing tags when merging. By default, new tags override existing ones |
| `-default-to-terraform` | `false` | Use Terraform even when OpenTofu is installed |
| `-verbose` | `false` | Enable verbose logging |
| `-version` | `false` | Print the version and exit |

> [!NOTE]
>
> Terratag is part of the env zero platform ecosystem and integrates with env zero's Infrastructure-as-Code management capabilities. env zero uses it to tag resources for [cost monitoring](https://docs.envzero.com/guides/cost-monitoring/cost-monitoring.md) and to apply [custom resource tags](https://docs.envzero.com/guides/admin-guide/additional-controls.md#adding-custom-resource-tagging).

## Next steps

For questions about Terratag behavior in your deployments, reach out to [env zero support](https://docs.envzero.com/guides/community-and-resources/support-and-help/support.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.