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

# Terraform Tags

> Define DevHelm tags with the devhelm_tag Terraform resource

The `devhelm_tag` resource creates and manages tags for organizing and filtering your DevHelm resources.

## Example

```hcl theme={null}
resource "devhelm_tag" "production" {
  name  = "production"
  color = "#10b981"
}

resource "devhelm_tag" "api" {
  name  = "api"
  color = "#3b82f6"
}
```

## Arguments

| Attribute | Type   | Required | Description                                                    |
| --------- | ------ | -------- | -------------------------------------------------------------- |
| `name`    | string | Yes      | Tag name (also used as import ID)                              |
| `color`   | string | —        | Hex color code (e.g., `#10b981`). Defaults to grey if omitted. |

### Computed attributes

| Attribute | Description |
| --------- | ----------- |
| `id`      | Tag ID      |

## Using tags with monitors

Reference tag IDs when creating monitors:

```hcl theme={null}
resource "devhelm_monitor" "api_health" {
  name    = "API Health"
  type    = "HTTP"
  tag_ids = [devhelm_tag.production.id, devhelm_tag.api.id]

  config = jsonencode({
    url    = "https://api.example.com/health"
    method = "GET"
  })
}
```

## Import

```bash theme={null}
terraform import devhelm_tag.production "production"
```

Import accepts the tag **name** or its **UUID**. If multiple tags share the same name (possible on legacy tenants), the import fails with an ambiguity error — import by UUID in that case.

## Data source

Look up an existing tag by name:

```hcl theme={null}
data "devhelm_tag" "production" {
  name = "production"
}

resource "devhelm_monitor" "api_health" {
  tag_ids = [data.devhelm_tag.production.id]
  # ...
}
```

See [Data sources](/mac/terraform/data-sources) for all available data sources.

## Next steps

<CardGroup cols={2}>
  <Card title="Monitors" icon="signal" href="/mac/terraform/monitors">
    Assign tags to monitors.
  </Card>

  <Card title="Data sources" icon="database" href="/mac/terraform/data-sources">
    Look up existing tags, environments, and more.
  </Card>
</CardGroup>
