First-party app
HCP Terraform HCP Terraform

HCP Terraform

Drive HCP Terraform and Terraform Enterprise: list workspaces, queue and apply runs, read state outputs, and manage workspace variables.

stable DevOps & InfrastructureDeveloper Tools

About

HCP Terraform ships in the w6w first-party pack. It declares 20 actions, 3 health checks, and the host runs its code in a sandbox that never sees the credential.

App id
io.w6w.terraform
Version
0.1.2
Author
w6w
Licence
MIT
Categories
DevOps & Infrastructure · Developer Tools

Overview

HCP Terraform runs infrastructure changes as reviewable runs against a shared state file, and this app drives that pipeline from a workflow: list and configure workspaces, queue and confirm runs, read the outputs a run produced, and manage the variables a workspace executes with.

Because this app can change real infrastructure, its most consequential actions are deliberately harder to trigger by accident than a typical read or write: queuing a run defaults to a plan only, an apply that would destroy resources requires the workflow to state how many it expects, and deleting a workspace removes only the workspace record — never the infrastructure it was managing, which keeps running and keeps costing money until something else tears it down. Reading a run’s state outputs is the standout integration point, since that’s how a piece of infrastructure a workflow just created — a database endpoint, a queue address — gets handed to whatever needs it next.

This app works identically against HashiCorp’s own hosted platform and against Terraform Enterprise, an organisation’s self-hosted copy of the same API, since a connection simply points at whichever address is in use. Reading and writing individual resources inside a state file isn’t part of it — this operates at the level of runs and workspaces, which is where Terraform’s own API draws the same line.

Build with HCP Terraform

Three routes to the same 20 actions. The Workflow tab is generated from HCP Terraform's own manifest and carries its real ids, so it is copy-pasteable; the Code and CLI examples are the same call for any action on any app, so every app-specific value in them is a blank you fill in.

Get the current account

account-get

Who this token is and what kind it is. An ORGANIZATION token cannot create runs or read state, and a TEAM token answers 404 for anything outside its team — neither failure mentions token types.

Get an organization

organization-get

One organisation's settings. `cost-estimation-enabled` adds a phase to every run, and a two-factor auth policy silently disables tokens belonging to accounts without it.

List organizations

organization-list

The organisations this token can see. The NAME is the identifier — every other path starts with it, and there is no separate id.

Apply a run

run-apply

Confirm a planned run, which CHANGES REAL INFRASTRUCTURE and cannot be undone. Reads the plan first and refuses to apply destructions without an acknowledgement of how many.

Cancel a run

run-cancel

Interrupt a running plan or apply. FORCE kills it instead of stopping safely — an interrupted apply leaves resources that exist and are not in the state file.

Queue a run

run-create

Queue a plan. Defaults to PLAN-ONLY, which cannot apply — because an ordinary run against an auto-apply workspace changes infrastructure from this single call with no confirmation.

Discard a run

run-discard

Throw away a planned run without applying it — this changes no infrastructure. It ALSO discards any runs queued behind it in the same workspace.

Get a run

run-get

A run's status and its plan's resource counts. `planned_and_finished` is a SUCCESS with no changes — a loop waiting for `applied` hangs on it forever.

List runs

run-list

A workspace's runs, newest first, with a count of how many are AWAITING a person — those hold the queue, and every new run sits behind them.

Read state outputs

state-outputs

A workspace's current output values — the endpoints and names other systems need. Sensitive outputs return NULL; the rest may still be secrets, because Terraform does not know which are.

Delete a workspace variable

variable-delete

Remove a variable. The effect only appears at the NEXT plan, and a deleted sensitive value cannot be recovered — nothing could read it while it existed.

List workspace variables

variable-list

A workspace's variables. A SENSITIVE variable's value is unreadable forever — read-modify-write across a workspace blanks every one of them.

Set a workspace variable

variable-set

Create or update a variable. Marking one SENSITIVE is one-way — its value can never be read back — so updating a sensitive variable requires an explicit new value.

Create a workspace

workspace-create

Create an API-driven workspace. Leaving the Terraform version unset means it tracks the NEWEST release, so a configuration can start failing without anything changing.

Delete a workspace

workspace-delete

Remove a workspace and its state history. The INFRASTRUCTURE IS NOT DELETED — it keeps running, unmanaged and unrecorded. Queue a destroy run first if that is the intent.

Get a workspace

workspace-get

One workspace, by id or by organisation and name. `auto-apply`, `locked` and `execution-mode` are the three attributes that decide whether a run will do anything.

List workspaces

workspace-list

An organisation's workspaces, with a count of how many AUTO-APPLY — those change infrastructure from a single run with no confirmation — and how many are locked.

Lock a workspace

