terraform-buildkite

command module
Version: v0.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 29, 2020 License: MIT Imports: 2 Imported by: 0

README

Terraform provider for buildkite

This allows you to manage buildkite pipelines with Terraform.

Originally forked from yougroupteam/terraform-buildkite

This provider is originally forked from saymedia/terraform-buildkite. However, since there's no maintainer from saymedia anymore we have now duplicated the repo instead to ensure contributed changes can be adopted buy the community.

See [https://github.com/saymedia/terraform-buildkite/issues/25] for details.

Installation

Run

go get github.com/yougroupteam/terraform-buildkite
go install github.com/yougroupteam/terraform-buildkite

Which gives you a terraform-provider-buildkite in $GOPATH/bin.

Add the provider to the plugin search path in your home directory (or, in CI, the home directory of whatever user runs terraform). You'll need to make sure the program conforms to the plugin naming convention noted in the Terraform documentation linked above. (eg: terraform-provider-buildkite_vX.Y.Z)

Usage

provider "buildkite" {
  # Get an API token from https://buildkite.com/user/api-access-tokens
  # Needs: read_pipelines, write_pipelines
  # Instead of embedding the API token in the .tf file,
  # it can also be passed via env variable BUILDKITE_API_TOKEN
  api_token    = "YOUR_API_TOKEN"
  # This is the part behind https://buildkite.com/, e.g. https://buildkite.com/some-org
  # Instead of embedding the org slug in the .tf file,
  # it can also be passed via env variable BUILDKITE_ORGANIZATION
  organization = "YOUR_ORG_SLUG"
}

resource "buildkite_pipeline" "terraform_test" {
  name       = "terraform-test"
  repository = "git@github.com:you/repo.git"

  step = [
    {
      type    = "script"
      name    = ":llama: Tests"
      command = "echo Hello world!"
    },
  ]
}

Importing existing pipelines

You can import existing pipeline definitions by their slug:

terraform import buildkite_pipeline.my_name my-pipeline-slug

Local development of this provider

To do local development you will most likely be working in a Github fork of the repository. After creating your fork you can add it as a remote on your local repository in GOPATH:

  • cd $GOPATH/src/github.com/yougroupteam/terraform-buildkite
  • git remote add mine git@github.com:yourname/terraform-buildkite
  • git checkout -b yourbranch
  • git push -u mine yourbranch

After this you should be able to git push to your fork, and eventually open a PR if you like.

You can build like this:

  • go install github.com/yougroupteam/terraform-buildkite/terraform-provider-buildkite

This should produce a file at $GOPATH/bin/terraform-provider-buildkite. To use this with Terraform you'll need to move that binary to the third-party plugins direcory to help Terraform find this file.

You can see debug output via TF_LOG=DEBUG terraform plan

Documentation

The Go Gopher

There is no documentation for this package.

Source Files

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL