The Terraform Provider for Octopus Deploy is under active development. Its functionalty can and will change; it is a v0.* product until its robustness can be assured. Please be aware that types like resources can and will be modified over time. It is strongly recommended to validate
and plan
configuration prior to committing changes via apply
.
This repository contains the source code for the Terraform Provider for Octopus Deploy. It supports provisioning/configuring of Octopus Deploy instances via Terraform. Documentation and guides for using this provider are located on the Terraform Registry: Documentation.
The Terraform Provider for Octopus Deploy is available via the Terraform Registry: OctopusDeployLabs/octopusdeploy. To install this provider, copy and paste this code into your Terraform configuration:
terraform {
required_providers {
octopusdeploy = {
source = "OctopusDeployLabs/octopusdeploy"
version = "version-number" # example: 0.7.62
}
}
}
data "octopusdeploy_space" "space" {
provider = octopusdeploy.unscoped
name = "Development Team"
}
provider "octopusdeploy" {
# configuration options
address = "https://octopus.example.com" # (required; string) the service endpoint of the Octopus REST API
api_key = "API-XXXXXXXXXXXXX" # (required; string) the API key to use with the Octopus REST API
space_id = data.octopusdeploy_space.space.id # (optional; string) the space ID in Octopus Deploy
}
If space_id
is not specified the Terraform Provider for Octopus Deploy will assume the default space.
You can provide your Octopus Server configuration via the OCTOPUS_URL
and OCTOPUS_APIKEY
environment variables, representing your Octopus Server address and API Key, respectively.
provider "octopusdeploy" {}
Run terraform init
to initialize this provider and enable resource management.
A build of this Terraform Provider can be created using the Makefile provided in the source:
$ make
This will generate a binary that will be installed to the local plugins folder. Once installed, the provider may be used through the following configuration:
terraform {
required_providers {
octopusdeploy = {
source = "octopus.com/com/octopusdeploy"
version = "0.7.63"
}
}
}
provider "octopusdeploy" {
address = # address
api_key = # API key
space_id = # space ID
}
After the provider has been built and saved to the local plugins folder, it may be used after initialization:
$ terraform init
Terraform will scan the local plugins folder directory structure (first) to qualify the source name provided in your Terraform configuration. If it can resolve this name then the local copy will be initialized for use with Terraform. Otherwise, it will scan the Terraform Registry.
version
number specified in your Terraform configuration MUST match the version number specified in the Makefile. Futhermore, this version MUST either be incremented for each local re-build; otherwise, Terraform will use the cached version of the provider in the .terraform
folder. Alternatively, you can simply delete the folder and re-run the terraform init
command.
Documentation is auto-generated by the tfplugindocs CLI. To generate the documentation, run the following command:
$ make docs
Contributions are welcome! ❤️ Please read our Contributing Guide for information about how to get involved in this project.