Coder Social home page Coder Social logo

rootlyhq / terraformer Goto Github PK

View Code? Open in Web Editor NEW

This project forked from googlecloudplatform/terraformer

0.0 0.0 0.0 71.13 MB

CLI tool to generate terraform files from Rootly

License: Apache License 2.0

Go 98.67% HCL 0.80% JavaScript 0.52% Makefile 0.01%

terraformer's Introduction

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.

terraformer's People

Contributors

sergeylanzman avatar meshuga avatar dependabot[bot] avatar skarimo avatar aqche avatar chenrui333 avatar alexmingoia avatar ghost---shadow avatar juno-yu avatar ktogo avatar rotemavni avatar yukirii avatar anilkumarnagaraj avatar sunil29feb avatar cucxabong avatar jmarhee avatar teraken0509 avatar juarezr avatar magodo avatar starptech avatar ddelnano avatar trois-six avatar t0rr3sp3dr0 avatar pratikmallya avatar noinarisak avatar okazu-dm avatar therve avatar rgreinho avatar reinoudk avatar mcbenjemaa avatar

terraformer's Issues

`provider.tf` is incorrectly generated causing failure to initialize terraform.

Terraform Version

1.5.7

Expected Behavior

terraformer rootly generates proper provider.tf files. For example:

terraform {
  required_version = ">= 0.13.1"
  
  required_providers {
    rootly = {
      source = "rootlyhq/rootly"
      version = "1.2.17"
    }
  }
}

provider "rootly" {
  # Configuration options
}

Actual Behavior

You will encounter this error when you initialize the any workspace generated by terraformer

$ terraform init

Initializing the backend...
╷
│ Error: Invalid legacy provider address
│
│ This configuration or its associated state refers to the unqualified provider "rootly".
│
│ You must complete the Terraform 0.13 upgrade process before upgrading to later versions.
╵

This is the file that is generated:

terraform {
	required_providers {
		rootly = {
	    version = "~> 1.2.17"
		}
  }
}

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:
Run Rootly terraformer and look at the resulting providers.tf generated.

Important Factoids

The work around is to first generate the terraform with terraformer, then manually update the providers.tf and then update the state with:

$ terraform state replace-provider -auto-approve "registry.terraform.io/-/rootly" "rootlyhq/rootly"
Terraform will perform the following actions:

  ~ Updating provider:
    - registry.terraform.io/-/rootly
    + registry.terraform.io/rootlyhq/rootly

Changing 432 resources:
...

Error: Insufficient task_params blocks when generating workflows

Terraform Version

Run terraform -v to show the version. If you are not running the latest version of Terraform, please upgrade because your issue may have already been fixed.

Affected Resource(s)

Please list the resources as a list, for example:

  • rootly_workflow_task_create_google_meeting
  • rootly_workflow_task_create_zoom_meeting
  • rootly_workflow_task_page_pagerduty_on_call_responders
  • rootly_workflow_task_update_pagerduty_incident

there are probably more resource that are impacted but we just are not using in rootly.

Expected Behavior

Terraform generates valid resources declarations when specifying the workflow resource.

Actual Behavior

running terraform plan results in the follow errors:

