/terraform-provider-octopusdeploy

An Octopus Deploy Terraform Provider

Primary LanguageGoMozilla Public License 2.0MPL-2.0

terraform-provider-octopusdeploy

Run integration tests against Octopus in a Docker container

A Terraform provider for Octopus Deploy.

It is based on the go-octopusdeploy Octopus Deploy client SDK.

Testing

A GitHub action has been added to this project which initializes an instance of Octopus Deploy and runs the tests against it. These same tests can be run in a forked repository.

Downloading & Installing

As this provider is still under development, you will need to manually download it.

There are compiled binaries for most platforms in Releases.

To use it, extract the binary for your platform into the same folder as your .tf file(s) will be located, then run terraform init.

Configure the Provider

Default Space

# main.tf

provider "octopusdeploy" {
  address = "http://octopus.production.yolo"
  apikey  = "API-XXXXXXXXXXXXX"
}

Scoped to a single Space

Simply provide the name of the space (not the space ID)

Note: System level resources such as Teams are not support on a Space-scoped provider.

# main.tf

provider "octopusdeploy" {
  address = "http://octopus.production.yolo"
  apikey  = "API-XXXXXXXXXXXXX"
  space   = "Support" // The name of the space
}

Multiple spaces

To manage resources in multiple spaces you currently must use multiple instances of the provider with aliases like so:

# main.tf

provider "octopusdeploy" {
  address = "http://octopus.production.yolo"
  apikey  = "API-XXXXXXXXXXXXX"
}

provider "octopusdeploy" {
  alias   = "space_support"

  address = "http://octopus.production.yolo"
  apikey  = "API-XXXXXXXXXXXXX"
  space   = "Support" // The name of the space
}

provider "octopusdeploy" {
  alias   = "space_product1"

  address = "http://octopus.production.yolo"
  apikey  = "API-XXXXXXXXXXXXX"
  space   = "Product1" // The name of another space
}

// This resource will use the default provider and the default space
resource "octopusdeploy_environment" "Env1" {
  name = "TestEnv1"
}

// This resource will use the provicder aliased as "space_1" which is scoped to "Space-1"
resource "octopusdeploy_environment" "Env2" {
  provider = "octopusdeploy.space_support"
  name     = "TestEnv2"
}

// This resource will use the provider aliased as "space_33" which is scoped to "Space-33"
resource "octopusdeploy_environment" "Env3" {
  provider = "octopusdeploy.space_product1"
  name     = "TestEnv3"
}

Data Sources

Provider Resources