Terraform Cloud
Terraform Cloud is used to manage cloud infrastructure including Amazon Web Services, Google Cloud Platform, and Microsoft Azure efficiently and remotely by managing Terraform code.
Use this integration to create workflows to manage cloud infrastructure using Terraform.
Configure Terraform Cloud in Spot Connect
- In the left main menu, click Connect and click Settings.
- Under the Integrations tab, select Terraform Cloud.
- Configure a new integration instance with the information below.
Details needed to set up a Terraform Cloud instance in Spot Connect:
Parameter | Description | Required |
---|---|---|
Integration Alias | A name for the integration instance | True |
Token | Terraform Cloud API token | True |
Organization | Name of target Organization from Terraform Cloud | True |
Follow these steps in your Terraform Cloud account to obtain the desired parameter values to enter in Spot Connect.
Create a Terraform API Token
-
Sign in to Terraform Cloud.
-
Click the user icon on the top left and click User Settings.
-
Click Tokens and click Create an API Token.
-
Add a description and expiration time.
-
Click Generate Token.
-
Copy the token and paste it into the Token field of the Add Integration Instance window in the Spot Connect console.
Obtain the Terraform Organization Name
-
Click the user icon on the top left and click User Settings.
-
Click Organizations.
-
Copy the Organization name and paste it into the Organization field of Add Integration Instance box in the Spot Connect console.
Integration Actions
You can add these actions in the Spot Connect workflow builder as part of your workflow:
- Terraform Cloud Apply
- Terraform Cloud Destroy
- Terraform Cloud Discard
- Terraform Cloud Plan
- Terraform Cloud Show
- Terraform Cloud Update Vars
Terraform Cloud Apply
Use the action to send an http request to Terraform Cloud and apply the request.
Input
Parameter | Description | Required |
---|---|---|
Terraform Cloud Instance | Terraform Cloud integration in Spot Connect | True |
Run Id | String representing ID of the run to be applied | True |
Output
Parameter | Type | Description |
---|---|---|
apply_result | String | |
workspace_id | String | Workspace ID from Terraform Cloud |
execution_status | String | Node execution status |
Action Example
- From the left panel, drag and drop the Terraform Cloud Apply node in the workflow builder.
- Select a Terraform Cloud Instance.
- Provide a run ID of the run you want to apply.
Input
Output
Terraform Cloud Destroy
Use the action node to destroy infrastructure that was deployed with Terraform.
Input
Parameter | Description | Required |
---|---|---|
Terraform Cloud Instance | Terraform Cloud integration in Spot Connect | True |
Workspace Name | String representing Terraform Cloud workspace ID | True |
Output
Parameter | Type | Description |
---|---|---|
run_id | String | String representing ID of the run destroyed |
run_status | String | String representing status of the run |
run_data | String | JSON object containing data of the run |
execution_status | String | Node execution status |
Action Example
- From the left panel, drag and drop the Terraform Cloud Destroy node in the workflow builder.
- Select a Terraform Cloud Instance.
- Select a workspace name to remove the deployed infrastructure from.
Input
Output
Terraform Cloud Discard
Use the action node to discard Terraform run and unlock a workspace.
Input
Parameter | Description | Required |
---|---|---|
Terraform Cloud Instance | Terraform Cloud integration in Spot Connect | True |
Workspace Name | Terraform Cloud workspace to be unlocked; must be specified if no Run Id is given | False |
Run Id | Specific run ID that needs to be discarded; must be specified if no Workspace Name is given | False |
Output
Parameter | Type | Description |
---|---|---|
run_id | String | Run ID that was discarded |
execution_status | String | Node execution status |
Action Example
- From the left panel, drag and drop the Terraform Cloud Discard node in the workflow builder.
- Select a Terraform Cloud Instance.
- Select a workspace name to discard a run from, or provide a run ID.
Input
Output
Terraform Cloud Plan
Use the action node to plan a Terraform run.
Input
Parameter | Description | Required |
---|---|---|
Terraform Cloud Instance | Terraform Cloud integration in Spot Connect | True |
Workspace Name | String representing Terraform Cloud workspace ID | True |
Output
Parameter | Type | Description |
---|---|---|
run_id | String | String representing ID of the plan created |
run_status | String | String representing status of the plan |
run_data | String | JSON object containing data of the plan |
execution_status | String | Node execution status |
Action Example
- From the left panel, drag and drop the Terraform Cloud Plan node in the workflow builder.
- Select a Terraform Cloud Instance.
- Select a workspace name you want to send a plan request to.
Input
Output
Terraform Cloud Show
Use the action node to extract Terraform State and save to an S3 location if specified.
Input
Parameter | Description | Required |
---|---|---|
Terraform Cloud Instance | Terraform Cloud integration in Spot Connect | True |
Workspace Name | String representing Terraform Cloud workspace ID | True |
S3 Bucket | An S3 bucket to store the extracted Terraform state | False |
Target Alias | AWS target account for the above selected S3 bucket | False |
Output
Parameter | Type | Description |
---|---|---|
bucket | String | Name of S3 bucket where data was stored |
is_truncated | boolean | Whether output exceeded 100 KB |
key | String | Key name for file in which data was stored |
show | String | Last 100 KB of the showed data |
execution_status | String | Node execution status |
Action Example
- From the left panel, drag and drop the Terraform Cloud Show node in the workflow builder.
- Select a Terraform Cloud Instance.
- Select a workspace name that has the state you want to extract from.
Input
Output
Terraform Cloud Update Vars
Use the action snippet to update Terraform Cloud workspace variables.
Input
Parameter | Description | Required |
---|---|---|
Terraform Cloud Instance | Terraform Cloud integration in Spot Connect | True |
Workspace Name | String representing Terraform Cloud workspace ID | True |
Variables | List of terraform variables needed to update | True |
Output
Parameter | Type | Description |
---|---|---|
run_id | String | String representing ID of the run destroyed |
run_status | String | Status of the run |
run_data | String | Response data of the run |
execution_status | String | Node execution status |
Action Example
- From the left panel, drag and drop the Terraform Cloud Update Vars node in the workflow builder.
- Select a Terraform Cloud Instance.
- Select a workspace name that has a variable you want to update.
- Hover over the variable you want to edit. Click Open JSON editor.
- Make changes and click Save.