GithubHelp home page GithubHelp logo

jakubjedelsky / terraform-provider-rootly Goto Github PK

View Code? Open in Web Editor NEW

This project forked from rootlyhq/terraform-provider-rootly

0.0 1.0 0.0 1.54 MB

Terraform provider for Rootly.

Home Page: https://registry.terraform.io/providers/rootlyhq/rootly

License: Mozilla Public License 2.0

JavaScript 4.62% Go 95.21% Makefile 0.17%

terraform-provider-rootly's Introduction

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.

terraform-provider-rootly's People

Contributors

alexmingoia avatar dependabot[bot] avatar kwent avatar ninir avatar weihanli101 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.