> ## 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

[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 title="Visit Terratag" icon="external-link" href="https://www.terratag.io/">
  Download Terratag and view full documentation
</Card>

## 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.
</Note>

## Next steps

* [OpenTofu Project](/guides/community-and-resources/community-and-open-source/opentofu) - Learn about env zero's open-source IaC foundation.
* [Managing Variables](/guides/admin-guide/variables) - Apply tags and labels via environment variables.
* [Support](/guides/community-and-resources/support-and-help/support) - Get help from the env zero support team.
