Export to Terraform

Export any ilert resource as Terraform HCL code directly from the web UI to adopt Infrastructure-as-Code practices incrementally.

ilert lets you export individual resources as ready-to-use Terraform (HCL) configuration blocks directly from the web application. This makes it easy to transition from UI-managed resources to Infrastructure-as-Code without having to write Terraform definitions from scratch.

Overview

The Export to Terraform feature is available on resource detail pages (e.g., alert sources and escalation policies). It generates a valid HCL resource block that maps to the ilert Terraform providerarrow-up-right, so you can copy the output into your .tf files and start managing the resource with Terraform right away.

Key capabilities:

  • One-click export — generate a complete Terraform resource definition for any supported ilert resource.

  • Import command — get the matching terraform import command so you can link the existing resource to your Terraform state without creating a duplicate.

  • Copy to clipboard — quickly copy the HCL block or import command with a single click.

  • Syntax-highlighted preview — review the generated code in a readable, syntax-highlighted modal before copying.

How to export a resource

  1. Navigate to the detail page of the resource you want to export (for example, Alert sources → <your alert source>).

  2. Click the Export to Terraform button in the top-right action bar.

  3. A modal opens with two sections:

    Resource definition — the generated HCL block that you can add to your .tf configuration file. For example:

    resource "ilert_alert_source" "prometheus" {
      integration_type  = "PROMETHEUS"
      name              = "Prometheus"
      alert_creation    = "INTELLIGENT_GROUPING"
      escalation_policy = "2207280"
      active            = true
      team {
        id   = 1
        name = "SRE Team"
      }
      alert_grouping_window = "PT5M"
      alert_priority_rule   = "LOW"
    }

    Import existing resource — a terraform import command that links the already existing ilert resource to your Terraform state. Running this before terraform apply prevents Terraform from creating a duplicate:

    terraform import ilert_alert_source.prometheus 2194927

    After importing, run terraform plan to verify there is no configuration drift between the definition and the live resource.

  4. Use the copy button next to each section to copy the content to your clipboard.

Typical workflow

A common workflow for adopting Terraform for an existing ilert setup looks like this:

  1. Export — open the resource in ilert and click Export to Terraform to get the HCL block.

  2. Add to your repository — paste the HCL block into a .tf file in your Infrastructure-as-Code repository.

  3. Import state — run the provided terraform import command to tell Terraform that this resource already exists.

  4. Verify — run terraform plan to confirm there is no drift. If the plan shows changes, adjust the .tf file until the plan is clean.

  5. Manage with Terraform — from now on, use terraform apply to make changes to the resource.

circle-info

You can adopt Terraform incrementally — export and import resources one by one at your own pace. There is no need to migrate everything at once.

Supported resources

Export to Terraform is available for almost all resources, except for Call flows, Event flows, and Status pages. Support for additional resource types is being rolled out progressively.

circle-info

The generated HCL maps to the resource types defined in the ilert Terraform providerarrow-up-right. Make sure you have the provider configured in your Terraform project. For provider setup instructions, see the Terraform overview.

Sensitive fields

Sensitive values such as integration keys or API tokens are not included in the exported HCL. You will need to supply these values separately, for example through Terraform variables or a secrets manager.

FAQ

Does Export to Terraform change anything in my ilert account?

No. The export is read-only — it generates code for you to copy but does not modify the resource or its state in ilert.

What happens if I skip the terraform import step?

If you run terraform apply without importing first, Terraform will attempt to create a new resource instead of managing the existing one, resulting in a duplicate.

Can I export multiple resources at once?

Bulk export is not yet supported. You can export resources one at a time from their respective detail pages.

Which Terraform provider version do I need?

Use the latest version of the ilert Terraform providerarrow-up-right to ensure all exported attributes are supported.

Where can I learn more about using the ilert Terraform provider?

See the Terraform overview for provider configuration and examples, and the guide on importing existing resources into Terraform state for a detailed walkthrough.

Last updated

Was this helpful?