Quick start repository for creating a Terraform Cloud/Enterprise Run Task in Go
MPL-2.0 License
This repository is a template for a Terraform Cloud and/or Terraform Enterprise run task. It is intended as a starting point for creating Terraform run tasks, containing:
internal/runtask/run_task_handler
),internal/runtask/run_task_scaffolding
),These files contain boilerplate code that you will need to edit to create your own Terraform run task. Detailed documentation for run task integration can be found on the HashiCorp Developer platform.
Please see the GitHub template repository documentation for how to create a new repository from this template on GitHub.
We highly recommend using a tunneling solution like ngrok to quickly test your run task on your local machine.
Run the run task service using the Go run
command:
go run main.go
Take note of the path
, hmac
, and addr
values configured in internal/runtask/run_task_scaffolding.Configure()
path
= /runtask
, hmac
= secret123
, addr
= :22180
(Optional) If you are using a tunneling solution, run and configure it to use the same port (addr
value) that the run task service is running on.
Verify that the run task service is running by calling the /healthcheck
endpoint:
curl -v -H "Content-Type: application/json" <Service URL>/healthcheck
Follow the steps on the Hashicorp Developer platform for Creating a Run Task and Associating Run Tasks with a Workspace
path
value to the end of your service's URL, ex: http://myservice.io/runtask
hmac
valueThis run task uses Go modules. Please see the Go documentation for the most up-to-date information about using Go modules.
To add a new dependency github.com/author/dependency
to your Terraform run task:
go get github.com/author/dependency
go mod tidy
Then commit the changes to go.mod
and go.sum
.