╷
│ Error: Insufficient task_params blocks
│
│   on workflow_task_create_google_meeting.tf line 1, in resource "rootly_workflow_task_create_google_meeting" "tfer--xxx":
│    1: resource "rootly_workflow_task_create_google_meeting" "tfer--xxx" {
│
│ At least 1 "task_params" blocks are required.
╵
╷
│ Error: Insufficient task_params blocks
│
│   on workflow_task_create_zoom_meeting.tf line 1, in resource "rootly_workflow_task_create_zoom_meeting" "xxx":
│    1: resource "rootly_workflow_task_create_zoom_meeting" "xxx" {
│
│ At least 1 "task_params" blocks are required.
╵
╷
│ Error: Insufficient task_params blocks
│
│   on workflow_task_create_zoom_meeting.tf line 9, in resource "rootly_workflow_task_create_zoom_meeting" "xxx":
│    9: resource "rootly_workflow_task_create_zoom_meeting" "xxx" {
│
│ At least 1 "task_params" blocks are required.
╵
╷
│ Error: Insufficient task_params blocks
│
│   on workflow_task_create_zoom_meeting.tf line 17, in resource "rootly_workflow_task_create_zoom_meeting" "xxx":
│   17: resource "rootly_workflow_task_create_zoom_meeting" "xxx" {
│
│ At least 1 "task_params" blocks are required.
╵
╷
│ Error: Insufficient task_params blocks
│
│   on workflow_task_create_zoom_meeting.tf line 25, in resource "rootly_workflow_task_create_zoom_meeting" "xxx":
│   25: resource "rootly_workflow_task_create_zoom_meeting" "xxx" {
│
│ At least 1 "task_params" blocks are required.
╵
╷
│ Error: Insufficient task_params blocks
│
│   on workflow_task_create_zoom_meeting.tf line 33, in resource "rootly_workflow_task_create_zoom_meeting" "xxx":
│   33: resource "rootly_workflow_task_create_zoom_meeting" "xxx" {
│
│ At least 1 "task_params" blocks are required.
╵
╷
│ Error: Insufficient task_params blocks
│
│   on workflow_task_create_zoom_meeting.tf line 41, in resource "rootly_workflow_task_create_zoom_meeting" "tfer--xxx":
│   41: resource "rootly_workflow_task_create_zoom_meeting" "tfer--xxx" {
│
│ At least 1 "task_params" blocks are required.
╵
╷
│ Error: Insufficient task_params blocks
│
│   on workflow_task_create_zoom_meeting.tf line 49, in resource "rootly_workflow_task_create_zoom_meeting" "tfer--xxx":
│   49: resource "rootly_workflow_task_create_zoom_meeting" "tfer--xxx" {
│
│ At least 1 "task_params" blocks are required.
╵
╷
│ Error: Insufficient task_params blocks
│
│   on workflow_task_create_zoom_meeting.tf line 57, in resource "rootly_workflow_task_create_zoom_meeting" "tfer--xxx":
│   57: resource "rootly_workflow_task_create_zoom_meeting" "tfer--xxx" {
│
│ At least 1 "task_params" blocks are required.
╵
╷
│ Error: Insufficient task_params blocks
│
│   on workflow_task_create_zoom_meeting.tf line 65, in resource "rootly_workflow_task_create_zoom_meeting" "tfer--xxx":
│   65: resource "rootly_workflow_task_create_zoom_meeting" "tfer--xxx" {
│
│ At least 1 "task_params" blocks are required.
╵
╷
│ Error: Insufficient task_params blocks
│
│   on workflow_task_create_zoom_meeting.tf line 73, in resource "rootly_workflow_task_create_zoom_meeting" "tfer--xxx":
│   73: resource "rootly_workflow_task_create_zoom_meeting" "tfer--xxx" {
│
│ At least 1 "task_params" blocks are required.
╵
╷
│ Error: Insufficient task_params blocks
│
│   on workflow_task_create_zoom_meeting.tf line 81, in resource "rootly_workflow_task_create_zoom_meeting" "tfer--xxx":
│   81: resource "rootly_workflow_task_create_zoom_meeting" "tfer--xxx" {
│
│ At least 1 "task_params" blocks are required.
╵
╷
│ Error: Insufficient task_params blocks
│
│   on workflow_task_page_pagerduty_on_call_responders.tf line 1, in resource "rootly_workflow_task_page_pagerduty_on_call_responders" "xxx":
│    1: resource "rootly_workflow_task_page_pagerduty_on_call_responders" "xxx" {
│
│ At least 1 "task_params" blocks are required.
╵
╷
│ Error: Insufficient task_params blocks
│
│   on workflow_task_page_pagerduty_on_call_responders.tf line 9, in resource "rootly_workflow_task_page_pagerduty_on_call_responders" "xxx":
│    9: resource "rootly_workflow_task_page_pagerduty_on_call_responders" "xxx" {
│
│ At least 1 "task_params" blocks are required.
╵
╷
│ Error: Insufficient task_params blocks
│
│   on workflow_task_page_pagerduty_on_call_responders.tf line 17, in resource "rootly_workflow_task_page_pagerduty_on_call_responders" "xxx":
│   17: resource "rootly_workflow_task_page_pagerduty_on_call_responders" "xxx" {
│
│ At least 1 "task_params" blocks are required.
╵
╷
│ Error: Insufficient task_params blocks
│
│   on workflow_task_page_pagerduty_on_call_responders.tf line 25, in resource "rootly_workflow_task_page_pagerduty_on_call_responders" "tfer--xxx":
│   25: resource "rootly_workflow_task_page_pagerduty_on_call_responders" "tfer--xxx" {
│
│ At least 1 "task_params" blocks are required.
╵
╷
│ Error: Insufficient task_params blocks
│
│   on workflow_task_page_pagerduty_on_call_responders.tf line 33, in resource "rootly_workflow_task_page_pagerduty_on_call_responders" "tfer--xxx":
│   33: resource "rootly_workflow_task_page_pagerduty_on_call_responders" "tfer--xxx" {
│
│ At least 1 "task_params" blocks are required.
╵
╷
│ Error: Insufficient task_params blocks
│
│   on workflow_task_page_pagerduty_on_call_responders.tf line 41, in resource "rootly_workflow_task_page_pagerduty_on_call_responders" "tfer--xxx":
│   41: resource "rootly_workflow_task_page_pagerduty_on_call_responders" "tfer--xxx" {
│
│ At least 1 "task_params" blocks are required.
╵
╷
│ Error: Insufficient task_params blocks
│
│   on workflow_task_page_pagerduty_on_call_responders.tf line 49, in resource "rootly_workflow_task_page_pagerduty_on_call_responders" "tfer--xxx":
│   49: resource "rootly_workflow_task_page_pagerduty_on_call_responders" "tfer--xxx" {
│
│ At least 1 "task_params" blocks are required.
╵
╷
│ Error: Insufficient task_params blocks
│
│   on workflow_task_page_pagerduty_on_call_responders.tf line 57, in resource "rootly_workflow_task_page_pagerduty_on_call_responders" "tfer--xxx":
│   57: resource "rootly_workflow_task_page_pagerduty_on_call_responders" "tfer--xxx" {
│
│ At least 1 "task_params" blocks are required.
╵
╷
│ Error: Insufficient task_params blocks
│
│   on workflow_task_page_pagerduty_on_call_responders.tf line 65, in resource "rootly_workflow_task_page_pagerduty_on_call_responders" "tfer--xxx":
│   65: resource "rootly_workflow_task_page_pagerduty_on_call_responders" "tfer--xxx" {
│
│ At least 1 "task_params" blocks are required.
╵
╷
│ Error: Insufficient task_params blocks
│
│   on workflow_task_page_pagerduty_on_call_responders.tf line 73, in resource "rootly_workflow_task_page_pagerduty_on_call_responders" "tfer--xxx":
│   73: resource "rootly_workflow_task_page_pagerduty_on_call_responders" "tfer--xxx" {
│
│ At least 1 "task_params" blocks are required.
╵
╷
│ Error: Insufficient task_params blocks
│
│   on workflow_task_page_pagerduty_on_call_responders.tf line 81, in resource "rootly_workflow_task_page_pagerduty_on_call_responders" "tfer--xxx":
│   81: resource "rootly_workflow_task_page_pagerduty_on_call_responders" "tfer--xxx" {
│
│ At least 1 "task_params" blocks are required.
╵
╷
│ Error: Insufficient task_params blocks
│
│   on workflow_task_page_pagerduty_on_call_responders.tf line 89, in resource "rootly_workflow_task_page_pagerduty_on_call_responders" "tfer--xxx":
│   89: resource "rootly_workflow_task_page_pagerduty_on_call_responders" "tfer--xxx" {
│
│ At least 1 "task_params" blocks are required.
╵
╷
│ Error: Insufficient task_params blocks
│
│   on workflow_task_update_pagerduty_incident.tf line 1, in resource "rootly_workflow_task_update_pagerduty_incident" "tfer--xxx":
│    1: resource "rootly_workflow_task_update_pagerduty_incident" "tfer--xxx" {
│
│ At least 1 "task_params" blocks are required.

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. terraformer-rootly import rootly --resources="workflow" --token $ROOTLY_API_TOKEN
  2. terraform init
  3. terraform plan

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.