Skip to main content

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.

Import resources created in the dashboard or via the CLI into Terraform management without recreating them.

Import syntax

terraform import <resource_type>.<name> "<import_id>"

Import IDs by resource

Each resource type uses a different identifier for import:
ResourceImport IDExample
devhelm_monitorMonitor nameterraform import devhelm_monitor.api "API Health"
devhelm_alert_channelChannel nameterraform import devhelm_alert_channel.slack "Slack Alerts"
devhelm_tagTag nameterraform import devhelm_tag.prod "production"
devhelm_environmentEnvironment slugterraform import devhelm_environment.staging "staging"
devhelm_secretSecret keyterraform import devhelm_secret.token "API_TOKEN"
devhelm_webhookWebhook URLterraform import devhelm_webhook.events "https://hooks.example.com/devhelm"
devhelm_resource_groupGroup nameterraform import devhelm_resource_group.payments "Payment Service"
devhelm_dependencyService slugterraform import devhelm_dependency.github "github"

Step-by-step

1. Write the resource block

Before importing, create the Terraform resource block that matches the existing resource:
resource "devhelm_monitor" "api_health" {
  name              = "API Health"
  type              = "HTTP"
  frequency_seconds = 60
  regions           = ["us-east"]

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

2. Run import

terraform import devhelm_monitor.api_health "API Health"

3. Run plan

Verify the imported state matches your configuration:
terraform plan
If the plan shows changes, adjust your HCL to match the existing resource’s configuration.

Bulk import

For importing many resources, use a shell loop:
for name in "API Health" "Marketing Site" "Database Port"; do
  terraform import "devhelm_monitor.$(echo $name | tr ' ' '_' | tr '[:upper:]' '[:lower:]')" "$name"
done

Secrets import

Imported secrets set a placeholder value since secret values are write-only. After import, update the value attribute to the actual secret:
resource "devhelm_secret" "api_token" {
  key   = "API_TOKEN"
  value = var.api_token
}
terraform import devhelm_secret.api_token "API_TOKEN"

Next steps

Terraform in CI/CD

Automate plan and apply in CI pipelines.

Data sources

Reference resources without importing them.