> This page is for Agent Handler.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.merge.dev/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.merge.dev/_mcp/server.

# Terraform

> **This Connector is in Beta**
>
> Merge has validated Terraform against the provider's documented API and not yet verified it against the live one, so its behavior can differ from the documentation. It carries the same tool surface it will have at general availability. [Connectors overview](/merge-agent-handler/connectors/overview) covers the tier and how to turn Beta Connectors off.

> **Ready to connect**
>
> No custom OAuth app setup required. Sign in or provide your credentials to connect.

**Authentication:** API token. See [Magic Link](/merge-agent-handler/features/magic-link) for the runtime auth flow.

## Sample use cases

* Start a run on the production workspace and show the plan output.
* Apply a run after it has been reviewed.
* Add a variable to the staging workspace.

## Available Tools

#### add_team_access

Grant a team access to a workspace. Set access to 'read', 'plan', 'write', or 'admin' for a fixed level, or 'custom' and set runs/variables/state_versions individually.

#### add_team_members

Add members to a team by HCP Terraform username (NOT user ID 'user-...').

#### apply_run

Apply a run that has finished planning and is awaiting confirmation.

#### apply_variable_set_to_workspaces

Apply a variable set to one or more workspaces, so its variables take effect there.

#### cancel_run

Cancel a run that is currently planning or applying, interrupting it.

#### create_project

Create a project in an organization. Projects group workspaces.

#### create_run

Create (queue) a run on a workspace from its latest configuration or a given configuration_version_id; set is_destroy for a teardown or plan_only for a speculative plan.

#### create_run_comment

Add a comment to a run. Use list_workspace_runs to find run IDs.

#### create_run_trigger

Create a run trigger so a successful apply in the source workspace queues a run in the target workspace.

#### create_team

Create a team in an organization. Set visibility and organization_access to control what the team can see and manage.

#### create_variable_in_variable_set

Add a variable to a variable set. key and category are required.

#### create_variable_set

Create a variable set in an organization.

#### create_workspace

Create a workspace in an organization. Only name is required.

#### create_workspace_variable

Create a Terraform or environment variable on a workspace.

#### delete_project

Delete a project. The project must contain no workspaces or stacks or the call is rejected.

#### delete_run_trigger

Delete a run trigger. Use list_run_triggers to find run trigger IDs.

#### delete_team

Delete a team. Use list_teams to find team IDs.

#### delete_variable_in_variable_set

Remove a variable from a variable set. Use list_variables_in_variable_set to find variable IDs.

#### delete_variable_set

Delete a variable set. Use list_variable_sets to find variable set IDs.

#### delete_workspace

Delete a workspace and everything in it, without checking whether it still manages resources — this can orphan live infrastructure.

#### delete_workspace_variable

Delete a variable from a workspace. Use list_workspace_variables to find variable IDs.

#### discard_run

Discard a run awaiting confirmation, abandoning its plan without applying. Use list_workspace_runs to find run IDs.

#### force_unlock_workspace

Force-unlock a workspace locked by another user or a stuck run.

#### get_account_details

Get the user or service account the API token authenticates as.

#### get_apply

Get one apply's metadata — status and the counts of resources added, changed, and destroyed.

#### get_configuration_version

Get one configuration version by ID. Use list_configuration_versions to find configuration version IDs.

#### get_current_state_version

Get a workspace's current (latest) state version. Use list_workspaces to find workspace IDs.

#### get_current_state_version_outputs

Get the outputs of a workspace's current state version — the quickest way to read a workspace's output values.

#### get_organization

Get one organization by name. Use list_organizations to find organization names.

#### get_organization_entitlements

Get the feature entitlement set for an organization — which features (teams, cost estimation, policy enforcement, etc.) its plan includes.

#### get_plan

Get one plan's metadata — status and the counts of resources to add, change, and destroy.

#### get_plan_json_output

Get planned resource actions from a plan's structured JSON output without attribute values; sensitive values are never returned.

#### get_project

Get one project by ID. Use list_projects to find project IDs.

#### get_run

Get one run by ID, including its status and links to its plan and apply (in relationships).

#### get_run_trigger

Get one run trigger by ID. Use list_run_triggers to find run trigger IDs.

#### get_state_version

Get one state version by ID. Use list_state_versions to find state version IDs.

#### get_state_version_output

Get one state version output by ID; sensitive output values are always redacted to null by the connector.

#### get_team

Get one team by ID. Use list_teams to find team IDs.

#### get_team_access

Get one team access grant by ID. Use list_team_access to find team access IDs.

#### get_variable_set

Get one variable set by ID. Its relationships.vars contains only variable IDs; use list_variables_in_variable_set for keys and metadata.

#### get_workspace

Get one workspace by ID. Use list_workspaces to find workspace IDs.

#### list_configuration_versions

List a workspace's configuration versions (uploaded Terraform config snapshots), newest first, with pagination.

#### list_organization_memberships

List the members of an organization with their user IDs, usernames, and emails.

#### list_organization_runs

List runs across an entire organization, newest first, with pagination.

#### list_organizations

List the HCP Terraform organizations the API token can access, with pagination.

#### list_projects

List projects in an organization, with pagination and an optional name search.

#### list_run_comments

List the comments on a run, with pagination. Use list_workspace_runs to find run IDs.

#### list_run_triggers

List a workspace's run triggers, with pagination.

#### list_state_version_outputs

List the named outputs of a state version, with pagination.

#### list_state_versions

List a workspace's state versions, newest first, with pagination.

#### list_team_access

List the teams that have access to a workspace and their access levels, with pagination.

#### list_teams

List teams in an organization, with pagination and an optional name search.

#### list_variable_sets

List an organization's variable sets, with pagination.

#### list_variables_in_variable_set

List the Terraform and environment variables in a variable set.

#### list_workspace_runs

List runs in a workspace, newest first, with pagination.

#### list_workspace_variables

List all Terraform and environment variables set on a workspace.

#### list_workspaces

List workspaces in an organization, newest change first.

#### lock_workspace

Lock a workspace so no new runs can start.

#### move_workspaces_to_project

Move one or more workspaces into a project.

#### remove_team_access

Remove a team's access to a workspace. Use list_team_access to find team access IDs.

#### remove_team_members

Remove members from a team by HCP Terraform username (NOT user ID 'user-...').

#### remove_variable_set_from_workspaces

Remove a variable set from one or more workspaces.

#### safe_delete_workspace

Delete a workspace only if it manages no resources; HCP Terraform refuses the call otherwise, so this cannot orphan live infrastructure.

#### unlock_workspace

Unlock a workspace you hold the lock on, re-enabling runs.

#### update_project

Update a project's name or description. Use list_projects to find project IDs.

#### update_team

Update a team's name, visibility, or organization access. Use list_teams to find team IDs.

#### update_team_access

Update a team's access level on a workspace. Use list_team_access to find team access IDs.

#### update_variable_set

Update a variable set's name, description, global flag, or priority. Use list_variable_sets to find variable set IDs.

#### update_workspace

Update a workspace's settings (name, description, execution_mode, terraform_version, working_directory, auto_apply).

#### update_workspace_variable

Update a workspace variable's value, key, description, category, or flags.