Skip to main content

Terraform

HCP Terraform (Terraform Cloud) connector — organizations, projects, workspaces, runs, plans, applies, variables, variable sets, state versions, teams, team access, and run triggers.

Categories: Developer Tools, Infrastructure

📝 Beta: This connector is in beta. It follows the service's documented API but has not yet been fully tested against the live service, so some tools may behave differently than described.

Set up​

Terraform connects with credentials from your Terraform account. Have these values ready:

  • API token
  1. Go to Organization > Connectors and find Terraform.
  2. Click Enable and choose which tools to allow.
  3. Each member enters their own values the first time they use it.

To use one account for the whole organization, turn on Share one connection with everyone. Every member's agents then act as that account, with exactly the access it has.

Tools​

Terraform offers 71 tools. Admins choose which ones agents can use. See Tool permission groups.

Read (35)​

View and search information without changing it.

ToolWhat it does
get_account_detailsGet the user or service account the API token authenticates as.
get_applyGet one apply's metadata — status and the counts of resources added, changed, and destroyed.
get_configuration_versionGet one configuration version by ID.
get_current_state_versionGet a workspace's current (latest) state version.
get_current_state_version_outputsGet the outputs of a workspace's current state version — the quickest way to read a workspace's output values.
get_organizationGet one organization by name.
get_organization_entitlementsGet the feature entitlement set for an organization — which features (teams, cost estimation, policy enforcement, etc.) its plan includes.
get_planGet one plan's metadata — status and the counts of resources to add, change, and destroy.
get_plan_json_outputGet planned resource actions from a plan's structured JSON output without attribute values; sensitive values are never returned.
get_projectGet one project by ID.
get_runGet one run by ID, including its status and links to its plan and apply (in relationships).
get_run_triggerGet one run trigger by ID.
get_state_versionGet one state version by ID.
get_state_version_outputGet one state version output by ID; sensitive output values are always redacted to null by the connector.
get_teamGet one team by ID.
get_team_accessGet one team access grant by ID.
get_variable_setGet one variable set by ID.
get_workspaceGet one workspace by ID.
list_configuration_versionsList a workspace's configuration versions (uploaded Terraform config snapshots), newest first, with pagination.
list_organization_membershipsList the members of an organization with their user IDs, usernames, and emails.
list_organization_runsList runs across an entire organization, newest first, with pagination.
list_organizationsList the HCP Terraform organizations the API token can access, with pagination.
list_projectsList projects in an organization, with pagination and an optional name search.
list_run_commentsList the comments on a run, with pagination.
list_run_triggersList a workspace's run triggers, with pagination.
list_state_version_outputsList the named outputs of a state version, with pagination.
list_state_versionsList a workspace's state versions, newest first, with pagination.
list_team_accessList the teams that have access to a workspace and their access levels, with pagination.
list_teamsList teams in an organization, with pagination and an optional name search.
list_variable_setsList an organization's variable sets, with pagination.
list_variables_in_variable_setList the Terraform and environment variables in a variable set.
list_workspace_runsList runs in a workspace, newest first, with pagination.
list_workspace_variablesList all Terraform and environment variables set on a workspace.
list_workspacesList workspaces in an organization, newest change first.
validate_credentialCheck that the HCP Terraform API token works by reading the authenticated account.

Write (11)​

Create or send data.

ToolWhat it does
add_team_accessGrant a team access to a workspace.
add_team_membersAdd members to a team by HCP Terraform username (NOT user ID 'user-...').
apply_variable_set_to_workspacesApply a variable set to one or more workspaces, so its variables take effect there.
create_projectCreate a project in an organization.
create_run_commentAdd a comment to a run.
create_run_triggerCreate a run trigger so a successful apply in the source workspace queues a run in the target workspace.
create_teamCreate a team in an organization.
create_variable_in_variable_setAdd a variable to a variable set. key and category are required.
create_variable_setCreate a variable set in an organization.
create_workspaceCreate a workspace in an organization.
create_workspace_variableCreate a Terraform or environment variable on a workspace. key and category are required; set sensitive=true to hide the value.

Delete or overwrite (25)​

Remove or replace existing data.

ToolWhat it does
apply_runApply a run that has finished planning and is awaiting confirmation.
cancel_runCancel a run that is currently planning or applying, interrupting it.
create_runCreate (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.
delete_projectDelete a project.
delete_run_triggerDelete a run trigger.
delete_teamDelete a team.
delete_variable_in_variable_setRemove a variable from a variable set.
delete_variable_setDelete a variable set.
delete_workspaceDelete a workspace and everything in it, without checking whether it still manages resources — this can orphan live infrastructure.
delete_workspace_variableDelete a variable from a workspace.
discard_runDiscard a run awaiting confirmation, abandoning its plan without applying.
force_unlock_workspaceForce-unlock a workspace locked by another user or a stuck run.
lock_workspaceLock a workspace so no new runs can start.
move_workspaces_to_projectMove one or more workspaces into a project.
remove_team_accessRemove a team's access to a workspace.
remove_team_membersRemove members from a team by HCP Terraform username (NOT user ID 'user-...').
remove_variable_set_from_workspacesRemove a variable set from one or more workspaces.
safe_delete_workspaceDelete a workspace only if it manages no resources; HCP Terraform refuses the call otherwise, so this cannot orphan live infrastructure.
unlock_workspaceUnlock a workspace you hold the lock on, re-enabling runs.
update_projectUpdate a project's name or description.
update_teamUpdate a team's name, visibility, or organization access.
update_team_accessUpdate a team's access level on a workspace.
update_variable_setUpdate a variable set's name, description, global flag, or priority.
update_workspaceUpdate a workspace's settings (name, description, execution_mode, terraform_version, working_directory, auto_apply).
update_workspace_variableUpdate a workspace variable's value, key, description, category, or flags.
⌘J