Skip to content
A terraform provider for GorillaStack. Write your configuration as code.
Go Makefile Shell
Branch: master
Clone or download
Latest commit 80f3c6d Aug 12, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
.travis.yml attempting to add goreleaser logic Jul 10, 2019 typos Jul 10, 2019
LICENSE fixing words Jul 10, 2019
go.mod updating makefile, adding gox as dependency for package builds Jul 15, 2019
staticcheck.conf initial commit Jun 4, 2019

Terraform Provider for GorillaStack

Build Status Release Software License GitHub last commit Powered By: GorillaStack


This provider plugin is maintained by:


Install the Provider

go get -d
cd $GOPATH/src/

Using the Provider

If you are looking for some sample terraform templates to help you get started, please take a look here.

Configure the provider using a .tfvars file. Here is what your terraform.tfvars file should look like.

# Your GorillaStack API Key
api_key = "<api_key>"
# Your GorillaStack Team's Id
team_id = "<gorillastack team_id>"

We recommend adding *.tfvars as an entry in your .gitignore file if you plan to commit your templates to a repository. We do not recommend hardcoding API keys and other information in your templates.

Then, define Rule and Tag Group resources in your templates.

variable "api_key" {}
variable "team_id" {}

provider "gorillastack" {
  api_key = "${var.api_key}"
  team_id = "${var.team_id}"

resource "gorillastack_tag_group" "ec2_instance_targets" {
  name    = "EC2 Instance Targets"
  tag_expression = "i \"application\":\"crm\" and not /environment/:/production/"

resource "gorillastack_tag_group" "autoscaling_group_targets" {
  name    = "AutoScaling Group Targets"
  tag_expression = "i \"type\":\"api\" and not /environment/:/production/"

resource "gorillastack_tag_group" "rds_targets" {
  name    = "RDS Targets"
  tag_expression = "not /environment/:/production/"

resource "gorillastack_rule" "test" {
  name      = "test rules creation from terraform"
  labels    = ["terraform", "test", "local"]
  enabled   = false

  context {
    aws {
    }  # should mean all accounts all regions

  trigger {
    schedule {
      cron                = "0 0 9 1 1"
      timezone            = "Australia/Sydney"
      notification_offset = 30
      notifications {
        slack_webhook {
          room_id         = "5cfe861335112656bda2f80a"

  actions {
    delete_detached_volumes {
      index         = 1
      dry_run       = true
      tag_targeted  = false
      days_detached = 0

    stop_instances {
      index         = 2
      tag_groups    = ["${}"]

    update_autoscaling_groups {
      index         = 3
      tag_groups    = ["${}"]
      min           = 0
      max           = 0
      desired       = 0
      store_existing_asg_settings = true

    delay {
      index         = 4
      wait_duration = 10

    stop_rds_instances {
      index         = 5
      tag_groups    = ["${}"]

Upgrading the provider

The GorillaStack provider doesn't upgrade automatically once you've started using it. After a new release you can run

go get -d
cd $GOPATH/src/

to upgrade to the latest stable version of the GorillaStack provider.

Building the provider

Clone the repository. In the steps above, go get -d installs the repository to: $GOPATH/src/

$ mkdir -p $GOPATH/src/; cd $GOPATH/src/
$ git clone

Enter the provider directory and build the provider

$ cd $GOPATH/src/
$ make

Contributing/Developing the provider

If you wish to work on the provider, you'll first need Go installed on your machine (version 1.11.4+ is required). You'll also need to correctly setup a GOPATH, as well as adding $GOPATH/bin to your $PATH.

To compile the provider, run make. This will build the provider and put the provider binary in the $GOPATH/bin directory.

For guidance on common development practices such as testing changes or vendoring libraries, see the contribution guidelines. If you have other development questions we don't cover, please file an issue!

You can’t perform that action at this time.