workspace-lock

Stop runs from starting. Runs are still ACCEPTED — they queue in `pending` — so a workflow creating one against a locked workspace waits for a state that never arrives.

Unlock a workspace

workspace-unlock

Release a workspace lock. FORCE overrides a lock held by somebody else or by a running apply — two applies against one state file is how state gets corrupted, so it is gated.

Update a workspace

workspace-update

Change a workspace's settings, and report what actually changed — the API IGNORES an attribute it does not recognise and returns 200, so a silent no-op looks like success.

A workflow step names the app and the action, and the editor fills in the connection when you pick one. This is the Step shape from the workflow spec, carrying HCP Terraform's real ids.

{
  "manifestVersion": "2",
  "name": "terraform-example",
  "steps": [
    {
      "id": "organization-get",
      "uses": {
        "app": "io.w6w.terraform",
        "action": "organization-get",
        "connection": "conn_YOUR_CONNECTION_ID"
      },
      "with": {
        "organization": "<organization>"
      }
    }
  ]
}

Here are some of the things you can do

  • Get an organization

    read
    organization-get
  • Get the current account

    read
    account-get
  • List organizations

    read
    organization-list
  • Apply a run

    perform
    run-apply
  • Queue a run

    perform
    run-create

+15 more actions available

Every app-specific value here is a blank you have to fill in. An app action is reached through the connection that authenticates it, so the address is a connection id, not the app id — and connections belong to your account, so a public page cannot know yours. Create one for HCP Terraform, then fill in the three blanks: conn_YOUR_CONNECTION_ID, the action key, and the parameters that action declares. The call itself is real — the shape is transcribed from the studio's own snippet builder, which prints the same kind of blanks — but nothing in it is specific to HCP Terraform. The Workflow tab is where this app's real ids are.

Install
npm install @w6w/sdk
yarn add @w6w/sdk
pnpm add @w6w/sdk
deno add npm:@w6w/sdk
Code
import { W6wClient, isActionRun } from "@w6w/sdk";

// Reads W6W_BASE_URL and W6W_TOKEN from the environment when omitted.
const client = new W6wClient();

const envelope = await client.run({
  urn: "conn_YOUR_CONNECTION_ID",
  action: "organization-get",
  payload: {
    organization: "<value>",
  },
});

if (isActionRun(envelope)) console.log(envelope.value);
Install the CLI
npm install -g @w6w/cli
CLI
w6w run conn_YOUR_CONNECTION_ID --action organization-get --payload '{"organization":"<value>"}'

Give an AI agent HCP Terraform — without giving it HCP Terraform's credentials. One MCP endpoint exposes every app, function and workflow the caller is entitled to, as tools it can discover and run. Access is granted per team while we onboard.

One tool call
{
  "name": "w6w_invoke",
  "arguments": {
    "ref": "app:io.w6w.terraform#organization-get",
    "input": {
      "organization": "<organization>"
    }
  }
}

Every tool names its target with a single ref. The app: form above doesn't name a connection at all — the host resolves which of the caller's HCP Terraform connections to sign with, and refuses rather than guesses when the answer is ambiguous.

What the agent gets

Credentials it can't read

The token is attached host-side, at the moment of the call. It is never a tool argument, never in the model's context, and never in a transcript — so a prompt injection has nothing to exfiltrate.

A tool surface scoped to the caller

Tools are derived per end user from what that person has actually connected and is entitled to — not one shared bot identity carrying the union of everyone's access.

A durable workflow in one call

Multi-step work runs on the workflow engine and returns a run handle the agent can poll — retries, branching and state survive the conversation that started them.

Health-aware discovery

HCP Terraform's declared health checks are on the surface too, so an agent can tell "the vendor is down" from "your credential expired" before it burns a retry on either.

The MCP surface is part of the hosted platform. HCP Terraform itself is MIT, and the runtime that executes it is source-available (FSL).

Request MCP access

Health checks

HCP Terraform declares its own checks, so its health is a property of the app rather than something the host guesses at.

service

HCP Terraform status

Reads status.hashicorp.com's COMPONENTS feed, not its summary: summary.json returns only the first 25 of 62 components and HCP Terraform is the 38th, so the conventional probe reports other products' health as Terraform's. Says nothing about self-hosted Terraform Enterprise.

dependency

Instance reachable

Pings this connection's own instance UNAUTHENTICATED — /api/v2/ping answers 204 without a token, so a revoked credential does not read as an outage. Also watches for the product or API version changing under the connection.

quota

Rate-limit headroom

Not checkable in a useful sense. The headers exist and precise — 30 requests per SECOND, resetting in one — so a point sample measures a window that is over before the result is stored. A 429 here is a fan-out problem, cleared by waiting a second.