rootlyhq / terraformer

CLI tool to generate terraform files from Rootly

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Rootly Terraformer

Generate Terraform configuration from Rootly's API. Terraform in reverse.

asciicast

Usage

1. Install

Homebrew

brew tap rootlyhq/homebrew-tap
brew install terraformer-rootly

Download

Terraform 0.13+ is required.

export ARCH=darwin-arm64 # Mac Apple silicon. For Mac Intel silicon use darwin-amd64. For Linux use linux-amd64.
curl -LO "https://github.com/rootlyhq/terraformer/releases/download/$(curl -s https://api.github.com/repos/rootlyhq/terraformer/releases/latest | grep tag_name | cut -d '"' -f 4)/terraformer-rootly-${ARCH}"
chmod +x terraformer-rootly-${ARCH}
sudo mv terraformer-rootly-${ARCH} /usr/local/bin/terraformer-rootly

2. Prepare working directory

Prepare a Terraform working directory with the Rootly provider installed.

If starting from scratch create a versions.tf file:

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

and run terraform init to initialize Terraform.

3. Import Terraform configuration

Set the ROOTLY_API_TOKEN environment variable or use --token= CLI flag when running terraformer-rootly.

Import all resources:

terraformer-rootly import rootly --resources=*

Or import specific resources:

terraformer-rootly import rootly --resources=environment,severity

See all available resources using terraformer-rootly import rootly list

Next steps

Generated .tfstate files need to be upgraded to Terraform 0.13+ format:

terraform state replace-provider -auto-approve -- -/rootly rootlyhq/rootly

Development

Upgrade Rootly API support

Run make build, commit changes, and tag with the next semantic version.

About

CLI tool to generate terraform files from Rootly

License:Apache License 2.0


Languages

Language:Go 98.7%Language:HCL 0.8%Language:JavaScript 0.5%Language:Makefile 0.0%