Giter Club home page Giter Club logo

terraform-octopus's Introduction

terraform-octopus

A plugin for Terraform to control / integrate with Octopus Deploy.

This is a work in progress. More providers and data-sources are planned, as well as a Provisioner to install the Octopus tentacle.

Tested against Octopus Deploy v3.3.17.

The following resource types are currently supported:

  • octopus_environment: Creates and manages an Octopus Deploy environment
  • octopus_variable: Creates and manages an Octopus Deploy variable (currently only project-level variables are supported)

Note that variables are matched on both name and combined scopes (Environments, Roles, Machines, Actions). If a variable already exists with the specified name and scopes, the provider will start managing the existing variable.

The following data-source types are currently supported:

  • octopus_environment: Tracks an existing Octopus Deploy environment
  • octopus_machine: Tracks an existing Octopus Deploy machine
  • octopus_project: Tracks an existing Octopus Deploy project
  • octopus_variable: Tracks an existing Octopus Deploy variable (currently only project-level variables are supported)

Data-sources are similar to variables, except they are read-only. The provider will read and track their state but never modify it.

To get started:

  • On windows, create / update $HOME\terraform.rc
  • On Linux / OSX, create / update ~/.terraformrc

And add the following contents:

providers {
	octopus = "path-to-the-folder/containing/terraform-provider-octopus"
}

Create a folder containing a single .tf file:

#
# This configuration will create an Octopus environment called "MyEnvironment" and configure a project-level variable named "MyVariable" to be scoped to it.
#

provider "octopus" {
	server_url   = "https://my-octopus-server/"
	api_key      = "my-octopus-api-key"
}

# Projects are a data source - the provider can read from them but not create or manage them.
data "octopus_project" "my_project" {
	slug         = "terraformtest" # The last segment of the URL in the browser when viewing the project home page.
}

data "octopus_machine" "my_machine" {
	slug         = "Machines-351" # The last segment of the URL in the browser when viewing the machine details home page.
}

resource "octopus_environment" "my_environment" {
	name         = "MyEnvironment"
}

resource "octopus_variable" "my_variable" {
	# This is the Id (or slug) of the project in which the variable is defined.
	project      = "${data.octopus_project.my_project.id}"

	name         = "MyVariable"
	value        = "Hello World"

	# The scopes (environment, role, machine, action) to which the variable applies.
	environments = ["${octopus_environment.my_environment.id}"]
}
  1. Run terraform plan -out tf.plan.
  2. Verify that everything looks ok.
  3. Run terraform apply tf.plan
  4. Have a look around and
  5. Run terraform show to inspect the current state.
  6. when it's time to clean up...
  7. Run terraform plan -destroy -out tf.plan
  8. Verify that everything looks ok.
  9. Run terraform apply tf.plan

terraform-octopus's People

Contributors

tintoy avatar

Watchers

 avatar  avatar

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.