HCP Terraform
Terraform workspaces, runs, state, variables and projects
Managed auth
Authentication
Methods your end users can connect with. Credentials are stored encrypted, and secret values are never shown again or returned by the API.
API key
Your users enter
- API tokenSecretRequired
- RegionOptionalIdentifier2 choices
Where to find them
- In HCP Terraform: your avatar → “Account settings” → “Tokens” → “Create an API token”.
- Give it a description and expiration, click “Generate token” and copy it: it is shown only once. It acts with your permissions in all your organizations; to limit it, use a team token (“Organization settings” → “API tokens” → “Team Tokens”) of a team with just the permissions needed.
Tools (2)
HCP Terraform API request
TERRAFORM_SEND_REQUESTAuthenticated call to the HCP Terraform API (https://{server}/api/v2). Any endpoint of the API is allowed. JSON:API format (data is in data.attributes). Examples: GET /organizations, GET /organizations/{org}/workspaces?page[size]=50&search[name]=…, GET /organizations/{org}/projects, GET /workspaces/{id}/runs?page[size]=10, GET /runs/{id}?include=plan, GET /plans/{id}/json-output, GET /workspaces/{id}/current-state-version, GET /workspaces/{id}/vars, GET /workspaces/{id}/current-assessment-result (drift), POST /runs {"data": {"type": "runs", "attributes": {"message": "…"}, "relationships": {"workspace": {"data": {"type": "workspaces", "id": "ws-…"}}}}} and POST /runs/{id}/actions/apply (writes, with the header Content-Type: application/vnd.api+json).
Required scopes
No scopes required
Input
HCP Terraform API request input Name Type Description methodstringHTTP methodOne of: GET,POST,PUT,PATCH,DELETEDefault:"GET"pathrequiredstringPath relative to the API base URL, or a full URL on the same API (e.g. a next-page link) queryobjectQuery string parameters bodyunknownJSON body formobjectBody as application/x-www-form-urlencoded instead of JSON body_base64stringBinary body, base64 (at most 960000 characters) content_typestringContent-Type of body_base64 headersobjectExtra headers such as Accept. Authentication is added automatically. Workspaces
TERRAFORM_LIST_WORKSPACESWorkspaces of an organization with Terraform version, execution mode, resource count, lock status, repository and last run status, without the full JSON:API dump.
Required scopes
No scopes required
Input
Workspaces input Name Type Description organizationrequiredstringOrganization name (GET /organizations lists them) searchstringPart of the workspace name maxintegerDefault: 50pageintegerDefault: 1

