Skip to main content
Data sources let you reference existing DevHelm resources — monitors, tags, environments, alert channels, and resource groups — in your Terraform configuration without managing their lifecycle.

Available data sources

Data sourceLookup keyReturns
devhelm_tagnameid, color
devhelm_environmentslugid, name, is_default
devhelm_alert_channelnameid, channel_type
devhelm_monitornameid, type, frequency_seconds, enabled, config, ping_url
devhelm_resource_groupnameid, slug, description

devhelm_tag

data "devhelm_tag" "production" {
  name = "production"
}

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

devhelm_environment

data "devhelm_environment" "staging" {
  slug = "staging"
}

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

devhelm_alert_channel

data "devhelm_alert_channel" "slack" {
  name = "Slack Alerts"
}

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

devhelm_monitor

data "devhelm_monitor" "api_health" {
  name = "API Health"
}

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

devhelm_resource_group

data "devhelm_resource_group" "payments" {
  name = "Payment Service"
}

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

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

Importing

Import existing resources into Terraform state.

Monitors

Create monitors that reference data sources.