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

> Query existing DevHelm resources with Terraform data sources

Data sources let you reference existing DevHelm resources — monitors, tags, environments, alert channels, resource groups, status pages, and catalog services — in your Terraform configuration without managing their lifecycle.

## Available data sources

| Data source              | Lookup key       | Returns                                                                                            |
| ------------------------ | ---------------- | -------------------------------------------------------------------------------------------------- |
| `devhelm_tag`            | `name`           | `id`, `color`                                                                                      |
| `devhelm_environment`    | `slug`           | `id`, `name`, `is_default`                                                                         |
| `devhelm_alert_channel`  | `name`           | `id`, `channel_type`                                                                               |
| `devhelm_monitor`        | `name`           | `id`, `type`, `frequency_seconds`, `enabled`, `config`, `ping_url`                                 |
| `devhelm_resource_group` | `name`           | `id`, `slug`, `description`                                                                        |
| `devhelm_service`        | `slug` (or UUID) | `id`, `name`, `category`, `official_status_url`, `overall_status`, `component_count`, `uptime_30d` |
| `devhelm_status_page`    | `slug`           | `id`, `name`, `description`, `visibility`, `enabled`, `incident_mode`, `page_url`                  |

<Note>
  Name-keyed lookups (`devhelm_tag`, `devhelm_alert_channel`,
  `devhelm_monitor`, `devhelm_resource_group`) fail with an ambiguity error if
  multiple resources share the name — names are not unique within an org.
</Note>

## devhelm\_tag

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

output "tag_id" {
  value = data.devhelm_tag.production.id
}
```

## devhelm\_environment

```hcl theme={null}
data "devhelm_environment" "staging" {
  slug = "staging"
}

resource "devhelm_monitor" "api" {
  environment_id = data.devhelm_environment.staging.id
  # ...
}
```

## devhelm\_alert\_channel

```hcl theme={null}
data "devhelm_alert_channel" "slack" {
  name = "Slack Alerts"
}

resource "devhelm_monitor" "api" {
  alert_channel_ids = [data.devhelm_alert_channel.slack.id]
  # ...
}
```

## devhelm\_monitor

```hcl theme={null}
data "devhelm_monitor" "api_health" {
  name = "API Health"
}

output "api_monitor_type" {
  value = data.devhelm_monitor.api_health.type
}
```

## devhelm\_resource\_group

```hcl theme={null}
data "devhelm_resource_group" "payments" {
  name = "Payment Service"
}

output "group_slug" {
  value = data.devhelm_resource_group.payments.slug
}
```

## devhelm\_service

Look up a third-party service in the DevHelm status-data catalog. Use the resulting `id` in notification-policy `service_id_in` match rules, or to validate a slug before creating a `devhelm_dependency`:

```hcl theme={null}
data "devhelm_service" "stripe" {
  slug = "stripe"
}

output "stripe_status" {
  value = data.devhelm_service.stripe.overall_status
}
```

## devhelm\_status\_page

```hcl theme={null}
data "devhelm_status_page" "public" {
  slug = "acme-status"
}

output "status_page_url" {
  value = data.devhelm_status_page.public.page_url
}
```

## When to use data sources

Use data sources when:

* A resource is managed outside Terraform (e.g., via the dashboard or YAML config) but you need its ID
* You want to reference shared resources (tags, environments) without importing them into state
* Cross-module references need resource IDs from a different Terraform module

## Next steps

<CardGroup cols={2}>
  <Card title="Importing" icon="download" href="/mac/terraform/importing">
    Import existing resources into Terraform state.
  </Card>

  <Card title="Monitors" icon="signal" href="/mac/terraform/monitors">
    Create monitors that reference data sources.
  </Card>
</CardGroup>
