Handle Terraform Cloud infrastructure requests automatically with Tines

Last updated on

Written by Shaun Finn Solutions Engineer, Tines

Tines is pleased to have joined the Terraform Cloud Run Tasks ecosystem. Tines helps DevOps teams better leverage the generally available Terraform Cloud run tasks pre-plan by enabling them to approve and record infrastructure requests from Terraform Cloud automatically.

There are two steps to activating this connection: 

  1. Create a new run task

  2. Start the run

Creating a run task in Terraform Cloud using Tines 

Run tasks are the configuration options in Terraform Cloud and are the first step to using Terraform Cloud and Tines together. To create a run task for Tines within Terraform Cloud, navigate to your Run Tasks via your Workspace Settings in Terraform Cloud.

Terraform Cloud run tasks

Insert a name, description, and endpoint URL for the new run task. 

Terraform Cloud run tasks

To start, you’ll need an endpoint URL from an existing or new Story in Tines. Drag-and-drop a Webhook Action onto the Storyboard and within the Tines Builder, copy the webhook URL from the Action. Then navigate back to Terraform Cloud. 

Tines Storyboard

Paste the webhook URL from Tines into the endpoint URL field of the Create Run Task block in Terraform Cloud as seen in the image below.  

Terraform Cloud run tasks

Next, click Create run task. Now that it has been created, associate the run task by clicking the ⊕ symbol beside it in the Available Run Tasks block.

Terraform Cloud

This example leverages the pre-plan run stage as well as a mandatory enforcement level. Select these options in the Run Stage and Enforcement Level section, then click Create

Terraform Cloud

Once the association has been created, Terraform Cloud will send an example JSON payload to the Tines Webhook Action to validate the communication. Navigate to your Tines Story and review the Webhook Action’s events to confirm the data has been received. 

Tines events

Now that a connection is established, when a run task is executed within the configured Terraform Cloud Workspace, Tines will receive a webhook notification containing all of the details. A run task can be executed from API, CLI, or Terraform Cloud UI. 

Using the run task 

Now that you’ve created a run task using Tines in Terraform Cloud, you can start a RUN using this task following the below steps. 

Terraform Cloud

If Start a new run is leveraged from the Terraform Cloud UI, the run can be named. 

Terraform Cloud

When the pre-plan process begins, Terraform Cloud will update the user to let them know it’s waiting for a response from the Tines run task that was previously configured. 

Terraform Cloud

Discover new efficiencies with Terraform Cloud and Tines 

Leveraging this example Story in the Tines Story Library, Tines can receive the notification and record the information in a ticketing platform, e.g. Jira.

Loading story...

Tines can also send an instant message requesting approval, or place the approval request within the ticket, for a user to approve or deny the request.

Example instant message from Tines

Based on the response selected, Tines will contact Terraform Cloud and approve or decline the Terraform Cloud run. If a run is approved, Tines will gather additional information to enhance tickets with the detailed context of the Terraform Cloud run process, including Terraforms cost estimation and any outputs the Terraform configuration may have.

Visit the Tines Story Library to discover, use, and customize pre-built automation workflows for Terraform Cloud and more. To get started with Tines, sign up for the always-free, full-featured Community Edition here.

Built by you, powered by Tines

Talk to one of our experts to learn the unique ways your business can leverage Tines.