Skip to content
  • There are no suggestions because the search field is empty.

Terraform provider overview

Manage AlertOps as code with the official Terraform provider.

The AlertOps Terraform provider manages your AlertOps account as code: users, groups, on-call schedules, escalation policies, response plays, workflows, integrations, services, topics and maintenance windows. It is published on the Terraform Registry as alertopsofficial/alertops (version 2.1) and maintained by AlertOps.

Requirements

  • Terraform 1.0 or later
  • An AlertOps account with API access and a V2 API key (see Authentication)

Install the provider

terraform {
  required_providers {
    alertops = {
      source  = "alertopsofficial/alertops"
      version = "~> 2.1"
    }
  }
}

provider "alertops" {
  # Best practice: set via ALERTOPS_API_KEY environment variable
  # api_key = "your-api-key"
}

Authentication

The provider requires an AlertOps API key. The following methods are supported, in order of precedence:

export ALERTOPS_API_KEY="your-api-key"
terraform plan

Static credentials

provider "alertops" {
  api_key = "your-api-key"
}

Warning: Hard-coding credentials in Terraform configuration is not recommended. Use the environment variable method or a secrets manager to keep credentials out of version control.

Schema

Optional

  • api_key (String, Sensitive) AlertOps API key. Can also be set via the ALERTOPS_API_KEY environment variable.
  • base_url (String) Base URL of the AlertOps v2 API. Defaults to https://api.alertops.com/api/v2. Can also be set via ALERTOPS_BASE_URL.
  • requests_per_second (Number) Client-side request limit per second. Defaults to 5. Can also be set via ALERTOPS_REQUESTS_PER_SECOND.
  • requests_per_minute (Number) Client-side request limit per minute. Defaults to 15. Can also be set via ALERTOPS_REQUESTS_PER_MINUTE.

Rate limiting

The AlertOps v2 API allows 5 requests per second and 15 per minute per API key. The provider queues its requests to stay within these limits and retries automatically (with backoff) if the API still answers 429 Too Many Requests, so large plans succeed but can take several minutes. Raise requests_per_minute only if your account has a higher limit.

Quick start

This configuration creates a user, an on-call group, a business-hours schedule, an escalation policy and an API inbound integration that routes to the group.

resource "alertops_user" "oncall" {
  user_name  = "jsmith"
  first_name = "Jane"
  last_name  = "Smith"
  locale     = "en-US"
  time_zone  = "(UTC-05:00) Eastern Time (US & Canada)"
  type       = "Standard"
  roles      = ["App Admin"]

  contact_methods = [
    {
      contact_method_name   = "Email-Official"
      email_address         = "jsmith@example.com"
      notification_time24x7 = true
      enabled               = true
      sequence              = 1
    }
  ]
}

# Create an on-call group
resource "alertops_group" "ops_team" {
  group_name = "ops-team"

  members = [
    {
      member_type = "User"
      member      = alertops_user.oncall.user_name
      sequence    = 1
      roles       = ["Primary"]
    }
  ]
}

# Create a schedule
resource "alertops_schedule" "business_hours" {
  group         = alertops_group.ops_team.group_name
  schedule_name = "Business Hours"
  schedule_type = "Fixed"
  time_zone     = "(UTC-05:00) Eastern Time (US & Canada)"
  weekday_mon   = true
  weekday_tue   = true
  weekday_wed   = true
  weekday_thu   = true
  weekday_fri   = true
  weekday_sat   = false
  weekday_sun   = false
}

# Create an escalation policy
resource "alertops_escalation_policy" "default" {
  escalation_policy_name = "Default Policy"
  priority               = "High"
}

# Create an API inbound integration
resource "alertops_inbound_integration" "my_app" {
  inbound_integration_name = "My Application"
  type                     = "API"
  escalation_policy        = alertops_escalation_policy.default.escalation_policy_name
  recipient_groups         = [alertops_group.ops_team.group_name]
}

Resources

ResourceWhat it manages
alertops_userManage AlertOps users with contact methods
alertops_groupManage on-call groups and their members
alertops_scheduleManage on-call schedules for a group
alertops_escalation_policyManage escalation policies and notification chains
alertops_response_playManage response plays: escalation paths of users and groups with wait times
alertops_workflowManage workflows (conditions and actions, e.g. notify on acknowledge/close)
alertops_inbound_integrationManage inbound integrations (API, Email, Heartbeat, etc.)
alertops_outbound_integrationManage outbound webhook integrations
alertops_serviceManage services with uptime tracking
alertops_maintenance_windowManage maintenance windows to suppress alerts
alertops_topicManage topics and the groups subscribed to them

Import existing resources

Every resource can be imported by its AlertOps ID, so you can bring an existing account under Terraform without recreating anything:

terraform import alertops_group.example 12345

Each resource page lists the ID it expects. On Terraform 1.5 and later, terraform plan -generate-config-out=generated.tf writes configuration for imported resources.

Upgrading from kamsrikanth/alertops

Earlier versions were published as kamsrikanth/alertops. To move to the official namespace, change source to alertopsofficial/alertops in required_providers, then run:

terraform init -upgrade
terraform state replace-provider registry.terraform.io/kamsrikanth/alertops registry.terraform.io/alertopsofficial/alertops

Behavior notes

  • Resources deleted outside Terraform are removed from state and re-created on the next apply.
  • Transient 5xx responses are retried up to 3 times for GET, PUT and DELETE. POST requests are never retried, so nothing is created twice.
  • Fields the provider does not model yet can be passed with extra_attributes where a resource supports it.