ayanich / terraform-pagerduty-example

Example repository to manage PagerDuty with Terraform and GitHub Actions, using GCS as Remote State Backend

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

terraform-pagerduty-example

Example repository to manage PagerDuty with Terraform and GitHub Actions, using GCS as Remote State Backend. This example sets up 3 users, 2 schedules and 2 integrations that are compatible with Alertmanager. This is a fairly trivial example, but allows to automate quite a lot of repetitive UI work.

Prerequisites

Setup GitHub Actions

Set GitHub secrets:

  • PAGERDUTY_TOKEN
  • GOOGLE_CREDENTIALS (Insert entire content of Service Account JSON key into the secret)

Usage

PR Creation

Terraform will run init, fmt, validate and plan. Results of the plan will be set as a comment on the PR.

Master Merge

Terraform will run init, validate and apply. Output will print integration keys if you've chaned/added any.

Managing existing PagerDuty setup via Terraform

I highly recommend playing with API Reference to understand all the moving parts of your existing setup and then importing those with terraform.

e.g. of importing an existing user:

terraform import 'pagerduty_user.user["alice"]' AL123C

About

Example repository to manage PagerDuty with Terraform and GitHub Actions, using GCS as Remote State Backend


Languages

Language:HCL 100.0%