terraform-cloud

Terraform Cloud nodes for n8n (workspaces, runs, state, wait)

Package Information

Downloads: 97 weekly / 107 monthly
Latest Version: 1.1.1
Author: Fernando Mendieta Ovejero

Documentation

Terraform Cloud for n8n

n8n Terraform Cloud Nodes

Custom n8n nodes to work with HashiCorp Terraform Cloud: manage runs, workspaces, projects, and state metadata.

Nodes included

  • TerraformCloud: Run operations (create plan/manual apply, apply, cancel, discard, add comment), list runs by workspace, get run status, list projects, list workspaces, fetch latest workspace state metadata.

What you can do (quick overview)

Runs

  • Create plan-only runs or plans that wait for manual apply in a workspace.
  • Apply, cancel, or discard an existing run.
  • Add comments to a run.
  • List runs per workspace or fetch the status of a specific run.

Workspaces

  • Create workspaces with vcs, variables, executions, directories...
  • List workspaces in an organization.
  • Fetch workspace details (includes current/latest run).
  • Fetch the current workspace state (state version + download URL).

Projects

  • List projects in an organization.

Credentials

You will need an api token credential to interact with Terraform Cloud.

Credentials for creating Workspace with VCS from Github App

To create a workspace whose VCS source is a GitHub App, you must use a User API Token.
An Organization API Token is not sufficient for this purpose.

How to create a User API Token

  1. Click on your profile picture in the upper-right corner.
  2. Go to Account Settings.
  3. Navigate to Tokens.
  4. Click Create API Token.

Example flows

General Overview

alt text

Launch a plan and check its status

  1. TerraformCloud node → Resource Run → Operation Create Plan (Manual Apply) → set Workspace ID + message.
    alt text

  2. TerraformCloud node → Resource Run → Operation Get Status → use the runId from step 1.
    alt text

Fetch workspace tf state

  1. TerraformCloud node → Resource Workspace → Operation Get Workspace State.
  2. Provide workspaceId or enable Resolve Workspace by Name with stateOrganization + workspaceName.
    alt text

Discard a Run from a Workspace

  1. TerraformCloud node → Resource Run → Operation Discard a run.
    alt text

Create a Workspace

  1. TerraformCloud node → Resource Run → Operation Create a Workspace.There are a multiple options on the creations: vcs control, auto apply, variables...
    alt text

Requirements

  • Terraform Cloud API token with access to the target organization/workspaces.
  • n8n 1.0+ (tested on 2.0.3).

Quick start

npm install
npm run dev   # starts n8n with the custom nodes linked

Build and lint

npm run build
npm run lint

Discussion