terraform-provider-rootly

command module
v0.1.80 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 3, 2023 License: MPL-2.0 Imports: 6 Imported by: 0

README

Rootly Provider

The Rootly provider is used to interact with the resources supported by Rootly. The provider needs to be configured with the proper credentials before it can be used. It requires terraform 0.14 or later.

Schema

Optional

Example Usage

Provider

terraform {
  required_providers {
    rootly = {
      source = "rootlyhq/rootly"
    }
  }
}

provider "rootly" {
  # We recommend using the `ROOTLY_API_TOKEN` env var to set the API Token
  # when interacting with Rootly's API.
  # api_token = var.rootly_api_key
}

Data sources

# uses output of severity data source as input for workflow
data "rootly_severity" "critical" {
  slug = "sev0"
}

resource "rootly_workflow_incident" "ping_oncall" {
  name        = "Ping on-call when critical incident"
  description = "ping on-call when critical incident happens"
  trigger_params {
    triggers                  = ["incident_created"]
    incident_condition_kind   = "IS"
    incident_kinds            = ["normal"]
    incident_condition_status = "IS"
    incident_statuses         = ["started"]
    severity_ids              = [data.rootly_severity.critical.id]
  }
  enabled = true
}

resource "rootly_workflow_task_send_sms" "sms_oncall" {
  workflow_id = rootly_workflow_incident.ping_oncall.id
  task_params {
    name          = "On-call team"
    phone_numbers = ["+11231231234"]
    content       = "Critical incident started"
  }
}

Custom form fields

# Custom form Fields
resource "rootly_form_field" "regions_affected" {
  name       = "Regions affected"
  kind       = "custom"
  input_kind = "multi_select"
  shown      = ["web_new_incident_form", "web_update_incident_form"]
  required   = ["web_new_incident_form", "web_update_incident_form"]
}

resource "rootly_form_field_option" "asia" {
  form_field_id = rootly_form_field.regions_affected.id
  value         = "Asia"
}

resource "rootly_form_field_option" "europe" {
  form_field_id = rootly_form_field.regions_affected.id
  value         = "Europe"
}

resource "rootly_form_field_option" "north_america" {
  form_field_id = rootly_form_field.regions_affected.id
  value         = "North America"
}

Workflows

# Jira workflow
resource "rootly_workflow_incident" "jira" {
  name        = "Create a Jira Issue"
  description = "Open Jira ticket whenever incident starts"
  trigger_params {
    triggers                  = ["incident_created"]
    incident_condition_kind   = "IS"
    incident_kinds            = ["normal"]
    incident_condition_status = "IS"
    incident_statuses         = ["started"]
  }
  enabled = true
}

resource "rootly_workflow_task_create_jira_issue" "jira" {
  workflow_id = rootly_workflow_incident.jira.id
  task_params {
    title       = "{{ incident.title }}"
    description = "{{ incident.summary }}"
    project_key = "ROOT"
    issue_type = {
      id   = "10001"
      name = "Task"
    }
    status = {
      id   = "10000"
      name = "To Do"
    }
    labels = "{{ incident.environment_slugs | concat: incident.service_slugs | concat: incident.functionality_slugs | concat: incident.group_slugs | join: \",\" }}"
  }
}

Dashboards

resource "rootly_dashboard" "overview" {
  name = "my_dashboard"
}

resource "rootly_dashboard_panel" "incidents_by_severity" {
  dashboard_id = rootly_dashboard.foo.id
  name         = "test"
  params {
    display = "line_chart"
    datasets {
      collection = "incidents"
      filter {
        operation = "and"
        rules {
          operation = "and"
          condition = "="
          key       = "status"
          value     = "started"
        }
      }
      group_by = "severity"
      aggregate {
        cumulative = false
        key        = "results"
        operation  = "count"
      }
    }
  }
}

Development

make build auto-generates code from Swagger, compiles provider, and regenerates docs.

Exclude API resources from the provider by adding them to the excluded list in tools/generate.js.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
Package rootly provides primitives to interact with the openapi HTTP API.
Package rootly provides primitives to interact with the openapi HTTP API.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL