content large_stringlengths 3 20.5k | url large_stringlengths 54 193 | branch large_stringclasses 4
values | source large_stringclasses 42
values | embeddings listlengths 384 384 | score float64 -0.21 0.65 |
|---|---|---|---|---|---|
[200]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/200 [201]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/201 [202]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/202 [204]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/204 [400]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/400 [401]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/401 [403]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/403 [404]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/404 [409]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/409 [412]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/412 [422]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/422 [429]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429 [500]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500 [504]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504 [JSON API document]: /terraform/cloud-docs/api-docs#json-api-documents [JSON API error object]: https://jsonapi.org/format/#error-objects # SSH keys API reference The `ssh-key` object represents an SSH key which includes a name and the SSH private key. An organization can have multiple SSH keys available. SSH keys can be used in two places: - You can assign them to VCS provider integrations, which are available in the API as `oauth-tokens`. Refer to [OAuth Tokens](/terraform/cloud-docs/api-docs/oauth-tokens) for additional information. Azure DevOps Server and Bitbucket Data Center require an SSH key. Other providers only require an SSH key when your repositories include submodules that are only accessible using an SSH connection instead of your VCS provider's API. - They can be [assigned to workspaces](/terraform/cloud-docs/api-docs/workspaces#assign-an-ssh-key-to-a-workspace) and used when Terraform needs to clone modules from a Git server. This is only necessary when your configurations directly reference modules from a Git server; you do not need to do this if you use HCP Terraform's [private module registry](/terraform/cloud-docs/registry). Listing and viewing SSH keys requires either permission to manage VCS settings for the organization, or admin access to at least one workspace. ([More about permissions.](/terraform/cloud-docs/users-teams-organizations/permissions)) [permissions-citation]: #intentionally-unused---keep-for-maintainers ~> \*\*Important:\*\* The list and read methods on this API only provide metadata about SSH keys. The actual private key text is write-only, and HCP Terraform never provides it to users via the API or UI. ## List SSH Keys `GET /organizations/:organization\_name/ssh-keys` | Parameter | Description | | -------------------- | -------------------------------------------------- | | `:organization\_name` | The name of the organization to list SSH keys for. | -> \*\*Note:\*\* This endpoint cannot be accessed with [organization tokens](/terraform/cloud-docs/users-teams-organizations/api-tokens#organization-api-tokens). You must access it with a [user token](/terraform/cloud-docs/users-teams-organizations/users#api-tokens) or [team token](/terraform/cloud-docs/users-teams-organizations/api-tokens#team-api-tokens). | Status | Response | Reason | | ------- | ---------------------------------------------------- | --------------------------------------------- | | [200][] | Array of [JSON API document][]s (`type: "ssh-keys"`) | Success | | [404][] | [JSON API error object][] | Organization not found or user not authorized | ### Query Parameters This endpoint supports pagination [with standard URL query parameters](/terraform/cloud-docs/api-docs#query-parameters). Remember to percent-encode `[` as `%5B` and `]` as `%5D` if your tooling doesn't automatically encode URLs. If neither pagination query parameters are provided, the endpoint will not be paginated and will return all results. | Parameter | Description | | -------------- | ------------------------------------------------------------------------ | | `page[number]` | \*\*Optional.\*\* If omitted, the endpoint will return the first page. | | `page[size]` | \*\*Optional.\*\* If omitted, the endpoint will return 20 ssh keys per page. | ### Sample Request ```shell curl \ --header "Authorization: Bearer $TOKEN" \ https://app.terraform.io/api/v2/organizations/my-organization/ssh-keys ``` ### Sample Response ```json { "data": [ { "attributes": { "name": "SSH Key" }, "id": "sshkey-GxrePWre1Ezug7aM", "links": { "self": "/api/v2/ssh-keys/sshkey-GxrePWre1Ezug7aM" }, "type": "ssh-keys" } ] } ``` ## Get an SSH Key `GET /ssh-keys/:ssh\_key\_id` | Parameter | Description | | ------------- | ---------------------- | | `:ssh\_key\_id` | The SSH key ID to get. | This endpoint is for looking up the name associated with an SSH key ID. It does not retrieve the key text. -> \*\*Note:\*\* This endpoint cannot be accessed with [organization tokens](/terraform/cloud-docs/users-teams-organizations/api-tokens#organization-api-tokens). You must access it with a [user token](/terraform/cloud-docs/users-teams-organizations/users#api-tokens) or [team token](/terraform/cloud-docs/users-teams-organizations/api-tokens#team-api-tokens). | Status | Response | Reason | | ------- | ------------------------------------------ | ---------------------------------------- | | [200][] | [JSON API document][] (`type: "ssh-keys"`) | Success | | [404][] | [JSON API error object][] | SSH key not found or user not authorized | ### Sample Request ```shell curl \ --header "Authorization: Bearer $TOKEN" \ https://app.terraform.io/api/v2/ssh-keys/sshkey-GxrePWre1Ezug7aM ``` ### Sample Response ```json { "data": { "attributes": | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/ssh-keys.mdx | main | terraform | [
-0.015784088522195816,
-0.01700746826827526,
-0.018668580800294876,
-0.028096551075577736,
-0.024631375446915627,
-0.08318780362606049,
-0.0621652752161026,
-0.07521579414606094,
-0.005580500699579716,
-0.03855427727103233,
0.03281282261013985,
0.0540321059525013,
0.006812138482928276,
-0.... | 0.052879 |
| | [200][] | [JSON API document][] (`type: "ssh-keys"`) | Success | | [404][] | [JSON API error object][] | SSH key not found or user not authorized | ### Sample Request ```shell curl \ --header "Authorization: Bearer $TOKEN" \ https://app.terraform.io/api/v2/ssh-keys/sshkey-GxrePWre1Ezug7aM ``` ### Sample Response ```json { "data": { "attributes": { "name": "SSH Key" }, "id": "sshkey-GxrePWre1Ezug7aM", "links": { "self": "/api/v2/ssh-keys/sshkey-GxrePWre1Ezug7aM" }, "type": "ssh-keys" } } ``` ## Create an SSH Key `POST /organizations/:organization\_name/ssh-keys` | Parameter | Description | | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `:organization\_name` | The name of the organization to create an SSH key in. The organization must already exist, and the token authenticating the API request must have permission to manage VCS settings. ([More about permissions.](/terraform/cloud-docs/users-teams-organizations/permissions)) | [permissions-citation]: #intentionally-unused---keep-for-maintainers -> \*\*Note:\*\* This endpoint cannot be accessed with [organization tokens](/terraform/cloud-docs/users-teams-organizations/api-tokens#organization-api-tokens). You must access it with a [user token](/terraform/cloud-docs/users-teams-organizations/users#api-tokens) or [team token](/terraform/cloud-docs/users-teams-organizations/api-tokens#team-api-tokens). | Status | Response | Reason | | ------- | ------------------------------------------ | -------------------------------------------------------------- | | [201][] | [JSON API document][] (`type: "ssh-keys"`) | Success | | [422][] | [JSON API error object][] | Malformed request body (missing attributes, wrong types, etc.) | | [404][] | [JSON API error object][] | User not authorized | ### Request Body This POST endpoint requires a JSON object with the following properties as a request payload. Properties without a default value are required. | Key path | Type | Default | Description | | ----------------------- | ------ | ------- | -------------------------------- | | `data.type` | string | | Must be `"ssh-keys"`. | | `data.attributes.name` | string | | A name to identify the SSH key. | | `data.attributes.value` | string | | The text of the SSH private key. | ### Sample Payload ```json { "data": { "type": "ssh-keys", "attributes": { "name": "SSH Key", "value": "-----BEGIN RSA PRIVATE KEY-----\nMIIEowIBAAKCAQEAm6+JVgl..." } } } ``` ### Sample Request ```shell curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request POST \ --data @payload.json \ https://app.terraform.io/api/v2/organizations/my-organization/ssh-keys ``` ### Sample Response ```json { "data": { "attributes": { "name": "SSH Key" }, "id": "sshkey-GxrePWre1Ezug7aM", "links": { "self": "/api/v2/ssh-keys/sshkey-GxrePWre1Ezug7aM" }, "type": "ssh-keys" } } ``` ## Update an SSH Key `PATCH /ssh-keys/:ssh\_key\_id` | Parameter | Description | | ------------- | ------------------------- | | `:ssh\_key\_id` | The SSH key ID to update. | This endpoint replaces the name of an existing SSH key. Editing SSH keys requires permission to manage VCS settings. ([More about permissions.](/terraform/cloud-docs/users-teams-organizations/permissions)) [permissions-citation]: #intentionally-unused---keep-for-maintainers -> \*\*Note:\*\* This endpoint cannot be accessed with [organization tokens](/terraform/cloud-docs/users-teams-organizations/api-tokens#organization-api-tokens). You must access it with a [user token](/terraform/cloud-docs/users-teams-organizations/users#api-tokens) or [team token](/terraform/cloud-docs/users-teams-organizations/api-tokens#team-api-tokens). | Status | Response | Reason | | ------- | ------------------------------------------ | ---------------------------------------- | | [200][] | [JSON API document][] (`type: "ssh-keys"`) | Success | | [404][] | [JSON API error object][] | SSH key not found or user not authorized | ### Request Body This POST endpoint requires a JSON object with the following properties as a request payload. Properties without a default value are required. | Key path | Type | Default | Description | | ----------------------- | ------ | --------- | ----------------------------------------------------------------------------- | | `data.type` | string | | Must be `"ssh-keys"`. | | `data.attributes.name` | string | (nothing) | A name to identify the SSH key. If omitted, the existing name is preserved. | ### Sample Payload ```json { "data": { "attributes": { "name": "SSH Key for GitHub" } } } ``` ### Sample Request ```shell curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request PATCH \ --data @payload.json \ https://app.terraform.io/api/v2/ssh-keys/sshkey-GxrePWre1Ezug7aM ``` ### Sample Response ```json { "data": { "attributes": { "name": "SSH Key for GitHub" }, "id": "sshkey-GxrePWre1Ezug7aM", "links": | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/ssh-keys.mdx | main | terraform | [
-0.007667006459087133,
0.08220629394054413,
-0.009162702597677708,
-0.009135933592915535,
-0.034437086433172226,
-0.03894437476992607,
-0.046802349388599396,
-0.018260126933455467,
0.04251592233777046,
0.05916083604097366,
0.019204996526241302,
-0.07235666364431381,
0.024759678170084953,
0... | 0.026197 |
"name": "SSH Key for GitHub" } } } ``` ### Sample Request ```shell curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request PATCH \ --data @payload.json \ https://app.terraform.io/api/v2/ssh-keys/sshkey-GxrePWre1Ezug7aM ``` ### Sample Response ```json { "data": { "attributes": { "name": "SSH Key for GitHub" }, "id": "sshkey-GxrePWre1Ezug7aM", "links": { "self": "/api/v2/ssh-keys/sshkey-GxrePWre1Ezug7aM" }, "type": "ssh-keys" } } ``` ## Delete an SSH Key `DELETE /ssh-keys/:ssh\_key\_id` | Parameter | Description | | ------------- | ------------------------- | | `:ssh\_key\_id` | The SSH key ID to delete. | Deleting SSH keys requires permission to manage VCS settings. ([More about permissions.](/terraform/cloud-docs/users-teams-organizations/permissions)) [permissions-citation]: #intentionally-unused---keep-for-maintainers -> \*\*Note:\*\* This endpoint cannot be accessed with [organization tokens](/terraform/cloud-docs/users-teams-organizations/api-tokens#organization-api-tokens). You must access it with a [user token](/terraform/cloud-docs/users-teams-organizations/users#api-tokens) or [team token](/terraform/cloud-docs/users-teams-organizations/api-tokens#team-api-tokens). | Status | Response | Reason | | ------- | ------------------------- | ---------------------------------------- | | [204][] | No Content | Success | | [404][] | [JSON API error object][] | SSH key not found or user not authorized | ### Sample Request ```shell curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request DELETE \ https://app.terraform.io/api/v2/ssh-keys/sshkey-GxrePWre1Ezug7aM ``` | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/ssh-keys.mdx | main | terraform | [
-0.023704927414655685,
0.0564708337187767,
0.01372962910681963,
-0.003946744371205568,
-0.0022325506433844566,
-0.038386132568120956,
-0.01073620654642582,
-0.04083554446697235,
0.04408019781112671,
0.0878433808684349,
0.0029240595176815987,
-0.06674963235855103,
0.04270590469241142,
0.006... | 0.025 |
[200]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/200 [201]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/201 [202]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/202 [204]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/204 [400]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/400 [401]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/401 [403]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/403 [404]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/404 [409]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/409 [412]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/412 [422]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/422 [429]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429 [500]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500 [504]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504 [JSON API document]: /terraform/cloud-docs/api-docs#json-api-documents [JSON API error object]: https://jsonapi.org/format/#error-objects # Policy set parameters API references [Sentinel parameters](/sentinel/docs/language/parameters) are a list of key/value pairs that HCP Terraform sends to the Sentinel runtime when performing policy checks on workspaces. They can help you avoid hardcoding sensitive parameters into a policy. @include 'tfc-package-callouts/policies.mdx' Parameters are only available for Sentinel policies. This set of APIs provides endpoints to create, update, list and delete parameters. ## Create a Parameter `POST /policy-sets/:policy\_set\_id/parameters` | Parameter | Description | | ---------------- | ---------------------------------------------------- | | `:policy\_set\_id` | The ID of the policy set to create the parameter in. | ### Request Body This POST endpoint requires a JSON object with the following properties as a request payload. Properties without a default value are required. | Key path | Type | Default | Description | | --------------------------- | ------ | ------- | ------------------------------------------------------------------------------------------------------ | | `data.type` | string | | Must be `"vars"`. | | `data.attributes.key` | string | | The name of the parameter. | | `data.attributes.value` | string | `""` | The value of the parameter. | | `data.attributes.category` | string | | The category of the parameters. Must be `"policy-set"`. | | `data.attributes.sensitive` | bool | `false` | Whether the value is sensitive. If true then the parameter is written once and not visible thereafter. | ### Sample Payload ```json { "data": { "type":"vars", "attributes": { "key":"some\_key", "value":"some\_value", "category":"policy-set", "sensitive":false } } } ``` ### Sample Request ```shell curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request POST \ --data @payload.json \ https://app.terraform.io/api/v2/policy-sets/polset-u3S5p2Uwk21keu1s/parameters ``` ### Sample Response ```json { "data": { "id":"var-EavQ1LztoRTQHSNT", "type":"vars", "attributes": { "key":"some\_key", "value":"some\_value", "sensitive":false, "category":"policy-set" }, "relationships": { "configurable": { "data": { "id":"pol-u3S5p2Uwk21keu1s", "type":"policy-sets" }, "links": { "related":"/api/v2/policy-sets/polset-u3S5p2Uwk21keu1s" } } }, "links": { "self":"/api/v2/policy-sets/polset-u3S5p2Uwk21keu1s/parameters/var-EavQ1LztoRTQHSNT" } } } ``` ## List Parameters `GET /policy-sets/:policy\_set\_id/parameters` | Parameter | Description | | ---------------- | ------------------------------------------------ | | `:policy\_set\_id` | The ID of the policy set to list parameters for. | ### Query Parameters This endpoint supports pagination [with standard URL query parameters](/terraform/cloud-docs/api-docs#query-parameters). Remember to percent-encode `[` as `%5B` and `]` as `%5D` if your tooling doesn't automatically encode URLs. If neither pagination query parameters are provided, the endpoint will not be paginated and will return all results. | Parameter | Description | | -------------- | -------------------------------------------------------------------------- | | `page[number]` | \*\*Optional.\*\* If omitted, the endpoint will return the first page. | | `page[size]` | \*\*Optional.\*\* If omitted, the endpoint will return 20 parameters per page. | ### Sample Request ```shell $ curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ "https://app.terraform.io/api/v2/policy-sets/polset-u3S5p2Uwk21keu1s/parameters" ``` ### Sample Response ```json { "data": [ { "id":"var-AD4pibb9nxo1468E", "type":"vars", "attributes": { "key":"name", "value":"hello", "sensitive":false, "category":"policy-set", }, "relationships": { "configurable": { "data": { "id":"pol-u3S5p2Uwk21keu1s", "type":"policy-sets" }, "links": { "related":"/api/v2/policy-sets/polset-u3S5p2Uwk21keu1s" } } }, "links": { "self":"/api/v2/policy-sets/polset-u3S5p2Uwk21keu1s/parameters/var-AD4pibb9nxo1468E" } } ] } ``` ## Update Parameters `PATCH /policy-sets/:policy\_set\_id/parameters/:parameter\_id` | Parameter | Description | | ---------------- | ------------------------------------------------- | | `:policy\_set\_id` | The ID of the policy set that owns the parameter. | | `:parameter\_id` | The ID of the parameter to be updated. | ### Request Body This POST endpoint requires a JSON object with the following properties as a request payload. Properties without a default value are required. | Key path | Type | Default | Description | | ----------------- | ------ | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `data.type` | string | | Must be `"vars"`. | | `data.id` | string | | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/policy-set-params.mdx | main | terraform | [
-0.015784088522195816,
-0.01700746826827526,
-0.018668580800294876,
-0.028096551075577736,
-0.024631375446915627,
-0.08318780362606049,
-0.0621652752161026,
-0.07521579414606094,
-0.005580500699579716,
-0.03855427727103233,
0.03281282261013985,
0.0540321059525013,
0.006812138482928276,
-0.... | 0.052879 |
object with the following properties as a request payload. Properties without a default value are required. | Key path | Type | Default | Description | | ----------------- | ------ | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `data.type` | string | | Must be `"vars"`. | | `data.id` | string | | The ID of the parameter to update. | | `data.attributes` | object | | New attributes for the parameter. This object can include `key`, `value`, `category` and `sensitive` properties, which are described above under [create a parameter](#create-a-parameter). All of these properties are optional; if omitted, a property will be left unchanged. | ### Sample Payload ```json { "data": { "id":"var-yRmifb4PJj7cLkMG", "attributes": { "key":"name", "value":"mars", "category":"policy-set", "sensitive": false }, "type":"vars" } } ``` ### Sample Request ```bash $ curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request PATCH \ --data @payload.json \ https://app.terraform.io/api/v2/policy-sets/polset-u3S5p2Uwk21keu1s/parameters/var-yRmifb4PJj7cLkMG ``` ### Sample Response ```json { "data": { "id":"var-yRmifb4PJj7cLkMG", "type":"vars", "attributes": { "key":"name", "value":"mars", "sensitive":false, "category":"policy-set", }, "relationships": { "configurable": { "data": { "id":"pol-u3S5p2Uwk21keu1s", "type":"policy-sets" }, "links": { "related":"/api/v2/policy-sets/polset-u3S5p2Uwk21keu1s" } } }, "links": { "self":"/api/v2/policy-sets/polset-u3S5p2Uwk21keu1s/parameters/var-yRmifb4PJj7cLkMG" } } } ``` ## Delete Parameters `DELETE /policy-sets/:policy\_set\_id/parameters/:parameter\_id` | Parameter | Description | | ---------------- | ------------------------------------------------- | | `:policy\_set\_id` | The ID of the policy set that owns the parameter. | | `:parameter\_id` | The ID of the parameter to be deleted. | ### Sample Request ```bash $ curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request DELETE \ https://app.terraform.io/api/v2/policy-sets/polset-u3S5p2Uwk21keu1s/parameters/var-yRmifb4PJj7cLkMG ``` | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/policy-set-params.mdx | main | terraform | [
0.007096482440829277,
0.045165661722421646,
-0.02767917513847351,
0.03229214623570442,
-0.10166280716657639,
-0.07216241210699081,
-0.0037961092311888933,
0.005245199892669916,
0.025095220655202866,
-0.022190706804394722,
-0.0491277240216732,
-0.11260432004928589,
0.025116413831710815,
0.0... | 0.013053 |
[200]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/200 [201]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/201 [202]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/202 [204]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/204 [400]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/400 [401]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/401 [403]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/403 [404]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/404 [409]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/409 [412]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/412 [422]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/422 [429]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429 [500]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500 [504]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504 [JSON API document]: /terraform/cloud-docs/api-docs#json-api-documents [JSON API error object]: https://jsonapi.org/format/#error-objects # Organizations API reference The Organizations API is used to list, show, create, update, and destroy organizations. ## List Organizations `GET /organizations` | Status | Response | Reason | | ------- | ----------------------------------------------- | ------------------------------------------------------------- | | [200][] | [JSON API document][] (`type: "organizations"`) | The request was successful | | [404][] | [JSON API error object][] | Organization not found or user unauthorized to perform action | ### Query Parameters This endpoint supports pagination [with standard URL query parameters](/terraform/cloud-docs/api-docs#query-parameters). Remember to percent-encode `[` as `%5B` and `]` as `%5D` if your tooling doesn't automatically encode URLs. Currently, this endpoint returns a full, unpaginated list of organizations (without pagination metadata) if both of the pagination query parameters are omitted. To avoid inconsistent behavior, we recommend always supplying pagination parameters when building against this API. | Parameter | Description | | -------------- | ----------------------------------------------------------------------------- | | `q` | \*\*Optional.\*\* A search query string. Organizations are searchable by name and notification email. This query takes precedence over the attribute specific searches `q[email]` or `q[name]`. | | `q[email]` | \*\*Optional.\*\* A search query string. This query searches organizations by notification email. If used with `q[name]`, it returns organizations that match both queries. | | `q[name]` | \*\*Optional.\*\* A search query string. This query searches organizations by name. If used with `q[email]`, it returns organizations that match both queries. | | `page[number]` | \*\*Optional.\*\* Defaults to the first page, if omitted when `page[size]` is provided. | | `page[size]` | \*\*Optional.\*\* Defaults to 20 organizations per page, if omitted when `page[number]` is provided. | ### Sample Request ```shell curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request GET \ https://app.terraform.io/api/v2/organizations\?page\[number\]\=1\&page\[size\]\=20 ``` ### Sample Response \*\*Note:\*\* Only HCP Terraform organizations return the `two-factor-conformant` and `assessments-enforced` properties. ```json { "data": [ { "id": "hashicorp", "type": "organizations", "attributes": { "external-id": "org-Hysjx5eUviuKVCJY", "created-at": "2021-08-24T23:10:04.675Z", "email": "hashicorp@example.com", "session-timeout": null, "session-remember": null, "collaborator-auth-policy": "password", "plan-expired": false, "plan-expires-at": null, "plan-is-trial": false, "plan-is-enterprise": false, "plan-identifier": "developer", "cost-estimation-enabled": true, "send-passing-statuses-for-untriggered-speculative-plans": true, "aggregated-commit-status-enabled": false, "speculative-plan-management-enabled": true, "allow-force-delete-workspaces": true, "name": "hashicorp", "permissions": { "can-update": true, "can-destroy": true, "can-access-via-teams": true, "can-create-module": true, "can-create-team": true, "can-create-workspace": true, "can-manage-users": true, "can-manage-subscription": true, "can-manage-sso": true, "can-update-oauth": true, "can-update-sentinel": true, "can-update-ssh-keys": true, "can-update-api-token": true, "can-traverse": true, "can-start-trial": true, "can-update-agent-pools": true, "can-manage-tags": true, "can-manage-varsets": true, "can-read-varsets": true, "can-manage-public-providers": true, "can-create-provider": true, "can-manage-public-modules": true, "can-manage-custom-providers": false, "can-manage-run-tasks": false, "can-read-run-tasks": false, "can-create-project": true }, "fair-run-queuing-enabled": true, "saml-enabled": false, "owners-team-saml-role-id": null, "two-factor-conformant": false, "assessments-enforced": false, "default-execution-mode": "remote", "user-tokens-enabled": true }, "relationships": { "default-agent-pool": { "data": null }, "oauth-tokens": { "links": { "related": "/api/v2/organizations/hashicorp/oauth-tokens" } }, "authentication-token": { "links": { "related": "/api/v2/organizations/hashicorp/authentication-token" } }, "entitlement-set": { "data": { "id": "org-Hysjx5eUviuKVCJY", "type": "entitlement-sets" }, "links": { "related": "/api/v2/organizations/hashicorp/entitlement-set" } }, "subscription": { "links": { "related": "/api/v2/organizations/hashicorp/subscription" } } }, "links": { "self": "/api/v2/organizations/hashicorp" } }, { "id": "hashicorp-two", "type": "organizations", "attributes": { "external-id": "org-iJ5tr4WgB4WpA1hD", "created-at": "2022-01-04T18:57:16.036Z", "email": "hashicorp@example.com", "session-timeout": null, "session-remember": null, "collaborator-auth-policy": "password", "plan-expired": false, "plan-expires-at": null, "plan-is-trial": false, "plan-is-enterprise": false, "plan-identifier": "free", "cost-estimation-enabled": false, "send-passing-statuses-for-untriggered-speculative-plans": false, "aggregated-commit-status-enabled": true, "speculative-plan-management-enabled": true, "allow-force-delete-workspaces": false, "name": "hashicorp-two", "permissions": { "can-update": true, "can-destroy": true, "can-access-via-teams": true, "can-create-module": true, "can-create-team": false, "can-create-workspace": true, "can-manage-users": true, "can-manage-subscription": true, "can-manage-sso": false, "can-update-oauth": true, "can-update-sentinel": false, "can-update-ssh-keys": true, "can-update-api-token": true, "can-traverse": true, "can-start-trial": true, "can-update-agent-pools": false, "can-manage-tags": true, "can-manage-varsets": true, "can-read-varsets": true, "can-manage-public-providers": true, "can-create-provider": true, "can-manage-public-modules": true, "can-manage-custom-providers": false, "can-manage-run-tasks": false, "can-read-run-tasks": false, "can-create-project": false }, "fair-run-queuing-enabled": true, "saml-enabled": false, "owners-team-saml-role-id": null, | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/organizations.mdx | main | terraform | [
-0.015784088522195816,
-0.01700746826827526,
-0.018668580800294876,
-0.028096551075577736,
-0.024631375446915627,
-0.08318780362606049,
-0.0621652752161026,
-0.07521579414606094,
-0.005580500699579716,
-0.03855427727103233,
0.03281282261013985,
0.0540321059525013,
0.006812138482928276,
-0.... | 0.052879 |
false, "can-create-workspace": true, "can-manage-users": true, "can-manage-subscription": true, "can-manage-sso": false, "can-update-oauth": true, "can-update-sentinel": false, "can-update-ssh-keys": true, "can-update-api-token": true, "can-traverse": true, "can-start-trial": true, "can-update-agent-pools": false, "can-manage-tags": true, "can-manage-varsets": true, "can-read-varsets": true, "can-manage-public-providers": true, "can-create-provider": true, "can-manage-public-modules": true, "can-manage-custom-providers": false, "can-manage-run-tasks": false, "can-read-run-tasks": false, "can-create-project": false }, "fair-run-queuing-enabled": true, "saml-enabled": false, "owners-team-saml-role-id": null, "two-factor-conformant": false, "assessments-enforced": false, "default-execution-mode": "remote", "user-tokens-enabled": true }, "relationships": { "default-agent-pool": { "data": null }, "oauth-tokens": { "links": { "related": "/api/v2/organizations/hashicorp-two/oauth-tokens" } }, "authentication-token": { "links": { "related": "/api/v2/organizations/hashicorp-two/authentication-token" } }, "entitlement-set": { "data": { "id": "org-iJ5tr4WgB4WpA1hD", "type": "entitlement-sets" }, "links": { "related": "/api/v2/organizations/hashicorp-two/entitlement-set" } }, "subscription": { "links": { "related": "/api/v2/organizations/hashicorp-two/subscription" } } }, "links": { "self": "/api/v2/organizations/hashicorp-two" } } ], "links": { "self": "https://tfe-zone-b0c8608c.ngrok.io/api/v2/organizations?page%5Bnumber%5D=1&page%5Bsize%5D=20", "first": "https://tfe-zone-b0c8608c.ngrok.io/api/v2/organizations?page%5Bnumber%5D=1&page%5Bsize%5D=20", "prev": null, "next": null, "last": "https://tfe-zone-b0c8608c.ngrok.io/api/v2/organizations?page%5Bnumber%5D=1&page%5Bsize%5D=20" }, "meta": { "pagination": { "current-page": 1, "page-size": 20, "prev-page": null, "next-page": null, "total-pages": 1, "total-count": 2 } } } ``` ## Show an Organization `GET /organizations/:organization\_name` | Parameter | Description | | -------------------- | ------------------------------------ | | `:organization\_name` | The name of the organization to show | | Status | Response | Reason | | ------- | ----------------------------------------------- | ------------------------------------------------------------- | | [200][] | [JSON API document][] (`type: "organizations"`) | The request was successful | | [404][] | [JSON API error object][] | Organization not found or user unauthorized to perform action | ### Sample Request ```shell curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request GET \ https://app.terraform.io/api/v2/organizations/hashicorp ``` ### Sample Response \*\*Note:\*\* Only HCP Terraform organizations return the `two-factor-conformant` and `assessments-enforced` properties. ```json { "data": { "id": "hashicorp", "type": "organizations", "attributes": { "external-id": "org-WV6DfwfxxXvLfvfs", "created-at": "2020-03-26T22:13:38.456Z", "email": "user@example.com", "session-timeout": null, "session-remember": null, "collaborator-auth-policy": "password", "plan-expired": false, "plan-expires-at": null, "plan-is-trial": false, "plan-is-enterprise": false, "cost-estimation-enabled": false, "send-passing-statuses-for-untriggered-speculative-plans": false, "aggregated-commit-status-enabled": true, "speculative-plan-management-enabled": true, "allow-force-delete-workspaces": false, "name": "hashicorp", "permissions": { "can-update": true, "can-destroy": true, "can-access-via-teams": true, "can-create-module": true, "can-create-team": false, "can-create-workspace": true, "can-manage-users": true, "can-manage-subscription": true, "can-manage-sso": false, "can-update-oauth": true, "can-update-sentinel": false, "can-update-ssh-keys": true, "can-update-api-token": true, "can-traverse": true, "can-start-trial": true, "can-update-agent-pools": false, "can-manage-tags": true, "can-manage-public-modules": true, "can-manage-public-providers": false, "can-manage-run-tasks": false, "can-read-run-tasks": false, "can-create-provider": false, "can-create-project": true }, "fair-run-queuing-enabled": true, "saml-enabled": false, "owners-team-saml-role-id": null, "two-factor-conformant": false, "assessments-enforced": false, "default-execution-mode": "remote", "user-tokens-enabled": true }, "relationships": { "default-agent-pool": { "data": null }, "oauth-tokens": { "links": { "related": "/api/v2/organizations/hashicorp/oauth-tokens" } }, "authentication-token": { "links": { "related": "/api/v2/organizations/hashicorp/authentication-token" } }, "entitlement-set": { "data": { "id": "org-WV6DfwfxxXvLfvfs", "type": "entitlement-sets" }, "links": { "related": "/api/v2/organizations/hashicorp/entitlement-set" } }, "subscription": { "links": { "related": "/api/v2/organizations/hashicorp/subscription" } } }, "links": { "self": "/api/v2/organizations/hashicorp" } } } ``` ## Create an Organization `POST /organizations` | Status | Response | Reason | | ------- | ----------------------------------------------- | -------------------------------------------------------------- | | [201][] | [JSON API document][] (`type: "organizations"`) | The organization was successfully created | | [404][] | [JSON API error object][] | Organization not found or user unauthorized to perform action | | [422][] | [JSON API error object][] | Malformed request body (missing attributes, wrong types, etc.) | ### Request Body This POST endpoint requires a JSON object with the following properties as a request payload. Properties without a default value are required. | Key path | Type | Default | Description | | ------------------------------------------------------------------------- | ------- | --------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `data.type` | string | | Must be `"organizations"` | | `data.attributes.name` | string | | Name of the organization | | `data.attributes.email` | string | | Admin email address | | `data.attributes.session-timeout` | integer | 20160 | Session timeout after inactivity (minutes) | | `data.attributes.session-remember` | integer | 20160 | Session expiration (minutes) | | `data.attributes.collaborator-auth-policy` | string | password | Authentication policy (`password` or `two\_factor\_mandatory`) | | `data.attributes.cost-estimation-enabled` | boolean | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/organizations.mdx | main | terraform | [
-0.07497815042734146,
-0.09230618923902512,
-0.14304780960083008,
0.03565707057714462,
0.04064434766769409,
-0.01835588365793228,
0.03320130333304405,
-0.08006225526332855,
-0.04618522524833679,
0.04741784930229187,
0.10333145409822464,
0.013440841808915138,
0.06085674464702606,
0.04864866... | 0.157797 |
`data.attributes.email` | string | | Admin email address | | `data.attributes.session-timeout` | integer | 20160 | Session timeout after inactivity (minutes) | | `data.attributes.session-remember` | integer | 20160 | Session expiration (minutes) | | `data.attributes.collaborator-auth-policy` | string | password | Authentication policy (`password` or `two\_factor\_mandatory`) | | `data.attributes.cost-estimation-enabled` | boolean | false | Whether or not the cost estimation feature is enabled for all workspaces in the organization. Defaults to false. In Terraform Enterprise, you must also enable cost estimation in [Site Administration](/terraform/enterprise/application-administration/integration#cost-estimation-integration). | | `data.attributes.send-passing-statuses-for-untriggered-speculative-plans` | boolean | false | Whether or not to send VCS status updates for untriggered speculative plans. This can be useful if large numbers of untriggered workspaces are exhausting request limits for connected version control service providers like GitHub. Defaults to false. In Terraform Enterprise, this setting is always false and cannot be changed but is also available in Site Administration. | | `data.attributes.aggregated-commit-status-enabled` | boolean | true | Whether or not to aggregate VCS status updates for triggered workspaces. This is useful for monorepo projects with configuration spanning many workspaces. Defaults to `true`. You cannot use this option if `send-passing-statuses-for-untriggered-speculative-plans` is set to `true`. | | `data.attributes.speculative-plan-management-enabled` | boolean | true | Whether or not to enable [Automatically cancel plan-only runs](/terraform/cloud-docs/users-teams-organizations/organizations/vcs-speculative-plan-management). Defaults to `true`. | | `data.attributes.owners-team-saml-role-id` | string | (nothing) | \*\*Optional.\*\* \*\*SAML only\*\* The name of the ["owners" team](/terraform/enterprise/saml/team-membership#managing-membership-of-the-owners-team) | | `data.attributes.assessments-enforced` | boolean | (false) | Whether or not to compel health assessments for all eligible workspaces. When true, health assessments occur on all compatible workspaces, regardless of the value of the workspace setting `assessments-enabled`. When false, health assessments only occur for workspaces that opt in by setting `assessments-enabled: true`. | | `data.attributes.allow-force-delete-workspaces` | boolean | (false) | Whether workspace administrators can [delete workspaces with resources under management](/terraform/cloud-docs/users-teams-organizations/organizations#general). If false, only organization owners may delete these workspaces. | | `data.attributes.default-execution-mode` | string | `remote` | Which [execution mode](/terraform/cloud-docs/workspaces/settings#execution-mode) to use by default. Valid values are `remote`, `local`, and `agent`. | | `data.attributes.default-agent-pool-id` | string | (previous value) | Required when `default-execution-mode` is set to `agent`. The ID of the agent pool belonging to the organization. Do \_not\_ specify this value if you set `execution-mode` to `remote` or `local`. | | `data.attributes.enforce-hyok` | boolean | false | Whether or not new workspaces within the organization are created with hold your own key enabled. Your organization must have a primary HYOK configuration before enabling `enforce-hyok`. Hold your own key is only available in HCP Terraform. Refer to [Encrypt your state and plan files](/terraform/cloud-docs/hold-your-own-key) for more information. | | `data.attributes.user-tokens-enabled` | boolean | true | Whether or not user tokens can access an organization's resources through the API. Defaults to `true`. | ### Sample Payload ```json { "data": { "type": "organizations", "attributes": { "name": "hashicorp", "email": "user@example.com" } } } ``` ### Sample Request ```shell curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request POST \ --data @payload.json \ https://app.terraform.io/api/v2/organizations ``` ### Sample Response \*\*Note:\*\* Only HCP Terraform organizations return the `two-factor-conformant` and `assessments-enforced` properties. ```json { "data": { "id": "hashicorp", "type": "organizations", "attributes": { "external-id": "org-Bzyc2JuegvVLAibn", "created-at": "2021-08-30T18:09:57.561Z", "email": "user@example.com", "session-timeout": null, "session-remember": null, "collaborator-auth-policy": "password", "plan-expired": false, "plan-expires-at": null, "plan-is-trial": false, "plan-is-enterprise": false, "cost-estimation-enabled": false, "send-passing-statuses-for-untriggered-speculative-plans": false, "aggregated-commit-status-enabled": true, "speculative-plan-management-enabled": true, "allow-force-delete-workspaces": false, "name": "hashicorp", "permissions": { "can-update": true, "can-destroy": true, "can-access-via-teams": true, "can-create-module": true, "can-create-team": false, "can-create-workspace": true, "can-manage-users": true, "can-manage-subscription": true, "can-manage-sso": false, "can-update-oauth": true, "can-update-sentinel": false, "can-update-ssh-keys": true, "can-update-api-token": true, "can-traverse": true, "can-start-trial": true, "can-update-agent-pools": false, "can-manage-tags": true, "can-manage-public-modules": true, "can-manage-public-providers": false, "can-manage-run-tasks": false, "can-read-run-tasks": false, "can-create-provider": false, "can-create-project": true }, "fair-run-queuing-enabled": true, "saml-enabled": false, | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/organizations.mdx | main | terraform | [
0.007683408446609974,
0.018575863912701607,
0.01942772977054119,
0.07758435606956482,
0.008553079329431057,
-0.04414800927042961,
-0.010256879962980747,
-0.07387298345565796,
0.03643735125660896,
0.13466623425483704,
-0.035089414566755295,
-0.07814391702413559,
0.025258423760533333,
0.0074... | -0.021336 |
true, "can-destroy": true, "can-access-via-teams": true, "can-create-module": true, "can-create-team": false, "can-create-workspace": true, "can-manage-users": true, "can-manage-subscription": true, "can-manage-sso": false, "can-update-oauth": true, "can-update-sentinel": false, "can-update-ssh-keys": true, "can-update-api-token": true, "can-traverse": true, "can-start-trial": true, "can-update-agent-pools": false, "can-manage-tags": true, "can-manage-public-modules": true, "can-manage-public-providers": false, "can-manage-run-tasks": false, "can-read-run-tasks": false, "can-create-provider": false, "can-create-project": true }, "fair-run-queuing-enabled": true, "saml-enabled": false, "owners-team-saml-role-id": null, "two-factor-conformant": false, "assessments-enforced": false, "default-execution-mode": "remote", "user-tokens-enabled": true }, "relationships": { "default-agent-pool": { "data": null }, "oauth-tokens": { "links": { "related": "/api/v2/organizations/hashicorp/oauth-tokens" } }, "authentication-token": { "links": { "related": "/api/v2/organizations/hashicorp/authentication-token" } }, "entitlement-set": { "data": { "id": "org-Bzyc2JuegvVLAibn", "type": "entitlement-sets" }, "links": { "related": "/api/v2/organizations/hashicorp/entitlement-set" } }, "subscription": { "links": { "related": "/api/v2/organizations/hashicorp/subscription" } } }, "links": { "self": "/api/v2/organizations/hashicorp" } }, "included": [ { "id": "org-Bzyc2JuegvVLAibn", "type": "entitlement-sets", "attributes": { "agents": false, "audit-logging": false, "configuration-designer": true, "cost-estimation": false, "global-run-tasks": false, "module-tests-generation": false, "operations": true, "policy-enforcement": false, "policy-limit": null, "policy-mandatory-enforcement-limit": null, "policy-set-limit": null, "private-module-registry": true, "run-task-limit": null, "run-task-mandatory-enforcement-limit": null, "run-task-workspace-limit": null, "run-tasks": false, "self-serve-billing": true, "sentinel": false, "sso": false, "state-storage": true, "teams": false, "usage-reporting": false, "user-limit": 5, "vcs-integrations": true, "versioned-policy-set-limit": null }, "links": { "self": "/api/v2/entitlement-sets/org-Bzyc2JuegvVLAibn" } } ] } ``` ## Update an Organization `PATCH /organizations/:organization\_name` | Parameter | Description | | -------------------- | -------------------------------------- | | `:organization\_name` | The name of the organization to update | | Status | Response | Reason | | ------- | ----------------------------------------------- | -------------------------------------------------------------- | | [200][] | [JSON API document][] (`type: "organizations"`) | The organization was successfully updated | | [404][] | [JSON API error object][] | Organization not found or user unauthorized to perform action | | [422][] | [JSON API error object][] | Malformed request body (missing attributes, wrong types, etc.) | ### Request Body This PATCH endpoint requires a JSON object with the following properties as a request payload. | Key path | Type | Default | Description | | ------------------------------------------------------------------------- | ------- | --------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `data.type` | string | | Must be `"organizations"` | | `data.attributes.name` | string | | Name of the organization | | `data.attributes.email` | string | | Admin email address | | `data.attributes.session-timeout` | integer | 20160 | Session timeout after inactivity (minutes) | | `data.attributes.session-remember` | integer | 20160 | Session expiration (minutes) | | `data.attributes.collaborator-auth-policy` | string | password | Authentication policy (`password` or `two\_factor\_mandatory`) | | `data.attributes.cost-estimation-enabled` | boolean | false | Whether or not the cost estimation feature is enabled for all workspaces in the organization. Defaults to false. In Terraform Enterprise, you must also enable cost estimation in [Site Administration](/terraform/enterprise/application-administration/integration#cost-estimation-integration). | | `data.attributes.send-passing-statuses-for-untriggered-speculative-plans` | boolean | false | Whether or not to send VCS status updates for untriggered speculative plans. This can be useful if large numbers of untriggered workspaces are exhausting request limits for connected version control service providers like GitHub. Defaults to false. In Terraform Enterprise, this setting is always false and cannot be changed but is also available in Site Administration. | | `data.attributes.aggregated-commit-status-enabled` | boolean | true | Whether or not to aggregate VCS status updates for triggered workspaces. This is useful for monorepo projects with configuration spanning many workspaces. Defaults to `true`. You cannot use this option if `send-passing-statuses-for-untriggered-speculative-plans` is set to `true`. | | `data.attributes.speculative-plan-management-enabled` | boolean | true | Whether or not to enable [Automatically cancel plan-only runs](/terraform/cloud-docs/users-teams-organizations/organizations/vcs-speculative-plan-management). Defaults to `true`. | | `data.attributes.owners-team-saml-role-id` | string | (nothing) | \*\*Optional.\*\* \*\*SAML only\*\* The name of the ["owners" team](/terraform/enterprise/saml/team-membership#managing-membership-of-the-owners-team) | | `data.attributes.assessments-enforced` | boolean | false | Whether or not to compel health assessments for all eligible workspaces. When true, health assessments occur on all compatible workspaces, regardless of the value of the workspace setting `assessments-enabled`. When false, | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/organizations.mdx | main | terraform | [
-0.0756801888346672,
-0.056104645133018494,
-0.13285993039608002,
0.013286626897752285,
0.05414670705795288,
-0.019683020189404488,
0.008721534162759781,
-0.08555930852890015,
-0.03498971462249756,
0.0473579578101635,
0.09460484981536865,
0.033122316002845764,
0.06165364384651184,
0.044062... | 0.174259 |
(nothing) | \*\*Optional.\*\* \*\*SAML only\*\* The name of the ["owners" team](/terraform/enterprise/saml/team-membership#managing-membership-of-the-owners-team) | | `data.attributes.assessments-enforced` | boolean | false | Whether or not to compel health assessments for all eligible workspaces. When true, health assessments occur on all compatible workspaces, regardless of the value of the workspace setting `assessments-enabled`. When false, health assessments only occur for workspaces that opt in by setting `assessments-enabled: true`. | | `data.attributes.allow-force-delete-workspaces` | boolean | false | Whether workspace administrators can [delete workspaces with resources under management](/terraform/cloud-docs/users-teams-organizations/organizations#general). If false, only organization owners may delete these workspaces. | | `data.attributes.default-execution-mode` | string | `remote` | Which [execution mode](/terraform/cloud-docs/workspaces/settings#execution-mode) to use by default. Valid values are `remote`, `local`, and `agent`. | | `data.attributes.default-agent-pool-id` | string | (previous value) | Required when `default-execution-mode` is set to `agent`. The ID of the agent pool belonging to the organization. Do \_not\_ specify this value if you set `execution-mode` to `remote` or `local`. | | `data.attributes.enforce-hyok` | boolean | false | Whether or not new workspaces within the organization are created with hold your own key (HYOK) enabled. Your organization must have a primary HYOK configuration before enabling `enforce-hyok`. Hold your own key is only available in HCP Terraform. Refer to [Encrypt your state and plan files](/terraform/cloud-docs/hold-your-own-key) for more information. | | `data.attributes.user-tokens-enabled` | boolean | true | Whether or not user tokens can access an organization's resources through the API. Defaults to `true`. | ### Sample Payload ```json { "data": { "type": "organizations", "attributes": { "email": "admin@example.com" } } } ``` ### Sample Request ```shell curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request PATCH \ --data @payload.json \ https://app.terraform.io/api/v2/organizations/hashicorp ``` ### Sample Response \*\*Note:\*\* The `two-factor-conformant` and `assessments-enforced` properties are only returned from HCP Terraform organizations. ```json { "data": { "id": "hashicorp", "type": "organizations", "attributes": { "external-id": "org-Bzyc2JuegvVLAibn", "created-at": "2021-08-30T18:09:57.561Z", "email": "admin@example.com", "session-timeout": null, "session-remember": null, "collaborator-auth-policy": "password", "plan-expired": false, "plan-expires-at": null, "plan-is-trial": false, "plan-is-enterprise": false, "cost-estimation-enabled": false, "send-passing-statuses-for-untriggered-speculative-plans": false, "aggregated-commit-status-enabled": true, "speculative-plan-management-enabled": true, "name": "hashicorp", "permissions": { "can-update": true, "can-destroy": true, "can-access-via-teams": true, "can-create-module": true, "can-create-team": false, "can-create-workspace": true, "can-manage-users": true, "can-manage-subscription": true, "can-manage-sso": false, "can-update-oauth": true, "can-update-sentinel": false, "can-update-ssh-keys": true, "can-update-api-token": true, "can-traverse": true, "can-start-trial": true, "can-update-agent-pools": false, "can-manage-tags": true, "can-manage-public-modules": true, "can-manage-public-providers": false, "can-manage-run-tasks": false, "can-read-run-tasks": false, "can-create-provider": false, "can-create-project": true }, "fair-run-queuing-enabled": true, "saml-enabled": false, "owners-team-saml-role-id": null, "two-factor-conformant": false, "assessments-enforced": false, "default-execution-mode": "remote", "user-tokens-enabled": true }, "relationships": { "default-agent-pool": { "data": null }, "oauth-tokens": { "links": { "related": "/api/v2/organizations/hashicorp/oauth-tokens" } }, "authentication-token": { "links": { "related": "/api/v2/organizations/hashicorp/authentication-token" } }, "entitlement-set": { "data": { "id": "org-Bzyc2JuegvVLAibn", "type": "entitlement-sets" }, "links": { "related": "/api/v2/organizations/hashicorp/entitlement-set" } }, "subscription": { "links": { "related": "/api/v2/organizations/hashicorp/subscription" } } }, "links": { "self": "/api/v2/organizations/hashicorp" } } } ``` ## Destroy an Organization `DELETE /organizations/:organization\_name` | Parameter | Description | | -------------------- | --------------------------------------- | | `:organization\_name` | The name of the organization to destroy | | Status | Response | Reason | | ------- | ------------------------- | ------------------------------------------------------------- | | [204][] | | The organization was successfully destroyed | | [404][] | [JSON API error object][] | Organization not found or user unauthorized to perform action | ### Sample Request ```shell curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request DELETE \ https://app.terraform.io/api/v2/organizations/hashicorp ``` ### Sample Response The response body will be empty if successful. ## Show the Entitlement Set This endpoint shows the [entitlements](/terraform/cloud-docs/api-docs#feature-entitlements) for an organization. `GET /organizations/:organization\_name/entitlement-set` | Parameter | Description | | -------------------- | ------------------------------------------------------ | | `:organization\_name` | The name of the organization's entitlement set to view | | Status | Response | Reason | | ------- | -------------------------------------------------- | ------------------------------------------------------------- | | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/organizations.mdx | main | terraform | [
-0.03997606784105301,
0.0039308033883571625,
0.011174616403877735,
0.08739098161458969,
0.0296368096023798,
-0.036456942558288574,
0.013098511844873428,
-0.17083829641342163,
0.019664259627461433,
0.0764765664935112,
0.03602384403347969,
-0.01701122708618641,
0.058875154703855515,
0.058537... | -0.03104 |
the Entitlement Set This endpoint shows the [entitlements](/terraform/cloud-docs/api-docs#feature-entitlements) for an organization. `GET /organizations/:organization\_name/entitlement-set` | Parameter | Description | | -------------------- | ------------------------------------------------------ | | `:organization\_name` | The name of the organization's entitlement set to view | | Status | Response | Reason | | ------- | -------------------------------------------------- | ------------------------------------------------------------- | | [200][] | [JSON API document][] (`type: "entitlement-sets"`) | The request was successful | | [404][] | [JSON API error object][] | Organization not found or user unauthorized to perform action | ### Sample Request ```shell curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ https://app.terraform.io/api/v2/organizations/hashicorp/entitlement-set ``` ### Sample Response ```json { "data": { "id": "org-Bzyc2JuegvVLAibn", "type": "entitlement-sets", "attributes": { "agents": false, "audit-logging": false, "configuration-designer": true, "cost-estimation": false, "global-run-tasks": false, "module-tests-generation": false, "operations": true, "policy-enforcement": false, "policy-limit": 5, "policy-mandatory-enforcement-limit": null, "policy-set-limit": 1, "private-module-registry": true, "private-policy-agents": false, "private-run-tasks": true, "private-vcs": false, "run-task-limit": 1, "run-task-mandatory-enforcement-limit": 1, "run-task-workspace-limit": 10, "run-tasks": false, "self-serve-billing": true, "sentinel": false, "sso": false, "state-storage": true, "teams": false, "usage-reporting": false, "user-limit": 5, "vcs-integrations": true, "versioned-policy-set-limit": null }, "links": { "self": "/api/v2/entitlement-sets/org-Bzyc2JuegvVLAibn" } } } ``` ## Show Module Producers This endpoint shows organizations that are configured to share modules with an organization through [module sharing](/terraform/enterprise/api-docs/admin/registry-sharing). `GET /organizations/:organization\_name/relationships/module-producers` | Parameter | Description | | -------------------- | ------------------------------------------------------- | | `:organization\_name` | The name of the organization's module producers to view | | Status | Response | Reason | | ------- | ----------------------------------------------- | ------------------------------------------------------------- | | [200][] | [JSON API document][] (`type: "organizations"`) | The request was successful | | [404][] | [JSON API error object][] | Organization not found or user unauthorized to perform action | ### Query Parameters This endpoint supports pagination [with standard URL query parameters](/terraform/cloud-docs/api-docs#query-parameters). Remember to percent-encode `[` as `%5B` and `]` as `%5D` if your tooling doesn't automatically encode URLs. | Parameter | Description | | -------------- | -------------------------------------------------------------------------------- | | `page[number]` | \*\*Optional.\*\* If omitted, the endpoint will return the first page. | | `page[size]` | \*\*Optional.\*\* If omitted, the endpoint will return 20 module producers per page. | ### Sample Request ```shell curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ https://tfe.example.com/api/v2/organizations/hashicorp/relationships/module-producers ``` ### Sample Response ```json { "data": [ { "id": "hc-nomad", "type": "organizations", "attributes": { "name": "hc-nomad", "external-id": "org-ArQSQMAkFQsSUZjB" }, "links": { "self": "/api/v2/organizations/hc-nomad" } } ], "links": { "self": "https://tfe.example.com/api/v2/organizations/hashicorp/relationships/module-producers?page%5Bnumber%5D=1&page%5Bsize%5D=20", "first": "https://tfe.example.com/api/v2/organizations/hashicorp/relationships/module-producers?page%5Bnumber%5D=1&page%5Bsize%5D=20", "prev": null, "next": null, "last": "https://tfe.example.com/api/v2/organizations/hashicorp/relationships/module-producers?page%5Bnumber%5D=1&page%5Bsize%5D=20" }, "meta": { "pagination": { "current-page": 1, "prev-page": null, "next-page": null, "total-pages": 1, "total-count": 1 } } } ``` ## Show data retention policy `GET /organizations/:organization\_name/relationships/data-retention-policy` | Parameter | Description | | ---------------------| --------------------------------------------------------------------| | `:organization\_name` | The name of the organization to show the data retention policy for. | This endpoint shows the data retention policy set explicitly on the organization. When no data retention policy is set for the organization, the endpoint returns the default policy configured for the Terraform Enterprise installation. Read more about [organization data retention policies](/terraform/enterprise/users-teams-organizations/organizations#data-retention-policies). For additional information, refer to [Data Retention Policy Types](/terraform/enterprise/api-docs/data-retention-policies#data-retention-policy-types) in the Terraform Enterprise documentation. ## Create or update data retention policy `POST /organizations/:organization\_name/relationships/data-retention-policy` | Parameter | Description | | -------------------- | -------------------------------------------------------------------------- | | `:organization\_name` | The name of the organization to update the data retention policy for. | This endpoint creates a data retention policy for an organization or updates the existing policy. Read more about [organization data retention policies](/terraform/enterprise/users-teams-organizations/organizations#data-retention-policies). Refer to [Data Retention Policy API](/terraform/enterprise/api-docs/data-retention-policies#create-or-update-data-retention-policy) in the Terraform Enterprise documentation for details. ## Remove data retention policy `DELETE /organizations/:organization\_name/relationships/data-retention-policy` | Parameter | Description | | ---------------------| -------------------------------------------------------------------------- | | `:organization\_name` | The name of the organization to remove the data retention policy for. | This | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/organizations.mdx | main | terraform | [
-0.020131617784500122,
0.0442391037940979,
0.012536589056253433,
-0.035117004066705704,
0.004263924900442362,
-0.006638870108872652,
-0.046204548329114914,
-0.018424082547426224,
0.006974187679588795,
0.0796993151307106,
-0.010114057920873165,
-0.1474195122718811,
0.03312566131353378,
-0.0... | 0.033744 |
[organization data retention policies](/terraform/enterprise/users-teams-organizations/organizations#data-retention-policies). Refer to [Data Retention Policy API](/terraform/enterprise/api-docs/data-retention-policies#create-or-update-data-retention-policy) in the Terraform Enterprise documentation for details. ## Remove data retention policy `DELETE /organizations/:organization\_name/relationships/data-retention-policy` | Parameter | Description | | ---------------------| -------------------------------------------------------------------------- | | `:organization\_name` | The name of the organization to remove the data retention policy for. | This endpoint removes the data retention policy explicitly set on an organization. When the data retention policy is deleted, the organization inherits the default policy configured for the Terraform Enterprise installation. Refer to [Data Retention Policies](/terraform/enterprise/application-administration/general#data-retention-policies) for additional information. Refer to [Data Retention Policies](/terraform/enterprise/users-teams-organizations/organizations#data-retention-policies) for information about configuring data retention policies for an organization. Refer to [Data Retention Policy API](/terraform/enterprise/api-docs/data-retention-policies#remove-data-retention-policy) in the Terraform Enterprise documentation for details. ## Available Related Resources The GET endpoints above can optionally return related resources, if requested with [the `include` query parameter](/terraform/cloud-docs/api-docs#inclusion-of-related-resources). The following resource types are available: | Resource Name | Description | | --------------------- | -------------------------------------------------------------------------------------------- | | `entitlement\_set` | The entitlement set that determines which HCP Terraform features the organization can use. | ## Relationships The following relationships may be present in various responses. | Resource Name | Description | | --------------------- | ----------------------------------------------------------------------------------------------------------------------------- | | `module-producers` | Other organizations configured to share modules with the organization. | | `oauth-tokens` | OAuth tokens associated with VCS configurations for the organization. | | `authentication-token` | The API token for an organization. | | `entitlement-set` | The entitlement set that determines which HCP Terraform features the organization can use. | | `subscription` | The current subscription for an organization. | | `default-agent-pool` | An organization's default agent pool. Set this value if your `default-execution-mode` is `agent`. | | `data-retention-policy` | Specifies an organization's data retention policy. Refer to [Data Retention Policy APIs](/terraform/enterprise/api-docs/data-retention-policies) in the Terraform Enterprise documentation for more details. | | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/organizations.mdx | main | terraform | [
-0.07544413208961487,
0.03987163305282593,
-0.011742066591978073,
0.02086774632334709,
0.010923333466053009,
-0.03412312641739845,
0.004082836210727692,
-0.1299840211868286,
0.0784091129899025,
0.06848832219839096,
0.05977651849389076,
0.005087933503091335,
0.030159935355186462,
-0.0072802... | 0.127225 |
[200]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/200 [201]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/201 [202]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/202 [204]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/204 [400]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/400 [401]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/401 [403]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/403 [404]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/404 [409]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/409 [412]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/412 [422]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/422 [429]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429 [500]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500 [504]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504 [JSON API document]: /terraform/cloud-docs/api-docs#json-api-documents [JSON API error object]: https://jsonapi.org/format/#error-objects # Run triggers API reference You can establish connections between one or more workspaces in your organization and use the `run-triggers` endpoint to allow HCP Terraform to automatically queue runs in your workspace when a successful run apply operation is performed in any of the source workspaces. You can connect each workspace to up to 20 source workspaces. ## Create a Run Trigger `POST /workspaces/:workspace\_id/run-triggers` | Parameter | Description | | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `:workspace\_id` | The ID of the workspace to create the run trigger in. Obtain this from the [workspace settings](/terraform/cloud-docs/workspaces/settings) or the [Show Workspace](/terraform/cloud-docs/api-docs/workspaces#show-workspace) endpoint. | | Status | Response | Reason | | ------- | ---------------------------------------------- | ------------------------------------------------------------------------ | | [201][] | [JSON API document][] (`type: "run-triggers"`) | Successfully created a run trigger | | [404][] | [JSON API error object][] | Workspace or sourceable not found or user unauthorized to perform action | | [422][] | [JSON API error object][] | Malformed request body (missing attributes, wrong types, etc.) | ### Permissions In order to create a run trigger, the user must have admin access to the specified workspace and permission to read runs for the sourceable workspace. ([More about permissions.](/terraform/cloud-docs/users-teams-organizations/permissions)) [permissions-citation]: #intentionally-unused---keep-for-maintainers ### Request Body This POST endpoint requires a JSON object with the following properties as a request payload. Properties without a default value are required. | Key path | Type | Default | Description | | ------------------------------------ | ------ | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `data.relationships.sourceable.data` | object | | A JSON API relationship object that represents the source workspace for the run trigger. This object must have `id` and `type` properties, and the `type` property must be `workspaces` (e.g. `{ "id": "ws-2HRvNs49EWPjDqT1", "type": "workspaces" }`). Obtain workspace IDs from the [workspace settings](/terraform/cloud-docs/workspaces/settings) or the [Show Workspace](/terraform/cloud-docs/api-docs/workspaces#show-workspace) endpoint. | ### Sample Payload ```json { "data": { "relationships": { "sourceable": { "data": { "id": "ws-2HRvNs49EWPjDqT1", "type": "workspaces" } } } } } ``` ### Sample Request ```shell curl \ --request POST \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --data @payload.json \ https://app.terraform.io/api/v2/workspaces/ws-XdeUVMWShTesDMME/run-triggers ``` ### Sample Response ```json { "data": { "id": "rt-3yVQZvHzf5j3WRJ1", "type": "run-triggers", "attributes": { "workspace-name": "workspace-1", "sourceable-name": "workspace-2", "created-at": "2018-09-11T18:21:21.784Z" }, "relationships": { "workspace": { "data": { "id": "ws-XdeUVMWShTesDMME", "type": "workspaces" } }, "sourceable": { "data": { "id": "ws-2HRvNs49EWPjDqT1", "type": "workspaces" } } }, "links": { "self": "/api/v2/run-triggers/rt-3yVQZvHzf5j3WRJ1" } } } ``` ## List Run Triggers `GET /workspaces/:workspace\_id/run-triggers` | Parameter | Description | | --------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `:workspace\_id` | The ID of the workspace to list run triggers for. Obtain this from the [workspace settings](/terraform/cloud-docs/workspaces/settings) or the [Show Workspace](/terraform/cloud-docs/api-docs/workspaces#show-workspace) endpoint. | | Status | Response | Reason | | ------- | ---------------------------------------------- | -------------------------------------------------------------------------------------------- | | [200][] | [JSON API document][] (`type: "run-triggers"`) | Request was successful | | [400][] | [JSON API error object][] | Required parameter `filter[run-trigger][type]` is missing or has been given an invalid value | | [404][] | [JSON API error object][] | Workspace not found or user unauthorized to perform action | ### Query Parameters This endpoint supports pagination [with standard URL query parameters](/terraform/cloud-docs/api-docs#query-parameters); remember to percent-encode `[` as `%5B` and `]` as `%5D` if your tooling doesn't automatically encode URLs. | Parameter | Description | | --------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `filter[run-trigger][type]` | \*\*Required\*\* Which type of run triggers to list; valid values are `inbound` or `outbound`. `inbound` run triggers create | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/run-triggers.mdx | main | terraform | [
-0.015784088522195816,
-0.01700746826827526,
-0.018668580800294876,
-0.028096551075577736,
-0.024631375446915627,
-0.08318780362606049,
-0.0621652752161026,
-0.07521579414606094,
-0.005580500699579716,
-0.03855427727103233,
0.03281282261013985,
0.0540321059525013,
0.006812138482928276,
-0.... | 0.052879 |
query parameters](/terraform/cloud-docs/api-docs#query-parameters); remember to percent-encode `[` as `%5B` and `]` as `%5D` if your tooling doesn't automatically encode URLs. | Parameter | Description | | --------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `filter[run-trigger][type]` | \*\*Required\*\* Which type of run triggers to list; valid values are `inbound` or `outbound`. `inbound` run triggers create runs in the specified workspace, and `outbound` run triggers create runs in other workspaces. | | `page[number]` | \*\*Optional.\*\* If omitted, the endpoint will return the first page. | | `page[size]` | \*\*Optional.\*\* If omitted, the endpoint will return 20 run triggers per page. | ### Permissions In order to list run triggers, the user must have permission to read runs for the specified workspace. ([More about permissions.](/terraform/cloud-docs/users-teams-organizations/permissions)) [permissions-citation]: #intentionally-unused---keep-for-maintainers ### Sample Request ```shell curl \ --request GET \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ https://app.terraform.io/api/v2/workspaces/ws-XdeUVMWShTesDMME/run-triggers?filter%5Brun-trigger%5D%5Btype%5D=inbound ``` ### Sample Response ```json { "data": [ { "id": "rt-WygcwSBuYaQWrM39", "type": "run-triggers", "attributes": { "workspace-name": "workspace-1", "sourceable-name": "workspace-2", "created-at": "2018-09-11T18:21:21.784Z" }, "relationships": { "workspace": { "data": { "id": "ws-XdeUVMWShTesDMME", "type": "workspaces" } }, "sourceable": { "data": { "id": "ws-2HRvNs49EWPjDqT1", "type": "workspaces" } } }, "links": { "self": "/api/v2/run-triggers/rt-WygcwSBuYaQWrM39" } }, { "id": "rt-8F5JFydVYAmtTjET", "type": "run-triggers", "attributes": { "workspace-name": "workspace-1", "sourceable-name": "workspace-3", "created-at": "2018-09-11T18:21:21.784Z" }, "relationships": { "workspace": { "data": { "id": "ws-XdeUVMWShTesDMME", "type": "workspaces" } }, "sourceable": { "data": { "id": "ws-BUHBEM97xboT8TVz", "type": "workspaces" } } }, "links": { "self": "/api/v2/run-triggers/rt-8F5JFydVYAmtTjET" } } ], "links": { "self": "https://app.terraform.io/api/v2/workspaces/ws-xdiJLyGpCugbFDE1/run-triggers?filter%5Brun-trigger%5D%5Btype%5D=inbound&page%5Bnumber%5D=1&page%5Bsize%5D=20", "first": "https://app.terraform.io/api/v2/workspaces/ws-xdiJLyGpCugbFDE1/run-triggers?filter%5Brun-trigger%5D%5Btype%5D=inbound&page%5Bnumber%5D=1&page%5Bsize%5D=20", "prev": null, "next": null, "last": "https://app.terraform.io/api/v2/workspaces/ws-xdiJLyGpCugbFDE1/run-triggers?filter%5Brun-trigger%5D%5Btype%5D=inbound&page%5Bnumber%5D=1&page%5Bsize%5D=20" }, "meta": { "pagination": { "current-page": 1, "prev-page": null, "next-page": null, "total-pages": 1, "total-count": 2 } } } ``` ## Show a Run Trigger `GET /run-triggers/:run\_trigger\_id` | Parameter | Description | | ----------------- | ------------------------------------------------------------------------------------ | | `:run\_trigger\_id` | The ID of the run trigger to show. Send a `GET` request to the `run-triggers` endpoint to find IDs. Refer to [List Run Triggers](#list-run-triggers) for details. | | Status | Response | Reason | | ------- | ---------------------------------------------- | ------------------------------------------------------------ | | [200][] | [JSON API document][] (`type: "run-triggers"`) | The request was successful | | [404][] | [JSON API error object][] | Run trigger not found or user unauthorized to perform action | ### Permissions In order to show a run trigger, the user must have permission to read runs for either the workspace or sourceable workspace of the specified run trigger. ([More about permissions.](/terraform/cloud-docs/users-teams-organizations/permissions)) [permissions-citation]: #intentionally-unused---keep-for-maintainers ### Sample Request ```shell curl \ --request GET \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ https://app.terraform.io/api/v2/run-triggers/rt-3yVQZvHzf5j3WRJ1 ``` ### Sample Response ```json { "data": { "id": "rt-3yVQZvHzf5j3WRJ1", "type": "run-triggers", "attributes": { "workspace-name": "workspace-1", "sourceable-name": "workspace-2", "created-at": "2018-09-11T18:21:21.784Z" }, "relationships": { "workspace": { "data": { "id": "ws-XdeUVMWShTesDMME", "type": "workspaces" } }, "sourceable": { "data": { "id": "ws-2HRvNs49EWPjDqT1", "type": "workspaces" } } }, "links": { "self": "/api/v2/run-triggers/rt-3yVQZvHzf5j3WRJ1" } } } ``` ## Delete a Run Trigger `DELETE /run-triggers/:run\_trigger\_id` | Parameter | Description | | ----------------- | -------------------------------------------------------------------------------------- | | `:run\_trigger\_id` | The ID of the run trigger to delete. Send a `GET` request to the `run-triggers` endpoint o find IDs. Refer to [List Run Triggers](#list-run-triggers) for details. | | Status | Response | Reason | | ------- | ------------------------- | ------------------------------------------------------------ | | [204][] | No Content | Successfully deleted the run trigger | | [404][] | [JSON API error object][] | Run trigger not found or user unauthorized to perform action | ### Permissions In order to delete a run trigger, the user must have admin access to the specified workspace. ([More about permissions.](/terraform/cloud-docs/users-teams-organizations/permissions)) [permissions-citation]: #intentionally-unused---keep-for-maintainers ### Sample Request ```shell curl \ --request DELETE \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ https://app.terraform.io/api/v2/run-triggers/rt-3yVQZvHzf5j3WRJ1 ``` | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/run-triggers.mdx | main | terraform | [
-0.018209317699074745,
0.08186934888362885,
0.0195670984685421,
0.027684751898050308,
-0.07306771725416183,
-0.019785350188612938,
-0.03924481198191643,
-0.0318676121532917,
0.04454028978943825,
0.07389137148857117,
-0.04503300040960312,
-0.11704976111650467,
0.06620258837938309,
-0.074290... | -0.048749 |
user unauthorized to perform action | ### Permissions In order to delete a run trigger, the user must have admin access to the specified workspace. ([More about permissions.](/terraform/cloud-docs/users-teams-organizations/permissions)) [permissions-citation]: #intentionally-unused---keep-for-maintainers ### Sample Request ```shell curl \ --request DELETE \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ https://app.terraform.io/api/v2/run-triggers/rt-3yVQZvHzf5j3WRJ1 ``` ## Available Related Resources The GET endpoints above can optionally return related resources, if requested with [the `include` query parameter](/terraform/cloud-docs/api-docs#inclusion-of-related-resources). The following resource types are available: These includes respect read permissions. If you do not have access to read the related resource, it will not be returned. \* `workspace` - The full workspace object. \* `sourceable` - The full source workspace object. | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/run-triggers.mdx | main | terraform | [
-0.03001217730343342,
0.041803788393735886,
0.006231255363672972,
0.00166314747184515,
0.02405349351465702,
-0.03149864077568054,
0.023167703300714493,
-0.10127904266119003,
0.059123169630765915,
0.07428470253944397,
-0.012721248902380466,
-0.0195756908506155,
0.05197416990995407,
0.010970... | 0.028245 |
[200]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/200 [201]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/201 [202]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/202 [204]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/204 [400]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/400 [401]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/401 [403]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/403 [404]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/404 [409]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/409 [412]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/412 [422]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/422 [429]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429 [500]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500 [504]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504 [JSON API document]: /terraform/cloud-docs/api-docs#json-api-documents [JSON API error object]: https://jsonapi.org/format/#error-objects # Organization memberships API reference Users are added to organizations by inviting them to join. Once accepted, they become members of the organization. The Organization Membership resource represents this membership. You can invite users who already have an account, as well as new users. If the user has an existing account with the same email address used to invite them, they can reuse the same login. -> \*\*Note:\*\* Once a user is a member of the organization, you can manage their team memberships using [the Team Membership API](/terraform/cloud-docs/api-docs/team-members). ## Invite a User to an Organization `POST /organizations/:organization\_name/organization-memberships` | Parameter | Description | | -------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | | `:organization\_name` | The name of the organization the user will be invited to join. The inviting user must have permission to manage organization memberships. | -> \*\*Note:\*\* Organization membership management is restricted to members of the owners team, the owners [team API token](/terraform/cloud-docs/users-teams-organizations/api-tokens#team-api-tokens), the [organization API token](/terraform/cloud-docs/users-teams-organizations/api-tokens#organization-api-tokens), and users or teams with one of the [Team Management](/terraform/cloud-docs/users-teams-organizations/permissions/organization#team-permissions) permissions. [permissions-citation]: #intentionally-unused---keep-for-maintainers | Status | Response | Reason | | ------- | ------------------------- | -------------------------------------------------------------- | | [201][] | [JSON API document][] | Successfully invited the user | | [400][] | [JSON API error object][] | Unable to invite user due to organization limits | | [404][] | [JSON API error object][] | Organization not found, or user unauthorized to perform action | | [422][] | [JSON API error object][] | Unable to invite user due to validation errors | ### Request Body This POST endpoint requires a JSON object with the following properties as a request payload. Properties without a default value are required. | Key path | Type | Default | Description | | --------------------------------- | -------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `data.type` | string | | Must be `"organization-memberships"`. | | `data.attributes.email` | string | | The email address of the user to be invited. | | `data.relationships.teams.data[]` | array\[object] | | A list of resource identifier objects that defines which teams the invited user will be a member of. These objects must contain `id` and `type` properties, and the `type` property must be `teams` (e.g. `{ "id": "team-GeLZkdnK6xAVjA5H", "type": "teams" }`). Obtain team IDs from the [List Teams](/terraform/cloud-docs/api-docs/teams#list-teams) endpoint. All users must be added to at least one team. | ### Sample Payload ```json { "data": { "attributes": { "email": "test@example.com" }, "relationships": { "teams": { "data": [ { "type": "teams", "id": "team-GeLZkdnK6xAVjA5H" } ] } }, "type": "organization-memberships" } } ``` ### Sample Request ```shell $ curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request POST \ --data @payload.json \ https://app.terraform.io/api/v2/organizations/my-organization/organization-memberships ``` ### Sample Response ```json { "data": { "id": "ou-nX7inDHhmC3quYgy", "type": "organization-memberships", "attributes": { "status": "invited" }, "relationships": { "teams": { "data": [ { "id": "team-GeLZkdnK6xAVjA5H", "type": "teams" } ] }, "user": { "data": { "id": "user-J8oxGmRk5eC2WLfX", "type": "users" } }, "organization": { "data": { "id": "my-organization", "type": "organizations" } } } }, "included": [ { "id": "user-J8oxGmRk5eC2WLfX", "type": "users", "attributes": { "username": null, "is-service-account": false, "auth-method": "hcp\_sso", "avatar-url": "https://www.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0?s=100&d=mm", "two-factor": { "enabled": false, "verified": false }, "email": "test@example.com", "permissions": { "can-create-organizations": true, "can-change-email": true, "can-change-username": true, "can-manage-user-tokens": false } }, "relationships": { "authentication-tokens": { "links": { "related": "/api/v2/users/user-J8oxGmRk5eC2WLfX/authentication-tokens" } } }, "links": { "self": "/api/v2/users/user-J8oxGmRk5eC2WLfX" } } ] } ``` ## List Memberships for an Organization `GET /organizations/:organization\_name/organization-memberships` | Parameter | Description | | -------------------- | | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/organization-memberships.mdx | main | terraform | [
-0.015784088522195816,
-0.01700746826827526,
-0.018668580800294876,
-0.028096551075577736,
-0.024631375446915627,
-0.08318780362606049,
-0.0621652752161026,
-0.07521579414606094,
-0.005580500699579716,
-0.03855427727103233,
0.03281282261013985,
0.0540321059525013,
0.006812138482928276,
-0.... | 0.052879 |
"email": "test@example.com", "permissions": { "can-create-organizations": true, "can-change-email": true, "can-change-username": true, "can-manage-user-tokens": false } }, "relationships": { "authentication-tokens": { "links": { "related": "/api/v2/users/user-J8oxGmRk5eC2WLfX/authentication-tokens" } } }, "links": { "self": "/api/v2/users/user-J8oxGmRk5eC2WLfX" } } ] } ``` ## List Memberships for an Organization `GET /organizations/:organization\_name/organization-memberships` | Parameter | Description | | -------------------- | -------------------------------------------------------- | | `:organization\_name` | The name of the organization to list the memberships of. | ### Query Parameters This endpoint supports pagination [with standard URL query parameters](/terraform/cloud-docs/api-docs#query-parameters). Remember to percent-encode `[` as `%5B` and `]` as `%5D` if your tooling doesn't automatically encode URLs. | Parameter | Description | | ---------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `q` | \*\*Optional.\*\* A search query string. Organization memberships are searchable by user name and email. | | `filter[status]` | \*\*Optional.\*\* If specified, restricts results to those with the matching status value. Valid values are `invited` and `active`. | | `filter[email]` | \*\*Optional.\*\* If specified, restricts results to those with a matching user email address. If multiple comma separated values are specified, results matching any of the values are returned. | | `page[number]` | \*\*Optional.\*\* If omitted, the endpoint will return the first page. | | `page[size]` | \*\*Optional.\*\* If omitted, the endpoint will return 20 users per page. | ### Sample Request ```shell $ curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ https://app.terraform.io/api/v2/organizations/my-organization/organization-memberships ``` ### Sample Response ```json { "data": [ { "id": "ou-tTJph1AQVK5ZmdND", "type": "organization-memberships", "attributes": { "status": "active" }, "relationships": { "teams": { "data": [ { "id": "team-yUrEehvfG4pdmSjc", "type": "teams" } ] }, "user": { "data": { "id": "user-vaQqszES9JnuK4eB", "type": "users" } }, "organization": { "data": { "id": "my-organization", "type": "organizations" } } } }, { "id": "ou-D6HPYFt4GzeBt3gB", "type": "organization-memberships", "attributes": { "status": "active" }, "relationships": { "teams": { "data": [ { "id": "team-yUrEehvfG4pdmSjc", "type": "teams" } ] }, "user": { "data": { "id": "user-oqCgH7NgTn95jTGc", "type": "users" } }, "organization": { "data": { "id": "my-organization", "type": "organizations" } } } }, { "id": "ou-x1E2eBwYwusLDC7h", "type": "organization-memberships", "attributes": { "status": "invited" }, "relationships": { "teams": { "data": [ { "id": "team-yUrEehvfG4pdmSjc", "type": "teams" } ] }, "user": { "data": { "id": "user-UntUdBTHsVRQMzC8", "type": "users" } }, "organization": { "data": { "id": "my-organization", "type": "organizations" } } } } ], "links": { "self": "https://app.terraform.io/api/v2/organizations/my-organization/organization-memberships?page%5Bnumber%5D=1&page%5Bsize%5D=20", "first": "https://app.terraform.io/api/v2/organizations/my-organization/organization-memberships?page%5Bnumber%5D=1&page%5Bsize%5D=20", "prev": null, "next": null, "last": "https://app.terraform.io/api/v2/organizations/my-organization/organization-memberships?page%5Bnumber%5D=1&page%5Bsize%5D=20" }, "meta": { "status-counts": { "total": 3, "active": 2, "invited": 1 }, "pagination": { "current-page": 1, "prev-page": null, "next-page": null, "total-pages": 1, "total-count": 3 } } } ``` ## List User's Own Memberships `GET /organization-memberships` ### Sample Request ```shell $ curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ https://app.terraform.io/api/v2/organization-memberships ``` ### Sample Response ```json { "data": [ { "id": "ou-VgJgfbDVN3APUm2F", "type": "organization-memberships", "attributes": { "status": "invited" }, "relationships": { "teams": { "data": [ { "id": "team-4QrJKzxB3J5N4cJc", "type": "teams" } ] }, "user": { "data": { "id": "user-vaQqszES9JnuK4eB", "type": "users" } }, "organization": { "data": { "id": "acme-corp", "type": "organizations" } } } }, { "id": "ou-tTJph1AQVK5ZmdND", "type": "organization-memberships", "attributes": { "status": "active" }, "relationships": { "teams": { "data": [ { "id": "team-yUrEehvfG4pdmSjc", "type": "teams" } ] }, "user": { "data": { "id": "user-vaQqszES9JnuK4eB", "type": "users" } }, "organization": { "data": { "id": "my-organization", "type": "organizations" } } } } ] } ``` ## Show a Membership `GET /organization-memberships/:organization\_membership\_id` | Parameter | Description | | ----------------------------- | --------------------------- | | `:organization\_membership\_id` | The organization membership | | Status | Response | Reason | | ------- | ---------------------------------------------------------- | ------------------------------------------------------------------------- | | [200][] | [JSON API document][] (`type: "organization-memberships"`) | The request was successful | | [404][] | [JSON API error object][] | Organization membership not found, | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/organization-memberships.mdx | main | terraform | [
-0.06992997974157333,
0.06155386567115784,
-0.028994468972086906,
0.06900226324796677,
0.008307725191116333,
-0.047402918338775635,
0.008596941828727722,
0.007908963598310947,
-0.015139051713049412,
-0.026674384251236916,
0.007124691270291805,
-0.07850342243909836,
0.010350373573601246,
0.... | 0.051664 |
| --------------------------- | | `:organization\_membership\_id` | The organization membership | | Status | Response | Reason | | ------- | ---------------------------------------------------------- | ------------------------------------------------------------------------- | | [200][] | [JSON API document][] (`type: "organization-memberships"`) | The request was successful | | [404][] | [JSON API error object][] | Organization membership not found, or user unauthorized to perform action | ### Sample Request ```shell $ curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ https://app.terraform.io/api/v2/organization-memberships/ou-kit6GaMo3zPGCzWb ``` ### Sample Response ```json { "data": { "id": "ou-kit6GaMo3zPGCzWb", "type": "organization-memberships", "attributes": { "status": "active" }, "relationships": { "teams": { "data": [ { "id": "team-97LkM7QciNkwb2nh", "type": "teams" } ] }, "user": { "data": { "id": "user-hn6v2WK1naDpGadd", "type": "users" } }, "organization": { "data": { "id": "hashicorp", "type": "organizations" } } } } } ``` ## Remove User from Organization `DELETE /organization-memberships/:organization\_membership\_id` | Parameter | Description | | ----------------------------- | --------------------------- | | `:organization\_membership\_id` | The organization membership | | Status | Response | Reason | | ------- | ------------------------- | -------------------------------------------------------------------------------------- | | [204][] | Empty body | Successfully removed the user from the organization | | [403][] | [JSON API error object][] | Unable to remove the user: you cannot remove yourself from organizations which you own | | [404][] | [JSON API error object][] | Organization membership not found, or user unauthorized to perform action | ### Sample Request ```shell $ curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request DELETE \ https://app.terraform.io/api/v2/organization-memberships/ou-tTJph1AQVK5ZmdND ``` ## Available Related Resources The GET endpoints above can optionally return related resources, if requested with [the `include` query parameter](/terraform/cloud-docs/api-docs#inclusion-of-related-resources). The following resource types are available: \* `user` - The user associated with the membership. \* `teams` - Teams the user is a member of. | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/organization-memberships.mdx | main | terraform | [
-0.07917819172143936,
0.09006436914205551,
-0.03600943088531494,
0.026409577578306198,
0.01922125183045864,
-0.05838383361697197,
-0.022416653111577034,
-0.009589803405106068,
0.032551538199186325,
-0.05648570880293846,
0.045176345854997635,
-0.06369882076978683,
0.019120318815112114,
0.02... | 0.125067 |
[200]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/200 [201]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/201 [202]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/202 [204]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/204 [304]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/304 [400]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/400 [401]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/401 [403]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/403 [404]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/404 [409]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/409 [412]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/412 [422]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/422 [429]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429 [500]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500 [504]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504 [If-Modified-Since]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-Modified-Since [JSON API document]: /terraform/cloud-docs/api-docs#json-api-documents [JSON API error object]: https://jsonapi.org/format/#error-objects [CIDR Notation]: https://en.wikipedia.org/wiki/Classless\_Inter-Domain\_Routing#CIDR\_notation [run task requests]: /terraform/cloud-docs/api-docs/run-tasks/run-tasks-integration#run-task-request # IP ranges API reference IP Ranges provides a list of HCP Terraform's IP ranges. For more information about HCP Terraform's IP ranges, view our documentation about [HCP Terraform IP Ranges](/terraform/cloud-docs/architectural-details/ip-ranges). ## IP Ranges Payload | Name | Type | Description | | --------------- | ----- | ------------------------------------------------------------------------------------------------ | | `api` | array | List of IP ranges in [CIDR notation] used for connections from user site to HCP Terraform APIs | | `notifications` | array | List of IP ranges in [CIDR notation] used for notifications and outbound [run task requests] | | `sentinel` | array | List of IP ranges in [CIDR notation] used for outbound requests from Sentinel policies. Applicable for [Policy Checks](https://developer.hashicorp.com/terraform/cloud-docs/policy-enforcement/manage-policy-sets#policy-checks) mode only (also known as Legacy mode) | | `vcs` | array | List of IP ranges in [CIDR notation] used for connecting to VCS providers | -> \*\*Note:\*\* The IP ranges for each feature returned by the IP Ranges API may overlap. Additionally, these published ranges do not currently allow for execution of Terraform runs against local resources. -> \*\*Note:\*\* Under normal circumstances, HashiCorp will publish any expected changes to HCP Terraform's IP ranges at least 24 hours in advance of implementing them. This should allow sufficient time for users to update any connected systems to reflect the changes. In the event of an emergency outage or failover operation, it may not be possible to pre-publish these changes. ## Get IP Ranges -> \*\*Note:\*\* The IP Ranges API does not require authentication -> \*\*Note:\*\* This endpoint supports the [If-Modified-Since][] HTTP request header `GET /meta/ip-ranges` | Status | Response | Reason | | ------- | ------------------ | -------------------------------------------------------------------------------------------------------------- | | [200][] | `application/json` | The request was successful | | [304][] | empty body | The request was successful; IP ranges were not modified since the specified date in `If-Modified-Since` header | ### Sample Request ```shell curl \ --request GET \ -H "If-Modified-Since: Tue, 26 May 2020 15:10:05 GMT" \ https://app.terraform.io/api/meta/ip-ranges ``` ### Sample Response ```json { "api": [ "75.2.98.97/32", "99.83.150.238/32" ], "notifications": [ "10.0.0.1/32", "192.168.0.1/32", "172.16.0.1/32" ], "sentinel": [ "10.0.0.1/32", "192.168.0.1/32", "172.16.0.1/32" ], "vcs": [ "10.0.0.1/32", "192.168.0.1/32", "172.16.0.1/32" ] } ``` | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/ip-ranges.mdx | main | terraform | [
-0.02449185587465763,
-0.019733238965272903,
-0.030942430719733238,
-0.02112526074051857,
-0.019326798617839813,
-0.09733036160469055,
-0.06041740998625755,
-0.08997057378292084,
0.004740177188068628,
-0.034597769379615784,
0.031186483800411224,
0.054574549198150635,
0.0010920173954218626,
... | 0.068166 |
[200]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/200 [404]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/404 [JSON API document]: /terraform/cloud-docs/api-docs#json-api-documents [JSON API error object]: https://jsonapi.org/format/#error-objects # State version outputs API reference State version outputs are the [output values](/terraform/language/values/outputs) from a Terraform state file for a workspace. They include the name and value of the output, as well as a sensitive boolean if the value should be hidden by default in UIs. ~> \*\*Important:\*\* The state version outputs for a state version (as well as some other information about it) might be \*\*populated asynchronously\*\* by HCP Terraform. These values might not be immediately available after the state version is uploaded. The `resources-processed` property on the associated [state version object](/terraform/cloud-docs/api-docs/state-versions) indicates whether or not HCP Terraform has finished any necessary asynchronous processing. If you need to use these values, be sure to wait for `resources-processed` to become `true` before assuming that the values are in fact empty. ## List State Version Outputs `GET /state-versions/:state\_version\_id/outputs` Listing state version outputs requires permission to read state outputs for the workspace. ([More about permissions.](/terraform/cloud-docs/users-teams-organizations/permissions)) | Parameter | Description | | ------------------- | ------------------------------------ | | `:state\_version\_id` | The ID of the desired state version. | | Status | Response | Reason | | ------- | ------------------------- | -------------------------------------------------------------------- | | [200][] | [JSON API document][] | Successfully returned a list of outputs for the given state version. | | [404][] | [JSON API error object][] | State version not found, or user unauthorized to perform action. | ### Query Parameters This endpoint supports pagination [with standard URL query parameters](/terraform/cloud-docs/api-docs#query-parameters). Remember to percent-encode `[` as `%5B` and `]` as `%5D` if your tooling doesn't automatically encode URLs. | Parameter | Description | | -------------- | ------------------------------------------------------------------------------------- | | `page[number]` | \*\*Optional.\*\* If omitted, the endpoint will return the first page. | | `page[size]` | \*\*Optional.\*\* If omitted, the endpoint will return 20 state version outputs per page. | ### Sample Request ```shell curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ https://app.terraform.io/api/v2/state-versions/sv-SDboVZC8TCxXEneJ/outputs ``` ### Sample Response ```json { "data": [ { "id": "wsout-xFAmCR3VkBGepcee", "type": "state-version-outputs", "attributes": { "name": "fruits", "sensitive": false, "type": "array", "value": [ "apple", "strawberry", "blueberry", "rasberry" ], "detailed\_type": [ "tuple", [ "string", "string", "string", "string" ] ] }, "links": { "self": "/api/v2/state-version-outputs/wsout-xFAmCR3VkBGepcee" } }, { "id": "wsout-vspuB754AUNkfxwo", "type": "state-version-outputs", "attributes": { "name": "vegetables", "sensitive": false, "type": "array", "value": [ "carrots", "potato", "tomato", "onions" ], "detailed\_type": [ "tuple", [ "string", "string", "string", "string" ] ] }, "links": { "self": "/api/v2/state-version-outputs/wsout-vspuB754AUNkfxwo" } } ], "links": { "self": "https://app.terraform.io/api/v2/state-versions/sv-SVB5wMrDL1XUgJ4G/outputs?page%5Bnumber%5D=1&page%5Bsize%5D=20", "first": "https://app.terraform.io/api/v2/state-versions/sv-SVB5wMrDL1XUgJ4G/outputs?page%5Bnumber%5D=1&page%5Bsize%5D=20", "prev": null, "next": null, "last": "https://app.terraform.io/api/v2/state-versions/sv-SVB5wMrDL1XUgJ4G/outputs?page%5Bnumber%5D=1&page%5Bsize%5D=20" }, "meta": { "pagination": { "current-page": 1, "page-size": 20, "prev-page": null, "next-page": null, "total-pages": 1, "total-count": 2 } } } ``` ## Show a State Version Output `GET /state-version-outputs/:state\_version\_output\_id` | Parameter | Description | | -------------------------- | ------------------------------------------- | | `:state\_version\_output\_id` | The ID of the desired state version output. | State version output IDs must be obtained from a [state version object](/terraform/cloud-docs/api-docs/state-versions). When requesting a state version, you can optionally add `?include=outputs` to include full details for all of that state version's outputs. | Status | Response | Reason | | ------- | ------------------------------------------------------- | ------------------------------------------------------ | | [200][] | [JSON API document][] (`type: "state-version-outputs"`) | Success. | | [404][] | [JSON API error object][] | State version output not found or user not authorized. | ### Sample Request ```shell curl \ --header "Authorization: Bearer $TOKEN" \ https://app.terraform.io/api/v2/state-version-outputs/wsout-J2zM24JPFbfc7bE5 ``` ### Sample Response ```json { "data": { "id": "wsout-J2zM24JPFbfc7bE5", "type": "state-version-outputs", "attributes": { "name": "flavor", "sensitive": false, "type": "string", "value": "Peanut Butter", "detailed-type": "string" }, "links": { "self": "/api/v2/state-version-outputs/wsout-J2zM24JPFbfc7bE5" } } } ``` ## Show Current State Version Outputs for | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/state-version-outputs.mdx | main | terraform | [
-0.06838908046483994,
0.08460360765457153,
0.02596317045390606,
0.0326547846198082,
0.0027171040419489145,
-0.03048485703766346,
-0.04839405044913292,
-0.11316126585006714,
0.05154920369386673,
0.023535238578915596,
-0.031231358647346497,
-0.06715958565473557,
0.04904667288064957,
-0.00489... | 0.060359 |
```shell curl \ --header "Authorization: Bearer $TOKEN" \ https://app.terraform.io/api/v2/state-version-outputs/wsout-J2zM24JPFbfc7bE5 ``` ### Sample Response ```json { "data": { "id": "wsout-J2zM24JPFbfc7bE5", "type": "state-version-outputs", "attributes": { "name": "flavor", "sensitive": false, "type": "string", "value": "Peanut Butter", "detailed-type": "string" }, "links": { "self": "/api/v2/state-version-outputs/wsout-J2zM24JPFbfc7bE5" } } } ``` ## Show Current State Version Outputs for a Workspace This endpoint allows organization users, who do not have permissions to read state versions, to fetch the latest [output values](/terraform/language/values/outputs) for a workspace. ([More about permissions.](/terraform/cloud-docs/users-teams-organizations/permissions)) -> \*\*Note:\*\* Sensitive values are not revealed and will be returned as `null`. To fetch an output including sensitive values see [Show a State Version Output](/terraform/cloud-docs/api-docs/state-version-outputs#show-a-state-version-output). `GET /workspaces/:workspace\_id/current-state-version-outputs` | Parameter | Description | | --------------- | -------------------------------------------- | | `:workspace\_id` | The ID of the workspace to read outputs from.| | Status | Response | Reason | | ------- | ------------------------------------------------------- | ------------------------------------------------------------------------------- | | [200][] | [JSON API document][] (`type: "state-version-outputs"`) | Successfully returned a list of outputs for the given workspace. | | [404][] | [JSON API error object][] | State version outputs not found or user not authorized. | | [503][] | [JSON API error object][] | State version outputs are being processed and are not ready. Retry the request. | ### Sample Request ```shell curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ https://app.terraform.io/api/v2/workspaces/ws-G4zM299PFbfc10E5/current-state-version-outputs ``` ### Sample Response ```json { "data": [ { "id": "wsout-J2zM24JPFbfc7bE5", "type": "state-version-outputs", "attributes": { "name": "flavor", "sensitive": false, "type": "string", "value": "Peanut Butter", "detailed-type": "string" }, "links": { "self": "/api/v2/state-version-outputs/wsout-J2zM24JPFbfc7bE5" } }, { "id": "wsout-FLzM23Gcd5f37bE5", "type": "state-version-outputs", "attributes": { "name": "recipe", "sensitive": true, "type": "string", "value": "Don Douglas' Peanut Butter Frenzy", "detailed-type": "string" }, "links": { "self": "/api/v2/state-version-outputs/wsout-FLzM23Gcd5f37bE5" } } ] } ``` | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/state-version-outputs.mdx | main | terraform | [
-0.04675070568919182,
0.09233995527029037,
0.013487919233739376,
0.00957033596932888,
0.0005214165430516005,
-0.026981448754668236,
-0.0571274571120739,
-0.05447385832667351,
0.03099186345934868,
0.08060240000486374,
-0.0383293442428112,
-0.0890028178691864,
-0.02119830809533596,
0.0065980... | 0.067141 |
[200]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/200 [201]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/201 [202]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/202 [204]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/204 [400]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/400 [401]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/401 [403]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/403 [404]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/404 [409]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/409 [412]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/412 [422]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/422 [429]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429 [500]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500 [504]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504 [JSON API document]: /terraform/cloud-docs/api-docs#json-api-documents [JSON API error object]: https://jsonapi.org/format/#error-objects # Users API reference HCP Terraform's user objects do not contain any identifying information about a user, other than their HCP Terraform username and avatar image; they are intended for displaying names and avatars in contexts that refer to a user by ID, like lists of team members or the details of a run. Most of these contexts can already include user objects via an `?include` parameter, so you shouldn't usually need to make a separate call to this endpoint. ## Show a User Shows details for a given user. `GET /users/:user\_id` | Parameter | Description | | ---------- | --------------------------- | | `:user\_id` | The ID of the desired user. | To find the ID that corresponds to a given username, you can request a [team object](/terraform/cloud-docs/api-docs/teams) for a team that user belongs to, specify `?include=users` in the request, and look for the user's name in the included list of user objects. | Status | Response | Reason | | ------- | --------------------------------------- | ------------------------------------------------ | | [200][] | [JSON API document][] (`type: "users"`) | The request was successful | | [401][] | [JSON API error object][] | Unauthorized | | [404][] | [JSON API error object][] | User not found, or unauthorized to view the user | ### Sample Request ```shell curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request GET \ https://app.terraform.io/api/v2/users/user-MA4GL63FmYRpSFxa ``` ### Sample Response ```json { "data": { "id": "user-MA4GL63FmYRpSFxa", "type": "users", "attributes": { "username": "admin", "is-service-account": false, "auth-method": "hcp\_sso", "avatar-url": "https://www.gravatar.com/avatar/fa1f0c9364253d351bf1c7f5c534cd40?s=100&d=mm", "v2-only": true, "permissions": { "can-create-organizations": false, "can-change-email": true, "can-change-username": true } }, "relationships": { "authentication-tokens": { "links": { "related": "/api/v2/users/user-MA4GL63FmYRpSFxa/authentication-tokens" } } }, "links": { "self": "/api/v2/users/user-MA4GL63FmYRpSFxa" } } } ``` | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/users.mdx | main | terraform | [
-0.015784088522195816,
-0.01700746826827526,
-0.018668580800294876,
-0.028096551075577736,
-0.024631375446915627,
-0.08318780362606049,
-0.0621652752161026,
-0.07521579414606094,
-0.005580500699579716,
-0.03855427727103233,
0.03281282261013985,
0.0540321059525013,
0.006812138482928276,
-0.... | 0.052879 |
[200]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/200 [201]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/201 [202]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/202 [204]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/204 [400]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/400 [401]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/401 [403]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/403 [404]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/404 [409]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/409 [412]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/412 [422]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/422 [429]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429 [500]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500 [504]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504 [JSON API document]: /terraform/cloud-docs/api-docs#json-api-documents [JSON API error object]: https://jsonapi.org/format/#error-objects # User tokens API reference ## List User Tokens `GET /users/:user\_id/authentication-tokens` | Parameter | Description | | ---------- | ------------------- | | `:user\_id` | The ID of the User. | Use the [Account API](/terraform/cloud-docs/api-docs/account) to find your own user ID. The objects returned by this endpoint only contain metadata, and do not include the secret text of any authentication tokens. A token is only shown upon creation, and cannot be recovered later. -> \*\*Note:\*\* You must access this endpoint with a [user token](/terraform/cloud-docs/users-teams-organizations/users#api-tokens), and it will only return useful data for that token's user account. | Status | Response | Reason | | ------- | ------------------------------------------------------- | ------------------------------------------------------------------------------------- | | [200][] | [JSON API document][] (`type: "authentication-tokens"`) | The request was successful | | [200][] | Empty [JSON API document][] (no type) | User has no authentication tokens, or request was made by someone other than the user | | [404][] | [JSON API error object][] | User not found | ### Query Parameters This endpoint supports pagination [with standard URL query parameters](/terraform/cloud-docs/api-docs#query-parameters). Remember to percent-encode `[` as `%5B` and `]` as `%5D` if your tooling doesn't automatically encode URLs. If neither pagination query parameters are provided, the endpoint will not be paginated and will return all results. | Parameter | Description | | -------------- | --------------------------------------------------------------------------- | | `page[number]` | \*\*Optional.\*\* If omitted, the endpoint will return the first page. | | `page[size]` | \*\*Optional.\*\* If omitted, the endpoint will return 20 user tokens per page. | ### Sample Request ```shell curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request GET \ https://app.terraform.io/api/v2/users/user-MA4GL63FmYRpSFxa/authentication-tokens ``` ### Sample Response ```json { "data": [ { "id": "at-QmATJea6aWj1xR2t", "type": "authentication-tokens", "attributes": { "created-at": "2018-11-06T22:56:10.203Z", "last-used-at": null, "description": null, "token": null, "expired-at": null }, "relationships": { "created-by": { "data": null } } }, { "id": "at-6yEmxNAhaoQLH1Da", "type": "authentication-tokens", "attributes": { "created-at": "2018-11-25T22:31:30.624Z", "last-used-at": "2018-11-26T20:27:54.931Z", "description": "api", "token": null, "expired-at": "2023-04-06T12:00:00.000Z" }, "relationships": { "created-by": { "data": { "id": "user-MA4GL63FmYRpSFxa", "type": "users" } } } } ] } ``` ## Show a User Token `GET /authentication-tokens/:id` | Parameter | Description | | --------- | ------------------------- | | `:id` | The ID of the User Token. | The objects returned by this endpoint only contain metadata, and do not include the secret text of any authentication tokens. A token is only shown upon creation, and cannot be recovered later. -> \*\*Note:\*\* You must access this endpoint with a [user token](/terraform/cloud-docs/users-teams-organizations/users#api-tokens), and it will only return useful data for that token's user account. | Status | Response | Reason | | ------- | ------------------------------------------------------- | ------------------------------------------------------------ | | [200][] | [JSON API document][] (`type: "authentication-tokens"`) | The request was successful | | [404][] | [JSON API error object][] | User Token not found, or unauthorized to view the User Token | ### Sample Request ```shell curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request GET \ https://app.terraform.io/api/v2/authentication-tokens/at-6yEmxNAhaoQLH1Da ``` ### Sample Response ```json { "data": { "id": "at-6yEmxNAhaoQLH1Da", "type": "authentication-tokens", "attributes": { "created-at": "2018-11-25T22:31:30.624Z", "last-used-at": "2018-11-26T20:34:59.487Z", "description": "api", "token": null, "expired-at": "2023-04-06T12:00:00.000Z" }, "relationships": { "created-by": { "data": { "id": "user-MA4GL63FmYRpSFxa", "type": "users" } } } } } ``` ## Create a User Token `POST /users/:user\_id/authentication-tokens` | Parameter | Description | | ---------- | ------------------- | | `:user\_id` | The ID of the User. | Use the [Account API](/terraform/cloud-docs/api-docs/account) to find your own user ID. | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/user-tokens.mdx | main | terraform | [
-0.015784088522195816,
-0.01700746826827526,
-0.018668580800294876,
-0.028096551075577736,
-0.024631375446915627,
-0.08318780362606049,
-0.0621652752161026,
-0.07521579414606094,
-0.005580500699579716,
-0.03855427727103233,
0.03281282261013985,
0.0540321059525013,
0.006812138482928276,
-0.... | 0.052879 |
"created-by": { "data": { "id": "user-MA4GL63FmYRpSFxa", "type": "users" } } } } } ``` ## Create a User Token `POST /users/:user\_id/authentication-tokens` | Parameter | Description | | ---------- | ------------------- | | `:user\_id` | The ID of the User. | Use the [Account API](/terraform/cloud-docs/api-docs/account) to find your own user ID. This endpoint returns the secret text of the created authentication token. A token is only shown upon creation, and cannot be recovered later. -> \*\*Note:\*\* You must access this endpoint with a [user token](/terraform/cloud-docs/users-teams-organizations/users#api-tokens), and it will only create new tokens for that token's user account. | Status | Response | Reason | | ------- | ------------------------------------------------------- | -------------------------------------------------------------- | | [201][] | [JSON API document][] (`type: "authentication-tokens"`) | The request was successful | | [404][] | [JSON API error object][] | User not found or user unauthorized to perform action | | [422][] | [JSON API error object][] | Malformed request body (missing attributes, wrong types, etc.) | | [500][] | [JSON API error object][] | Failure during User Token creation | ### Request Body This POST endpoint requires a JSON object with the following properties as a request payload. Properties without a default value are required. | Key path | Type | Default | Description | | ----------------------------- | ------ | ------- | --------------------------------------------------------------------------------------------------------------- | | `data.type` | string | | Must be `"authentication-tokens"`. | | `data.attributes.description` | string | | The description for the User Token. | | `data.attributes.expired-at` | string | `null` | The UTC date and time that the User Token will expire, in ISO 8601 format. If omitted or set to `null` the token will never expire. | ### Sample Payload ```json { "data": { "type": "authentication-tokens", "attributes": { "description":"api", "expired-at": "2023-04-06T12:00:00.000Z" } } } ``` ### Sample Request ```shell curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request POST \ --data @payload.json \ https://app.terraform.io/api/v2/users/user-MA4GL63FmYRpSFxa/authentication-tokens ``` ### Sample Response ```json { "data": { "id": "at-MKD1X3i4HS3AuD41", "type": "authentication-tokens", "attributes": { "created-at": "2018-11-26T20:48:35.054Z", "last-used-at": null, "description": "api", "token": "6tL24nM38M7XWQ.atlasv1.KmWckRfzeNmUVFNvpvwUEChKaLGznCSD6fPf3VPzqMMVzmSxFU0p2Ibzpo2h5eTGwPU", "expired-at": "2023-04-06T12:00:00.000Z" }, "relationships": { "created-by": { "data": { "id": "user-MA4GL63FmYRpSFxa", "type": "users" } } } } } ``` ## Destroy a User Token `DELETE /authentication-tokens/:id` | Parameter | Description | | --------- | ------------------------------------ | | `:id` | The ID of the User Token to destroy. | -> \*\*Note:\*\* You must access this endpoint with a [user token](/terraform/cloud-docs/users-teams-organizations/users#api-tokens), and it will only delete tokens for that token's user account. | Status | Response | Reason | | ------- | ------------------------- | ------------------------------------------------------------ | | [204][] | Empty response | The User Token was successfully destroyed | | [404][] | [JSON API error object][] | User Token not found, or user unauthorized to perform action | ### Sample Request ```shell curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request DELETE \ https://app.terraform.io/api/v2/authentication-tokens/at-6yEmxNAhaoQLH1Da ``` | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/user-tokens.mdx | main | terraform | [
-0.05165969207882881,
0.040172796696424484,
0.02368374541401863,
0.0356009416282177,
-0.021967824548482895,
-0.014013595879077911,
0.02743985876441002,
-0.011676901020109653,
0.07422006875276566,
0.10708039999008179,
-0.027000175788998604,
-0.0790635347366333,
0.0684080719947815,
-0.026323... | 0.022822 |
Follow this template to format each API method. There are usually multiple sections like this on a given API endpoint page. [200]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/200 [201]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/201 [202]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/202 [204]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/204 [400]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/400 [401]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/401 [403]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/403 [404]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/404 [409]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/409 [412]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/412 [422]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/422 [429]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429 [500]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500 [504]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504 [JSON API document]: /terraform/cloud-docs/api-docs#json-api-documents [JSON API error object]: http://jsonapi.org/format/#error-objects # Example name API reference A explanatory sentence about what this thing in HCP Terraform does. ## Create a Something Add at least one sentence of description about what this endpoint does. `POST /organizations/:organization\_name/somethings` | Parameter | Description | | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `:organization\_name` | The name of the organization to create the something in. The organization must already exist in the system, and the user must have permissions to create new somethings. | -> \*\*Note:\*\* This endpoint cannot be accessed with [organization tokens](/terraform/cloud-docs/users-teams-organizations/api-tokens#organization-api-tokens). You must access it with a [user token](/terraform/cloud-docs/users-teams-organizations/users#api-tokens) or [team token](/terraform/cloud-docs/users-teams-organizations/api-tokens#team-api-tokens). | Status | Response | Reason | | ------- | -------------------------------------------- | -------------------------------------------------------------- | | [200][] | [JSON API document][] (`type: "somethings"`) | Successfully created a team | | [400][] | [JSON API error object][] | Invalid `include` parameter | | [404][] | [JSON API error object][] | Organization not found, or user unauthorized to perform action | | [422][] | [JSON API error object][] | Malformed request body (missing attributes, wrong types, etc.) | | [500][] | [JSON API error object][] | Failure during team creation | ### Query Parameters [These are standard URL query parameters](/terraform/cloud-docs/api-docs#query-parameters); remember to percent-encode `[` as `%5B` and `]` as `%5D` if your tooling doesn't automatically encode URLs. | Parameter | Description | | ----------------------- | ------------------------------------------------------------- | | `filter[workspace][id]` | \*\*Required.\*\* The workspace ID where this action will happen. | ### Request Body This POST endpoint requires a JSON object with the following properties as a request payload. Properties without a default value are required. | Key path | Type | Default | Description | | --------------------------- | ------ | ------- | ------------------------------------------------------------------------------------------------------ | | `data.type` | string | | Must be `"somethings"`. | | `data[].type` | string | | ... | | `data.attributes.category` | string | | Whether this is a blue or red something. Valid values are `"blue"` or `"red"`. | | `data.attributes.sensitive` | bool | `false` | Whether the value is sensitive. If true then the something is written once and not visible thereafter. | | `filter.workspace.name` | string | | The name of the workspace that owns the something. | | `filter.organization.name` | string | | The name of the organization that owns the workspace. | ### Available Related Resources This GET endpoint can optionally return related resources, if requested with [the `include` query parameter](/terraform/cloud-docs/api-docs#inclusion-of-related-resources). The following resource types are available: | Resource Name | Description | | ------------------ | --------------------------------------------- | | `organization` | The full organization record. | | `current\_run` | Additional information about the current run. | | `current\_run.plan` | The plan used in the current run. | ### Sample Payload ```json { "data": { "type":"somethings", "attributes": { "category":"red", "sensitive":true } }, "filter": { "organization": { "name":"my-organization" }, "workspace": { "name":"my-workspace" } } } ``` ### Sample Request ```shell curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request POST \ --data @payload.json \ https://app.terraform.io/api/v2/somethings ``` ### Sample Response ```json { "data": { "id":"som-EavQ1LztoRTQHSNT", "type":"somethings", "attributes": { "sensitive":true, "category":"red", }, "relationships": { "configurable": { "data": { "id":"ws-4j8p6jX1w33MiDC7", "type":"workspaces" }, "links": { "related":"/api/v2/organizations/my-organization/workspaces/my-workspace" } } }, "links": { "self":"/api/v2/somethings/som-EavQ1LztoRTQHSNT" } } } ``` | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/_template.mdx | main | terraform | [
-0.03183702006936073,
0.07935114204883575,
-0.04898053780198097,
0.025842592120170593,
-0.011522671207785606,
-0.05650189518928528,
-0.10380014777183533,
-0.017093971371650696,
-0.01641135662794113,
-0.018458828330039978,
-0.04605792462825775,
0.038061413913965225,
0.006437865551561117,
-0... | 0.023685 |
```json { "data": { "id":"som-EavQ1LztoRTQHSNT", "type":"somethings", "attributes": { "sensitive":true, "category":"red", }, "relationships": { "configurable": { "data": { "id":"ws-4j8p6jX1w33MiDC7", "type":"workspaces" }, "links": { "related":"/api/v2/organizations/my-organization/workspaces/my-workspace" } } }, "links": { "self":"/api/v2/somethings/som-EavQ1LztoRTQHSNT" } } } ``` | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/_template.mdx | main | terraform | [
-0.016976116225123405,
0.05987115949392319,
-0.007391070481389761,
0.0621601939201355,
0.00783896166831255,
0.011804873123764992,
-0.05926051735877991,
0.0009327655425295234,
0.007850016467273235,
-0.048824068158864975,
0.040379565209150314,
-0.040555015206336975,
-0.024810222908854485,
0.... | 0.010261 |
[200]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/200 [201]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/201 [202]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/202 [204]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/204 [400]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/400 [401]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/401 [403]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/403 [404]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/404 [409]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/409 [412]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/412 [422]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/422 [429]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429 [500]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500 [504]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504 [JSON API document]: /terraform/cloud-docs/api-docs#json-api-documents [JSON API error object]: https://jsonapi.org/format/#error-objects # Runs API reference Before working with the runs or configuration versions APIs, read the [API-driven run workflow](/terraform/cloud-docs/workspaces/run/api) page, which provides an overview of this workflow and walks through a simplified implementation. Performing a workspace run on a new configuration is a multi-step process. 1. [Create a configuration version on the workspace](/terraform/cloud-docs/api-docs/configuration-versions#create-a-configuration-version). 1. [Upload configuration files to the configuration version](/terraform/cloud-docs/api-docs/configuration-versions#upload-configuration-files). 1. [Create a run on the workspace](#create-a-run); this is done automatically when a configuration file is uploaded. 1. [Create and queue an apply on the run](#apply-a-run); if the run can't be auto-applied. Alternatively, you can create a run with a pre-existing configuration version, even one from another workspace. This is useful for promoting known good code from one workspace to another. ## Attributes ### Run States The run state is found in `data.attributes.status`, and you can reference the following list of possible states. | State | Description | |------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | `pending` | The initial status of a run after creation. | | `fetching` | The run is waiting for HCP Terraform to fetch the configuration from VCS. | | `fetching\_completed` | HCP Terraform has fetched the configuration from VCS and the run will continue. | | `pre\_plan\_running` | The pre-plan phase of the run is in progress. | | `pre\_plan\_completed` | The pre-plan phase of the run has completed. | | `queuing` | HCP Terraform is queuing the run to start the planning phase. | | `plan\_queued` | HCP Terraform is waiting for its backend services to start the plan. | | `planning` | The planning phase of a run is in progress. | | `planned` | The planning phase of a run has completed. | | `cost\_estimating` | The cost estimation phase of a run is in progress. | | `cost\_estimated` | The cost estimation phase of a run has completed. | | `policy\_checking` | The sentinel policy checking phase of a run is in progress. | | `policy\_override` | A sentinel policy has soft failed, and a user can override it to continue the run. | | `policy\_soft\_failed` | A sentinel policy has soft failed for a plan-only run. This is a final state. | | `policy\_checked` | The sentinel policy checking phase of a run has completed. | | `confirmed` | A user has confirmed the plan. | | `post\_plan\_running` | The post-plan phase of the run is in progress. | | `post\_plan\_completed` | The post-plan phase of the run has completed. | | `planned\_and\_finished` | The run is completed. This status only exists for plan-only runs and runs that produce a plan with no changes to apply. This is a final state. | | `planned\_and\_saved` | The run has finished its planning, checks, and estimates, and can be confirmed for apply. This status is only used for saved plan runs. | | `apply\_queued` | Once the changes in the plan have been confirmed, the run will transition to `apply\_queued`. This status indicates that the run should start as soon as the backend services that run terraform have available capacity. In HCP Terraform, you should seldom see this status, as our aim is to always have capacity. However, in Terraform Enterprise this status will be more common due to the self-hosted nature. | | `applying` | Terraform is applying the changes specified in the plan. | | `applied` | Terraform has applied the changes specified in the plan. | | | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/run.mdx | main | terraform | [
-0.015784088522195816,
-0.01700746826827526,
-0.018668580800294876,
-0.028096551075577736,
-0.024631375446915627,
-0.08318780362606049,
-0.0621652752161026,
-0.07521579414606094,
-0.005580500699579716,
-0.03855427727103233,
0.03281282261013985,
0.0540321059525013,
0.006812138482928276,
-0.... | 0.052879 |
our aim is to always have capacity. However, in Terraform Enterprise this status will be more common due to the self-hosted nature. | | `applying` | Terraform is applying the changes specified in the plan. | | `applied` | Terraform has applied the changes specified in the plan. | | `discarded` | The run has been discarded. This is a final state. | | `errored` | The run has errored. This is a final state. | | `canceled` | The run has been canceled. | | `force\_canceled` | A workspace admin forcefully canceled the run. ### Run Operations The run operation specifies the Terraform execution mode. You can reference the following list of possible execution modes and use them as query parameters in the [workspace](/terraform/cloud-docs/api-docs/run#list-runs-in-a-workspace) and [organization](/terraform/cloud-docs/api-docs/run#list-runs-in-a-organization) runs lists. | Operation | Description | | ---------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `plan\_only` | The run does not have an apply phase. This is also called a [\_speculative plan\_](/terraform/cloud-docs/workspaces/run/modes-and-options#plan-only-speculative-plan). | | `plan\_and\_apply` | The run includes both plan and apply phases. | | `save\_plan` | The run is a saved plan run. It can include both plan and apply phases, but only becomes the workspace's current run if a user chooses to apply it. | | `refresh\_only` | The run should update Terraform state, but not make changes to resources. | | `destroy` | The run should destroy all objects, regardless of configuration changes. | | `empty\_apply` | The run should perform an apply with no changes to resources. This is most commonly used to [upgrade terraform state versions](/terraform/cloud-docs/workspaces/state#upgrading-state). | | `action\_only` | The run is a `refresh\_only` run that contains at least one [action invocation](/terraform/plugin/framework/actions). It updates state but does not create, change, or destroy resources. | ### Run Sources You can use the following sources as query parameters in [workspace](/terraform/cloud-docs/api-docs/run#list-runs-in-a-workspace) and [organization](/terraform/cloud-docs/api-docs/run#list-runs-in-a-organization) runs lists. | Source | Description | |-----------------------------|-----------------------------------------------------------------------------------------| | `tfe-ui` | Indicates a run was queued from HCP Terraform UI. | | `tfe-api` | Indicates a run was queued from HCP Terraform API. | | `tfe-configuration-version` | Indicates a run was queued from a Configuration Version, triggered from a VCS provider. | ### Run Status Groups The run status group specifies a collection of run states by logical category. | Group | Description | |------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | `non\_final` | Inclusive of runs that are currently running, require user confirmation, or are queued/pending. | | `final` | Inclusive of runs that have reached their final and terminal state. | | `discardable` | Inclusive of runs whose state falls under the following: `planned`, `planned\_and\_saved`, `cost\_estimated`, `policy\_checked`, `policy\_override`, `post\_plan\_running`, `post\_plan\_completed` | ## Create a Run `POST /runs` A run performs a plan and apply, using a configuration version and the workspace’s current variables. You can specify a configuration version when creating a run; if you don’t provide one, the run defaults to the workspace’s most recently used version. (A configuration version is “used” when it is created or used for a run in this workspace.) Creating a run requires permission to queue plans for the specified workspace. ([More about permissions.](/terraform/cloud-docs/users-teams-organizations/permissions)) When creating a run, you may optionally provide a list of variable objects containing key and value attributes. These values apply to that run specifically and take precedence over variables with the same key applied to the workspace(e.g., variable sets). Refer to [Variable Precedence](/terraform/cloud-docs/variables#precedence) for more information. All values must be expressed as an HCL literal in the same syntax you would use when writing Terraform code. Refer to [Types](/terraform/language/expressions/types#types) in the Terraform documentation for more details. Setting `debugging\_mode: true` enables debugging mode for the queued run only. This is equivalent to | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/run.mdx | main | terraform | [
0.0257315244525671,
-0.005601236596703529,
0.030485861003398895,
0.05626257136464119,
-0.04577863588929176,
-0.06552805751562119,
-0.062478214502334595,
-0.05732199177145958,
0.01962863840162754,
0.10325832664966583,
-0.047784674912691116,
0.0005671371472999454,
0.02536190301179886,
-0.039... | 0.056459 |
[Variable Precedence](/terraform/cloud-docs/variables#precedence) for more information. All values must be expressed as an HCL literal in the same syntax you would use when writing Terraform code. Refer to [Types](/terraform/language/expressions/types#types) in the Terraform documentation for more details. Setting `debugging\_mode: true` enables debugging mode for the queued run only. This is equivalent to setting the `TF\_LOG` environment variable to `TRACE` for this run. See [Debugging Terraform](/terraform/internals/debugging) for more information. \*\*Sample Run Variables:\*\* ```json "attributes": { "variables": [ { "key": "replicas", "value": "2" }, { "key": "access\_key", "value": "\"ABCDE12345\"" } ] } ``` [permissions-citation]: #intentionally-unused---keep-for-maintainers -> \*\*Note:\*\* This endpoint cannot be accessed with [organization tokens](/terraform/cloud-docs/users-teams-organizations/api-tokens#organization-api-tokens). You must access it with a [user token](/terraform/cloud-docs/users-teams-organizations/users#api-tokens) or [team token](/terraform/cloud-docs/users-teams-organizations/api-tokens#team-api-tokens). ### Request Body This POST endpoint requires a JSON object with the following properties as a request payload. Properties without a default value are required. | Key path | Type | Default | Description | | -------------------------------------------------- | -------------------- | -------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `data.attributes.allow-empty-apply` | bool | none | Specifies whether Terraform can apply the run even when the plan [contains no changes](/terraform/cloud-docs/workspaces/run/modes-and-options#allow-empty-apply). Use this property to [upgrade state](/terraform/cloud-docs/workspaces/state#upgrading-state) after upgrading a workspace to a new terraform version. | | `data.attributes.allow-config-generation` | bool | `false` | Specifies whether Terraform can [generate resource configuration](/terraform/language/import/generating-configuration) when planning to import new resources. When set to `false`, Terraform returns an error when `import` blocks do not have a corresponding `resource` block. | | `data.attributes.auto-apply` | bool | Defaults to the [Auto Apply](/terraform/cloud-docs/workspaces/settings#auto-apply-and-manual-apply) workspace setting. | Determines if Terraform automatically applies the configuration on a successful `terraform plan`. | | `data.attributes.debugging-mode` | bool | `false` | When set to `true`, enables verbose logging for the queued plan. | | `data.attributes.is-destroy` | bool | `false` | When set to `true`, the plan destroys all provisioned resources. Mutually exclusive with `refresh-only`. | | `data.attributes.message` | string | `"Queued manually via the Terraform Enterprise API"` | Specifies the message associated with this run. | | `data.attributes.refresh` | bool | `true` | Specifies whether or not to refresh the state before a plan. | | `data.attributes.refresh-only` | bool | `false` | When set to `true`, this run refreshes the state without modifying any resources. Mutually exclusive with `is-destroy`. | | `data.attributes.replace-addrs` | array\[string] | | Specifies an optional list of resource addresses to be passed to the `-replace` flag. | | `data.attributes.target-addrs` | array\[string] | | Specifies an optional list of resource addresses to be passed to the `-target` flag. | | `data.attributes.variables` | array\[{key, value}] | (empty array) | Specifies an optional list of run-specific variable values. Refer to [Run-Specific Variables](/terraform/cloud-docs/variables/managing-variables#run-specific-variables) for details. | | `data.attributes.plan-only` | bool | (from configuration version) | Specifies if this is a [speculative, plan-only](/terraform/cloud-docs/workspaces/run/modes-and-options#plan-only-speculative-plan) run that Terraform cannot apply. Often used in conjunction with terraform-version in order to test whether an upgrade would succeed. | | `data.attributes.save-plan` | bool | `false` | When set to `true`, the run is executed as a `save plan` run. A `save plan` run plans and checks the configuration without becoming the workspace's current run. These run types only becomes the current run if you confirm that you want to apply them when prompted. When creating new [configuration versions](/terraform/enterprise/api-docs/configuration-versions) for saved plan runs, be sure to make them `provisional`. | | `data.attributes.terraform-version` | string | none | Specifies the Terraform version to use in this run. Only valid for plan-only runs; must be a valid Terraform version available to the organization. | | `data.relationships.workspace.data.id` | string | none | Specifies the workspace ID to execute the run in. | | `data.relationships.configuration-version.data.id` | string | none | Specifies the configuration version to use for | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/run.mdx | main | terraform | [
0.0009311398025602102,
0.06796950846910477,
0.040164463222026825,
0.03945527970790863,
-0.04037373885512352,
-0.023068411275744438,
-0.009750060737133026,
-0.09050390124320984,
0.048454396426677704,
0.06897619366645813,
0.01532684825360775,
-0.08189813792705536,
0.025402365252375603,
0.045... | -0.026211 |
in this run. Only valid for plan-only runs; must be a valid Terraform version available to the organization. | | `data.relationships.workspace.data.id` | string | none | Specifies the workspace ID to execute the run in. | | `data.relationships.configuration-version.data.id` | string | none | Specifies the configuration version to use for this run. If the `configuration-version` object is omitted, Terraform uses the workspace's latest configuration version to create the run . | | Status | Response | Reason | |---------|----------------------------------------|-----------------------------------------------------------------------------| | [201][] | [JSON API document][] (`type: "runs"`) | Successfully created a run | | [404][] | [JSON API error object][] | Organization or workspace not found, or user unauthorized to perform action | | [422][] | [JSON API error object][] | Malformed request body (missing attributes, wrong types, etc.) | ### Sample Payload ```json { "data": { "attributes": { "message": "Custom message" }, "type":"runs", "relationships": { "workspace": { "data": { "type": "workspaces", "id": "ws-LLGHCr4SWy28wyGN" } }, "configuration-version": { "data": { "type": "configuration-versions", "id": "cv-n4XQPBa2QnecZJ4G" } } } } } ``` ### Sample Request ```shell curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request POST \ --data @payload.json \ https://app.terraform.io/api/v2/runs ``` ### Sample Response ```json { "data": { "id": "run-CZcmD7eagjhyX0vN", "type": "runs", "attributes": { "actions": { "is-cancelable": true, "is-confirmable": false, "is-discardable": false, "is-force-cancelable": false }, "canceled-at": null, "created-at": "2021-05-24T07:38:04.171Z", "has-changes": false, "auto-apply": false, "allow-empty-apply": false, "allow-config-generation": false, "is-destroy": false, "message": "Custom message", "plan-only": false, "source": "tfe-api", "status-timestamps": { "plan-queueable-at": "2021-05-24T07:38:04+00:00" }, "status": "pending", "trigger-reason": "manual", "target-addrs": null, "permissions": { "can-apply": true, "can-cancel": true, "can-comment": true, "can-discard": true, "can-force-execute": true, "can-force-cancel": true, "can-override-policy-check": true }, "refresh": false, "refresh-only": false, "replace-addrs": null, "save-plan": false, "variables": [] }, "relationships": { "apply": {...}, "comments": {...}, "configuration-version": {...}, "cost-estimate": {...}, "created-by": {...}, "input-state-version": {...}, "plan": {...}, "run-events": {...}, "policy-checks": {...}, "workspace": {...}, "workspace-run-alerts": {...} }, "links": { "self": "/api/v2/runs/run-CZcmD7eagjhyX0vN" } } } ``` ## Apply a Run `POST /runs/:run\_id/actions/apply` | Parameter | Description | |-----------|---------------------| | `run\_id` | The run ID to apply | Applies a run that is paused waiting for confirmation after a plan. This includes runs in the "needs confirmation" and "policy checked" states. This action is only required for runs that can't be auto-applied. Plans can be auto-applied if the auto-apply setting is enabled on the workspace and the plan was queued by a new VCS commit or by a user with permission to apply runs for the workspace. -> \*\*Note:\*\* If the run has a soft failed sentinel policy, you will need to [override the policy check](/terraform/cloud-docs/api-docs/policy-checks#override-policy) before Terraform can apply the run. You can find policy check details in the `relationships` section of the [run details endpoint](#get-run-details) response. Applying a run requires permission to apply runs for the workspace. ([More about permissions.](/terraform/cloud-docs/users-teams-organizations/permissions)) [permissions-citation]: #intentionally-unused---keep-for-maintainers This endpoint queues the request to perform an apply; the apply might not happen immediately. Since this endpoint represents an action (not a resource), it does not return any object in the response body. -> \*\*Note:\*\* This endpoint cannot be accessed with [organization tokens](/terraform/cloud-docs/users-teams-organizations/api-tokens#organization-api-tokens). You must access it with a [user token](/terraform/cloud-docs/users-teams-organizations/users#api-tokens) or [team token](/terraform/cloud-docs/users-teams-organizations/api-tokens#team-api-tokens). | Status | Response | Reason(s) | |---------|---------------------------|---------------------------------------------------------| | [202][] | none | Successfully queued an apply request. | | [409][] | [JSON API error object][] | Run was not paused for confirmation; apply not allowed. | ### Request Body This POST endpoint allows an optional JSON object with the following properties as a request payload. | Key path | Type | Default | Description | |-----------|--------|---------|------------------------------------| | `comment` | string | `null` | An optional comment about the run. | ### Sample Payload This payload is optional, | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/run.mdx | main | terraform | [
-0.015572095289826393,
0.016460172832012177,
0.03776957094669342,
0.032496750354766846,
-0.02179521881043911,
-0.03768628090620041,
-0.10260257869958878,
-0.10276414453983307,
0.020229201763868332,
0.06941959261894226,
-0.042367611080408096,
-0.04243158549070358,
-0.004419221077114344,
-0.... | -0.049919 |
Request Body This POST endpoint allows an optional JSON object with the following properties as a request payload. | Key path | Type | Default | Description | |-----------|--------|---------|------------------------------------| | `comment` | string | `null` | An optional comment about the run. | ### Sample Payload This payload is optional, so the `curl` command will work without the `--data @payload.json` option too. ```json { "comment":"Looks good to me" } ``` ### Sample Request ```shell curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request POST \ --data @payload.json \ https://app.terraform.io/api/v2/runs/run-DQGdmrWMX8z9yWQB/actions/apply ``` ## List Runs in a Workspace `GET /workspaces/:workspace\_id/runs` | Parameter | Description | |----------------|------------------------------------| | `workspace\_id` | The workspace ID to list runs for. | By default, `plan\_only` runs will be excluded from the results. To see all runs, use `filter[operation]` with all available operations included as a comma-separated list. This endpoint has an adjusted rate limit of 30 requests per minute. Note that most endpoints are limited to 30 requests per second. | Status | Response | Reason | |---------|--------------------------------------------------|--------------------------| | [200][] | Array of [JSON API document][]s (`type: "runs"`) | Successfully listed runs | ### Query Parameters This endpoint supports pagination [with standard URL query parameters](/terraform/cloud-docs/api-docs#query-parameters); remember to percent-encode `[` as `%5B` and `]` as `%5D` if your tooling doesn't automatically encode URLs. | Parameter | Description | Required | | -------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | | `page[number]` | If omitted, the endpoint returns the first page. | Optional | | `page[size]` | If omitted, the endpoint returns 20 runs per page. | Optional | | `filter[operation]` | A comma-separated list of run operations. The result lists runs that perform one of these operations. For details on options, refer to [Run operations](/terraform/enterprise/api-docs/run#run-operations). | Optional | | `filter[status]` | A comma-separated list of run statuses. The result lists runs that are in one of the statuses you specify. For details on options, refer to [Run states](/terraform/enterprise/api-docs/run#run-states). | Optional | | `filter[agent\_pool\_names]` | A comma-separated list of agent pool names. The result lists runs that use one of the agent pools you specify. | Optional | | `filter[source]` | A comma-separated list of run sources. The result lists runs that came from one of the sources you specify. Options are listed in [Run Sources](/terraform/enterprise/api-docs/run#run-sources). | Optional | | `filter[status\_group]` | A single status group. The result lists runs whose status falls under this status group. For details on options, refer to [Run status groups](/terraform/enterprise/api-docs/run#run-status-groups). | Optional | | `filter[timeframe]` | A single year period. The result lists runs that were created within the year you specify. An integer year or the string "year" for the past year are valid values. If omitted, the endpoint returns all runs since the creation of the workspace. | Optional | | `search[user]` | Searches for runs that match the VCS username you supply. | Optional | | `search[commit]` | Searches for runs that match the commit sha you specify. | Optional | | `search[basic]` | Searches for runs that match the VCS username, commit sha, run\_id, or run message your specify. HCP Terraform prioritizes `search[commit]` or `search[user]` and ignores `search[basic]` in favor of the higher priority parameters if you include them in your query. | Optional | ### Sample Request ```shell curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ https://app.terraform.io/api/v2/workspaces/ws-yF7z4gyEQRhaCNG9/runs ``` ### Sample Response ```json { "data": [ { "id": "run-CZcmD7eagjhyX0vN", "type": "runs", "attributes": { "actions": { "is-cancelable": true, "is-confirmable": false, "is-discardable": false, "is-force-cancelable": false }, "canceled-at": null, "created-at": "2021-05-24T07:38:04.171Z", "has-changes": false, "auto-apply": false, "allow-empty-apply": false, "allow-config-generation": false, "is-destroy": false, "message": "Custom message", "plan-only": false, "source": "tfe-api", | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/run.mdx | main | terraform | [
-0.047493208199739456,
0.05218978971242905,
-0.011843465268611908,
0.01159210316836834,
-0.059622325003147125,
-0.07190551608800888,
-0.0350162573158741,
-0.008714525029063225,
0.04226798191666603,
0.06995085626840591,
-0.033302176743745804,
-0.062167275696992874,
-0.015928583219647408,
0.... | 0.033425 |
application/vnd.api+json" \ https://app.terraform.io/api/v2/workspaces/ws-yF7z4gyEQRhaCNG9/runs ``` ### Sample Response ```json { "data": [ { "id": "run-CZcmD7eagjhyX0vN", "type": "runs", "attributes": { "actions": { "is-cancelable": true, "is-confirmable": false, "is-discardable": false, "is-force-cancelable": false }, "canceled-at": null, "created-at": "2021-05-24T07:38:04.171Z", "has-changes": false, "auto-apply": false, "allow-empty-apply": false, "allow-config-generation": false, "is-destroy": false, "message": "Custom message", "plan-only": false, "source": "tfe-api", "status-timestamps": { "plan-queueable-at": "2021-05-24T07:38:04+00:00" }, "status": "pending", "trigger-reason": "manual", "target-addrs": null, "permissions": { "can-apply": true, "can-cancel": true, "can-comment": true, "can-discard": true, "can-force-execute": true, "can-force-cancel": true, "can-override-policy-check": true }, "refresh": false, "refresh-only": false, "replace-addrs": null, "save-plan": false, "variables": [] }, "relationships": { "apply": {...}, "comments": {...}, "configuration-version": {...}, "cost-estimate": {...}, "created-by": {...}, "input-state-version": {...}, "plan": {...}, "run-events": {...}, "policy-checks": {...}, "workspace": {...}, "workspace-run-alerts": {...} }, "links": { "self": "/api/v2/runs/run-bWSq4YeYpfrW4mx7" } }, {...} ], "links": { "first": "https://app.terraform.io/api/v2/workspaces/ws-yF7z4gyEQRhaCNG9/runs?page[number]=1&page[size]=20", "last": "https://app.terraform.io/api/v2/workspaces/ws-yF7z4gyEQRhaCNG9/runs?page[number]=19206&page[size]=20", "self": "https://app.terraform.io/api/v2/workspaces/ws-yF7z4gyEQRhaCNG9/runs?page[number]=2&page[size]=20", "prev": "https://app.terraform.io/api/v2/workspaces/ws-yF7z4gyEQRhaCNG9/runs?page[number]=1&page[size]=20", "next": "https://app.terraform.io/api/v2/workspaces/ws-yF7z4gyEQRhaCNG9/runs?page[number]=3&page[size]=20" }, "meta": { "pagination": { "current-page": 2, "next-page": 3, "prev-page": 1, "page-size": 20, "total-count": 384105, "total-pages": 19206 } } } ``` ## List Runs in an Organization `GET /organizations/:organization\_name/runs` | Parameter | Description | |----------------|------------------------------------| | `organization\_name` | The organization name to list runs for. | This endpoint has an adjusted rate limit of 30 requests per minute. Note that most endpoints are limited to 30 requests per second. Note that this endpoint differs from others in the pagination metadata included in the response, such as the exclusion of the typical `total-count` and `total-pages`. See the Sample Response below for more details. | Status | Response | Reason | |---------|--------------------------------------------------|--------------------------| | [200][] | Array of [JSON API document][]s (`type: "runs"`) | Successfully listed runs | ### Query Parameters This endpoint supports pagination [with standard URL query parameters](/terraform/cloud-docs/api-docs#query-parameters); remember to percent-encode `[` as `%5B` and `]` as `%5D` if your tooling doesn't automatically encode URLs. | Parameter | Description | Required | | -------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | | `page[number]` | If omitted, the endpoint returns the first page. | Optional | | `page[size]` | If omitted, the endpoint returns 20 runs per page. | Optional | | `filter[operation]` | A comma-separated list of run operations. The result lists runs that perform one of these operations. For details on options, refer to [Run operations](/terraform/enterprise/api-docs/run#run-operations). | Optional | | `filter[status]` | A comma-separated list of run statuses. The result lists runs that are in one of the statuses you specify. For details on options, refer to [Run states](/terraform/enterprise/api-docs/run#run-states). | Optional | | `filter[agent\_pool\_names]` | A comma-separated list of agent pool names. The result lists runs that use one of the agent pools you specify. | Optional | | `filter[workspace\_names]` | A comma-separated list of workspace names. The result lists runs that belong to one of the workspaces your specify. | Optional | | `filter[source]` | A comma-separated list of run sources. The result lists runs that came from one of the sources you specify. Options are listed in [Run Sources](/terraform/enterprise/api-docs/run#run-sources). | Optional | | `filter[status\_group]` | A single status group. The result lists runs whose status falls under this status group. For details on options, refer to [Run status groups](/terraform/enterprise/api-docs/run#run-status-groups). | Optional | | `filter[timeframe]` | A single year period. The result lists runs that were created within the year you specify. An integer year or the string "year" for the past year are valid values. If omitted, the endpoint returns runs created in the last year. | Optional | | `search[user]` | Searches for runs that match the VCS username you supply. | Optional | | `search[commit]` | Searches for runs that match the commit sha you specify. | Optional | | `search[basic]` | Searches for runs that match the VCS username, commit sha, run\_id, or | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/run.mdx | main | terraform | [
-0.0737210363149643,
0.056821584701538086,
0.048036377876996994,
0.04723508656024933,
0.026710741221904755,
-0.05344396084547043,
-0.064341701567173,
-0.06078460440039635,
0.0641542300581932,
0.10722304880619049,
0.000027180425604456104,
-0.0720139741897583,
-0.010263086296617985,
0.025869... | 0.035165 |
| Optional | | `search[user]` | Searches for runs that match the VCS username you supply. | Optional | | `search[commit]` | Searches for runs that match the commit sha you specify. | Optional | | `search[basic]` | Searches for runs that match the VCS username, commit sha, run\_id, or run message your specify. HCP Terraform prioritizes `search[commit]` or `search[user]` and ignores `search[basic]` in favor of the higher priority parameters if you include them in your query. | Optional | ### Sample Request ```shell curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ https://app.terraform.io/api/v2/organizations/hashicorp/runs ``` ### Sample Response ```json { "data": [ { "id": "run-CZcmD7eagjhyX0vN", "type": "runs", "attributes": { "actions": { "is-cancelable": true, "is-confirmable": false, "is-discardable": false, "is-force-cancelable": false }, "canceled-at": null, "created-at": "2021-05-24T07:38:04.171Z", "has-changes": false, "auto-apply": false, "allow-empty-apply": false, "allow-config-generation": false, "is-destroy": false, "message": "Custom message", "plan-only": false, "source": "tfe-api", "status-timestamps": { "plan-queueable-at": "2021-05-24T07:38:04+00:00" }, "status": "pending", "trigger-reason": "manual", "target-addrs": null, "permissions": { "can-apply": true, "can-cancel": true, "can-comment": true, "can-discard": true, "can-force-execute": true, "can-force-cancel": true, "can-override-policy-check": true }, "refresh": false, "refresh-only": false, "replace-addrs": null, "save-plan": false, "variables": [] }, "relationships": { "apply": {...}, "comments": {...}, "configuration-version": {...}, "cost-estimate": {...}, "created-by": {...}, "input-state-version": {...}, "plan": {...}, "run-events": {...}, "policy-checks": {...}, "workspace": {...}, "workspace-run-alerts": {...} }, "links": { "self": "/api/v2/runs/run-bWSq4YeYpfrW4mx7" } }, {...} ], "links": { "self": "https://app.terraform.io/api/v2/organizations/hashicorp/runs?page[number]=2&page[size]=20", "prev": "https://app.terraform.io/api/v2/organizations/hashicorp/runs?page[number]=1&page[size]=20", "next": "https://app.terraform.io/api/v2/organizations/hashicorp/runs?page[number]=3&page[size]=20" }, "meta": { "pagination": { "current-page": 1, "next-page": 2, "prev-page": null, "page-size": 20 } } } ``` ## Get run details `GET /runs/:run\_id` | Parameter | Description | |-----------|--------------------| | `:run\_id` | The run ID to get. | This endpoint is used for showing details of a specific run. | Status | Response | Reason | |---------|----------------------------------------|--------------------------------------| | [200][] | [JSON API document][] (`type: "runs"`) | Success | | [404][] | [JSON API error object][] | Run not found or user not authorized | ### Sample Request ```shell curl \ --header "Authorization: Bearer $TOKEN" \ https://app.terraform.io/api/v2/runs/run-bWSq4YeYpfrW4mx7 ``` ### Sample Response ```json { "data": { "id": "run-CZcmD7eagjhyX0vN", "type": "runs", "attributes": { "actions": { "is-cancelable": true, "is-confirmable": false, "is-discardable": false, "is-force-cancelable": false }, "canceled-at": null, "created-at": "2021-05-24T07:38:04.171Z", "has-changes": false, "auto-apply": false, "allow-empty-apply": false, "allow-config-generation": false, "is-destroy": false, "message": "Custom message", "plan-only": false, "source": "tfe-api", "status-timestamps": { "plan-queueable-at": "2021-05-24T07:38:04+00:00" }, "status": "pending", "trigger-reason": "manual", "target-addrs": null, "permissions": { "can-apply": true, "can-cancel": true, "can-comment": true, "can-discard": true, "can-force-execute": true, "can-force-cancel": true, "can-override-policy-check": true }, "refresh": false, "refresh-only": false, "replace-addrs": null, "save-plan": false, "variables": [] }, "relationships": { "apply": {...}, "comments": {...}, "configuration-version": {...}, "cost-estimate": {...}, "created-by": {...}, "input-state-version": {...}, "plan": {...}, "run-events": {...}, "policy-checks": {...}, "task-stages": {...}, "workspace": {...}, "workspace-run-alerts": {...} }, "links": { "self": "/api/v2/runs/run-bWSq4YeYpfrW4mx7" } } } ``` ## Discard a Run `POST /runs/:run\_id/actions/discard` | Parameter | Description | |-----------|-----------------------| | `run\_id` | The run ID to discard | The `discard` action can be used to skip any remaining work on runs that are paused waiting for confirmation or priority. This includes runs in the "pending," "needs confirmation," "policy checked," and "policy override" states. Discarding a run requires permission to apply runs for the workspace. ([More about permissions.](/terraform/cloud-docs/users-teams-organizations/permissions)) [permissions-citation]: #intentionally-unused---keep-for-maintainers This endpoint queues the request to perform a discard; the discard might not happen immediately. After discarding, the run is completed and later runs can proceed. This endpoint represents an action as opposed to a resource. As such, it does not return any object in the response body. -> \*\*Note:\*\* This endpoint cannot be accessed with [organization tokens](/terraform/cloud-docs/users-teams-organizations/api-tokens#organization-api-tokens). You must access it with a [user token](/terraform/cloud-docs/users-teams-organizations/users#api-tokens) or [team token](/terraform/cloud-docs/users-teams-organizations/api-tokens#team-api-tokens). | Status | Response | Reason(s) | |---------|---------------------------|-----------------------------------------------------------------------| | [202][] | none | Successfully queued a discard request. | | | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/run.mdx | main | terraform | [
0.016573794186115265,
0.10506654530763626,
0.03396983444690704,
-0.0021799765527248383,
-0.025519954040646553,
0.014071800746023655,
-0.030292624607682228,
-0.013192241080105305,
0.03954148292541504,
0.02764599211513996,
0.00009338904055766761,
-0.13487309217453003,
0.023924998939037323,
-... | 0.027165 |
does not return any object in the response body. -> \*\*Note:\*\* This endpoint cannot be accessed with [organization tokens](/terraform/cloud-docs/users-teams-organizations/api-tokens#organization-api-tokens). You must access it with a [user token](/terraform/cloud-docs/users-teams-organizations/users#api-tokens) or [team token](/terraform/cloud-docs/users-teams-organizations/api-tokens#team-api-tokens). | Status | Response | Reason(s) | |---------|---------------------------|-----------------------------------------------------------------------| | [202][] | none | Successfully queued a discard request. | | [409][] | [JSON API error object][] | Run was not paused for confirmation or priority; discard not allowed. | ### Request Body This POST endpoint allows an optional JSON object with the following properties as a request payload. | Key path | Type | Default | Description | |-----------|--------|---------|--------------------------------------------------------| | `comment` | string | `null` | An optional explanation for why the run was discarded. | ### Sample Payload This payload is optional, so the `curl` command will work without the `--data @payload.json` option too. ```json { "comment": "This run was discarded" } ``` ### Sample Request ```shell curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request POST \ --data @payload.json \ https://app.terraform.io/api/v2/runs/run-DQGdmrWMX8z9yWQB/actions/discard ``` ## Cancel a Run `POST /runs/:run\_id/actions/cancel` | Parameter | Description | |-----------|----------------------| | `run\_id` | The run ID to cancel | The `cancel` action can be used to interrupt a run that is currently planning or applying. Performing a cancel is roughly equivalent to hitting ctrl+c during a Terraform plan or apply on the CLI. The running Terraform process is sent an `INT` signal, which instructs Terraform to end its work and wrap up in the safest way possible. Canceling a run requires permission to apply runs for the workspace. ([More about permissions.](/terraform/cloud-docs/users-teams-organizations/permissions)) [permissions-citation]: #intentionally-unused---keep-for-maintainers This endpoint queues the request to perform a cancel; the cancel might not happen immediately. After canceling, the run is completed and later runs can proceed. This endpoint represents an action as opposed to a resource. As such, it does not return any object in the response body. -> \*\*Note:\*\* This endpoint cannot be accessed with [organization tokens](/terraform/cloud-docs/users-teams-organizations/api-tokens#organization-api-tokens). You must access it with a [user token](/terraform/cloud-docs/users-teams-organizations/users#api-tokens) or [team token](/terraform/cloud-docs/users-teams-organizations/api-tokens#team-api-tokens). | Status | Response | Reason(s) | |---------|---------------------------|-------------------------------------------------------| | [202][] | none | Successfully queued a cancel request. | | [409][] | [JSON API error object][] | Run was not planning or applying; cancel not allowed. | | [404][] | [JSON API error object][] | Run was not found or user not authorized. | ### Request Body This POST endpoint allows an optional JSON object with the following properties as a request payload. | Key path | Type | Default | Description | |-----------|--------|---------|-------------------------------------------------------| | `comment` | string | `null` | An optional explanation for why the run was canceled. | ### Sample Payload This payload is optional, so the `curl` command will work without the `--data @payload.json` option too. ```json { "comment": "This run was stuck and would never finish." } ``` ### Sample Request ```shell curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request POST \ --data @payload.json \ https://app.terraform.io/api/v2/runs/run-DQGdmrWMX8z9yWQB/actions/cancel ``` ## Forcefully cancel a run `POST /runs/:run\_id/actions/force-cancel` | Parameter | Description | |-----------|----------------------| | `run\_id` | The run ID to cancel | The `force-cancel` action is like [cancel](#cancel-a-run), but ends the run immediately. Once invoked, the run is placed into a `canceled` state, and the running Terraform process is terminated. The workspace is immediately unlocked, allowing further runs to be queued. The `force-cancel` operation requires admin access to the workspace. ([More about permissions.](/terraform/cloud-docs/users-teams-organizations/permissions)) [permissions-citation]: #intentionally-unused---keep-for-maintainers This endpoint enforces a prerequisite that a [non-forceful cancel](#cancel-a-run) is performed first, and a cool-off period has elapsed. To determine if this criteria is met, it is useful to check the `data.attributes.is-force-cancelable` value of the [run details endpoint](#get-run-details). | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/run.mdx | main | terraform | [
-0.011551940813660622,
0.08425986021757126,
0.04692317172884941,
0.02366669476032257,
-0.001491251401603222,
-0.06091998517513275,
-0.041057832539081573,
-0.03440907225012779,
0.08225953578948975,
0.08251512795686722,
-0.04070225730538368,
-0.10541194677352905,
-0.024208709597587585,
0.017... | 0.048816 |
operation requires admin access to the workspace. ([More about permissions.](/terraform/cloud-docs/users-teams-organizations/permissions)) [permissions-citation]: #intentionally-unused---keep-for-maintainers This endpoint enforces a prerequisite that a [non-forceful cancel](#cancel-a-run) is performed first, and a cool-off period has elapsed. To determine if this criteria is met, it is useful to check the `data.attributes.is-force-cancelable` value of the [run details endpoint](#get-run-details). The time at which the force-cancel action will become available can be found using the [run details endpoint](#get-run-details), in the key `data.attributes.force\_cancel\_available\_at`. Note that this key is only present in the payload after the initial cancel has been initiated. This endpoint represents an action as opposed to a resource. As such, it does not return any object in the response body. -> \*\*Note:\*\* This endpoint cannot be accessed with [organization tokens](/terraform/cloud-docs/users-teams-organizations/api-tokens#organization-api-tokens). You must access it with a [user token](/terraform/cloud-docs/users-teams-organizations/users#api-tokens) or [team token](/terraform/cloud-docs/users-teams-organizations/api-tokens#team-api-tokens). ~> \*\*Warning:\*\* This endpoint has potentially dangerous side-effects, including loss of any in-flight state in the running Terraform process. Use this operation with extreme caution. | Status | Response | Reason(s) | |---------|---------------------------|--------------------------------------------------------------------------------------------------------------------| | [202][] | none | Successfully queued a cancel request. | | [409][] | [JSON API error object][] | Run was not planning or applying, has not been canceled non-forcefully, or the cool-off period has not yet passed. | | [404][] | [JSON API error object][] | Run was not found or user not authorized. | ### Request Body This POST endpoint allows an optional JSON object with the following properties as a request payload. | Key path | Type | Default | Description | |-----------|--------|---------|-------------------------------------------------------| | `comment` | string | `null` | An optional explanation for why the run was canceled. | ### Sample Payload This payload is optional, so the `curl` command will work without the `--data @payload.json` option too. ```json { "comment": "This run was stuck and would never finish." } ``` ### Sample Request ```shell curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request POST \ --data @payload.json \ https://app.terraform.io/api/v2/runs/run-DQGdmrWMX8z9yWQB/actions/force-cancel ``` ## Forcefully execute a run `POST /runs/:run\_id/actions/force-execute` | Parameter | Description | |-----------|-----------------------| | `run\_id` | The run ID to execute | The force-execute action cancels all prior runs that are not already complete, unlocking the run's workspace and allowing the run to be executed. (It initiates the same actions as the "Run this plan now" button at the top of the view of a pending run.) Force-executing a run requires permission to apply runs for the workspace. ([More about permissions.](/terraform/cloud-docs/users-teams-organizations/permissions)) [permissions-citation]: #intentionally-unused---keep-for-maintainers This endpoint enforces the following prerequisites: - The target run is in the "pending" state. - The workspace is locked by another run. - The run locking the workspace can be discarded. This endpoint represents an action as opposed to a resource. As such, it does not return any object in the response body. -> \*\*Note:\*\* This endpoint cannot be accessed with [organization tokens](/terraform/cloud-docs/users-teams-organizations/api-tokens#organization-api-tokens). You must access it with a [user token](/terraform/cloud-docs/users-teams-organizations/users#api-tokens) or [team token](/terraform/cloud-docs/users-teams-organizations/api-tokens#team-api-tokens). ~> \*\*Note:\*\* While useful at times, force-executing a run circumvents the typical workflow of applying runs using HCP Terraform. It is not intended for regular use. If you find yourself using it frequently, please reach out to HashiCorp Support for help in developing an alternative approach. | Status | Response | Reason(s) | |---------|---------------------------|-----------------------------------------------------------------------------------------------| | [202][] | none | Successfully initiated the force-execution process. | | [403][] | [JSON API error object][] | Run is not pending, its workspace was not locked, or its workspace association was not found. | | [409][] | [JSON API error object][] | The run locking the workspace was not in a discardable state. | | [404][] | [JSON API error object][] | Run | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/run.mdx | main | terraform | [
-0.02154684253036976,
0.045105453580617905,
0.053270597010850906,
0.08437585830688477,
0.007974756881594658,
-0.0656186193227768,
0.00022304360754787922,
-0.14861942827701569,
0.10404979437589645,
0.13060766458511353,
-0.003746452508494258,
0.003128020791336894,
0.011667399667203426,
-0.03... | 0.017034 |
API error object][] | Run is not pending, its workspace was not locked, or its workspace association was not found. | | [409][] | [JSON API error object][] | The run locking the workspace was not in a discardable state. | | [404][] | [JSON API error object][] | Run was not found or user not authorized. | ### Request Body This POST endpoint does not take a request body. ### Sample Request ```shell curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request POST \ https://app.terraform.io/api/v2/runs/run-DQGdmrWMX8z9yWQB/actions/force-execute ``` ## Available Related Resources The GET endpoints above can optionally return related resources, if requested with [the `include` query parameter](/terraform/cloud-docs/api-docs#inclusion-of-related-resources). The following resource types are available: - `plan` - Additional information about plans. - `apply` - Additional information about applies. - `created\_by` - Full user records of the users responsible for creating the runs. - `cost\_estimate` - Additional information about cost estimates. - `configuration\_version` - The configuration record used in the run. - `configuration\_version.ingress\_attributes` - The commit information used in the run. | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/run.mdx | main | terraform | [
-0.06680329144001007,
0.03683210164308548,
-0.007753144484013319,
0.02543504349887371,
0.010597540996968746,
-0.024394184350967407,
-0.05266442149877548,
-0.1117415502667427,
0.05100332200527191,
0.0738743245601654,
-0.011866665445268154,
-0.033864956349134445,
0.0010634340578690171,
0.050... | 0.066481 |
[200]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/200 [201]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/201 [202]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/202 [204]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/204 [307]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/307 [400]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/400 [401]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/401 [403]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/403 [404]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/404 [409]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/409 [412]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/412 [422]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/422 [429]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429 [500]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500 [504]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504 [JSON API document]: /terraform/cloud-docs/api-docs#json-api-documents [JSON API error object]: http://jsonapi.org/format/#error-objects # Stack states API reference Stack states offer deeper insight into the state of a particular Stack deployment. ## Overview The scope of the API includes the following endpoints: | Method | Path | Action | |----------|----------------------------------------------|------------------------------------------------------------------------------------------------------------| | `GET` | `/stacks/:stack\_id/stack-states` | Call this endpoint to [list Stack states](#list-stack-states). | | `GET` | `/stack-states/:stack\_state\_id` | Call this endpoint to [show a Stack state](#show-a-stack-state). | | `GET` | `/stack-states/:stack\_state\_id/description` | Call this endpoint to [show a Stack state description](#show-a-stack-state-description). | ## List Stack states This endpoint lists states for a Stack. `GET /stacks/:stack\_id/stack-states` | Parameter | Description | |-------------|------------------------------------------------------------| | `:stack\_id` | The ID of the Stack to list the states of. | ### Query Parameters This endpoint supports pagination [with standard URL query parameters](/terraform/cloud-docs/api-docs#query-parameters); remember to percent-encode `[` as `%5B` and `]` as `%5D` if your tooling doesn't automatically encode URLs. | Parameter | Description | |----------------|------------------------------------------------------------------------------| | `page[number]` | \*\*Optional.\*\* If omitted, the endpoint will return the first page. | | `page[size]` | \*\*Optional.\*\* If omitted, the endpoint will return 20 Stack states per page. | ### Sample Request ```shell $ curl\ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ https://app.terraform.io/api/v2/stacks/st-VrqRktntTNJrAhBz/stack-states ``` ### Sample Response ```json { "data": [ { "id": "sts-ykymXedzS8mbXKGc", "type": "stack-states", "attributes": { "generation": 1, "status": "completed", "deployment": "simple", "components": [ { "address": "component.pet", "component-address": "component.pet", "instance-correlator": "ZLqa501mJ7nhAw2LjjI0EGseuFR73XnXVubflsHFj/4=", "component-correlator": "mVeO7lZxmV5xQ9Hr+JOAljxocBy301AqmloiGV9yohg=", "resource-instance-count": 3 }, { "address": "component.nulls", "component-address": "component.nulls", "instance-correlator": "gA0VCfa68e5TerC8yiNFUPa1PgLFqeV0HAf9t8j8vYE=", "component-correlator": "tgwFPu/Y6FxtySWdN/SjfLf01WUsOwtrefsbNLXfauI=", "resource-instance-count": 1 }, { "address": "component.nils", "component-address": "component.nils", "instance-correlator": "+0KI2KgtqbfLK27i3RWObJ7cU9LM5ksPkkOwiTMeNmE=", "component-correlator": "sqlcMWrMGhp3ZydAWIRw6wDXIeO5FBK9G6mC1Gw/oGo=", "resource-instance-count": 9 } ], "is-current": true, "resource-instance-count": 13 }, "relationships": { "stack": { "data": { "id": "st-YwBzgFeeW6Mq4wkH", "type": "stacks" } }, "stack-deployment-run": { "data": null } }, "links": { "self": "/api/v2/stack-states/sts-ykymXedzS8mbXKGc", "description": "/api/v2/stack-states/sts-ykymXedzS8mbXKGc/description" } } ], "links": { "self": "https://app.terraform.io/api/v2/stacks/st-YwBzgFeeW6Mq4wkH/stack-states?page%5Bnumber%5D=1&page%5Bsize%5D=1", "first": "https://app.terraform.io/api/v2/stacks/st-YwBzgFeeW6Mq4wkH/stack-states?page%5Bnumber%5D=1&page%5Bsize%5D=1", "prev": null, "next": "https://app.terraform.io/api/v2/stacks/st-YwBzgFeeW6Mq4wkH/stack-states?page%5Bnumber%5D=2&page%5Bsize%5D=1", "last": "https://app.terraform.io/api/v2/stacks/st-YwBzgFeeW6Mq4wkH/stack-states?page%5Bnumber%5D=3&page%5Bsize%5D=1" }, "meta": { "pagination": { "current-page": 1, "page-size": 1, "prev-page": null, "next-page": 2, "total-pages": 3, "total-count": 3 } } } ``` ## Show a Stack state This endpoint lists details about a Stack state. `GET /stack\_states/:stack\_state\_id` | Parameter | Description | |-------------------|-----------------------------------------------| | `:stack\_state\_id` | The ID of the Stack state to get details for. | ### Sample Request ```shell $ curl\ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ https://app.terraform.io/api/v2/stack-states/sts-PrqektntTNJrAhCm ``` ### Sample Response ```json { "data": { "id": "sts-ykymXedzS8mbXKGc", "type": "stack-states", "attributes": { "generation": 1, "status": "completed", "deployment": "simple", "components": [ { "address": "component.pet", "component-address": "component.pet", "instance-correlator": "ZLqa501mJ7nhAw2LjjI0EGseuFR73XnXVubflsHFj/4=", "component-correlator": "mVeO7lZxmV5xQ9Hr+JOAljxocBy301AqmloiGV9yohg=", "resource-instance-count": 3 }, { "address": "component.nulls", "component-address": "component.nulls", "instance-correlator": "gA0VCfa68e5TerC8yiNFUPa1PgLFqeV0HAf9t8j8vYE=", "component-correlator": "tgwFPu/Y6FxtySWdN/SjfLf01WUsOwtrefsbNLXfauI=", "resource-instance-count": 1 }, { "address": "component.nils", "component-address": "component.nils", "instance-correlator": "+0KI2KgtqbfLK27i3RWObJ7cU9LM5ksPkkOwiTMeNmE=", "component-correlator": "sqlcMWrMGhp3ZydAWIRw6wDXIeO5FBK9G6mC1Gw/oGo=", "resource-instance-count": 9 } ], "is-current": true, "resource-instance-count": 13 }, "relationships": { "stack": { "data": { "id": "st-YwBzgFeeW6Mq4wkH", "type": "stacks" } }, "stack-deployment-run": { "data": null } }, "links": { "self": "/api/v2/stack-states/sts-ykymXedzS8mbXKGc", "description": "/api/v2/stack-states/sts-ykymXedzS8mbXKGc/description" } } } ``` ## Show a Stack state description This endpoint redirects to a download URL for a Stack state description. `GET /stack-states/:stack\_state\_id/description` | Parameter | Description | |-------------------|-------------------------------------------------------------------| | `:stack\_state\_id` | The ID of the Stack state to get a description for. | | Status | Response | Reason | |---------|---------------------------|--------------------------------------------------------------------| | [204][] | No Content | Responds with empty success when state has not yet been uploaded. | | [307][] | [JSON API error object][] | Redirect client to temporary Stack state description download URL. | | [404][] | [JSON API error object][] | Stack state not found, or user unauthorized | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/stacks/states.mdx | main | terraform | [
-0.026010459288954735,
-0.02275005355477333,
-0.026095468550920486,
-0.018418513238430023,
-0.02009897492825985,
-0.08436909317970276,
-0.05374377593398094,
-0.0791759043931961,
-0.0060250526294112206,
-0.03486490249633789,
0.03005075827240944,
0.05508139356970787,
0.0022271922789514065,
-... | 0.068675 |
[204][] | No Content | Responds with empty success when state has not yet been uploaded. | | [307][] | [JSON API error object][] | Redirect client to temporary Stack state description download URL. | | [404][] | [JSON API error object][] | Stack state not found, or user unauthorized to perform action. | ### Sample Request ```shell $ curl\ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ https://app.terraform.io/api/v2/stack-states/sts-LSqektntTNJrAhCt/description ``` | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/stacks/states.mdx | main | terraform | [
-0.01921856962144375,
0.01805146038532257,
0.015383041463792324,
0.009962636977434158,
0.01587539166212082,
-0.08057820051908493,
-0.08015874773263931,
-0.04162135720252991,
0.07170674204826355,
0.09883090853691101,
0.02067182958126068,
-0.09752672910690308,
0.014656547456979752,
0.0380471... | 0.068925 |
[200]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/200 [201]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/201 [202]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/202 [204]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/204 [400]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/400 [401]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/401 [403]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/403 [404]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/404 [409]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/409 [412]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/412 [422]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/422 [429]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429 [500]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500 [504]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504 [JSON API document]: /terraform/cloud-docs/api-docs#json-api-documents [JSON API error object]: http://jsonapi.org/format/#error-objects # Stack API reference Stacks let you split your Terraform configuration into components and then deploy and manage those components across multiple deployments. You can manage the lifecycle of each deployment separately, roll out configuration changes across your deployments, and manage your Stack as a unit in HCP Terraform. To learn more, refer to the [Stacks overview](/terraform/cloud-docs/stacks). ## Overview The scope of the API includes the following endpoints: | Method | Path | Action | |----------|-------------------------------------------------- |------------------------------------------------------------------------------------------------------------| | `POST` | `/stacks` | Call this endpoint to [create a Stack](#create-a-stack). | | `GET` | `/organizations/:organization\_name/stacks` | Call this endpoint to [list Stacks](#list-stacks). | | `GET` | `/stacks/:stack\_id` | Call this endpoint to [show a Stack](#show-a-stack). | | `GET` | `/stacks/:stack\_id/stack-configuration-summaries` | Call this endpoint to [list Stack configuration summaries](#list-stack-configuration-summaries). | | `PATCH` | `/stacks/:stack\_id` | Call this endpoint to [update a Stack](#update-a-stack). | | `DELETE` | `/stacks/:stack\_id` | Call this endpoint to [delete a Stack](#delete-a-stack). | ## Create a Stack This endpoint creates a Stack for an organization. `POST /stacks` The ability to create Stacks is restricted to users with \*\*Maintain\*\* project permissions, teams with the [\*\*Manage all projects\*\* permission](terraform/cloud-docs/users-teams-organizations/permissions), and the [organization API token](/terraform/cloud-docs/users-teams-organizations/api-tokens#organization-api-tokens). | Status | Response | Reason | |---------|---------------------------|-----------------------------------------------------------------------| | [201][] | [JSON API document][] | Successfully created a Stack. | | [404][] | [JSON API error object][] | Not found, or the user is unauthorized to perform this action. | | [422][] | [JSON API error object][] | Malformed request body (e.g., missing attributes, wrong types, etc.). | | [500][] | [JSON API error object][] | Internal system failure. | ### Request Body This POST endpoint requires a JSON object with the following properties as a request payload. Properties without a default value are required. | Key path | Type | Default | Description | |-------------------------------------------------------|---------|------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | `data.attributes.name` | string | | The name of the Stack, which can only include letters, numbers, `-`, and `\_`. This will be used as an identifier and must be unique in the project. | | `data.attributes.description` | string | (nothing) | A description for the Stack. | | `data.attributes.speculative-enabled` | boolean | `false` | Whether this Stack allows automatic speculative plans. Setting this to `false` prevents HCP Terraform from running plans on pull requests, which can improve security if the VCS repository is public or includes untrusted contributors. | | `data.attributes.trigger-disabled` | boolean | | When disabled, plan operations won't automatically start. | | `data.attributes.service-provider` | string | (nothing) | The VCS provider being connected with. Valid options are `"github"`, `"github\_enterprise"`, `"gitlab\_hosted"`, `"gitlab\_community\_edition"`, `"gitlab\_enterprise\_edition"`, or `"ado\_server"`. | | `data.attributes.debugging-mode` | boolean | false | When enabled, plan and apply operations will generate debug level logs. | `data.attributes.vcs-repo` | object | | Settings for the Stack's VCS repository. | | `data.attributes.vcs-repo.branch` | string | (nothing) | The repository branch used by this Stack's configuration. If omitted or submitted as an empty string, this defaults to the repository's default branch, such as `main`. | | `data.attributes.vcs-repo.tags-regex` | string | (previous value) | A regular expression used to match Git tags. HCP Terraform begins preparing a Stack configuration when this value is present and a VCS event occurs that contains a matching Git tag for the regular expression. | | `data.attributes.vcs-repo.identifier` | string | | A reference to your VCS repository in the format `:org/:repo` where `:org` and `:repo` refer to the organization and repository | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/stacks/index.mdx | main | terraform | [
-0.015784088522195816,
-0.01700746826827526,
-0.018668580800294876,
-0.028096551075577736,
-0.024631375446915627,
-0.08318780362606049,
-0.0621652752161026,
-0.07521579414606094,
-0.005580500699579716,
-0.03855427727103233,
0.03281282261013985,
0.0540321059525013,
0.006812138482928276,
-0.... | 0.052879 |
a Stack configuration when this value is present and a VCS event occurs that contains a matching Git tag for the regular expression. | | `data.attributes.vcs-repo.identifier` | string | | A reference to your VCS repository in the format `:org/:repo` where `:org` and `:repo` refer to the organization and repository in your VCS provider. | | `data.attributes.vcs-repo.display-identifier` | string | (nothing) | The display identifier for the Stack's VCS repository. For most VCS providers outside of BitBucket Cloud and Azure DevOps, this will match the identifier string. | | `data.attributes.vcs-repo.repository-http-url` | string | | The HTTP URL for the repository. | | `data.attributes.vcs-repo.github-app-installation-id` | string | | The VCS connection GitHub App installation to use. Find this ID on the account settings page. Requires previously authorizing the GitHub App and generating a user-to-server token. Manage the token from \*\*Account Settings\*\* within HCP Terraform. You can not specify this value if `oauth-token-id` is specified. | | `data.attributes.vcs-repo.oauth-token-id` | string | | The VCS Connection (OAuth Connection + Token) to use. You can obtain this ID from the [oauth-tokens](/terraform/cloud-docs/api-docs/oauth-tokens) endpoint. | | `data.relationships.project.data.id` | string | | The ID of the project to create the Stack in. You must have permission to manage the project, either by organization-level permissions or team admin access to a specific project. | | `data.relationships.agent-pool.data.id` | string | (nothing) | The ID of the agent pool to use for Stack operations. If this is omitted, then the Stack will use the Global Agent Pool. The Agent Pool must be available within the project or oganization for the Stack to use. ### Sample Payload ```json { "data": { "attributes": { "vcs-repo": { "identifier": "my-organization/basic-stack", "display-identifier": "my-organization/basic-stack", "oauth-token-id": "ot-hmAyP66qk2AMVdbJ", "branch": "", "service-provider": "github", "repository-http-url": "https://github.com/my-organization/basic-stack", "trigger-disabled": false }, "name": "basic-stack", "description": "Example Stack for documentation", "speculative-enabled": false }, "relationships": { "project": { "data": { "type": "projects", "id": "prj-nG2MW392YZMp1txf" } } } } } ``` ### Sample Request ```shell $ curl\ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request POST \ --data @payload.json \ https://app.terraform.io/api/v2/stacks ``` ### Sample Response ```json { "data": { "id": "st-kJcSJemafdBCPw3B", "type": "stacks", "attributes": { "name": "basic-stack", "description": "Example Stack for documentation", "vcs-repo": { "branch": "", "tags-regex": null, "sparse-checkout-pattern": "", "identifier": "my-organization/basic-stack", "display-identifier": "my-organization/basic-stack", "oauth-token-id": "ot-gRfG6EFP6DJMBKJx", "repository-http-url": "https://github.com/my-organization/basic-stack", "service-provider": "github", "trigger-disabled": false }, "speculative-enabled": false, "linked-stack-connections": { "upstream-count": 0, "downstream-count": 0, "inputs-count": 0, "outputs-count": 0 }, "created-at": "2025-09-16T15:39:44.590Z", "updated-at": "2025-09-16T15:39:44.590Z" }, "relationships": { "project": { "data": { "id": "prj-nG2MW392YZMp1txf", "type": "projects" } }, "agent-pool": { "data": null }, "stack-configurations": { "links": { "related": "/api/v2/stacks/st-kJcSJemafdBCPw3B/stack-configurations" } } }, "links": { "self": "/api/v2/stacks/st-kJcSJemafdBCPw3B" }, "meta": { "beta": false } } } ``` ## List Stacks This endpoint lists Stacks in the organization. `GET /organizations/:organization\_name/stacks` Stack read access is restricted to users or teams with the [\*\*Read\*\* project role](/terraform/cloud-docs/users-teams-organizations/permissions) and an [organization API token](/terraform/cloud-docs/users-teams-organizations/api-tokens#organization-api-tokens). | Parameter | Description | |----------------------|--------------------------------------------------| | `:organization\_name` | List all Stacks under the specified organization | ### Query Parameters This endpoint supports pagination [with standard URL query parameters](/terraform/cloud-docs/api-docs#query-parameters); remember to percent-encode `[` as `%5B` and `]` as `%5D` if your tooling doesn't automatically encode URLs. | Parameter | Description | |----------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | `page[number]` | \*\*Optional.\*\* If omitted, the endpoint will return the first page. | | `page[size]` | \*\*Optional.\*\* If omitted, the endpoint will return 20 Stacks per page. | | `sort` | \*\*Optional.\*\* Allows sorting the returned Stacks. Valid values are "name" and "updated-at". Prepending a hyphen to the sort parameter reverses the order. For example, `"-name"` sorts by name in reverse alphabetical order. If omitted, the default sort order is arbitrary but stable. | ### Available Related Resources This GET | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/stacks/index.mdx | main | terraform | [
-0.021849194541573524,
-0.040502388030290604,
-0.0328083299100399,
0.049267515540122986,
0.0009060148731805384,
0.013129844330251217,
0.01940673403441906,
0.003006831044331193,
0.1301112323999405,
0.07681713253259659,
0.007161956280469894,
-0.07428521662950516,
0.04335547611117363,
-0.0289... | 0.031064 |
| \*\*Optional.\*\* Allows sorting the returned Stacks. Valid values are "name" and "updated-at". Prepending a hyphen to the sort parameter reverses the order. For example, `"-name"` sorts by name in reverse alphabetical order. If omitted, the default sort order is arbitrary but stable. | ### Available Related Resources This GET endpoint can optionally return related resources, if requested with [the `include` query parameter](/terraform/cloud-docs/api-docs#inclusion-of-related-resources). The following resource types are available: | Resource Name | Description | | -------- | ----------------------------- | | `project`| The full organization record. | ### Sample Request ```shell $ curl\ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ https://app.terraform.io/api/v2/organizations/my-organization/stacks ``` ### Sample Response ```json { "data": [ { "id": "st-kJcSJemafdBCPw3B", "type": "stacks", "attributes": { "name": "basic-stack", "description": "Example Stack for documentation", "vcs-repo": { "branch": "", "tags-regex": null, "sparse-checkout-pattern": "", "identifier": "hashicorp-guides/pet-nulls-stack", "display-identifier": "hashicorp-guides/pet-nulls-stack", "oauth-token-id": "ot-gRfG6EFP6DJMBKJx", "repository-http-url": "https://github.com/hashicorp-guides/pet-nulls-stack", "service-provider": "github", "trigger-disabled": false }, "speculative-enabled": false, "linked-stack-connections": { "upstream-count": 0, "downstream-count": 0, "inputs-count": 0, "outputs-count": 0 }, "created-at": "2025-09-16T15:39:44.590Z", "updated-at": "2025-09-16T15:39:44.590Z" }, "relationships": { "project": { "data": { "id": "prj-nG2MW392YZMp1txf", "type": "projects" } }, "agent-pool": { "data": null }, "stack-configurations": { "links": { "related": "/api/v2/stacks/st-kJcSJemafdBCPw3B/stack-configurations" } } }, "links": { "self": "/api/v2/stacks/st-kJcSJemafdBCPw3B" }, "meta": { "beta": false } } ], "links": { "self": "https://app.terraform.io/api/v2/organizations/hashicorp/stacks?page%5Bnumber%5D=1&page%5Bsize%5D=1", "first": "https://app.terraform.io/api/v2/organizations/hashicorp/stacks?page%5Bnumber%5D=1&page%5Bsize%5D=1", "prev": null, "next": "https://app.terraform.io/api/v2/organizations/hashicorp/stacks?page%5Bnumber%5D=2&page%5Bsize%5D=1", "last": "https://app.terraform.io/api/v2/organizations/hashicorp/stacks?page%5Bnumber%5D=18&page%5Bsize%5D=1" }, "meta": { "pagination": { "current-page": 1, "page-size": 1, "prev-page": null, "next-page": 2, "total-pages": 18, "total-count": 18 } } } ``` ## Show a Stack `GET /stacks/:stack\_id` This endpoint returns details of the specified Stack. Stack read access is restricted to users or teams with the [\*\*Read\*\* project role](/terraform/cloud-docs/users-teams-organizations/permissions) and an [organization API token](/terraform/cloud-docs/users-teams-organizations/api-tokens#organization-api-tokens). | Parameter | Description | |-------------|---------------| | `:stack\_id` | The Stack id. | ### Available Related Resources This GET endpoint can optionally return related resources, if requested with [the `include` query parameter](/terraform/cloud-docs/api-docs#inclusion-of-related-resources). The following resource types are available: | Resource Name | Description | | ---------------------------------------------- | --------------------------------------------------------------- | | `latest\_stack\_configuration` | The latest Stack configuration for the Stack. | | `latest\_stack\_configuration.stack\_diagnostics` | The Stack diagnostics associated with the latest configuration. | | `organization` | The full organization record. | | `project` | The project record. | ### Sample Request ```shell $ curl\ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ https://app.terraform.io/api/v2/stacks/st-LSqektntTNJrAhCt ``` ### Sample Response ```json { "data": { "id": "st-kJcSJemafdBCPw3B", "type": "stacks", "attributes": { "name": "basic-stack", "description": "Example Stack for documentation", "vcs-repo": { "branch": "", "tags-regex": null, "sparse-checkout-pattern": "", "identifier": "hashicorp-guides/pet-nulls-stack", "display-identifier": "hashicorp-guides/pet-nulls-stack", "oauth-token-id": "ot-gRfG6EFP6DJMBKJx", "repository-http-url": "https://github.com/hashicorp-guides/pet-nulls-stack", "service-provider": "github", "trigger-disabled": false }, "speculative-enabled": false, "linked-stack-connections": { "upstream-count": 0, "downstream-count": 0, "inputs-count": 0, "outputs-count": 0 }, "created-at": "2025-09-16T15:39:44.590Z", "updated-at": "2025-09-16T15:39:44.590Z", "deleteable": true }, "relationships": { "project": { "data": { "id": "prj-nG2MW392YZMp1txf", "type": "projects" } }, "agent-pool": { "data": null }, "latest-stack-configuration": { "data": null }, "stack-configurations": { "links": { "related": "/api/v2/stacks/st-kJcSJemafdBCPw3B/stack-configurations" } } }, "links": { "self": "/api/v2/stacks/st-kJcSJemafdBCPw3B" }, "meta": { "beta": false } } } ``` ## List Stack configuration summaries This endpoint lists configuration summaries for the specified Stack. `GET /stacks/:stack\_id/stack-configuration-summaries` | Parameter | Description | |-------------|---------------------------------------------------| | `:stack\_id` | The Stack id to list configuration summaries for. | ### Query Parameters This endpoint supports pagination [with standard URL query parameters](/terraform/cloud-docs/api-docs#query-parameters); remember to percent-encode `[` as `%5B` and `]` as `%5D` if your tooling doesn't automatically encode URLs. | Parameter | Description | |----------------|-----------------------------------------------------------------------------------------------| | `page[number]` | \*\*Optional.\*\* If omitted, the endpoint will return the first page. | | `page[size]` | \*\*Optional.\*\* If omitted, the endpoint will return 20 Stack configuration summaries per page. | ### Sample Request ```shell $ curl\ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ https://app.terraform.io/api/v2/stacks/st-EJyw2MktbRjdsg96/stack-configuration-summaries ``` ### Sample Response ```json { "data": | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/stacks/index.mdx | main | terraform | [
-0.021970268338918686,
0.05846616253256798,
0.07174093276262283,
0.03202075511217117,
-0.01596369594335556,
-0.0051878965459764,
-0.015440813265740871,
-0.0844602957367897,
0.07071128487586975,
0.09646838903427124,
0.006319936830550432,
-0.02170952782034874,
0.042261019349098206,
0.0128211... | -0.019028 |
If omitted, the endpoint will return the first page. | | `page[size]` | \*\*Optional.\*\* If omitted, the endpoint will return 20 Stack configuration summaries per page. | ### Sample Request ```shell $ curl\ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ https://app.terraform.io/api/v2/stacks/st-EJyw2MktbRjdsg96/stack-configuration-summaries ``` ### Sample Response ```json { "data": [ { "id": "stc-jEvHkd8DXBK594WD-summary", "type": "stack-configuration-summaries", "attributes": { "status": "completed", "sequence-number": 1, "stack-deployment-group-status-summary": { "pending": 2, "deploying": 0, "succeeded": 0, "failed": 0, "abandoned": 0 } }, "relationships": { "stack-configuration": { "data": { "id": "stc-jEvHkd8DXBK594WD", "type": "stack-configurations" } } } } ], "links": { "self": "https://app.terraform.io/api/v2/stacks/st-MfwPNTsAEejHJtDw/stack-configuration-summaries?page%5Bnumber%5D=1&page%5Bsize%5D=20", "first": "https://app.terraform.io/api/v2/stacks/st-MfwPNTsAEejHJtDw/stack-configuration-summaries?page%5Bnumber%5D=1&page%5Bsize%5D=20", "prev": null, "next": null, "last": "https://app.terraform.io/api/v2/stacks/st-MfwPNTsAEejHJtDw/stack-configuration-summaries?page%5Bnumber%5D=1&page%5Bsize%5D=20" }, "meta": { "pagination": { "current-page": 1, "page-size": 20, "prev-page": null, "next-page": null, "total-pages": 1, "total-count": 1 } } } ``` ## Update a Stack `PATCH /stacks/:stack\_id` This endpoint updates the specified Stack. | Parameter | Description | |-------------|---------------| | `:stack\_id` | The Stack id. | ### Request Body This endpoint requires a JSON object with the following properties as a request payload. Properties without a default value are required. | Key path | Type | Default | Description | |-------------------------------------------------------|---------|------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | `data.attributes.name` | string | | The name of the Stack, which can only include letters, numbers, `-`, and `\_`. This will be used as an identifier and must be unique in the project. | | `data.attributes.description` | string | (nothing) | A description for the Stack. | | `data.attributes.speculative-enabled` | boolean | `false` | Whether this Stack allows automatic speculative plans. Setting this to `false` prevents HCP Terraform from running plans on pull requests, which can improve security if the VCS repository is public or includes untrusted contributors. | | `data.attributes.trigger-disabled` | boolean | | When disabled, plan operations won't automatically start. | | `data.attributes.service-provider` | string | (nothing) | The VCS provider being connected with. Valid options are `"github"`, `"github\_enterprise"`, `"gitlab\_hosted"`, `"gitlab\_community\_edition"`, `"gitlab\_enterprise\_edition"`, or `"ado\_server"`. | | `data.attributes.debugging-mode` | boolean | false | When enabled, plan and apply operations will generate debug level logs. | `data.attributes.vcs-repo` | object | | Settings for the Stack's VCS repository. | | `data.attributes.vcs-repo.branch` | string | (nothing) | The repository branch used by this Stack's configuration. If omitted or submitted as an empty string, this defaults to the repository's default branch (e.g. `main`). | | `data.attributes.vcs-repo.tags-regex` | string | (previous value) | A regular expression used to match Git tags. HCP Terraform begins preparing a Stack configuration when this value is present and a VCS event occurs that contains a matching Git tag for the regular expression. | | `data.attributes.vcs-repo.identifier` | string | | A reference to your VCS repository in the format `:org/:repo` where `:org` and `:repo` refer to the organization and repository in your VCS provider. | | `data.attributes.vcs-repo.display-identifier` | string | (nothing) | The display identifier for the Stack's VCS repository. For most VCS providers outside of BitBucket Cloud and Azure DevOps, this will match the identifier string. | | `data.attributes.vcs-repo.repository-http-url` | string | | The HTTP URL for the repository. | | `data.attributes.vcs-repo.github-app-installation-id` | string | | The VCS Connection GitHub App Installation to use. Find this ID on the account settings page. Requires previously authorizing the GitHub App and generating a user-to-server token. Manage the token from \*\*Account Settings\*\* within HCP Terraform. You can not specify this value if `oauth-token-id` is specified. | | `data.attributes.vcs-repo.oauth-token-id` | string | | The VCS Connection (OAuth Connection + Token) to use. This ID can be obtained from the [oauth-tokens](/terraform/cloud-docs/api-docs/oauth-tokens) endpoint. | | `data.relationships.project.data.id` | string | | The ID of the project to create the Stack in. You must have permission to manage the project, either | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/stacks/index.mdx | main | terraform | [
-0.03158203512430191,
0.08911986649036407,
0.02036047726869583,
0.04373900592327118,
-0.003127726726233959,
-0.020334111526608467,
-0.071316659450531,
-0.04151583090424538,
0.07924595475196838,
0.0697689801454544,
0.021619999781250954,
-0.09351478517055511,
0.013237334787845612,
-0.0367519... | 0.02562 |
| `data.attributes.vcs-repo.oauth-token-id` | string | | The VCS Connection (OAuth Connection + Token) to use. This ID can be obtained from the [oauth-tokens](/terraform/cloud-docs/api-docs/oauth-tokens) endpoint. | | `data.relationships.project.data.id` | string | | The ID of the project to create the Stack in. You must have permission to manage the project, either by organization-level permissions or team admin access to a specific project. | | `data.relationships.agent-pool.data.id` | string | (nothing) | The ID of the agent pool to use for Stack operations. If this is omitted, then the Stack will use the Global Agent Pool. The Agent Pool must be available within the project or oganization for the Stack to use. ### Sample Payload ```json { "data": { "attributes": { "vcs-repo": { "identifier": "hashicorp/pet-nulls-stack-local", "display-identifier": "hashicorp/pet-nulls-stack-local", "oauth-token-id": "ot-hmAyP66qk2AMVdbJ", "branch": "", "service-provider": "github", "repository-http-url":"https://github.com/hashicorp/pet-nulls-stack-local", "tags-regex": null, "trigger-disabled": false }, "name": "pet-nulls-stack-local", "description": "testing patch", "speculative-enabled": false, "debugging-mode": false } } } ``` ### Sample Request ```shell $ curl\ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request PATCH \ https://app.terraform.io/api/v2/stacks/st-EJyw2MktbRjdsg96 ``` ### Sample Response ```json { "data": { "id": "st-MfwPNTsAEejHJtDw", "type": "stacks", "attributes": { "name": "betatest", "description": "testing patch", "vcs-repo": { "branch": "", "tags-regex": null, "sparse-checkout-pattern": "", "identifier": "hashicorp-guides/pet-nulls-stack", "display-identifier": "hashicorp-guides/pet-nulls-stack", "oauth-token-id": "ot-gRfG6EFP6DJMBKJx", "repository-http-url": "https://github.com/hashicorp-guides/pet-nulls-stack", "service-provider": "github", "trigger-disabled": false }, "speculative-enabled": false, "linked-stack-connections": { "upstream-count": 0, "downstream-count": 0, "inputs-count": 0, "outputs-count": 0 }, "created-at": "2025-09-11T15:15:46.249Z", "updated-at": "2025-09-16T15:48:32.554Z" }, "relationships": { "project": { "data": { "id": "prj-nG2MW392YZMp1txf", "type": "projects" } }, "agent-pool": { "data": null }, "stack-configurations": { "links": { "related": "/api/v2/stacks/st-MfwPNTsAEejHJtDw/stack-configurations" } } }, "links": { "self": "/api/v2/stacks/st-MfwPNTsAEejHJtDw" }, "meta": { "beta": false } } } ``` ## Delete a Stack `DELETE /stacks/:stack\_id` This endpoint deletes the specified Stack. | Parameter | Description | |-------------|------------------------------------------------------------------------------------------------------------------------------------------------| | `:stack\_id` | The ID of the Stack to delete. Refer to [List Stacks](#list-stacks) for reference information about finding IDs. | | Status | Response | Reason | |---------|---------------------------|---------------------------------------------------------| | [204][] | No Content | Successfully deleted the Stack | | [404][] | [JSON API error object][] | Stack not found, or user unauthorized to perform action | ### Sample Request ```shell curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request DELETE \ https://app.terraform.io/api/v2/stacks/st-EJyw2MktbRjdsg96 ``` | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/stacks/index.mdx | main | terraform | [
-0.04797353968024254,
0.001211029477417469,
-0.033941660076379776,
0.019530130550265312,
-0.03471213951706886,
-0.07115517556667328,
-0.03221355006098747,
-0.013667833991348743,
0.1007518321275711,
0.04395141825079918,
-0.013900954276323318,
-0.0967877134680748,
0.039631009101867676,
0.021... | 0.013285 |
[200]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/200 [201]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/201 [202]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/202 [204]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/204 [400]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/400 [401]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/401 [403]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/403 [404]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/404 [409]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/409 [412]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/412 [422]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/422 [429]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429 [500]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500 [504]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504 [JSON API document]: /terraform/cloud-docs/api-docs#json-api-documents [JSON API error object]: http://jsonapi.org/format/#error-objects # Stack deployments API reference You can create Stack deployments in a Stack's `deployment.tfdeploy.hcl` file. A deployment consists of a deployment group, at least one deployment run, and at least one deployment step. To learn more, refer to [Define deployment configuration](/terraform/language/stacks/deploy/config). ## Overview The scope of the API includes the following endpoints: | Method | Path | Action | |----------|------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------| | `GET` | `/stacks/:stack\_id/stack-deployments` | Call this endpoint to [list Stack deployments](#list-stack-deployments). | | `GET` | `/stack-configurations/:stack\_configuration\_id/stack-deployment-groups` | Call this endpoint to [list Stack deployment groups](#list-stack-deployment-groups). | | `GET` | `/stack-configurations/:stack\_configuration\_id/stack-deployment-groups/:stack\_deployment\_group\_name` | Call this endpoint to [show a Stack deployment group by name](#show-a-stack-deployment-group-by-name). | | `GET` | `/stack-deployment-groups/:stack\_deployment\_group\_id` | Call this endpoint to [show a Stack deployment group by ID](#show-a-stack-deployment-group-by-id). | | `GET` | `/stack-deployment-groups/:stack\_deployment\_group\_id/stack-deployment-runs` | Call this endpoint to [list Stack deployment runs](#list-stack-deployment-runs-in-a-configuration). | | `GET` | `/stacks/:stack\_id/stack-deployments/:deployment\_name/stack-deployment-runs` | Call this endpoint to [list deployment runs for a deployment group](#list-stack-deployment-runs-in-a-group). | | `GET` | `/stack-deployment-runs/:stack\_deployment\_run\_id` | Call this endpoint to [show a Stack deployment run](#show-a-stack-deployment-run). | | `GET` | `/stack-deployment-runs/:stack\_deployment\_run\_id/stack-deployment-steps` | Call this endpoint to [list Stack deployment steps](#list-stack-deployment-steps). | | `GET` | `/stack-deployment-steps/:stack\_deployment\_step\_id` | Call this endpoint to [show a Stack deployment step](#show-a-stack-deployment-step). | | `GET` | `/stack-deployment-steps/:stack\_deployment\_step\_id/stack-diagnostics` | Call this endpoint to [list Stack deployment step diagnostics](#list-stack-deployment-step-diagnostics). | | `GET` | `/stack-deployment-steps/:stack\_deployment\_step\_id/artifacts` | Call this endpoint to [retrieve a deployment steps artifacts](#show-a-stack-deployment-step-artifact). | | `GET` | `/stack-approvals/:stack\_approval\_id` | Call this endpoint to [show a Stack approval](#show-a-stack-approval). | | `POST` | `/stack-deployment-groups/:stack\_deployment\_group\_id/approve-all-plans` | Call this endpoint to [approve a Stack deployment group](#approve-a-stack-deployment-group). | | `POST` | `/stack-deployment-groups/:stack\_deployment\_group\_id/rerun` | Call this endpoint to [rerun a Stack deployment group](#rerun-a-stack-deployment-group). | | `POST` | `/stack-deployment-runs/:stack\_deployment\_run\_id/approve-all-plans` | Call this endpoint to [approve a Stack deployment run](#approve-a-stack-deployment-run). | | `POST` | `/stack-deployment-runs/:stack\_deployment\_run\_id/cancel` | Call this endpoint to [cancel a Stack deployment run](#cancel-a-stack-deployment-run). | | `POST` | `/stack-deployment-steps/:stack\_deployment\_step\_id/advance` | Call this endpoint to [advance a Stack deployment step](#advance-a-stack-deployment-step). | ## List Stack deployments This endpoint lists all the deployments under the specified Stack. `GET /stacks/:stack\_id/stack-deployments` | Parameter | Description | |-------------|----------------------------------------------| | `:stack\_id` | The id of the Stack to list deployments for. | ### Query Parameters This endpoint supports pagination [with standard URL query parameters](/terraform/cloud-docs/api-docs#query-parameters); remember to percent-encode `[` as `%5B` and `]` as `%5D` if your tooling doesn't automatically encode URLs. | Parameter | Description | |----------------|------------------------------------------------------------------------------------| | `page[number]` | \*\*Optional.\*\* If omitted, the endpoint will return the first page. | | `page[size]` | \*\*Optional.\*\* If omitted, the endpoint will return 20 Stacks deployments per page. | ### Available Related Resources This GET endpoint can optionally return related resources, if requested with [the `include` query parameter](/terraform/cloud-docs/api-docs#inclusion-of-related-resources). The following resource types are available: | Resource Name | Description | | ------------------------------------------- | ------------------------------------------------------------------ | | `latest\_deployment\_run` | The latest deployment run associated with that deployment. | | `latest\_deployment\_run.stack\_configuration` | The Stack configuration associated with the latest deployment run. | ### Sample Request ```shell $ curl\ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ https://app.terraform.io/api/v2/stacks/st-LSqektntTNJrAhCt/stack-deployments ``` ### Sample Response ```json { "data": [ { "id": "st-MWvJsvy1FCg3bnXY-std-simple", "type": "stack-deployments", "attributes": { "name": "simple" }, "relationships": { "stack": { "data": { "id": "st-MWvJsvy1FCg3bnXY", "type": "stacks" } }, "latest-deployment-run": { "data": { "id": "sdr-vzub48Y4f7sFBk7J", "type": "stack-deployment-runs" } } }, "links": { "self": "/api/v2/stacks/st-MWvJsvy1FCg3bnXY/stack-deployments/simple", "stack-deployment-runs": "/api/v2/stacks/st-MWvJsvy1FCg3bnXY/stack-deployments/simple/stack-deployment-runs" } } ], "links": { "self": "https://app.terraform.io/api/v2/stacks/st-MWvJsvy1FCg3bnXY/stack-deployments?page%5Bnumber%5D=1&page%5Bsize%5D=20", "first": "https://app.terraform.io/api/v2/stacks/st-MWvJsvy1FCg3bnXY/stack-deployments?page%5Bnumber%5D=1&page%5Bsize%5D=20", "prev": null, "next": null, "last": "https://app.terraform.io/api/v2/stacks/st-MWvJsvy1FCg3bnXY/stack-deployments?page%5Bnumber%5D=1&page%5Bsize%5D=20" }, "meta": { "pagination": { "current-page": 1, "page-size": 20, | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/stacks/deployments.mdx | main | terraform | [
-0.015784088522195816,
-0.01700746826827526,
-0.018668580800294876,
-0.028096551075577736,
-0.024631375446915627,
-0.08318780362606049,
-0.0621652752161026,
-0.07521579414606094,
-0.005580500699579716,
-0.03855427727103233,
0.03281282261013985,
0.0540321059525013,
0.006812138482928276,
-0.... | 0.052879 |
{ "data": { "id": "st-MWvJsvy1FCg3bnXY", "type": "stacks" } }, "latest-deployment-run": { "data": { "id": "sdr-vzub48Y4f7sFBk7J", "type": "stack-deployment-runs" } } }, "links": { "self": "/api/v2/stacks/st-MWvJsvy1FCg3bnXY/stack-deployments/simple", "stack-deployment-runs": "/api/v2/stacks/st-MWvJsvy1FCg3bnXY/stack-deployments/simple/stack-deployment-runs" } } ], "links": { "self": "https://app.terraform.io/api/v2/stacks/st-MWvJsvy1FCg3bnXY/stack-deployments?page%5Bnumber%5D=1&page%5Bsize%5D=20", "first": "https://app.terraform.io/api/v2/stacks/st-MWvJsvy1FCg3bnXY/stack-deployments?page%5Bnumber%5D=1&page%5Bsize%5D=20", "prev": null, "next": null, "last": "https://app.terraform.io/api/v2/stacks/st-MWvJsvy1FCg3bnXY/stack-deployments?page%5Bnumber%5D=1&page%5Bsize%5D=20" }, "meta": { "pagination": { "current-page": 1, "page-size": 20, "prev-page": null, "next-page": null, "total-pages": 1, "total-count": 1 } } } ``` ## List Stack deployment groups This endpoint lists all the deployment groups for the specified Stack configuration. `GET /stack-configurations/:stack\_configuration\_id/stack-deployment-groups` | Parameter | Description | |---------------------------|------------------------------------------------------------------| | `:stack\_configuration\_id` | The id of the Stack configuration to list deployment groups for. | ### Query Parameters This endpoint supports pagination [with standard URL query parameters](/terraform/cloud-docs/api-docs#query-parameters); remember to percent-encode `[` as `%5B` and `]` as `%5D` if your tooling doesn't automatically encode URLs. | Parameter | Description | |----------------|-----------------------------------------------------------------------------------------| | `page[number]` | \*\*Optional.\*\* If omitted, the endpoint will return the first page. | | `page[size]` | \*\*Optional.\*\* If omitted, the endpoint will return 20 Stack deployment groups per page. | ### Sample Request ```shell $ curl\ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ https://app.terraform.io/api/v2/stack-configurations/stc-d7w6uC1QEB6fqWjW/stack-deployment-groups ``` ### Sample Response ```json { "data": [ { "id": "sdg-f5GVSZb7HxQ5aWG7", "type": "stack-deployment-groups", "attributes": { "status": "pending", "created-at": "2025-09-16T14:46:45.026Z", "updated-at": "2025-09-16T14:46:45.026Z", "deploying-at": null, "succeeded-at": null, "failed-at": null, "abandoned-at": null, "name": "simple\_default", "deployment-group-config": { "auto-approve-checks": [] } }, "relationships": { "stack-configuration": { "data": { "id": "stc-d7w6uC1QEB6fqWjW", "type": "stack-configurations" } }, "stack-approvals": { "data": [] }, "stack-deployment-runs": { "links": { "related": "/api/v2/stack-deployment-groups/sdg-f5GVSZb7HxQ5aWG7/stack-deployment-runs" } } }, "links": { "self": "/api/v2/stack-deployment-groups/sdg-f5GVSZb7HxQ5aWG7", "stack-deployment-group-summaries": "/api/v2/stack-configurations/stc-d7w6uC1QEB6fqWjW/stack-deployment-group-summaries" } } ], "links": { "self": "https://app.terraform.io/api/v2/stack-configurations/stc-d7w6uC1QEB6fqWjW/stack-deployment-groups?page%5Bnumber%5D=1&page%5Bsize%5D=20", "first": "https://app.terraform.io/api/v2/stack-configurations/stc-d7w6uC1QEB6fqWjW/stack-deployment-groups?page%5Bnumber%5D=1&page%5Bsize%5D=20", "prev": null, "next": null, "last": "https://app.terraform.io/api/v2/stack-configurations/stc-d7w6uC1QEB6fqWjW/stack-deployment-groups?page%5Bnumber%5D=1&page%5Bsize%5D=20" }, "meta": { "pagination": { "current-page": 1, "page-size": 20, "prev-page": null, "next-page": null, "total-pages": 1, "total-count": 1 } } } ``` ## Show a Stack deployment group by name This endpoint gets details about a Stack deployment group by name `GET /stack-configurations/:stack\_configuration\_id/stack-deployment-groups/:stack\_deployment\_group\_name` | Parameter | Description | |--------------------------------|-----------------------------------------------------------------------| | `:stack\_configuration\_id` | The id of the Stack configuration to fetch the deployment groups for. | | `:stack\_deployment\_group\_name` | The name of the Stack deployment group. | ### Sample Request ```shell $ curl\ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ https://app.terraform.io/api/v2/stack-configurations/stc-d7w6uC1QEB6fqWjW/stack-deployment-groups/simple\_default ``` ### Sample Response ```json { "data": { "id": "sdg-f5GVSZb7HxQ5aWG7", "type": "stack-deployment-groups", "attributes": { "status": "pending", "created-at": "2025-09-16T14:46:45.026Z", "updated-at": "2025-09-16T14:46:45.026Z", "deploying-at": null, "succeeded-at": null, "failed-at": null, "abandoned-at": null, "name": "simple\_default", "deployment-group-config": { "auto-approve-checks": [] } }, "relationships": { "stack-configuration": { "data": { "id": "stc-d7w6uC1QEB6fqWjW", "type": "stack-configurations" } }, "stack-approvals": { "data": [] }, "stack-deployment-runs": { "links": { "related": "/api/v2/stack-deployment-groups/sdg-f5GVSZb7HxQ5aWG7/stack-deployment-runs" } } }, "links": { "self": "/api/v2/stack-deployment-groups/sdg-f5GVSZb7HxQ5aWG7", "stack-deployment-group-summaries": "/api/v2/stack-configurations/stc-d7w6uC1QEB6fqWjW/stack-deployment-group-summaries" } } } ``` ## Show a Stack deployment group by ID This endpoint gets details about a Stack deployment group by ID. `GET /stack-deployment-groups/:stack\_deployment\_group\_id` | Parameter | Description | |------------------------------|------------------------------------------------| | `:stack\_deployment\_group\_id` | The id of the Stack deployment group to fetch. | ### Sample Request ```shell $ curl\ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ https://app.terraform.io/api/v2/stack-deployment-groups/sdg-f5GVSZb7HxQ5aWG7 ``` ### Sample Response ```json { "data": { "id": "sdg-f5GVSZb7HxQ5aWG7", "type": "stack-deployment-groups", "attributes": { "status": "pending", "created-at": "2025-09-16T14:46:45.026Z", "updated-at": "2025-09-16T14:46:45.026Z", "deploying-at": null, "succeeded-at": null, "failed-at": null, "abandoned-at": null, "name": "simple\_default", "deployment-group-config": { "auto-approve-checks": [] } }, "relationships": { "stack-configuration": { "data": { "id": "stc-d7w6uC1QEB6fqWjW", "type": "stack-configurations" } }, "stack-approvals": { "data": [] }, "stack-deployment-runs": { "links": { "related": "/api/v2/stack-deployment-groups/sdg-f5GVSZb7HxQ5aWG7/stack-deployment-runs" } } }, "links": { "self": "/api/v2/stack-deployment-groups/sdg-f5GVSZb7HxQ5aWG7", "stack-deployment-group-summaries": "/api/v2/stack-configurations/stc-d7w6uC1QEB6fqWjW/stack-deployment-group-summaries" } } } ``` ## List Stack deployment runs in a configuration This endpoint lists Stack deployment runs for a Stack configuration. `GET /stack-configurations/:stack\_configuration\_id/stack-deployment-runs` | Parameter | Description | |-------------------------- |----------------------------------------------------------------------------------------| | `:stack\_configuration\_id` | The id of the Stack deployment group for which Stack deployment | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/stacks/deployments.mdx | main | terraform | [
-0.033427342772483826,
0.013079417869448662,
0.04477215185761452,
0.024791233241558075,
0.019060594961047173,
-0.060525622218847275,
-0.11516764014959335,
-0.02746407687664032,
0.01572139374911785,
0.052792809903621674,
0.024391431361436844,
-0.06426054984331131,
0.0076888431794941425,
-0.... | -0.072905 |
{ "self": "/api/v2/stack-deployment-groups/sdg-f5GVSZb7HxQ5aWG7", "stack-deployment-group-summaries": "/api/v2/stack-configurations/stc-d7w6uC1QEB6fqWjW/stack-deployment-group-summaries" } } } ``` ## List Stack deployment runs in a configuration This endpoint lists Stack deployment runs for a Stack configuration. `GET /stack-configurations/:stack\_configuration\_id/stack-deployment-runs` | Parameter | Description | |-------------------------- |----------------------------------------------------------------------------------------| | `:stack\_configuration\_id` | The id of the Stack deployment group for which Stack deployment runs are being listed. | ### Query Parameters This endpoint supports pagination [with standard URL query parameters](/terraform/cloud-docs/api-docs#query-parameters); remember to percent-encode `[` as `%5B` and `]` as `%5D` if your tooling doesn't automatically encode URLs. | Parameter | Description | |----------------|---------------------------------------------------------------------------------------| | `page[number]` | \*\*Optional.\*\* If omitted, the endpoint will return the first page. | | `page[size]` | \*\*Optional.\*\* If omitted, the endpoint will return 20 Stack deployment runs per page. | ### Available Related Resources This GET endpoint can optionally return related resources, if requested with [the `include` query parameter](/terraform/cloud-docs/api-docs#inclusion-of-related-resources). The following resource types are available: | Resource Name | Description | | ------------------------------| ------------------------------------------------------------------------------------------------------------------------------- | | `stack\_deployment\_group` | The deployment group that contains the run. | | `stack\_approval` | The Stack approval created for the deployment run. | | `destroy\_stack\_configuration` | The configuration that last referenced a deployment that has been omitted in the configuration that contains the specified run. | | `current\_step` | The current step for the deployment run. | ### Sample Request ```shell $ curl\ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ https://app.terraform.io/api/v2/stack-configurations/stc-d7w6uC1QEB6fqWjW/stack-deployment-runs ``` ### Sample Response ```json { "data": [ { "id": "sdr-AUkZBKdkE9vRKDsi", "type": "stack-deployment-runs", "attributes": { "status": "pre\_deploying\_pending\_operator", "deployment": "simple", "created-at": "2025-09-16T14:46:45.032Z", "updated-at": "2025-09-16T14:46:45.121Z", "pre-deploying-at": "2025-09-16T14:46:45.067Z", "pre-deploying-pending-operator-at": "2025-09-16T14:46:45.121Z", "acquiring-lock-at": null, "deploying-at": null, "deploying-pending-operator-at": null, "succeeded-at": null, "failed-at": null, "abandoned-at": null, "plan-mode": "plan" }, "relationships": { "stack-deployment-group": { "data": { "id": "sdg-f5GVSZb7HxQ5aWG7", "type": "stack-deployment-groups" } }, "stack-configuration": { "data": { "id": "stc-d7w6uC1QEB6fqWjW", "type": "stack-configurations" } }, "stack-deployment-steps": { "links": { "related": "/api/v2/stack-deployment-runs/sdr-AUkZBKdkE9vRKDsi/stack-deployment-steps" } }, "stack-approval": { "data": null }, "current-step": { "data": { "id": "sds-HQuuzLYg8rcPSbRt", "type": "stack-deployment-steps" } }, "destroy-stack-configuration": { "data": null }, "latest-deployment-run-for-deployment": { "data": null }, "blocked-by-deployment-group": { "data": null } }, "links": { "self": "/api/v2/stack-deployment-runs/sdr-AUkZBKdkE9vRKDsi" } } ], "links": { "self": "https://app.terraform.io/api/v2/stack-configurations/stc-d7w6uC1QEB6fqWjW/stack-deployment-runs?page%5Bnumber%5D=1&page%5Bsize%5D=20", "first": "https://app.terraform.io/api/v2/stack-configurations/stc-d7w6uC1QEB6fqWjW/stack-deployment-runs?page%5Bnumber%5D=1&page%5Bsize%5D=20", "prev": null, "next": null, "last": "https://app.terraform.io/api/v2/stack-configurations/stc-d7w6uC1QEB6fqWjW/stack-deployment-runs?page%5Bnumber%5D=1&page%5Bsize%5D=20" }, "meta": { "status-counts": { "total": 1 }, "pagination": { "current-page": 1, "page-size": 20, "prev-page": null, "next-page": null, "total-pages": 1, "total-count": 1 } } } ``` ## List Stack deployment runs in a group This endpoint lists Stack deployment runs for a Stack deployment group. `GET /stack-deployment-groups/:stack\_deployment\_group\_id/stack-deployment-runs` | Parameter | Description | |------------------------------|----------------------------------------------------------------------------------------| | `:stack\_deployment\_group\_id` | The id of the Stack deployment group for which Stack deployment runs are being listed. | ### Query Parameters This endpoint supports pagination [with standard URL query parameters](/terraform/cloud-docs/api-docs#query-parameters); remember to percent-encode `[` as `%5B` and `]` as `%5D` if your tooling doesn't automatically encode URLs. | Parameter | Description | |----------------|---------------------------------------------------------------------------------------| | `page[number]` | \*\*Optional.\*\* If omitted, the endpoint will return the first page. | | `page[size]` | \*\*Optional.\*\* If omitted, the endpoint will return 20 Stack deployment runs per page. | ### Available Related Resources This GET endpoint can optionally return related resources, if requested with [the `include` query parameter](/terraform/cloud-docs/api-docs#inclusion-of-related-resources). The following resource types are available: | Resource Name | Description | | ------------------------------| ------------------------------------------------------------------------------------------------------------------------------- | | `stack\_deployment\_group` | The deployment group that contains the run. | | `stack\_approval` | The Stack approval created for the deployment run. | | `destroy\_stack\_configuration` | The configuration that last referenced a deployment that has been omitted in the configuration that contains the specified run. | | `blocked\_by\_deployment\_group` | The deployment group that is blocking this run from proceeding. | ### Sample Request ```shell $ curl\ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ https://app.terraform.io/api/v2/stack-deployment-groups/stg-RSqektntTNJrAhCm/stack-deployment-runs | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/stacks/deployments.mdx | main | terraform | [
0.0007495296886190772,
0.017729436978697777,
-0.02581137791275978,
0.04223761335015297,
-0.02514774724841118,
-0.03680020570755005,
-0.040565650910139084,
0.026915600523352623,
0.01537454966455698,
-0.018271036446094513,
0.059599947184324265,
-0.08285902440547943,
-0.038861408829689026,
-0... | 0.053316 |
The configuration that last referenced a deployment that has been omitted in the configuration that contains the specified run. | | `blocked\_by\_deployment\_group` | The deployment group that is blocking this run from proceeding. | ### Sample Request ```shell $ curl\ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ https://app.terraform.io/api/v2/stack-deployment-groups/stg-RSqektntTNJrAhCm/stack-deployment-runs ``` ### Sample Response ```json { "data": [ { "id": "sdr-A7Ly5aDFHUepLeF7", "type": "stack-deployment-runs", "attributes": { "status": "pre\_deploying\_pending\_operator", "deployment": "simple", "created-at": "2025-09-11T15:33:25.141Z", "updated-at": "2025-09-11T15:33:33.390Z", "pre-deploying-at": "2025-09-11T15:33:25.273Z", "pre-deploying-pending-operator-at": "2025-09-11T15:33:33.390Z", "acquiring-lock-at": null, "deploying-at": null, "deploying-pending-operator-at": null, "succeeded-at": null, "failed-at": null, "abandoned-at": null, "plan-mode": "normal" }, "relationships": { "stack-deployment-group": { "data": { "id": "sdg-LwBSiWxcrjhYBGMK", "type": "stack-deployment-groups" } }, "stack-configuration": { "data": { "id": "stc-jEvHkd8DXBK594WD", "type": "stack-configurations" } }, "stack-deployment-steps": { "links": { "related": "/api/v2/stack-deployment-runs/sdr-A7Ly5aDFHUepLeF7/stack-deployment-steps" } }, "stack-approval": { "data": null }, "current-step": { "data": { "id": "sds-qbXEc9fNpt7MNpKT", "type": "stack-deployment-steps" } }, "destroy-stack-configuration": { "data": null }, "latest-deployment-run-for-deployment": { "data": null }, "blocked-by-deployment-group": { "data": null } }, "links": { "self": "/api/v2/stack-deployment-runs/sdr-A7Ly5aDFHUepLeF7" } } ], "links": { "self": "https://app.terraform.io/api/v2/stack-deployment-groups/sdg-LwBSiWxcrjhYBGMK/stack-deployment-runs?page%5Bnumber%5D=1&page%5Bsize%5D=20", "first": "https://app.terraform.io/api/v2/stack-deployment-groups/sdg-LwBSiWxcrjhYBGMK/stack-deployment-runs?page%5Bnumber%5D=1&page%5Bsize%5D=20", "prev": null, "next": null, "last": "https://app.terraform.io/api/v2/stack-deployment-groups/sdg-LwBSiWxcrjhYBGMK/stack-deployment-runs?page%5Bnumber%5D=1&page%5Bsize%5D=20" }, "meta": { "pagination": { "current-page": 1, "page-size": 20, "prev-page": null, "next-page": null, "total-pages": 1, "total-count": 1 } } } ``` ## Show a Stack deployment run This endpoint gets details about a Stack deployment run. `GET /stack-deployment-runs/:stack\_deployment\_run\_id` | Parameter | Description | |----------------------------|---------------------------------------------| | `:stack\_deployment\_run\_id` | The id of the Stack deployment run to show. | ### Available Related Resources This GET endpoint can optionally return related resources, if requested with [the `include` query parameter](/terraform/cloud-docs/api-docs#inclusion-of-related-resources). The following resource types are available: | Resource Name | Description | | ---------------------------------------| ------------------------------------------------------------------------------------------------------------------------------- | | `stack\_deployment\_group` | The deployment group that contains the run. | | `stack\_approval` | The Stack approval created for the deployment run. | | `destroy\_stack\_configuration` | The configuration that last referenced a deployment that has been omitted in the configuration that contains the specified run. | | `blocked\_by\_deployment\_group` | The deployment group that is blocking this run from proceeding. | | `latest\_deployment\_run\_for\_deployment` | The latest deployment run for the deployment that the current run is targeting. ### Sample Request ```shell $ curl\ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ https://app.terraform.io/api/v2/stack-deployment-runs/sdr-LSqektntTNJrAhCt ``` ### Sample Response ```json { "data": { "id": "sdr-A7Ly5aDFHUepLeF7", "type": "stack-deployment-runs", "attributes": { "status": "pre\_deploying\_pending\_operator", "deployment": "simple", "created-at": "2025-09-11T15:33:25.141Z", "updated-at": "2025-09-11T15:33:33.390Z", "pre-deploying-at": "2025-09-11T15:33:25.273Z", "pre-deploying-pending-operator-at": "2025-09-11T15:33:33.390Z", "acquiring-lock-at": null, "deploying-at": null, "deploying-pending-operator-at": null, "succeeded-at": null, "failed-at": null, "abandoned-at": null, "plan-mode": "normal" }, "relationships": { "stack-deployment-group": { "data": { "id": "sdg-LwBSiWxcrjhYBGMK", "type": "stack-deployment-groups" } }, "stack-configuration": { "data": { "id": "stc-jEvHkd8DXBK594WD", "type": "stack-configurations" } }, "stack-deployment-steps": { "links": { "related": "/api/v2/stack-deployment-runs/sdr-A7Ly5aDFHUepLeF7/stack-deployment-steps" } }, "stack-approval": { "data": null }, "current-step": { "data": { "id": "sds-qbXEc9fNpt7MNpKT", "type": "stack-deployment-steps" } }, "destroy-stack-configuration": { "data": null }, "latest-deployment-run-for-deployment": { "data": { "id": "sdr-A7Ly5aDFHUepLeF7", "type": "stack-deployment-runs" } }, "blocked-by-deployment-group": { "data": null } }, "links": { "self": "/api/v2/stack-deployment-runs/sdr-A7Ly5aDFHUepLeF7" } } } ``` ## List Stack deployment steps This endpoint lists Stack deployment steps for a Stack deployment run. `GET /stack-deployment-runs/:stack\_deployment\_run\_id/stack-deployment-steps` | Parameter | Description | |----------------------------|---------------------------------------------------------------------------------------| | `:stack\_deployment\_run\_id` | The id of the Stack deployment run for which Stack deployment steps are being listed. | ### Query Parameters This endpoint supports pagination [with standard URL query parameters](/terraform/cloud-docs/api-docs#query-parameters); remember to percent-encode `[` as `%5B` and `]` as `%5D` if your tooling doesn't automatically encode URLs. | Parameter | Description | |----------------|---------------------------------------------------------------------------------------------| | `page[number]` | \*\*Optional.\*\* If omitted, the endpoint will return the first page. | | `page[size]` | \*\*Optional.\*\* If omitted, the endpoint will return 20 Stack deployment steps runs per page. | ### Available Related Resources This GET endpoint can optionally return related resources, if requested with [the `include` query parameter](/terraform/cloud-docs/api-docs#inclusion-of-related-resources). | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/stacks/deployments.mdx | main | terraform | [
-0.018371393904089928,
0.013492131605744362,
0.03747321665287018,
0.007336371578276157,
-0.003423896851018071,
-0.0882616862654686,
-0.07629972696304321,
-0.08768640458583832,
0.05147455632686615,
0.11436714231967926,
0.027020514011383057,
-0.0697750598192215,
-0.00969418790191412,
-0.0134... | -0.027433 |
`page[number]` | \*\*Optional.\*\* If omitted, the endpoint will return the first page. | | `page[size]` | \*\*Optional.\*\* If omitted, the endpoint will return 20 Stack deployment steps runs per page. | ### Available Related Resources This GET endpoint can optionally return related resources, if requested with [the `include` query parameter](/terraform/cloud-docs/api-docs#inclusion-of-related-resources). The following resource types are available: | Resource Name | Description | | --------------------- | --------------------------------------------------------------------------------------- | | `stack\_approval` | The approval associated with the specified step. | | `stack\_approval.user` | The user that created the approval for the specified step. | | `stack\_state` | The state that was created as the result of an apply operation from the specified step. | ### Sample Request ```shell $ curl\ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ https://app.terraform.io/api/v2/stack-deployment-runs/str-RSqektntTNJrAhCm/stack-deployment-steps ``` ### Sample Response ```json { "data": [ { "id": "sds-c8qjj4urpyh1wFrU", "type": "stack-deployment-steps", "attributes": { "status": "pending\_operator", "operation-type": "plan", "requires-state-lock": false, "created-at": "2025-09-10T21:22:31.577Z", "updated-at": "2025-09-11T17:38:13.903Z", "queued-at": "2025-09-10T21:22:31.606Z", "running-at": "2025-09-10T21:22:32.797Z", "pending-operator-at": "2025-09-10T21:22:39.862Z", "completed-at": null, "failed-at": null, "abandoned-at": null }, "relationships": { "stack-deployment-run": { "data": { "id": "sdr-qreEJHTfJ9i3qooa", "type": "stack-deployment-runs" } }, "stack-diagnostics": { "links": { "related": "/api/v2/stack-deployment-steps/sds-c8qjj4urpyh1wFrU/stack-diagnostics" }, "meta": { "count": 0 } }, "stack-approval": { "data": null } }, "links": { "self": "/api/v2/stack-deployment-steps/sds-c8qjj4urpyh1wFrU", "plan-description": "/api/v2/stack-deployment-steps/sds-c8qjj4urpyh1wFrU/artifacts?name=plan-description", "structured-log": "https://app.terraform.io/\_archivist/v1/object/dmF1bHQ6djE6QUFxZHhyS2xHcjA0MzVvbWhXOTVXU1gwQW1MS2hVNiszcHRLd01RZWgxT3phMmdJMWo0RC8xT1liWGZBaFFhalF2NG11R3dmdndIdnBmWWsyeWQzYnlnUW1sYjdTRm5rM1BjMlN0dVFXZWJMbmtkeWVaamMvYkhMcjZzLytvVVpJc3NtVFpJSng5MVVrTmd3eWNKM2JWd1ZNUXVUZWR3bzRHSU5qb3JzWW5FeEE0WlJlTHJySFlQMzJhMmRaSUJKMU5GYy9kQUJwOCs3M1k1WEhNa0o1VTdPK1FwRmYwVThqdkx1eklNQzVuYXphOUVBRTZzYUlERk1Pc3JXWnpwRnFYR3BGTGZleGNNSE1RVE0yTGVseFhkd3M0Ymo5ZkV4RXVZTUdrR0ZId215d2U3SllwaGFhRkUvT2VRUTVlTmZoUGp1SklxVkhTZ05IRktlVDNCeEN3UVpCUDlHRnpveUwrWTZ6aW81ZVM1YUM0QVZvV1BUMDA0WkF4VmtwTDVRclVRPQ" } } ], "links": { "self": "https://app.terraform.io/api/v2/stack-deployment-runs/sdr-qreEJHTfJ9i3qooa/stack-deployment-steps?page%5Bnumber%5D=1&page%5Bsize%5D=20", "first": "https://app.terraform.io/api/v2/stack-deployment-runs/sdr-qreEJHTfJ9i3qooa/stack-deployment-steps?page%5Bnumber%5D=1&page%5Bsize%5D=20", "prev": null, "next": null, "last": "https://app.terraform.io/api/v2/stack-deployment-runs/sdr-qreEJHTfJ9i3qooa/stack-deployment-steps?page%5Bnumber%5D=1&page%5Bsize%5D=20" }, "meta": { "pagination": { "current-page": 1, "page-size": 20, "prev-page": null, "next-page": null, "total-pages": 1, "total-count": 1 } } } ``` ## Show a Stack deployment step This endpoint gets details about a Stack deployment step. `GET /stack-deployment-steps/:stack\_deployment\_step\_id` | Parameter | Description | |-----------------------------|----------------------------------------------| | `:stack\_deployment\_step\_id` | The id of the Stack deployment step to show. | ### Available Related Resources This GET endpoint can optionally return related resources, if requested with [the `include` query parameter](/terraform/cloud-docs/api-docs#inclusion-of-related-resources). The following resource types are available: | Resource Name | Description | | --------------------- | --------------------------------------------------------------------------------------- | | `stack\_approval` | The approval associated with the specified step. | | `stack\_approval.user` | The user that created the approval for the specified step. | | `stack\_state` | The state that was created as the result of an apply operation from the specified step. | ### Sample Request ```shell $ curl\ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ https://app.terraform.io/api/v2/stack-deployment-steps/sds-LSqektntTNJrAhCt ``` ### Sample Response ```json { "data": { "id": "sds-c8qjj4urpyh1wFrU", "type": "stack-deployment-steps", "attributes": { "status": "pending\_operator", "operation-type": "plan", "requires-state-lock": false, "created-at": "2025-09-10T21:22:31.577Z", "updated-at": "2025-09-11T17:38:13.903Z", "queued-at": "2025-09-10T21:22:31.606Z", "running-at": "2025-09-10T21:22:32.797Z", "pending-operator-at": "2025-09-10T21:22:39.862Z", "completed-at": null, "failed-at": null, "abandoned-at": null }, "relationships": { "stack-deployment-run": { "data": { "id": "sdr-qreEJHTfJ9i3qooa", "type": "stack-deployment-runs" } }, "stack-diagnostics": { "links": { "related": "/api/v2/stack-deployment-steps/sds-c8qjj4urpyh1wFrU/stack-diagnostics" }, "meta": { "count": 0 } }, "stack-approval": { "data": null } }, "links": { "self": "/api/v2/stack-deployment-steps/sds-c8qjj4urpyh1wFrU", "plan-description": "/api/v2/stack-deployment-steps/sds-c8qjj4urpyh1wFrU/artifacts?name=plan-description", "structured-log": "https://app.terraform.io/\_archivist/v1/object/dmF1bHQ6djE6dHAxbFAwTHRXK3FQRFRxWklXd2E1UG0yc1JLQ3JsNVJheUNZR2l5ak9EYy9XOHk3RmdqSGw4VEswUmJDTFBCNlEvSEgvRHhhb0FCRVBmKytCRHV4TktENEFJRytWT3dXVjdTR2ZuRkFRODdEOUtuN08vdzQvRGdEcXVmb0xINHR5QlJZRnB3L1ZmRmY3blk3Q3dub1hCUmVXMW9uZUxLUUdyZGQzUWpLS3M0S0dMMTNiN3ZGRnFrQ3NoSjVKeXE4WS9iTzd6anA2MHZkWitUZ2hEcndZcTBZK0M5dFFrQkZzWjdoTUJhdS9ja3VMb3M5OFZBa0k2WjJBSHh3T2NCRjBLdjNlRThRUDBqOStrVWYxWXQ2VllTUzUzQ1YxNUkvUUJyY09CeUFsOGtrSVlMTWdFWkErM1g4NmN4UEQ3emFHZDAwUnJOa0xyQmd3VERiRGF4ZTRiMzdNVFZkcFFFWlZBMzJOcDloOWZ3U1pTMjY0Y0M4enUwdUp6WmZUditVZjk4PQ" } } } ``` ## List Stack deployment step diagnostics This endpoint lists Stack deployment step diagnostics for a Stack deployment step. `GET /stack-deployment-steps/:stack\_deployment\_step\_id/stack-diagnostics` | Parameter | Description | |-----------------------------|----------------------------------------------------------------------------------------------| | `:stack\_deployment\_step\_id` | The id of the Stack deployment step for which Stack deployment diagnostics are being listed. | ### Query Parameters This endpoint supports pagination [with standard URL query parameters](/terraform/cloud-docs/api-docs#query-parameters); remember to percent-encode `[` as `%5B` and `]` as `%5D` if your tooling doesn't automatically encode URLs. | Parameter | Description | |----------------|---------------------------------------------------------------------------------------------------| | `page[number]` | \*\*Optional.\*\* If omitted, the endpoint will return the first page. | | `page[size]` | \*\*Optional.\*\* If omitted, the endpoint will return 20 Stack deployment step diagnostics per page. | ### Sample Request ```shell $ curl\ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ https://app.terraform.io/api/v2/stack-deployment-steps/sds-LSqektntTNJrAhCt/stack-diagnostics ``` ### Sample Response ```json { "data": [ { "id": "stf-PrqektntTNJrAhCm", "type": "stack-diagnostics", "attributes": { "severity": "warning", "summary": | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/stacks/deployments.mdx | main | terraform | [
-0.04164831340312958,
0.060972925275564194,
0.04590312018990517,
0.03785692900419235,
0.011188975535333157,
-0.019637493416666985,
-0.03613770753145218,
-0.09487874805927277,
0.052096523344516754,
0.0635557547211647,
0.027478119358420372,
-0.06368532031774521,
0.04444525018334389,
-0.05158... | 0.009666 |
| \*\*Optional.\*\* If omitted, the endpoint will return 20 Stack deployment step diagnostics per page. | ### Sample Request ```shell $ curl\ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ https://app.terraform.io/api/v2/stack-deployment-steps/sds-LSqektntTNJrAhCt/stack-diagnostics ``` ### Sample Response ```json { "data": [ { "id": "stf-PrqektntTNJrAhCm", "type": "stack-diagnostics", "attributes": { "severity": "warning", "summary": "Diagnostics reported", "detail": "While preparing the configuration, HCP Terraform reported 2 warnings.", "diags": null, "acknowledged": true, "acknowledged-at": "2025-06-11T06:13:01.082Z", "created-at": "2025-06-11T06:13:01.082Z" }, "links": { "self": "/api/v2/stack-deployment-steps/sds-LSqektntTNJrAhCt/stack-diagnostics" }, "relationships": { "stack-configuration": { "data": { "id": "stc-RSqektntTNJrAhCm", "type": "stack-configurations" } }, "stack-deployment-step": { "data": { "id": "sds-qB6dJk7G7r7icTE8", "type": "stack-deployment-steps" } } } } ], "links": { "self": "https://app.terraform.io/api/v2/stack-deployment-steps/sds-LSqektntTNJrAhCt/stack-diagnostics?page%5Bnumber%5D=1&page%5Bsize%5D=20", "first": "https://app.terraform.io/api/v2/stack-deployment-steps/sds-LSqektntTNJrAhCt/stack-diagnostics?page%5Bnumber%5D=1&page%5Bsize%5D=20", "prev": null, "next": null, "last": "https://app.terraform.io/api/v2/stack-deployment-steps/sds-LSqektntTNJrAhCt/stack-diagnostics?page%5Bnumber%5D=1&page%5Bsize%5D=20" }, "meta": { "pagination": { "current-page": 1, "page-size": 20, "prev-page": null, "next-page": null, "total-pages": 1, "total-count": 1 } } } ``` ## Show a Stack deployment step artifact This endpoint returns an archivist URL for the requested artifact of a specified deployment step. `GET /stack-deployment-steps/:stack\_deployment\_step\_id/artifacts` | Parameter | Description | |-----------------------------|----------------------------------------------------------------------------| | `:stack\_deployment\_step\_id` | The id of the Stack deployment step for which the artifacts are requested. | ### Query Parameters [These are standard URL query parameters](/terraform/cloud-docs/api-docs#query-parameters); remember to percent-encode `[` as `%5B` and `]` as `%5D` if your tooling doesn't automatically encode URLs. | Parameter | Description | | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `name`. | \*\*Required.\*\* The name of the particular artifact being requested. Acceptable values are `plan-description`, `plan-debug-log`, `apply-description`, and `apply-debug-log` | ### Sample Request ```shell $ curl\ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ https://app.terraform.io/api/v2/stack-deployment-steps/sds-LSqektntTNJrAhCt/name=plan-description ``` ## Show a Stack approval This endpoint gets details about a Stack approval. `GET /stack-approvals/:stack\_approval\_id` | Parameter | Description | |----------------------|---------------------------------------| | `:stack\_approval\_id` | The id of the Stack approval to show. | ### Available Related Resources This GET endpoint can optionally return related resources, if requested with [the `include` query parameter](/terraform/cloud-docs/api-docs#inclusion-of-related-resources). The following resource types are available: | Resource Name | Description | | ------------- | --------------------------------------------------- | | `user` | The user that created the specified Stack approval. | ### Sample Request ```shell $ curl\ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ https://app.terraform.io/api/v2/stack-approvals/sta-LSqektntTNJrAhCt ``` ### Sample Response ```json { "data": { "id": "sa-6jJFPnNyEUSLLGhh", "type": "stack-approvals", "attributes": { "reason": null, "created-at": "2025-09-16T14:25:02.485Z" }, "relationships": { "user": { "data": { "id": "user-zqE1r5BwBu9rVLAR", "type": "users" } } } } } ``` ## Approve a Stack deployment group This endpoint creates a global approval for all runs in a Stack deployment group. `POST /stack-deployment-groups/:stack\_deployment\_group\_id/approve-all-plans` | Parameter | Description | |------------------------------|-------------------------------------------| | `:stack\_deployment\_group\_id` | The Stack deployment group id to approve. | | Status | Response | Reason | |---------|---------------------------|------------------------------------------------------------------------------------ | | [204][] | No Content | Successfully created an approval for all plans recieved for Stack deployment Group. | | [404][] | [JSON API error object][] | Stack deployment Group not found, or user unauthorized to perform action. | ### Request Body This POST endpoint will optionally accept a JSON object with the following properties as a request payload. Properties without a default value are required. | Key path | Type | Default | Description | |----------|---------|---------|-----------------------------| | `reason` | string | "" | The reason for the approval | ### Sample Request ```shell $ curl\ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ https://app.terraform.io/api/v2/stack-deployment-groups/stg-LSqektntTNJrAhCt/approve-all-plans ``` ## Rerun a Stack deployment group This endpoint reruns a Stack deployment group that has ended up in a failed state. `POST /stack-deployment-groups/:stack\_deployment\_group\_id/rerun` | Parameter | Description | |------------------------------|-----------------------------------------| | `:stack\_deployment\_group\_id` | The Stack deployment group id to rerun. | | Status | Response | Reason | |---------|---------------------------|--------------------------------------------------------------------------| | [204][] | No Content | Successfully recieved plan for | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/stacks/deployments.mdx | main | terraform | [
0.0033058100380003452,
0.09180372953414917,
0.03679852932691574,
0.012402829714119434,
-0.0031088385730981827,
-0.03788599371910095,
-0.050375036895275116,
-0.04129372164607048,
0.0526190921664238,
0.0780276358127594,
0.006236318964511156,
-0.13895998895168304,
0.055784668773412704,
-0.028... | 0.000805 |
reruns a Stack deployment group that has ended up in a failed state. `POST /stack-deployment-groups/:stack\_deployment\_group\_id/rerun` | Parameter | Description | |------------------------------|-----------------------------------------| | `:stack\_deployment\_group\_id` | The Stack deployment group id to rerun. | | Status | Response | Reason | |---------|---------------------------|--------------------------------------------------------------------------| | [204][] | No Content | Successfully recieved plan for Stack deployment Group. | | [404][] | [JSON API error object][] | Stack deployment Group not found, or user unauthorized to perform action | ### Query Parameters This endpoint requires the usage of query parameters to specify which deployments within the group must be rerun | Parameter | Description | |---------------|-------------------------------------------------------------------------------------------------------------------- | | `deployments` | \*\*Required.\*\* A comma separated list specifying the names of the deployments within the group that are to be rerun. | ### Sample Request ```shell $ curl\ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ https://app.terraform.io/api/v2/stack-deployment-groups/stg-LSqektntTNJrAhCt/rerun ``` ## Approve a Stack deployment run This endpoint approves all current and future plans associated with a Stack deployment run. `POST /stack-deployment-runs/:stack\_deployment\_run\_id/approve-all-plans` | Parameter | Description | |----------------------------|-----------------------------------------| | `:stack\_deployment\_run\_id` | The Stack deployment run id to approve. | ### Request Body This POST endpoint will optionally accept a JSON object with the following properties as a request payload. Properties without a default value are required. | Key path | Type | Default | Description | |----------|---------|---------|-----------------------------| | `reason` | string | "" | The reason for the approval | ### Query Parameters | Parameter | Description | |-------------|-----------------------------------------------------------| | `all\_plans` | \*\*Optional.\*\* Approve all potential future plans as well. | | Status | Response | Reason | |---------|---------------------------|------------------------------------------------------------------------| | [204][] | No Content | Successfully approved all plans recieved for Stack deployment Run. | | [404][] | [JSON API error object][] | Stack deployment Run not found, or user unauthorized to perform action | ### Sample Request ```shell $ curl\ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ https://app.terraform.io/api/v2/stack-deployment-runs/sdr-LSqektntTNJrAhCt/approve-all-plans ``` ## Cancel a Stack deployment run This endpoint cancels a Stack deployment run. `POST /stack-deployment-runs/:stack\_deployment\_run\_id/cancel` | Parameter | Description | |----------------------------|----------------------------------------- | | `:stack\_deployment\_run\_id` | The id for the deployment run to cancel. | ### Query Parameters | Parameter | Description | |-----------|-------------------------------------------------------------------- | | `force` | \*\*Optional.\*\* Whether or not to forcably cancel the deployment run. | | Status | Response | Reason | |---------|---------------------------|------------------------------------------------------------------------| | [204][] | No Content | Successfully receieved cancel for the Stack deployment Run. | | [404][] | [JSON API error object][] | Stack deployment Run not found, or user unauthorized to perform action | ### Sample Request ```shell $ curl\ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ https://app.terraform.io/api/v2/stack-deployment-runs/sdr-LSqektntTNJrAhCt/cancel ``` ## Advance a Stack deployment step This endpoint advances a Stack deployment step. `POST /stack-deployment-steps/:stack\_deployment\_step\_id/advance` | Parameter | Description | |-----------------------------|------------------------------------------------- | | `:stack\_deployment\_step\_id` | The id for the Stack deployment step to advance. | | Status | Response | Reason | |---------|---------------------------|-------------------------------------------------------------------------| | [204][] | No Content | Successfully recieved advance for Stack deployment Step. | | [404][] | [JSON API error object][] | Stack deployment Step not found, or user unauthorized to perform action | ### Request Body This POST endpoint will optionally accept a JSON object with the following properties as a request payload. Properties without a default value are required. | Key path | Type | Default | Description | |----------|---------|---------|--------------------------------| | `reason` | string | "" | The reason for the advancement | ### Sample Request ```shell $ curl\ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ https://app.terraform.io/api/v2/stack-deployment-steps/sds-LSqektntTNJrAhCt/advance ``` | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/stacks/deployments.mdx | main | terraform | [
-0.00003786647357628681,
-0.03953249007463455,
0.03509864956140518,
0.053958382457494736,
-0.022777728736400604,
-0.06041065230965614,
-0.05303866043686867,
-0.0718710720539093,
-0.01828933134675026,
-0.01576690562069416,
0.05497003719210625,
-0.04554181173443794,
0.000463260366814211,
-0.... | -0.001761 |
string | "" | The reason for the advancement | ### Sample Request ```shell $ curl\ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ https://app.terraform.io/api/v2/stack-deployment-steps/sds-LSqektntTNJrAhCt/advance ``` | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/stacks/deployments.mdx | main | terraform | [
0.007408448029309511,
0.09591358155012131,
-0.02168409340083599,
-0.028444936498999596,
-0.009859985671937466,
-0.013870876282453537,
-0.009014722891151905,
0.01282541174441576,
0.03406905755400658,
0.08241260796785355,
-0.0014610867947340012,
-0.0855642780661583,
0.012713435105979443,
-0.... | 0.068696 |
[200]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/200 [201]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/201 [202]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/202 [302]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/302 [204]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/204 [400]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/400 [401]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/401 [403]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/403 [404]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/404 [409]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/409 [412]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/412 [422]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/422 [429]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429 [500]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500 [504]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504 [JSON API document]: /terraform/cloud-docs/api-docs#json-api-documents [JSON API error object]: http://jsonapi.org/format/#error-objects # Stack configurations API reference A Stack configuration version is a snapshot of all of the pieces that make up your Stack. To learn more about what makes up a Stack configuration version, refer to [Configuration versions](/terraform/cloud-docs/stacks/deploy/configuration-versions). ## Overview The scope of the API includes the following endpoints: | Method | Path | Action | |----------|----------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------| | `POST` | `/stacks/:stack\_id/stack-configurations` | Call this endpoint to [create a Stack configuration](#create-a-stack-configuration). | | `POST` | `/stacks/:stack\_id/fetch-latest-from-vcs` | Call this endpoint to [fetch the latest Stack configuration](#fetch-a-stack-configuration). | | `GET` | `/stacks/:stack\_id/stack-configurations` | Call this endpoint to [list Stack configurations](#list-stack-configurations). | | `GET` | `/stack-configurations/:stack\_configuration\_id` | Call this endpoint to [show a Stack configuration](#show-stack-configuration). | | `GET` | `/stack-configurations/:stack\_configuration\_id/stack-deployment-group-summaries` | Call this endpoint to [list Deployment Group Summaries](#list-deployment-group-summaries). | | `GET` | `/stack-configurations/:stack\_configuration\_id/stack-diagnostics` | Call this endpoint to [list Stack configuration diagnostics](#list-stack-configuration-diagnostics). | | `GET` | `/stack-configurations/:stack\_configuration\_id/upload-url` | Call this endpoint to [fetch Stack configuration upload url](#fetch-stack-configuration-upload-url). | | `GET` | `/stack-configurations/:stack\_configuration\_id/source-bundle` | Call this endpoint to [fetch Stack configuration source bundle](#fetch-stack-configuration-source-bundle). | ## Create a Stack configuration This endpoint creates an empty Stack configuration for the specified Stack. You will have to upload a configuration file to the Stack configurations upload URL to let the Stack prepare a job to run and generate plans. This endpoint cannot be used if the Stack is connected to a VCS repo. `POST /stacks/:stack\_id/stack-configurations` | Parameter | Description | |-------------|-----------------------------------------------| | `:stack\_id` | The target Stack ID to create a configuration | ### Request Body This POST endpoint requires a JSON object with the following properties as a request payload. Properties without a default value are required. | Key path | Type | Default | Description | |-------------------------------|---------|---------|------------------------------------------------------------------------------------------------------------------------------------------------| | `data.attributes.speculative` | boolean | `false` | Specifies if this is a speculative configuration that HCP Terraform cannot converge past the plan step. | | Status | Response | Reason | |---------|---------------------------|-----------------------------------------------------------------------| | [200][] | [JSON API document][] | Successfully created a Stack configuration. | | [404][] | [JSON API error object][] | Not found, or the user is unauthorized to perform this action. | | [422][] | [JSON API error object][] | Malformed request body (e.g., missing attributes, wrong types, etc.). | | [500][] | [JSON API error object][] | Internal system failure. | ### Sample Payload ```json { "data": { "attributes": { "speculative": true } } } ``` ### Sample Request ```shell $ curl\ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request POST \ --data @payload.json \ https://app.terraform.io/api/v2/stacks/st-YwBzgFeeW6Mq4wkH/stack-configurations ``` ### Sample Response ```json { "data": { "id": "stc-4EWffseuNa1FpfDH", "type": "stack-configurations", "attributes": { "status": "pending", "sequence-number": 2, "preparing-event-stream-url": "https://archivist.terraform.io/v1/object/dmF1bHQ6djE6WTVtSkdnbE01anBlK3A2dEhWd3ZKYlB0M2hUSzFkNm9PdWhrcWo4QzdMMURIUnFNSTlOSFZGdkt6ZloxWjZlUUlYaEd2cnlVV3NoNnlweHNzNnZNQkRVSk9JS2R2NE80Q2ZWTHhsbGxwRzgyMnQrVWlEd3o2c2VueEs1ZGducmtmNG0rdmIzR1hxeGtmZThsTk1hUTJLNHJrSkZiUk5saEpad1lEelF1aEZ3MG8zTks2VlNldHRHV0YzUG0rUmdneUpsOXU2QlFaYk9EUjlEUWlTZUpQeUE4UEVwejczZmxxRFgrTGIwaDVzQmxwUHNuUWZycEtKZm9VQmZpemZCbSs0RWJxdC9BbFlpM216VXE3dk1GcnplbkxIQ2FyM3Q3Y0o5WGc1QjFLUElGRHRweXI4VE1JOWFHUm9iQ1NwSXJpR2pVdng4OHh1U0FLWXpYVUwvZTJuUSs2WURSd1FoMDNVUm5jYmhmWStGK3VVL3p3QmtYcG1laA", "created-at": "2025-09-16T16:29:22.855Z", "updated-at": "2025-09-16T16:29:22.855Z", "speculative": false, "components": [] }, "relationships": { "stack": { "data": { "id": "st-YwBzgFeeW6Mq4wkH", "type": "stacks" } }, "stack-diagnostics": { "links": { "related": "/api/v2/stack-configurations/stc-4EWffseuNa1FpfDH/stack-diagnostics" } }, "stack-deployment-groups": { "links": { "related": "/api/v2/stack-configurations/stc-4EWffseuNa1FpfDH/stack-deployment-groups" } } }, "links": { "self": "/api/v2/stack-configurations/stc-4EWffseuNa1FpfDH", "json-schemas": "/api/v2/stack-configurations/stc-4EWffseuNa1FpfDH/json-schemas" }, "meta": { "beta": false } } } ``` ## Fetch a Stack configuration This endpoint creates a Stack configuration for a VCS-backed Stack by pulling it from the head of the Stack's branch. `POST /stacks/:stack\_id/fetch-latest-from-vcs` | Parameter | Description | |-------------|--------------------------------------------------| | `:stack\_id` | The target Stack ID to fetch a configuration for.| | Status | Response | Reason | |---------|---------------------------|-----------------------------------------------------------------------------------| | [204][] | No Content | Successfully started the process of retrieving the latest configuration from VCS. | | [404][] | | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/stacks/configurations.mdx | main | terraform | [
-0.022840997204184532,
-0.01981019228696823,
-0.029182204976677895,
-0.013868125155568123,
-0.018806852400302887,
-0.0860305055975914,
-0.05282869562506676,
-0.0755099505186081,
-0.0026346701197326183,
-0.036433931440114975,
0.028786011040210724,
0.05538564175367355,
-0.0026604565791785717,
... | 0.06642 |
branch. `POST /stacks/:stack\_id/fetch-latest-from-vcs` | Parameter | Description | |-------------|--------------------------------------------------| | `:stack\_id` | The target Stack ID to fetch a configuration for.| | Status | Response | Reason | |---------|---------------------------|-----------------------------------------------------------------------------------| | [204][] | No Content | Successfully started the process of retrieving the latest configuration from VCS. | | [404][] | [JSON API error object][] | Stack not found, or user unauthorized to perform action | ### Sample Request ```shell $ curl\ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ https://app.terraform.io/api/v2/stack/st-SihZTyXKfNXUWuUa/fetch-latest-from-vcs ``` ## List Stack configurations This endpoint lists configurations for the specified Stack. `GET /stacks/:stack\_id/stack-configurations` | Parameter | Description | |-------------|------------------------------------------| | `:stack\_id` | The Stack id to list configurations for. | ### Query Parameters This endpoint supports pagination [with standard URL query parameters](/terraform/cloud-docs/api-docs#query-parameters); remember to percent-encode `[` as `%5B` and `]` as `%5D` if your tooling doesn't automatically encode URLs. | Parameter | Description | |----------------|--------------------------------------------------------------------------------------| | `page[number]` | \*\*Optional.\*\* If omitted, the endpoint will return the first page. | | `page[size]` | \*\*Optional.\*\* If omitted, the endpoint will return 20 Stack configurations per page. | ### Available Related Resources This GET endpoint can optionally return related resources, if requested with [the `include` query parameter](/terraform/cloud-docs/api-docs#inclusion-of-related-resources). The following resource types are available: | Resource Name | Description | | -------------------- | ------------------------------------------------------------ | | `ingress\_attributes` | The vcs information associated with the Stack configurations. | ### Sample Request ```shell $ curl\ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ https://app.terraform.io/api/v2/stacks/st-YwBzgFeeW6Mq4wkH/stack-configurations ``` ### Sample Response ```json { "data": [ { "id": "stc-4EWffseuNa1FpfDH", "type": "stack-configurations", "attributes": { "status": "pending", "sequence-number": 2, "preparing-event-stream-url": "https://archivist.terraform.io/v1/object/dmF1bHQ6djE6N2JTaDVOcEVwbFZVR21vZTBkaEl4S1dOY0VRREMrdnB1L0hGUTFmWnNvdUZVaVpYWDdLZWJPMUhjRmdkdkJVY0gzc245VG9KMVpjTXFTbE9JWlJwQ2FzbTh0c3pUNFRzWW1OV1pIbjhTMVVEa0V3MVlCYVNLYXdsaUNLYU1QellZVzZDdFQ1ZStIczhnd1o4cnprd1hjZEJTaUZnMXJsRzF4aXFidXdaNHBXM0VLeFR6N3JiYkZpVEE5OU9jRTU2SVpaa29kSXJuWlowYW1La0FKL1VjT095eCtNUTRXMUJ0S3VydytWZ0Z3dWZtdHYrNkFwVDg0RmdVb1FGOTBIRS9JZjgvWk81QXgyOWl3U1pRa0pzVnByUWdIMFE4UTBNQzk5N2lkaWNzZmpVdVRwTWR3ZUJUNlFEN0JVSENjVU94Yi82ZUkwV1NVS21vZnNKMjk2QTNxSS91OGNOUUZjRVpmNE1Cb3pYa1hpd2pIaVJPVEdRNEhKZw", "created-at": "2025-09-16T16:29:22.855Z", "updated-at": "2025-09-16T16:29:22.855Z", "speculative": false, "components": [] }, "relationships": { "stack": { "data": { "id": "st-YwBzgFeeW6Mq4wkH", "type": "stacks" } }, "stack-diagnostics": { "links": { "related": "/api/v2/stack-configurations/stc-4EWffseuNa1FpfDH/stack-diagnostics" } }, "stack-deployment-groups": { "links": { "related": "/api/v2/stack-configurations/stc-4EWffseuNa1FpfDH/stack-deployment-groups" } } }, "links": { "self": "/api/v2/stack-configurations/stc-4EWffseuNa1FpfDH", "json-schemas": "/api/v2/stack-configurations/stc-4EWffseuNa1FpfDH/json-schemas" }, "meta": { "beta": false } } ], "links": { "self": "https://app.terraform.io/api/v2/stacks/st-YwBzgFeeW6Mq4wkH/stack-configurations?page%5Bnumber%5D=1&page%5Bsize%5D=1", "first": "https://app.terraform.io/api/v2/stacks/st-YwBzgFeeW6Mq4wkH/stack-configurations?page%5Bnumber%5D=1&page%5Bsize%5D=1", "prev": null, "next": "https://app.terraform.io/api/v2/stacks/st-YwBzgFeeW6Mq4wkH/stack-configurations?page%5Bnumber%5D=2&page%5Bsize%5D=1", "last": "https://app.terraform.io/api/v2/stacks/st-YwBzgFeeW6Mq4wkH/stack-configurations?page%5Bnumber%5D=2&page%5Bsize%5D=1" }, "meta": { "pagination": { "current-page": 1, "page-size": 1, "prev-page": null, "next-page": 2, "total-pages": 2, "total-count": 2 } } } ``` ## Show Stack configuration `GET /stack-configurations/:stack\_configuration\_id` This endpoint returns details of the specified Stack configuration. | Parameter | Description | |---------------------------|-----------------------------| | `:stack\_configuration\_id` | The Stack configuration id. | ### Available Related Resources This GET endpoint can optionally return related resources, if requested with [the `include` query parameter](/terraform/cloud-docs/api-docs#inclusion-of-related-resources). The following resource types are available: | Resource Name | Description | | ------------------- | -------------------------------------------------------------- | | `ingress\_attributes`| The vcs information associated with the Stack configuration. | | `stack\_diagnostics` | The Stack diagnostics associated with the Stack configuration. | ### Sample Request ```shell $ curl\ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ https://app.terraform.io/api/v2/stack-configurations/stc-4EWffseuNa1FpfDH ``` ### Sample Response ```json { "data": { "id": "stc-4EWffseuNa1FpfDH", "type": "stack-configurations", "attributes": { "status": "pending", "sequence-number": 2, "preparing-event-stream-url": "https://archivist.terraform.io/v1/object/dmF1bHQ6djE6Umh4WE9sTUlGb0F3Q0NFTUQ4a2ZIOUlvZ1ZWNmlEOERFRVgyUVBJY2ZZMGgwbUJpS0tQd2FYdjYvOUpMLzAyTUdlM2hLYWt5RGdlRmZUZm84b0trajZpenNodDcrVzB4Y3ZDanhWYUZ0YXFGRWx4aG5GMFVwQ2VmbUtVSzU0L2dKYjJGdE5rekoydG9mTEF6bnR1L2hDcjEvYkxtNUNyOE90UUxlVEQ3cTl3emtqTU9IQlFOeDhIcnk3Tk8yNVZRcm9JQ2swUjdsYmZ6OTJBS0FuOWpJSmF3Y0ZDK2NEU3hoRmFoL0VUWVhIR25QVUxJSmFvK2RqcytlQ2JMc1ROZVphNDFBcEVoUjJZeGJSYyttSEwydnhCTjhnUnFyVXlCUEJOUlVyR0g1aW1pMHFuZ1EybTIxOGpjNWJlMnYrRHY5L0swV3RodGIvZk1DejN5SFBGSnJtVndyS2NGMmpUekd6ajByd2RyeXZqdHVLcFRIUnFobWdTeQ", "created-at": "2025-09-16T16:29:22.855Z", "updated-at": "2025-09-16T16:29:22.855Z", "speculative": false, "components": [] }, "relationships": { "stack": { "data": { "id": "st-YwBzgFeeW6Mq4wkH", "type": "stacks" } }, "stack-diagnostics": { "links": { "related": "/api/v2/stack-configurations/stc-4EWffseuNa1FpfDH/stack-diagnostics" } }, "stack-deployment-groups": { "links": { "related": "/api/v2/stack-configurations/stc-4EWffseuNa1FpfDH/stack-deployment-groups" } } }, "links": { "self": "/api/v2/stack-configurations/stc-4EWffseuNa1FpfDH", "json-schemas": "/api/v2/stack-configurations/stc-4EWffseuNa1FpfDH/json-schemas" }, "meta": { "beta": false } } } ``` ## List Deployment Group Summaries This endpoint lists deployment group summaries for the specified Stack configuration. `GET /stack-configurations/:stack\_configuration\_id/stack-deployment-group-summaries` | Parameter | Description | |-------------|------------------------------------------------------------------------------------- | | `:stack\_configuration\_id` | The Stack configuration id to list the deployment group summaries for. | ### Query Parameters This endpoint supports pagination [with standard URL query parameters](/terraform/cloud-docs/api-docs#query-parameters); remember to percent-encode `[` as `%5B` and `]` as `%5D` if your tooling doesn't automatically encode URLs. | Parameter | Description | |----------------|-----------------------------------------------------------------------------------------------| | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/stacks/configurations.mdx | main | terraform | [
0.003995544742792845,
-0.008666750974953175,
-0.06306364387273788,
0.04166622832417488,
-0.029035404324531555,
-0.048087481409311295,
-0.058487419039011,
0.023095067590475082,
-0.002506880322471261,
-0.0070185367949306965,
0.048515547066926956,
-0.08300327509641647,
0.014272832311689854,
-... | 0.035299 |
| `:stack\_configuration\_id` | The Stack configuration id to list the deployment group summaries for. | ### Query Parameters This endpoint supports pagination [with standard URL query parameters](/terraform/cloud-docs/api-docs#query-parameters); remember to percent-encode `[` as `%5B` and `]` as `%5D` if your tooling doesn't automatically encode URLs. | Parameter | Description | |----------------|-----------------------------------------------------------------------------------------------| | `page[number]` | \*\*Optional.\*\* If omitted, the endpoint will return the first page. | | `page[size]` | \*\*Optional.\*\* If omitted, the endpoint will return 20 Stack configuration summaries per page. | ### Sample Request ```shell $ curl\ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ https://app.terraform.io/api/v2/stack-configurations/stc-yyu5ajbMU45nea3L/stack-deployment-group-summaries ``` ### Sample Response ```json { "data": [ { "id": "sdg-wPG9EBFcz7LvYSJ9", "type": "stack-deployment-group-summaries", "attributes": { "name": "simple\_default", "status": "succeeded", "status-counts": { "pending": 0, "pre-deploying": 0, "pre-deploying-pending-operator": 0, "acquiring-lock": 0, "deploying": 0, "deploying-pending-operator": 0, "succeeded": 1, "failed": 0, "abandoned": 0 } }, "relationships": { "stack-deployment-group": { "data": { "id": "sdg-wPG9EBFcz7LvYSJ9", "type": "stack-deployment-groups" } } } } ], "links": { "self": "https://app.terraform.io/api/v2/stack-configurations/stc-yyu5ajbMU45nea3L/stack-deployment-group-summaries?page%5Bnumber%5D=1&page%5Bsize%5D=20", "first": "https://app.terraform.io/api/v2/stack-configurations/stc-yyu5ajbMU45nea3L/stack-deployment-group-summaries?page%5Bnumber%5D=1&page%5Bsize%5D=20", "prev": null, "next": null, "last": "https://app.terraform.io/api/v2/stack-configurations/stc-yyu5ajbMU45nea3L/stack-deployment-group-summaries?page%5Bnumber%5D=1&page%5Bsize%5D=20" }, "meta": { "pagination": { "current-page": 1, "page-size": 20, "prev-page": null, "next-page": null, "total-pages": 1, "total-count": 1 } } } ``` ## List Stack configuration diagnostics This endpoint lists the diagnostics related to the preparation process for the specified Stack configuration. `GET /stack-configurations/:stack\_configuration\_id/stack-diagnostics` | Parameter | Description | |---------------------------|---------------------------------------------------------| | `:stack\_configuration\_id` | The Stack configuration id to list the diagnostics for. | ### Query Parameters This endpoint supports pagination [with standard URL query parameters](/terraform/cloud-docs/api-docs#query-parameters); remember to percent-encode `[` as `%5B` and `]` as `%5D` if your tooling doesn't automatically encode URLs. | Parameter | Description | |----------------|-------------------------------------------------------------------------------------------------| | `page[number]` | \*\*Optional.\*\* If omitted, the endpoint will return the first page. | | `page[size]` | \*\*Optional.\*\* If omitted, the endpoint will return 20 Stack configuration diagnostics per page. | ### Sample Request ```shell $ curl\ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ https://app.terraform.io/api/v2/stack-configurations/stc-vHvM8dY1cYCVsfuT/stack-diagnostics ``` ### Sample Response ```json { "data": [ { "id": "std-fU7vZ3RS1TRYnrUs", "type": "stack-diagnostics", "attributes": { "severity": "error", "summary": "Diagnostics reported", "detail": "While preparing the configuration, HCP Terraform reported 1 error.", "diags": [ { "range": { "end": { "byte": 213, "line": 10, "column": 4 }, "start": { "byte": 212, "line": 10, "column": 3 }, "source": "git::https://github.com/aaabdelgany/pet-nulls-stack.git//deployments.tfdeploy.hcl?ref=41607dab260dcd108a81ce1fa935bf72c93abbf6", "filename": "deployments.tfdeploy.hcl" }, "detail": "The argument \"deployment\_group\" was already set at git::https://github.com/aaabdelgany/pet-nulls-stack.git//deployments.tfdeploy.hcl?ref=41607dab260dcd108a81ce1fa935bf72c93abbf6:9,3-19. Each argument may be set only once.", "snippet": { "code": " deployment\_group = deployment\_group.custom2", "values": [], "context": "deployment \"simple\"", "start\_line": 10, "highlight\_end\_offset": 3, "highlight\_start\_offset": 2 }, "summary": "Attribute redefined", "severity": "error" } ], "acknowledged": true, "acknowledged-at": "2025-08-27T18:29:33.605Z", "created-at": "2025-08-27T18:16:37.380Z" }, "relationships": { "stack-configuration": { "data": { "id": "stc-vHvM8dY1cYCVsfuT", "type": "stack-configurations" } } }, "links": { "self": "/api/v2/stack-diagnostics/std-fU7vZ3RS1TRYnrUs" } } ], "links": { "self": "https://app.terraform.io/api/v2/stack-configurations/stc-vHvM8dY1cYCVsfuT/stack-diagnostics?page%5Bnumber%5D=1&page%5Bsize%5D=20", "first": "https://app.terraform.io/api/v2/stack-configurations/stc-vHvM8dY1cYCVsfuT/stack-diagnostics?page%5Bnumber%5D=1&page%5Bsize%5D=20", "prev": null, "next": null, "last": "https://app.terraform.io/api/v2/stack-configurations/stc-vHvM8dY1cYCVsfuT/stack-diagnostics?page%5Bnumber%5D=1&page%5Bsize%5D=20" }, "meta": { "pagination": { "current-page": 1, "page-size": 20, "prev-page": null, "next-page": null, "total-pages": 1, "total-count": 1 } } } ``` ## Fetch Stack configuration upload URL `GET /stack-configurations/:stack\_configuration\_id/upload-url` This endpoint fetches the Stack configuration upload url. Use this URL to upload a raw configuration file for a manually created Stack configuration. | Parameter | Description | |---------------------------|---------------------------------------------------------| | `:stack\_configuration\_id` | The Stack configuration id to fetch the upload URL for. | ### Sample Request ```shell $ curl\ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ https://app.terraform.io/api/v2/stack-configurations/stc-SihZTyXKfNXUWuUa/upload-url ``` ### Sample Response ```json { "data": { "source-upload-url": "https://github.com/stack-config-uploads" }, "links": { "self": "/api/v2/stack-configurations/stc-SihZTyXKfNXUWuUa/upload-url" } } ``` ## Fetch Stack configuration source bundle `GET /stack-configurations/:stack\_configuration\_id/source-bundle` This endpoint redirects to the download URL for a Stack configuration source bundle. | Parameter | Description | |---------------------------|------------------------------------------------------------| | `:stack\_configuration\_id` | The Stack configuration id to fetch the source bundle for. | | Status | Response | | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/stacks/configurations.mdx | main | terraform | [
-0.008192229084670544,
0.041731953620910645,
0.034201834350824356,
0.014289133250713348,
-0.06114717200398445,
0.020635336637496948,
-0.06238487735390663,
-0.09309320151805878,
0.045308828353881836,
0.08484864234924316,
-0.012405982241034508,
-0.09918974339962006,
0.06809787452220917,
-0.0... | -0.02946 |
"/api/v2/stack-configurations/stc-SihZTyXKfNXUWuUa/upload-url" } } ``` ## Fetch Stack configuration source bundle `GET /stack-configurations/:stack\_configuration\_id/source-bundle` This endpoint redirects to the download URL for a Stack configuration source bundle. | Parameter | Description | |---------------------------|------------------------------------------------------------| | `:stack\_configuration\_id` | The Stack configuration id to fetch the source bundle for. | | Status | Response | Reason | |---------|---------------------------|-----------------------------------------------------------------------| | [302][] | HTTP Redirect | Successfully redirect client to temporary source bundle download URL | | [404][] | [JSON API error object][] | Stack configuration not found, or user unauthorized to perform action | | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/stacks/configurations.mdx | main | terraform | [
-0.04257899522781372,
-0.007248526439070702,
-0.06837517023086548,
0.04460018873214722,
0.0331493616104126,
-0.0036382025573402643,
-0.025964248925447464,
0.057217564433813095,
0.014409518800675869,
0.020786330103874207,
0.03126698359847069,
-0.06165418028831482,
-0.014545539394021034,
-0.... | 0.005013 |
[200]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/200 [201]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/201 [202]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/202 [204]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/204 [400]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/400 [401]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/401 [403]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/403 [404]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/404 [409]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/409 [412]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/412 [422]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/422 [429]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429 [500]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500 [504]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504 [JSON API document]: /terraform/cloud-docs/api-docs#json-api-documents [JSON API error object]: https://jsonapi.org/format/#error-objects # Tests API reference Tests are terraform operations(runs) and are referred to as Test Runs within the HCP Terraform API. Performing a test on a new configuration is a multi-step process. 1. [Create a configuration version on the registry module](#create-a-configuration-version-for-a-test). 1. [Upload configuration files to the configuration version](#upload-configuration-files-for-a-test). 1. [Create a test on the module](#create-a-test-run); HCP Terraform completes this step automatically when you upload a configuration file. Alternatively, you can create a test with a pre-existing configuration version, even one from another module. This is useful for promoting known good code from one module to another. ## Attributes The `tests` API endpoint has the following attributes. ### Test Run States The state of the test operation is found in `data.attributes.status`, and you can reference the following list of possible states. | State | Description | | ---------- | ------------------------------------------------------- | | `pending` | The initial status of a run after creation. | | `queued` | HCP Terraform has queued the test operation to start. | | `running` | HCP Terraform is executing the test. | | `errored` | The test has errored. This is a final state. | | `canceled` | The test has been canceled. This is a final state. | | `finished` | The test has completed. This is a final state. | ### Test run status The final test status is found in `data.attributes.test-status`, and you can reference the following list of possible states. | Status | Description | | ------ | ---------------------------- | | `pass` | The given tests have passed. | | `fail` | The given tests have failed. | ### Detailed test status The test results can be found via the following attributes | Status | Description | | | ------------------------------- | ------------------------------------------- | | `data.attributes.tests-passed` | The number of tests that have passed. | | `data.attributes.tests-failed` | The number of tests that have failed. | | `data.attributes.tests-errored` | The number of tests that have errored out. | | `data.attributes.tests-skipped` | The number of tests that have been skipped. | ### Test Sources List tests for a module. You can use the following sources as [tests list](/terraform/cloud-docs/api-docs/private-registry/tests#list-tests-for-a-module) query parameters. | Source | Description | |-----------------------------|------------------------------------------------------------------------------------------| | `terraform` | Indicates a test was queued from HCP Terraform CLI. | | `tfe-api` | Indicates a test was queued from HCP Terraform API. | | `tfe-configuration-version` | Indicates a test was queued from a Configuration Version, triggered from a VCS provider. | ## Create a Test `POST /organizations/:organization\_name/tests/registry-modules/private/:namespace/:name/:provider/test-runs` | Parameter | Description | | -------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `:organization\_name` | The name of the organization for the module. The organization must already exist, and the token authenticating the API request must belong to the "owners" team or a member of the "owners" team. | | `:namespace` | The namespace of the module for which the test is being created. For private modules this is the same as the `:organization\_name` parameter. | | `:name` | The name of the module for which the test is being created. | | `:provider` | The name of the provider for which the test is being created. | A test run executes tests against a registry module, using a configuration version and the modules’s current environment variables. Creating a test run requires permission to access the specified module. Refer to [Permissions](/terraform/cloud-docs/users-teams-organizations/permissions) for more information. When creating a test run, you may optionally provide a | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/private-registry/tests.mdx | main | terraform | [
-0.015784088522195816,
-0.01700746826827526,
-0.018668580800294876,
-0.028096551075577736,
-0.024631375446915627,
-0.08318780362606049,
-0.0621652752161026,
-0.07521579414606094,
-0.005580500699579716,
-0.03855427727103233,
0.03281282261013985,
0.0540321059525013,
0.006812138482928276,
-0.... | 0.052879 |
is being created. | A test run executes tests against a registry module, using a configuration version and the modules’s current environment variables. Creating a test run requires permission to access the specified module. Refer to [Permissions](/terraform/cloud-docs/users-teams-organizations/permissions) for more information. When creating a test run, you may optionally provide a list of variable objects containing key and value attributes. These values apply to that test run specifically and take precedence over variables with the same key that are created within the module. All values must be expressed as an HCL literal in the same syntax you would use when writing Terraform code. \*\*Sample Test Variables:\*\* ```json "attributes": { "variables": [ { "key": "replicas", "value": "2" }, { "key": "access\_key", "value": "\"ABCDE12345\"" } ] } ``` ### Request Body This POST endpoint requires a JSON object with the following properties as a request payload. Properties without a default value are required. | Key path | Type | Default | Description | | -------------------------------------------------- | -------------------- | ------------- | -------------------------------------------------------------------------------------------------- | | `data.attributes.verbose` | bool | `false` | Specifies whether Terraform should print the plan or state for each test run block as it executes. | | `data.attributes.test-directory` | string | `"tests"` | Sets the directory where HCP Terraform executes the tests. | | `data.attributes.filters` | array\[string] | (empty array) | When specified, HCP Terraform only executes the test files contained within this array. | | `data.attributes.variables` | array\[{key, value}] | (empty array) | Specifies an optional list of test-specific environment variable values. | | `data.relationships.configuration-version.data.id` | string | none | Specifies the configuration version that HCP Terraform executes the test against. | ### Sample Payload ```json { "data": { "attributes": { "verbose": true, "filters": ["tests/test.tftest.hcl"], "test-directory": "tests", "variables": [ { "key" : "number", "value": 4} ] }, "type":"test-runs" } } ``` ### Sample Request ```shell curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request POST \ --data @payload.json \ https://app.terraform.io/api/v2/organizations/my-organization/tests/registry-modules/private/my-organization/private/registry-provider/test-runs ``` ### Sample Response ```json { "data": { "id": "trun-KFg8DSiRz4E37mdJ", "type": "test-runs", "attributes": { "status": "queued", "status-timestamps": { "queued-at": "2023-10-03T18:27:39+00:00" }, "created-at": "2023-10-03T18:27:39.239Z", "updated-at": "2023-10-03T18:27:39.264Z", "test-configurable-type": "RegistryModule", "test-configurable-id": "mod-9rjVHLCUE9QD3k6L", "variables": [ { "key": "number", "value": "4" } ], "filters": [ "tests/test.tftest.hcl" ], "test-directory": "tests", "verbose": true, "test-status": null, "tests-passed": null, "tests-failed": null, "tests-errored": null, "tests-skipped": null, "source": "tfe-api", "message": "Queued manually via the Terraform Enterprise API" }, "relationships": { "configuration-version": { "data": { "id": "cv-d3zBGFf5DfWY4GY9", "type": "configuration-versions" }, "links": { "related": "/api/v2/configuration-versions/cv-d3zBGFf5DfWY4GY9" } }, "created-by": { "data": { "id": "user-zsRFs3AGaAHzbEfs", "type": "users" }, "links": { "related": "/api/v2/users/user-zsRFs3AGaAHzbEfs" } } } } } ``` ## Create a Configuration Version for a Test `POST /organizations/:organization\_name/tests/registry-modules/private/:namespace/:name/:provider/test-runs/configuration-versions` | Parameter | Description | | -------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `:organization\_name` | The name of the organization for the module. The organization must already exist, and the token authenticating the API request must belong to the "owners" team or a member of the "owners" team. | | `:namespace` | The namespace of the module for which the configuration version is being created. For private modules this is the same as the `:organization\_name` parameter. | | `:name` | The name of the module for which the configuration version is being created. | | `:provider` | The name of the provider for which the configuration version is being created. | ### Sample Request ```shell curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request POST \ https://app.terraform.io/api/v2/organizations/my-organization/tests/registry-modules/private/my-organization/registry-name/registry-provider/test-runs/configuration-versions ``` ### Sample Response ```json { "data": { "id": "cv-aaady7niJMY1wAvx", "type": "configuration-versions", "attributes": { "auto-queue-runs": true, "error": null, "error-message": null, "source": "tfe-api", "speculative": false, "status": "pending", "status-timestamps": {}, "changed-files": [], "provisional": false, "upload-url": "https://archivist.terraform.io/v1/object/dmF1bHQ6djM6eFliQ0l1ZEhNUDRMZmdWeExoYWZ1WnFwaCtYQUFSQjFaWVcySkEyT0tyZTZXQ0hjN3ZYQkFvbkJHWkg2Y0U2MDRHRXFvQVl6cUJqQzJ0VkppVHBXTlJNWmpVc1ZTekg5Q1hMZ0hNaUpNdUhib1hGS1RpT3czRGdRaWtPZFZ3VWpDQ1U0S2dhK2xLTUQ2ZFZDaUZ3SktiNytrMlpoVHd0cXdGVHIway8zRkFmejdzMSt0Rm9TNFBTV3dWYjZUTzJVNE1jaW9UZ2VKVFJNRnUvbjBudUp4U0l6VzFDYkNzVVFsb2VFbC9DRFlCTWFsbXBMNzZLUGQxeTJHb09ZTkxHL1d2K1NtcmlEQXptZTh1Q1BwR1dhbVBXQTRiREdlTkI3Qyt1YTRRamFkRzBWYUg3NE52TGpqT1NKbzFrZ3J3QmxnMGhHT3VaTHNhSmo0eXpv" }, "relationships": { | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/private-registry/tests.mdx | main | terraform | [
0.012591413222253323,
0.053044553846120834,
-0.027871351689100266,
0.025625040754675865,
-0.05495351925492287,
-0.021421533077955246,
-0.025752851739525795,
-0.05323559418320656,
0.03412947431206703,
0.04965856298804283,
0.01567383110523224,
-0.06081417202949524,
0.05095944553613663,
0.050... | -0.006433 |
--header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request POST \ https://app.terraform.io/api/v2/organizations/my-organization/tests/registry-modules/private/my-organization/registry-name/registry-provider/test-runs/configuration-versions ``` ### Sample Response ```json { "data": { "id": "cv-aaady7niJMY1wAvx", "type": "configuration-versions", "attributes": { "auto-queue-runs": true, "error": null, "error-message": null, "source": "tfe-api", "speculative": false, "status": "pending", "status-timestamps": {}, "changed-files": [], "provisional": false, "upload-url": "https://archivist.terraform.io/v1/object/dmF1bHQ6djM6eFliQ0l1ZEhNUDRMZmdWeExoYWZ1WnFwaCtYQUFSQjFaWVcySkEyT0tyZTZXQ0hjN3ZYQkFvbkJHWkg2Y0U2MDRHRXFvQVl6cUJqQzJ0VkppVHBXTlJNWmpVc1ZTekg5Q1hMZ0hNaUpNdUhib1hGS1RpT3czRGdRaWtPZFZ3VWpDQ1U0S2dhK2xLTUQ2ZFZDaUZ3SktiNytrMlpoVHd0cXdGVHIway8zRkFmejdzMSt0Rm9TNFBTV3dWYjZUTzJVNE1jaW9UZ2VKVFJNRnUvbjBudUp4U0l6VzFDYkNzVVFsb2VFbC9DRFlCTWFsbXBMNzZLUGQxeTJHb09ZTkxHL1d2K1NtcmlEQXptZTh1Q1BwR1dhbVBXQTRiREdlTkI3Qyt1YTRRamFkRzBWYUg3NE52TGpqT1NKbzFrZ3J3QmxnMGhHT3VaTHNhSmo0eXpv" }, "relationships": { "ingress-attributes": { "data": null, "links": { "related": "/api/v2/configuration-versions/cv-aaady7niJMY1wAvx/ingress-attributes" } } }, "links": { "self": "/api/v2/configuration-versions/cv-aaady7niJMY1wAvx" } } } ``` ## Upload Configuration Files for a Test `PUT https://archivist.terraform.io/v1/object/` \*\*The URL is provided in the `upload-url` attribute when creating a `configuration-versions` resource. After creation, the URL is hidden on the resource and no longer available.\*\* ### Sample Request \*\*@filename is the name of the configuration file you wish to upload.\*\* ```shell curl \ --header "Content-Type: application/octet-stream" \ --request PUT \ --data-binary @filename \ https://archivist.terraform.io/v1/object/4c44d964-eba7-4dd5-ad29-1ece7b99e8da ``` ## List Tests for a Module `GET /organizations/:organization\_name/tests/registry-modules/private/:namespace/:name/:provider/test-runs/` | Parameter | Description | | -------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `:organization\_name` | The name of the organization for the module. The organization must already exist, and the token authenticating the API request must belong to the "owners" team or a member of the "owners" team. | | `:namespace` | The namespace of the module which the tests have executed against. For private modules this is the same as the `:organization\_name` parameter. | | `:name` | The name of the module which the tests have executed against. | | `:provider` | The name of the provider which the tests have executed against. | ### Query Parameters This endpoint supports pagination [with standard URL query parameters](/terraform/cloud-docs/api-docs#query-parameters); remember to percent-encode `[` as `%5B` and `]` as `%5D` if your tooling does not automatically encode URLs. | Parameter | Description | Required | | --- | --- | --- | | `page[number]` | If omitted, the endpoint returns the first page. | Optional | | `page[size]` | If omitted, the endpoint returns 20 runs per page. | Optional | | `filter[source]` | \*\*Optional.\*\* A comma-separated list of test sources; the result will only include tests that came from one of these sources. Options are listed in [Test Sources](/terraform/cloud-docs/api-docs/private-registry/tests#test-sources). | ### Sample Request ```shell curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ https://app.terraform.io/api/v2/organizations/my-organization/tests/registry-modules/private/my-organization/registry-name/registry-provider/test-runs ``` ### Sample Response ```json { "data": [ { "id": "trun-KFg8DSiRz4E37mdJ", "type": "test-runs", "attributes": { "status": "finished", "status-timestamps": { "queued-at": "2023-10-03T18:27:39+00:00", "started-at": "2023-10-03T18:27:41+00:00", "finished-at": "2023-10-03T18:27:53+00:00" }, "log-read-url": "https://archivist.terraform.io/v1/object/dmF1bHQ6djM6eFliQ0l1ZEhNUDRMZmdWeExoYWZ1WnFwaCtYQUFSQjFaWVcySkEyT0tyZTZXQ0hjN3ZYQkFvbkJHWkg2Y0U2MDRHRXFvQVl6cUJqQzJ0VkppVHBXTlJNWmpVc1ZTekg5Q1hMZ0hNaUpNdUhib1hGS1RpT3czRGdRaWtPZFZ3VWpDQ1U0S2dhK2xLTUQ2ZFZDaUZ3SktiNytrMlpoVHd0cXdGVHIway8zRkFmejdzMSt0Rm9TNFBTV3dWYjZUTzJVNE1jaW9UZ2VKVFJNRnUvbjBudUp4U0l6VzFDYkNzVVFsb2VFbC9DRFlCTWFsbXBMNzZLUGQxeTJHb09ZTkxHL1d2K1NtcmlEQXptZTh1Q1BwR1dhbVBXQTRiREdlTkI3Qyt1YTRRamFkRzBWYUg3NE52TGpqT1NKbzFrZ3J3QmxnMGhHT3VaTHNhSmo0eXpv", "created-at": "2023-10-03T18:27:39.239Z", "updated-at": "2023-10-03T18:27:53.574Z", "test-configurable-type": "RegistryModule", "test-configurable-id": "mod-9rjVHLCUE9QD3k6L", "variables": [ { "key": "number", "value": "4" } ], "filters": [ "tests/test.tftest.hcl" ], "test-directory": "tests", "verbose": true, "test-status": "pass", "tests-passed": 1, "tests-failed": 0, "tests-errored": 0, "tests-skipped": 0, "source": "tfe-api", "message": "Queued manually via the Terraform Enterprise API" }, "relationships": { "configuration-version": { "data": { "id": "cv-d3zBGFf5DfWY4GY9", "type": "configuration-versions" }, "links": { "related": "/api/v2/configuration-versions/cv-d3zBGFf5DfWY4GY9" } }, "created-by": { "data": { "id": "user-zsRFs3AGaAHzbEfs", "type": "users" }, "links": { "related": "/api/v2/users/user-zsRFs3AGaAHzbEfs" } } } }, {...} ] } ``` ## Get Test Details `GET /organizations/:organization\_name/tests/registry-modules/private/:namespace/:name/:provider/test-runs/:test\_run\_id` | Parameter | Description | | -------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `:organization\_name` | The name of the organization for the module. The organization must already exist, and the token authenticating the API request must belong to the "owners" team or a member of the "owners" team. | | `:namespace` | The namespace of the module which the test was executed against. For private modules this is the same as the `:organization\_name` parameter. | | `:name` | The name of the module which the test was executed against. | | `:provider` | The name of the provider which the test was executed against. | | `:test\_run\_id` | The test ID to get. | ### Sample Request ```shell curl \ | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/private-registry/tests.mdx | main | terraform | [
-0.0722401961684227,
0.06683891266584396,
-0.019378570839762688,
0.027258332818746567,
-0.01949192024767399,
-0.04750040918588638,
-0.038419678807258606,
-0.03096557967364788,
0.0313195139169693,
0.11986584216356277,
0.009137262590229511,
-0.1160607561469078,
0.014456087723374367,
0.055653... | 0.057598 |
as the `:organization\_name` parameter. | | `:name` | The name of the module which the test was executed against. | | `:provider` | The name of the provider which the test was executed against. | | `:test\_run\_id` | The test ID to get. | ### Sample Request ```shell curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ https://app.terraform.io/api/v2/organizations/my-organization/tests/registry-modules/private/my-organization/registry-name/registry-provider/test-runs/trun-xFMAHM3FhkFBL6Z7 ``` ### Sample Response ```json { "data": { "id": "trun-KFg8DSiRz4E37mdJ", "type": "test-runs", "attributes": { "status": "finished", "status-timestamps": { "queued-at": "2023-10-03T18:27:39+00:00", "started-at": "2023-10-03T18:27:41+00:00", "finished-at": "2023-10-03T18:27:53+00:00" }, "log-read-url": "https://archivist.terraform.io/v1/object/dmF1bHQ6djM6eFliQ0l1ZEhNUDRMZmdWeExoYWZ1WnFwaCtYQUFSQjFaWVcySkEyT0tyZTZXQ0hjN3ZYQkFvbkJHWkg2Y0U2MDRHRXFvQVl6cUJqQzJ0VkppVHBXTlJNWmpVc1ZTekg5Q1hMZ0hNaUpNdUhib1hGS1RpT3czRGdRaWtPZFZ3VWpDQ1U0S2dhK2xLTUQ2ZFZDaUZ3SktiNytrMlpoVHd0cXdGVHIway8zRkFmejdzMSt0Rm9TNFBTV3dWYjZUTzJVNE1jaW9UZ2VKVFJNRnUvbjBudUp4U0l6VzFDYkNzVVFsb2VFbC9DRFlCTWFsbXBMNzZLUGQxeTJHb09ZTkxHL1d2K1NtcmlEQXptZTh1Q1BwR1dhbVBXQTRiREdlTkI3Qyt1YTRRamFkRzBWYUg3NE52TGpqT1NKbzFrZ3J3QmxnMGhHT3VaTHNhSmo0eXpv", "created-at": "2023-10-03T18:27:39.239Z", "updated-at": "2023-10-03T18:27:53.574Z", "test-configurable-type": "RegistryModule", "test-configurable-id": "mod-9rjVHLCUE9QD3k6L", "variables": [ { "key": "number", "value": "4" } ], "filters": [ "tests/test.tftest.hcl" ], "test-directory": "tests", "verbose": true, "test-status": "pass", "tests-passed": 1, "tests-failed": 0, "tests-errored": 0, "tests-skipped": 0, "source": "tfe-api", "message": "Queued manually via the Terraform Enterprise API" }, "relationships": { "configuration-version": { "data": { "id": "cv-d3zBGFf5DfWY4GY9", "type": "configuration-versions" }, "links": { "related": "/api/v2/configuration-versions/cv-d3zBGFf5DfWY4GY9" } }, "created-by": { "data": { "id": "user-zsRFs3AGaAHzbEfs", "type": "users" }, "links": { "related": "/api/v2/users/user-zsRFs3AGaAHzbEfs" } } } } } ``` ## Cancel a Test `POST /organizations/:organization\_name/tests/registry-modules/private/:namespace/:name/:provider/test-runs/:test\_run\_id/cancel` | Parameter | Description | | -------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `:organization\_name` | The name of the organization to create a test in. The organization must already exist, and the token authenticating the API request must belong to the "owners" team or a member of the "owners" team. | | `:namespace` | The namespace of the module for which the test is being canceled. For private modules this is the same as the `:organization\_name` parameter. | | `:name` | The name of the module for which the test is being canceled. | | `:provider` | The name of the provider for which the test is being canceled. | | `:test\_run\_id` | The test ID to cancel. | Use the `cancel` action to interrupt a test that is currently running. The action sends an `INT` signal to the running Terraform process, which instructs Terraform to safely end the tests and attempt to teardown any infrastructure that your tests create. | Status | Response | Reason(s) | | ------- | ------------------------- | ------------------------------------------ | | [202][] | none | Successfully queued a cancel request. | | [409][] | [JSON API error object][] | Test was not running; cancel not allowed. | | [404][] | [JSON API error object][] | Test was not found or user not authorized. | ### Sample Request ```shell curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request POST \ https://app.terraform.io/api/v2/organizations/my-organization/tests/registry-modules/private/my-organization/registry-name/registry-provider/test-runs/trun-xFMAHM3FhkFBL6Z7/cancel ``` ## Forcefully cancel a Test `POST /organizations/:organization\_name/tests/registry-modules/private/:namespace/:name/:provider/test-runs/:test\_run\_id/force-cancel` | Parameter | Description | | -------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `:organization\_name` | The name of the organization for the module. The organization must already exist, and the token authenticating the API request must belong to the `owners` team or a member of the `owners` team. | | `:namespace` | The namespace of the module for which the test is being force-canceled. For private modules this is the same as the `:organization\_name` parameter. | | `:name` | The name of the module for which the test is being force-canceled. | | `:provider` | The name of the provider for which the test is being force-canceled. | | `:test\_run\_id` | The test ID to cancel. The `force-cancel` action ends the test immediately. Once invoked, Terraform places the test into a `canceled` state and terminates the running Terraform process. ~> \*\*Warning:\*\* This endpoint has potentially dangerous side-effects, including loss of any in-flight state in the running Terraform process. Use this operation with extreme caution. | Status | Response | Reason(s) | | ------- | ------------------------- | -------------------------------------------------------------- | | [202][] | none | Successfully | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/private-registry/tests.mdx | main | terraform | [
-0.033429913222789764,
0.09602788090705872,
-0.044897280633449554,
0.0534590408205986,
-0.016162646934390068,
-0.060642778873443604,
-0.03749072551727295,
-0.036144815385341644,
0.03644502907991409,
0.07081373780965805,
0.02057075686752796,
-0.08832453936338425,
-0.00855475664138794,
0.028... | 0.046962 |
terminates the running Terraform process. ~> \*\*Warning:\*\* This endpoint has potentially dangerous side-effects, including loss of any in-flight state in the running Terraform process. Use this operation with extreme caution. | Status | Response | Reason(s) | | ------- | ------------------------- | -------------------------------------------------------------- | | [202][] | none | Successfully queued a cancel request. | | [409][] | [JSON API error object][] | Test was not running, or has not been canceled non-forcefully. | | [404][] | [JSON API error object][] | Test was not found or user not authorized. | ### Sample Request ```shell curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request POST \ https://app.terraform.io/api/v2/organizations/my-organization/tests/registry-modules/private/my-organization/registry-name/registry-provider/test-runs/trun-xFMAHM3FhkFBL6Z7/force-cancel ``` ## Create an Environment Variable for Module Tests `POST /organizations/:organization\_name/tests/registry-modules/private/:namespace/:name/:provider/vars` | Parameter | Description | | -------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `:organization\_name` | The name of the organization of the module. The organization must already exist, and the token authenticating the API request must belong to the "owners" team or a member of the "owners" team. | | `:namespace` | The namespace of the module for which the testing environment variable is being created. For private modules this is the same as the `:organization\_name` parameter. | | `:name` | The name of the module for which the testing environment variable is being created. | | `:provider` | The name of the provider for which the testing environment variable is being created. | ### Request Body This POST endpoint requires a JSON object with the following properties as a request payload. Properties without a default value are required. | Key path | Type | Default | Description | | ----------------------------- | ------ | ------- | ----------------------------------------------------------------------------------------------------- | | `data.type` | string | none | Must be `"vars"`. | | `data.attributes.key` | string | none | The variable's name. Test variable keys must begin with a letter or underscore and can only contain letters, numbers, and underscores. | | `data.attributes.value` | string | `""` | The value of the variable. | | `data.attributes.description` | string | none | The description of the variable. | | `data.attributes.category` | string | none | This must be `"env"`. | | `data.attributes.sensitive` | bool | `false` | Whether the value is sensitive. When set to `true`, Terraform writes the variable once and is not visible thereafter. | ### Sample Payload ```json { "data": { "type":"vars", "attributes": { "key":"some\_key", "value":"some\_value", "description":"some description", "category":"env", "sensitive":false } } } ``` ### Sample Request ```shell curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request POST \ --data @payload.json \ https://app.terraform.io/api/v2/organizations/my-organization/tests/registry-modules/private/my-organization/registry-name/registry-provider/vars ``` ### Sample Response ``` { "data": { "id": "var-xSCUzCxdqMs2ygcg", "type": "vars", "attributes": { "key": "keykey", "value": "some\_value", "sensitive": false, "category": "env", "hcl": false, "created-at": "2023-10-03T19:47:05.393Z", "description": "some description", "version-id": "699b14ea5d5e5c02f6352fac6bfd0a1424c21d32be14d1d9eb79f5e1f28f663a" }, "links": { "self": "/api/v2/vars/var-xSCUzCxdqMs2ygcg" } } } ``` ## List Test Variables for a Module `GET /organizations/:organization\_name/tests/registry-modules/private/:namespace/:name/:provider/vars` | Parameter | Description | | -------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `:organization\_name` | The name of the organization for the module. The organization must already exist, and the token authenticating the API request must belong to the `owners` team or a member of the `owners` team. | | `:namespace` | The namespace of the module which the test environment variables were created for. For private modules this is the same as the `:organization\_name` parameter. | | `:name` | The name of the module which the test environment variables were created for. | | `:provider` | The name of the provider which the test environment variables were created for. | ### Sample Request ```shell $ curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ https://app.terraform.io/api/v2/organizations/my-organization/tests/registry-modules/private/my-organization/registry-name/registry-provider/vars ``` | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/private-registry/tests.mdx | main | terraform | [
-0.06001880392432213,
0.09657802432775497,
0.018367402255535126,
-0.011117789894342422,
0.007878310978412628,
-0.08372847735881805,
-0.04435012489557266,
-0.08235783129930496,
0.05693595111370087,
0.09600526094436646,
-0.013695581816136837,
-0.0259874165058136,
0.009134471416473389,
-0.024... | 0.066114 |
| The name of the module which the test environment variables were created for. | | `:provider` | The name of the provider which the test environment variables were created for. | ### Sample Request ```shell $ curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ https://app.terraform.io/api/v2/organizations/my-organization/tests/registry-modules/private/my-organization/registry-name/registry-provider/vars ``` ### Sample Response ```json { "data": [ { "id": "var-xSCUzCxdqMs2ygcg", "type": "vars", "attributes": { "key": "keykey", "value": "some\_value", "sensitive": false, "category": "env", "hcl": false, "created-at": "2023-10-03T19:47:05.393Z", "description": "some description", "version-id": "699b14ea5d5e5c02f6352fac6bfd0a1424c21d32be14d1d9eb79f5e1f28f663a" }, "links": { "self": "/api/v2/vars/var-xSCUzCxdqMs2ygcg" } } ] } ``` ## Update Test Variables for a Module `PATCH /organizations/:organization\_name/tests/registry-modules/private/:namespace/:name/:provider/vars/variable\_id` | Parameter | Description | | -------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `:organization\_name` | The name of the organization for the module. The organization must already exist, and the token authenticating the API request must belong to the "owners" team or a member of the "owners" team. | | `:namespace` | The namespace of the module for which the test environment variable is being updated. For private modules this is the same as the `:organization\_name` parameter. | | `:name` | The name of the module for which the test environment variable is being updated. | | `:provider` | The name of the provider for which the test environment variable is being updated. | | `:variable\_id` | The ID of the variable to update. | ### Request Body This PATCH endpoint requires a JSON object with the following properties as a request payload. Properties without a default value are required. | Key path | Type | Default | Description | | ----------------- | ------ | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `data.type` | string | | Must be `"vars"`. | | `data.attributes` | object | none | New attributes for the variable. This object can include `key`, `value`, `description`, `category`, and `sensitive` properties. Refer to [Create an Environment Variable for Module Tests](#create-an-environment-variable-for-module-tests) for additional information. All properties are optional. | ### Sample Payload ```json { "data": { "attributes": { "key":"name", "value":"mars", "description": "new description", "category":"env", "sensitive": false }, "type":"vars" } } ``` ### Sample Request ```bash $ curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request PATCH \ --data @payload.json \ https://app.terraform.io/api/v2/organizations/my-organization/tests/registry-modules/private/my-organization/registry-name/registry-provider/vars/var-yRmifb4PJj7cLkMG ``` ### Sample Response ```json { "data": { "id":"var-yRmifb4PJj7cLkMG", "type":"vars", "attributes": { "key":"name", "value":"mars", "description":"new description", "sensitive":false, "category":"env", "hcl":false } } } ``` ## Delete Test Variable for a Module `DELETE /organizations/:organization\_name/tests/registry-modules/private/:namespace/:name/:provider/vars/variable\_id` | Parameter | Description | | -------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `:organization\_name` | The name of the organization for the module. The organization must already exist, and the token authenticating the API request must belong to the `owners` team or a member of the `owners` team. | | `:namespace` | The namespace of the module for which the test environment variable is being deleted. For private modules this is the same as the `:organization\_name` parameter. | | `:name` | The name of the module for which the test environment variable is being deleted. | | `:provider` | The name of the provider for which the test environment variable is being deleted. | | `:variable\_id` | The ID of the variable to delete. | ### Sample Request ```bash $ curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request DELETE \ https://app.terraform.io/api/v2/organizations/my-organization/tests/registry-modules/private/my-organization/registry-name/registry-provider/vars/var-yRmifb4PJj7cLkMG ``` | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/private-registry/tests.mdx | main | terraform | [
-0.01058156881481409,
0.05324297770857811,
-0.016001034528017044,
0.0411204919219017,
-0.014444367028772831,
-0.03877606987953186,
-0.020032422617077827,
-0.021756725385785103,
0.02859107404947281,
0.06632467359304428,
0.0186880175024271,
-0.1134919747710228,
0.03340936824679375,
0.0417765... | -0.010917 |
[200]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/200 [201]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/201 [202]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/202 [204]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/204 [400]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/400 [401]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/401 [403]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/403 [404]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/404 [409]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/409 [412]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/412 [422]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/422 [429]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429 [500]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500 [503]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503 [JSON API document]: /terraform/cloud-docs/api-docs#json-api-documents [JSON API error object]: https://jsonapi.org/format/#error-objects # Manage module versions API reference Use the module version management API endpoints to deprecate, revoke, and revert of status of module versions in your organization’s private registry. @include "tfc-package-callouts/manage-module-versions.mdx" ## Overview As part of the module lifecycle, you can deprecate or revoke older module versions as you stop supporting them, signaling to module consumers that they need to upgrade to newer versions. When you deprecate a module version, HCP Terraform adds warnings to the module's registry page and to run outputs when anyone uses the deprecated version. After deprecating a module version, you can revert that deprecated status to remove the warnings from that version in the registry and outputs. Revoking a module version adds warnings to the module's registry page, warnings in the run outputs of existing users, and blocks new users from using that version. Reverting a module version’s revocation sets the module version back to a deprecated state. For more details on deprecating or revoking module versions, refer to [Manage module versions](/terraform/cloud-docs/registry/manage-module-versions). ## Deprecate a module version Use this endpoint to deprecate a module version. `PATCH /api/v2/organizations/:organization\_name/registry-modules/private/:organization\_name/:module\_name/:module\_provider/:module\_version` | Parameter | Description | | :---- | :---- | | `:organization\_name` | The name of the organization the module belongs to. | | `:module\_name` | The name of the module whose version you want to deprecate. | | `:module\_provider` | Specifies the Terraform provider that this module uses. | | `:module\_version` | The module version you want to deprecate. | This endpoint allows you to deprecate a specific module version. Deprecating a module version adds warnings to the run output of any consumers using this module. | Status | Response | Reason | | :---- | :---- | :---- | | [200](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/200) | [JSON API document](/terraform/cloud-docs/api-docs#json-api-documents) | Successfully deprecated a module version. | | [404](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/404) | [JSON API error object](http://jsonapi.org/format/#error-objects) | This organization is not authorized to deprecate this module version, or the module version does not exist. | | [422](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/422) | [JSON API error object](http://jsonapi.org/format/#error-objects) | Malformed request body, for example the request is missing attributes or uses the wrong types. | | [500](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) or [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) | [JSON API error object](http://jsonapi.org/format/#error-objects) | Failure occurred while deprecating a module version. | ### Sample payload ```json { "data": { "type": "module-versions", "attributes": { "deprecation": { "deprecated-status": "Deprecated", "reason": "Deprecated due to a security vulnerability issue.", "link": "https://www.hashicorp.com/" } } } } ``` ### Sample request ```shell curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request PATCH \ --data @payload.json \ https://app.terraform.io/api/v2/organizations/hashicorp/registry-modules/private/hashicorp/lb-http/google/11.0.0 ``` ### Sample response ```json { "data": { "type": "module-versions", "id": "1", "relationships": { "deprecation": { "data": { "id": "2", "type": "deprecations" } } } }, "included": [ { "type": "deprecations", "id": "2", "attributes": { "link": "https://www.hashicorp.com/", "reason": "Deprecated due to a security vulnerability issue. Applies will be blocked in 15 days." } } ] } ``` ## Revert the deprecation status for a module version Use this endpoint to revert the deprecation of a module version. `PATCH /api/v2/organizations/:organization\_name/registry-modules/private/:organization\_name/:module\_name/:module\_provider/:module\_version` | Parameter | Description | | :---- | :---- | | `:organization\_name` | The name of the organization the module belongs to. | | `:module\_name` | The name of the module you want to revert the deprecation of. | | `:module\_provider` | Specifies the Terraform provider that this module uses. | | `:module\_version` | The module version you want to revert the deprecation of. | Deprecating a module version | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/private-registry/manage-module-versions.mdx | main | terraform | [
-0.015784088522195816,
-0.01700746826827526,
-0.018668580800294876,
-0.028096551075577736,
-0.024631375446915627,
-0.08318780362606049,
-0.0621652752161026,
-0.07521579414606094,
-0.005580500699579716,
-0.03855427727103233,
0.03281282261013985,
0.0540321059525013,
0.006812138482928276,
-0.... | 0.052879 |
module belongs to. | | `:module\_name` | The name of the module you want to revert the deprecation of. | | `:module\_provider` | Specifies the Terraform provider that this module uses. | | `:module\_version` | The module version you want to revert the deprecation of. | Deprecating a module version adds warnings to the run output of any consumers using this module. Reverting the deprecation status removes warnings from the output of consumers and fully reinstates the module version. | Status | Response | Reason | | :---- | :---- | :---- | | [200](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/200) | [JSON API document](/terraform/cloud-docs/api-docs#json-api-documents) | Successfully reverted a module version’s deprecation status and reinstated that version. | | [404](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/404) | [JSON API error object](http://jsonapi.org/format/#error-objects) | This organization is not authorized to revert the depreciation of this module version, or the module version does not exist. | | [422](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/422) | [JSON API error object](http://jsonapi.org/format/#error-objects) | Malformed request body, for example the request is missing attributes or uses the wrong types. | | [500](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) or [503] | [JSON API error object](http://jsonapi.org/format/#error-objects) | Failure occurred while reverting the deprecation of a module version. | ### Sample request ```shell curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request PATCH \ --data @payload.json \ https://app.terraform.io/api/v2/organizations/hashicorp/registry-modules/private/hashicorp/lb-http/google/11.0.0 ``` ### Sample payload ```json { "data": { "type": "module-versions", "attributes": { "deprecation": { "deprecated-status": "Undeprecated" } } } } ``` ### Sample response ```json { "data": { "type": "module-versions", "id": "1" } } ``` ## Fetch a module version’s deprecation data Send a `GET` request to the `/modules/:github-organization/:module/:provider/versions` endpoint to retrieve data about private registry modules, including the module's deprecation status. Refer to the [private registry module API example](/terraform/cloud-docs/api-docs/private-registry/modules#sample-registry-request-private-module) for additional information. For example, if you want to know the deprecation status of v0.0.1 of the `aws` provider’s `consul` module in your `my-cloud-org` organization, you could perform the following API call: ```shell curl \ --header "Authorization: Bearer $TOKEN" \ https://app.terraform.io/api/registry/v1/modules/my-cloud-org/consul/aws/0.0.1 ``` If the module is deprecated, your response includes a `deprecation` key with the details of that module version’s deprecation. ```json { "id": "hashicorp/consul/aws/0.0.1", "owner": "gruntwork-team", "namespace": "hashicorp", "name": "consul", "version": "0.0.1", "provider": "aws", "description": "A Terraform Module for how to run Consul on AWS using Terraform and Packer" // ... // "deprecation": { "reason": "This version was deprecated due to a vulnerability issue. Please upgrade to 0.0.2.", "link": "https://hashicorp.com" } } ``` To check the deprecation status of all of the `consul` module’s versions, you could perform the following API call: ```shell curl \ --header "Authorization: Bearer $TOKEN" \ https://app.terraform.io/api/registry/v1/modules/my-cloud-org/consul/aws/versions ``` The response includes multiple versions, and each version has a `deprecation` key listing the details of that module’s deprecation. If a module version has not been deprecated, the `deprecation` field returns `null`. ```json { "modules": [ { "source": "hashicorp/consul/aws", "versions": [ { "version": "0.0.1", // ... // "deprecation": { "reason": "security vulnerability", "link": "www.hashicorp.com" } }, { "version": "0.0.2", "submodules": [], "root": { "dependencies": [], "providers": [ { "name": "template", "version": "" }, { "name": "aws", "version": "" } ] }, "deprecation": null } ] } ] } ``` ## Revoke a module version Use this endpoint to revoke a module version. You must [deprecate a module version](#deprecate-a-module-version) before you can revoke it. `PATCH /api/v2/organizations/:organization\_name/registry-modules/private/:organization\_name/:module\_name/:module\_provider/:module\_version` | Parameter | Description | | :---- | :---- | | `:organization\_name` | The name of the organization the module belongs to. | | `:module\_name` | The name of the module whose version you want to revoke. | | `:module\_provider` | Specifies the Terraform provider that this module uses. | | `:module\_version` | The module version you want to revoke. | This endpoint allows | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/private-registry/manage-module-versions.mdx | main | terraform | [
-0.05346827208995819,
0.07232768833637238,
0.07533719390630722,
0.01362062431871891,
0.03913160786032677,
-0.024951014667749405,
-0.0684056505560875,
-0.060798853635787964,
0.021696168929338455,
0.05073844641447067,
0.020082658156752586,
0.03135380148887634,
0.02756020426750183,
-0.0098578... | 0.00873 |
name of the organization the module belongs to. | | `:module\_name` | The name of the module whose version you want to revoke. | | `:module\_provider` | Specifies the Terraform provider that this module uses. | | `:module\_version` | The module version you want to revoke. | This endpoint allows you to revoke a specific module version. Revoking a module version adds warnings to the run output of current consumers of this version and blocks new users from trying to use that version. | Status | Response | Reason | | :---- | :---- | :---- | | [200](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/200) | [JSON API document](/terraform/cloud-docs/api-docs#json-api-documents) | Successfully revoked a module version. | | [404](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/404) | [JSON API error object](http://jsonapi.org/format/#error-objects) | This organization is not authorized to revoke this module version, or the module version does not exist. | | [422](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/422) | [JSON API error object](http://jsonapi.org/format/#error-objects) | Malformed request body, for example the request is missing attributes or uses the wrong types. | | [500](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) or [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) | [JSON API error object](http://jsonapi.org/format/#error-objects) | Failure occurred while revoking a module version. | ### Sample Payload ```json { "data": { "type": "module-versions", "attributes": { "revocation": { "status": "Revoked", "message": "Revoked due to a security vulnerability issue.", "link": "https://www.hashicorp.com/" } } } } ``` ### Sample Request ```shell-session curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request PATCH \ --data @payload.json \ https://app.terraform.io/api/v2/organizations/hashicorp/registry-modules/private/hashicorp/lb-http/google/11.0.0 ``` ### Sample Response ```json { "data": { "id": "modver-uKQCVs5vAKDmUMyw", "type": "registry-module-versions", "attributes": { "source": "tfe-api", "status": "ok", "version": "11.0.0", "commit-sha": null, "branch": null, "created-at": "2024-08-28T20:48:05.206Z", "updated-at": "2024-08-28T20:48:09.175Z", "revocation": { "status": "Revoked", "message": "Revoked due to a security vulnerability issue.", "link": "https://www.hashicorp.com/" } }, "relationships": { "registry-module": { "data": { "id": "mod-yDKMcmJYx9oFrGao", "type": "registry-modules" } } }, "links": { "upload": "https://app.terraform.io/\_archivist/v1/object/dmF1bHQ6djE6eElWekF3RH" } } } ``` ## Revert the revocation status for a module version Use this endpoint to revert the revocation of a module version. `PATCH /api/v2/organizations/:organization\_name/registry-modules/private/:organization\_name/:module\_name/:module\_provider/:module\_version` | Parameter | Description | | :---- | :---- | | `:organization\_name` | The name of the organization the module belongs to. | | `:module\_name` | The name of the module you want to revert the revocation of. | | `:module\_provider` | Specifies the Terraform provider that this module uses. | | `:module\_version` | The module version you want to revert the revocation of. | When you revert the revocation of a module version, HCP Terraform sets that version as deprecated, signaling that it is still maintained and supported but not recommended. Deprecated module versions produce warnings in the registry and run outputs, but new users can still use them. | Status | Response | Reason | | :---- | :---- | :---- | | [200](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/200) | [JSON API document](/terraform/cloud-docs/api-docs#json-api-documents) | Successfully reverted a module version’s revocation status and deprecated that version. | | [404](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/404) | [JSON API error object](http://jsonapi.org/format/#error-objects) | This organization is not authorized to revert the revocation of this module version, or the module version does not exist. | | [422](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/422) | [JSON API error object](http://jsonapi.org/format/#error-objects) | Malformed request body, for example the request is missing attributes or uses the wrong types. | | [500](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) or [503] | [JSON API error object](http://jsonapi.org/format/#error-objects) | Failure occurred while reverting the revocation of a module version. | ### Sample Request ```shell curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request PATCH \ --data @payload.json \ https://app.terraform.io/api/v2/organizations/hashicorp/registry-modules/private/hashicorp/lb-http/google/11.0.0 ``` ### Sample payload ```json { "data": { "type": "module-versions", "attributes": { "revocation": { "status": "Unrevoked" } } } } ``` ### Sample Response ```json { "data": { "id": "modver-uKQCVs5vAKDmUMyw", "type": "registry-module-versions", "attributes": { "source": "tfe-api", "status": "ok", "version": "11.0.0", "commit-sha": null, "branch": null, | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/private-registry/manage-module-versions.mdx | main | terraform | [
-0.047362320125103,
0.10671645402908325,
0.0652599036693573,
0.007128585129976273,
0.027496155351400375,
-0.03676353767514229,
-0.03113819845020771,
-0.09923709183931351,
0.06055837497115135,
0.05155932158231735,
0.008171744644641876,
0.042422305792570114,
0.0429125539958477,
0.00849906541... | 0.03245 |
PATCH \ --data @payload.json \ https://app.terraform.io/api/v2/organizations/hashicorp/registry-modules/private/hashicorp/lb-http/google/11.0.0 ``` ### Sample payload ```json { "data": { "type": "module-versions", "attributes": { "revocation": { "status": "Unrevoked" } } } } ``` ### Sample Response ```json { "data": { "id": "modver-uKQCVs5vAKDmUMyw", "type": "registry-module-versions", "attributes": { "source": "tfe-api", "status": "ok", "version": "11.0.0", "commit-sha": null, "branch": null, "created-at": "2024-08-28T20:48:05.206Z", "updated-at": "2024-08-28T20:48:09.175Z", "revocation": { "status": "Unrevoked", } }, "relationships": { "registry-module": { "data": { "id": "mod-yDKMcmJYx9oFrGao", "type": "registry-modules" } } }, "links": { "upload": "https://app.terraform.io/\_archivist/v1/object/dmF1bHQ6djE6eElWekF3RH" } } } ``` ## Fetch data about a module version’s revocation Send a `GET` request to the `/organizations/:organization\_name/registry-modules/:registry\_name/:namespace/:name/:provider` endpoint to retrieve data about private registry modules, including the module's revocation status. Refer to the [private registry module API example](/terraform/cloud-docs/api-docs/private-registry/modules#get-a-module) for additional information. For example, if you want to know the revocation status of v0.0.1 of the `aws` provider’s `consul` module in your `my-cloud-org` organization, you could perform the following API call: ```shell-session curl \ --header "Authorization: Bearer $TOKEN" \ https://app.terraform.io/api/v2/organizations/my-cloud-org/registry-modules/private/my-cloud-org/consul/aws/version?module\_version=1.0.0 ``` If the module is revoked, your response includes a `revocation` key with the details of that module version’s revocation. ```json { "data": { "id": "modver-3tKAXyRnpGYCxW7d", "type": "registry-module-versions", "attributes": { "source": "github", "status": "ok", "version": "1.0.0", "commit-sha": "ea18e73d8da502870fdcbfc54155046bc0cf2679", "branch": null, "created-at": "2024-10-11T19:53:35.082Z", "updated-at": "2024-10-11T19:53:38.782Z", "revocation": { "status": "revoked", "message": "please upgrade to version 1.0.1", "link": "https://github.com" } }, "relationships": { "registry-module": { "data": { "id": "mod-u8BFFruSTSz8dN4C", "type": "registry-modules" } } }, "links": { "upload": "https://archivist.terraform.io/v1/object/dmF1bHQ6djQ6V1pZWWwra1" } } } ``` To check the revocation status of all of the `consul` module’s versions, you could perform the following API call: ```shell-session curl \ --header "Authorization: Bearer $TOKEN" \ https://app.terraform.io/api/v2/organizations/my-cloud-org/registry-modules/private/my-cloud-org/consul/aws ``` The response includes the revoked versions of this module in the `revoked-versions` key. ```json { "data": { "id": "mod-u8BFFruSTSz8dN4C", "type": "registry-modules", "attributes": { "name": "module", "namespace": "my-cloud-org", // ... // "revoked-versions": [ "1.0.0" ], // ... // }, } ``` | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/private-registry/manage-module-versions.mdx | main | terraform | [
-0.03067539446055889,
0.05373343825340271,
0.051711149513721466,
-0.03967601805925369,
-0.028051238507032394,
-0.045564115047454834,
-0.06136876717209816,
-0.050966423004865646,
0.010376140475273132,
0.07758434116840363,
0.02499924972653389,
-0.09823063760995865,
-0.0063725607469677925,
-0... | 0.039047 |
[200]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/200 [201]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/201 [202]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/202 [204]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/204 [400]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/400 [401]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/401 [403]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/403 [404]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/404 [409]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/409 [412]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/412 [422]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/422 [429]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429 [500]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500 [504]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504 [JSON API document]: /terraform/cloud-docs/api-docs#json-api-documents [JSON API error object]: https://jsonapi.org/format/#error-objects # Stack component configurations API reference Publish a Stack component configuration to the HCP Terraform private registry to share Stacks across your organization. When you publish a component configuration, other teams can use it to create a Stack by defining a `stack` block in their own `.tfcomponent.hcl` file. Refer to [Publish a Stack](/terraform/cloud-docs/registry/publish-stack-configuration) to learn more publishing a Stack component configuration. To learn more about Stacks, refer to the [Stacks overview](/terraform/cloud-docs/stacks). ## Overview The following table lists all the endpoints for managing Stack component configurations in your organization's private registry: | Method | Path | Action | |--------|------|--------| | GET | `/organizations/:organization\_name/registry-components` | [List Stack component configurations](#list-stack-component-configurations-for-an-organization) for an organization. | | POST | `/organizations/:organization\_name/registry-components` | [Create a Stack component configuration](#create-a-stack-component-configuration), with or without VCS. | | POST | `/api/v2/registry-components/:component\_id/versions` | [Create a new version](#create-a-component-configuration-version) of a Stack component configuration. | | PUT | `https://archivist.terraform.io/v1/object/` | [Add a Stack component configuration version](#add-a-component-configuration-version). | | GET | `/api/v2/registry-components/:component\_id` | [Get details about a Stack component configuration](#get-a-stack-component-configuration). | | DELETE | `/api/v2/registry-components/:component\_id/versions/:version` | [Delete a specific version](#delete-a-component-configuration-version) of a Stack component configuration. | | DELETE | `/api/v2/registry-components/:component\_id` | [Delete an entire Stack component configuration](#delete-a-stack-component-configuration). | ## List Stack component configurations for an organization `GET /organizations/:organization\_name/registry-components` | Parameter | Description | | -------------------- | ----------------------------------------------------------------------------- | | `:organization\_name` | The name of the organization to list available component configurations from. | ### Query parameters This endpoint supports pagination [with standard URL query parameters](/terraform/cloud-docs/api-docs#query-parameters). Remember to percent-encode `[` as `%5B` and `]` as `%5D` if your tooling doesn't automatically encode URLs. | Parameter | Description | | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ | | `q` | \*\*Optional.\*\* A search query string. Component configurations are searchable by name and namespace fields. | | `page[number]` | \*\*Optional.\*\* If omitted, the endpoint will return the first page. | | `page[size]` | \*\*Optional.\*\* If omitted, the endpoint will return 20 component configurations per page. | ### Sample request The following example request lists Stack component configurations for the `my-organization` organization: ```shell curl \ --request GET \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ https://app.terraform.io/api/v2/organizations/my-organization/registry-components ``` ### Sample response The following response example lists Stack component configurations for the `my-organization` organization: ```json { "data": [ { "id": "comp-wed33EBTz4w8XeSS", "type": "registry-components", "attributes": { "name": "hashibank-app-security", "namespace": "my-organization", "description": "Stack component configuration for HashiBank application security", "status": "completed", "created-at": "2024-11-11T11:20:21Z", "updated-at": "2024-11-11T11:20:24Z", "latest-version": "1.0.0", "published-at": "2024-11-11T11:20:30.126135Z", "providers": [ { "name": "aws", "namespace": "hashicorp", "source": "hashicorp/aws" } ] }, "relationships": { "organization": { "data": { "id": "org-rT5Smhs7tBfjGnsZ", "type": "organizations" } } }, "links": { "self": "/api/v2/registry-components/comp-wed33EBTz4w8XeSS" } }, { "id": "comp-hGqAHmU28NE2hnjA", "type": "registry-components", "attributes": { "name": "eks-cluster", "namespace": "my-organization", "description": "Stack component configuration for EKS cluster setup", "status": "completed", "created-at": "2024-11-26T13:45:28Z", "updated-at": "2024-11-26T13:45:30Z", "latest-version": "1.0.5", "published-at": "2024-11-26T13:45:33.719842Z", "providers": [ { "name": "aws", "namespace": "hashicorp", "source": "hashicorp/aws" }, { "name": "random", "namespace": "hashicorp", "source": "hashicorp/random" } ] }, "relationships": { "organization": { "data": { "id": "org-rT5Smhs7tBfjGnsZ", "type": "organizations" } } }, "links": { "self": "/api/v2/registry-components/comp-hGqAHmU28NE2hnjA" } } ], "links": { "self": "https://app.terraform.io/api/v2/organizations/my-organization/registry-components?page%5Bnumber%5D=1&page%5Bsize%5D=20", "first": "https://app.terraform.io/api/v2/organizations/my-organization/registry-components?page%5Bnumber%5D=1&page%5Bsize%5D=20", "prev": null, "next": null, "last": "https://app.terraform.io/api/v2/organizations/my-organization/registry-components?page%5Bnumber%5D=1&page%5Bsize%5D=20" }, "meta": { "pagination": { "current-page": 1, "page-size": 20, "prev-page": null, "next-page": null, "total-pages": 1, "total-count": 2 } } } ``` ## Create a Stack component configuration `POST /organizations/:organization\_name/registry-components` | Parameter | Description | | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `:organization\_name` | The name of the organization to create a component configuration in. The organization must | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/private-registry/stack-component-configurations.mdx | main | terraform | [
-0.015784088522195816,
-0.01700746826827526,
-0.018668580800294876,
-0.028096551075577736,
-0.024631375446915627,
-0.08318780362606049,
-0.0621652752161026,
-0.07521579414606094,
-0.005580500699579716,
-0.03855427727103233,
0.03281282261013985,
0.0540321059525013,
0.006812138482928276,
-0.... | 0.052879 |
1, "page-size": 20, "prev-page": null, "next-page": null, "total-pages": 1, "total-count": 2 } } } ``` ## Create a Stack component configuration `POST /organizations/:organization\_name/registry-components` | Parameter | Description | | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `:organization\_name` | The name of the organization to create a component configuration in. The organization must already exist, and the token authenticating the API request must belong to a team member with [\*\*Manage Stack component configurations\*\*](/terraform/cloud-docs/users-teams-organizations/permissions/organization#manage-stack-component-configurations) permissions. | You can use this endpoint to publish a component configuration using the [API-only workflow](#api-only-workflow) or [VCS-backed workflow](#vcs-backed-workflow). | Status | Response | Reason | | ------- | ----------------------------------------------------------- | ------------------------------------------------------------ | | [201][] | [JSON API document][] (`type: "registry-components"`) | Successfully published component configuration | | [422][] | [JSON API error object][] | Malformed request body (missing attributes, wrong types, etc.) | | [404][] | [JSON API error object][] | Not found, or the user is unauthorized to perform this action. | ### VCS-backed workflow VCS-backed publishing sources a component configuration directly from a VCS repository. The publishing process fetches all SemVer version tags with the optional `v` prefix. For each version, HCP Terraform clones the tag and parses the configuration to create different versions of the component configuration. Each component configuration version details the required input and output variables, `README` documentation, providers, and other related information. #### Request body This `POST` endpoint requires a `JSON` object with the following properties as a request payload. Properties without a default value are required. | Key path | Type | Default | Description | | ------------------------------------------------- | ------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `data.type` | string | | Must be `"registry-components"`. | | `data.attributes.name` | string | (optional) | The name of this component configuration. If not specified, HCP Terraform uses the repository name. May contain alphanumeric characters, with dashes and underscores allowed in non-leading or trailing positions. Maximum length is 64 characters. | | `data.attributes.vcs-repo.identifier` | string | | The repository from which to ingress the configuration. | | `data.attributes.vcs-repo.oauth-token-id` | string | | The VCS connection (OAuth connection + token) to use. Get this ID from the [`oauth-tokens` endpoint](/terraform/cloud-docs/api-docs/oauth-tokens). You can not specify this value if `github-app-installation-id` is specified. | | `data.attributes.vcs-repo.github-app-installation-id` | string | | The GitHub App installation connection to use. Find this ID on the account settings page. Requires previously authorizing the GitHub App and generating a user-to-server token. Manage the token from \*\*Account Settings\*\* within HCP Terraform. You can not specify this value if `oauth-token-id` is specified. | | `data.attributes.vcs-repo.display\_identifier` | string | | The display identifier for the repository. For most VCS providers outside of Bitbucket Cloud, this identifier matches the `data.attributes.vcs-repo.identifier` string. | | `data.attributes.vcs-repo.source-directory` | string | (optional) | The directory in the repository where the component configuration is located. Useful for monorepo setups where multiple component configurations exist in different directories. | | `data.attributes.vcs-repo.tag-prefix` | string | (optional) | A prefix to filter tags for versioning. Only tags matching this prefix will be considered as versions. Useful for monorepo setups where multiple component configurations share the same repository but use different tag prefixes. | A VCS repository identifier, `data.attributes.vcs-repo.identifier`, is a reference to your VCS repository. Use the syntax `:org/:repo`, where `:org` and `:repo` refer to the organization and repository in your VCS provider. If you are using Bitbucket Data Center, use the syntax `:project\_key/:repo`. If you are using Azure DevOps, use the syntax `:org/:project/\_git/:repo`. The OAuth token ID identifies the VCS connection, and therefore the organization, that HCP Terraform creates the component configuration in. #### Sample payload The following example payload sources a VCS-backed component configuration from the | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/private-registry/stack-component-configurations.mdx | main | terraform | [
-0.02154497243463993,
-0.0002994627575390041,
-0.05327973887324333,
0.05290580913424492,
-0.1205032616853714,
0.05208608880639076,
-0.05607445165514946,
0.06207283213734627,
-0.009527812711894512,
0.020755618810653687,
0.05674978345632553,
-0.05014368146657944,
0.018124358728528023,
-0.063... | 0.038273 |
Data Center, use the syntax `:project\_key/:repo`. If you are using Azure DevOps, use the syntax `:org/:project/\_git/:repo`. The OAuth token ID identifies the VCS connection, and therefore the organization, that HCP Terraform creates the component configuration in. #### Sample payload The following example payload sources a VCS-backed component configuration from the `my-org` organization in the `terraform-component-eks-cluster` repository: ```json { "data": { "type": "registry-components", "attributes": { "vcs-repo": { "identifier": "my-org/terraform-component-eks-cluster", "oauth-token-id": "ot-hmAyP66qk2AMVdbJ", "display\_identifier": "my-org/terraform-component-eks-cluster", } } } } ``` The following example payload sources a VCS-backed component configuration from the `my-org` organization in the `hashibank-monorepo` repository with a source directory and tag prefix: ```json { "data": { "type": "registry-components", "attributes": { "name": "hashibank-app-security", "vcs-repo": { "identifier": "my-org/hashibank-monorepo", "github-app-installation-id": "ghain-abc123xyz456", "source-directory": "components/security", "tag-prefix": "security/" } } } } ``` #### Sample response The following example response body returns the VCS-backed component configuration's details: ```json { "data": { "id": "comp-UnpBkfLQJZUXARc6", "type": "registry-components", "attributes": { "name": "hashibank-app-security", "namespace": "my-organization", "status": "completed", "created-at": "2024-12-03T10:31:53Z", "updated-at": "2024-12-03T10:31:53Z", "version-statuses": [ { "version": "1.0.0", "status": "completed" } ], "vcs-repo": { "identifier": "my-org/hashibank-app-security", "display-identifier": "my-org/hashibank-app-security", "source-directory": null, "tag-prefix": null, "oauth-token-id": "ot-eNzYfKyB11MMTqEx" } }, "relationships": { "organization": { "data": { "id": "org-rT5Smhs7tBfjGnsZ", "type": "organizations" } }, "registry-component-versions": { "links": { "related": "/api/v2/registry-components/comp-UnpBkfLQJZUXARc6/versions" } } }, "links": { "self": "/api/v2/registry-components/comp-UnpBkfLQJZUXARc6" } } } ``` ### API-only workflow API-only publishing creates a component configuration without a backing VCS repository. After creating the component configuration, you must explicitly create and upload subsequent versions using the [Create a component configuration version endpoint](#create-a-component-configuration-version). #### Request body This `POST` endpoint requires a `JSON` object with the following properties as a request payload. Properties without a default value are required. | Key path | Type | Default | Description | | --------------------- | ------ | ------- | ---------------------------------------------------------------------------------------------------------------------------------- | | `data.type` | string | | Must be `"registry-components"`. | | `data.attributes.name`| string | | The name of this component configuration. May contain alphanumeric characters, with dashes and underscores allowed in non-leading or trailing positions. Maximum length is 64 characters. | #### Sample payload The following example payload creates an API-only component configuration named `eks-cluster`: ```json { "data": { "type": "registry-components", "attributes": { "name": "eks-cluster" } } } ``` #### Sample request The following example request creates an API-only component configuration in the `my-organization` organization: ```shell curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request POST \ --data @payload.json \ https://app.terraform.io/api/v2/organizations/my-organization/registry-components ``` #### Sample response The following example response body returns the API-only component configuration's details: ```json { "data": { "id": "comp-fZn7uHu99ZCpAKZJ", "type": "registry-components", "attributes": { "name": "eks-cluster", "namespace": "my-organization", "status": "pending", "created-at": "2024-01-15T19:36:56.288Z", "updated-at": "2024-01-15T19:36:56.288Z", "version-statuses": [] }, "relationships": { "organization": { "data": { "id": "org-rT5Smhs7tBfjGnsZ", "type": "organizations" } }, "registry-component-versions": { "links": { "related": "/api/v2/registry-components/comp-fZn7uHu99ZCpAKZJ/versions" } } }, "links": { "self": "/api/v2/registry-components/comp-fZn7uHu99ZCpAKZJ" } } } ``` ## Create a component configuration version `POST /api/v2/registry-components/:component\_id/versions` | Parameter | Description | | -------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `:component\_id` | The ID of the component configuration to create, such as `comp-UnpBkfLQJZUXARc6`. The token authenticating the API request must belong to a team member with [\*\*Manage Stack component configurations\*\*](/terraform/cloud-docs/users-teams-organizations/permissions/organization#manage-stack-component-configurations) permissions. | Creates a new version for component configurations that do not source from a VCS repository. VCS-backed component configurations automatically create new versions for new tags. After creating a version for an [API-published component configuration](#api-only-workflow), you can upload subsequent configurations to the link that HCP Terraform returns. | Status | Response | Reason | | ------- | --------------------------------------------------------------------- | -------------------------------------------------------------- | | [201][] | [JSON API document][] (`type: "registry-component-versions"`) | Successfully published component configuration version | | [422][] | [JSON API error object][] | Malformed request body (missing | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/private-registry/stack-component-configurations.mdx | main | terraform | [
-0.0014749841066077352,
-0.004111467860639095,
-0.029420722275972366,
0.013219393789768219,
-0.034395359456539154,
0.044599030166864395,
0.0031413757242262363,
-0.012683669105172157,
0.0517616793513298,
0.05805390700697899,
-0.02665874920785427,
-0.09336506575345993,
0.10063061863183975,
-... | 0.032335 |
subsequent configurations to the link that HCP Terraform returns. | Status | Response | Reason | | ------- | --------------------------------------------------------------------- | -------------------------------------------------------------- | | [201][] | [JSON API document][] (`type: "registry-component-versions"`) | Successfully published component configuration version | | [422][] | [JSON API error object][] | Malformed request body (missing attributes, wrong types, etc.) | | [404][] | [JSON API error object][] | Not found, or the user is unauthorized to perform this action. | ### Request body This `POST` endpoint requires a `JSON` object with the following properties as a request payload. Properties without a default value are required. | Key path | Type | Default | Description | | ------------------------------ | ------ | ------- | -------------------------------------------------------------------------------------------- | | `data.type` | string | | Must be `"registry-component-versions"`. | | `data.attributes.version` | string | | A valid SemVer version string. | ### Sample payload The following example payload creates a component configuration version for `1.2.3`: ```json { "data": { "type": "registry-component-versions", "attributes": { "version": "1.2.3" } } } ``` ### Sample request The following example request creates a new version for the `comp-UnpBkfLQJZUXARc6` component configuration: ```shell curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request POST \ --data @payload.json \ https://app.terraform.io/api/v2/registry-components/comp-UnpBkfLQJZUXARc6/versions ``` ### Sample response The following example response body returns the details of the new component configuration version: ```json { "data": { "id": "compver-Ecdq2uaNUXNHNHcA", "type": "registry-component-versions", "attributes": { "source": "api", "status": "pending", "version": "1.0.0", "readme": null, "description": null, "published-at": null, "error-message": null, "source-url": null }, "relationships": { "registry-component": { "links": { "related": "/api/v2/registry-components/comp-FRxdjivJqVVfi2SY" } }, "resources": { "links": { "related": "/api/v2/registry-components/comp-FRxdjivJqVVfi2SY/versions/1.0.0/resources" } }, "variables": { "links": { "related": "/api/v2/registry-components/comp-FRxdjivJqVVfi2SY/versions/1.0.0/variables" } }, "outputs": { "links": { "related": "/api/v2/registry-components/comp-FRxdjivJqVVfi2SY/versions/1.0.0/outputs" } }, "providers": { "links": { "related": "/api/v2/registry-components/comp-FRxdjivJqVVfi2SY/versions/1.0.0/providers" } }, "subcomponents": { "links": { "related": "/api/v2/registry-components/comp-FRxdjivJqVVfi2SY/versions/1.0.0/subcomponents" } } }, "links": { "self": "/api/v2/registry-components/compver-Ecdq2uaNUXNHNHcA/versions/1.0.0", "upload": "https://archivist.terraform.io/v1/object/dmF1bHQ6djE6Q1JjVWM5ZHBFRXZzdWZTKy80NUh3bDRMREd4QkxRaXZ0bXE3QXYzRHFMcFE0NVVhVmRmSE43K0dTUlp1aUsxQ253VmN6SFoyM1pLWU4vbGxsVW8wUkh4UzZ3S1ZmYXljRHhKM1gxR0RIdTJiSlNMbGYzYmo5ejVlUHZPQlArRUJHa1h3WUFLemhuOUhsS3pXZnRvbHppbVJYZEJCUjl6TlZLdEhqT29DdjY4U3RQRW51MkptTCsvUUlWK2xKNDhjK2NaT1JCbjNLYWtGZFh1UGtJL2V4YVFYbjVEVXdScEpJNzdrR2ZKSXgvNjd6UkVEZDBDZElBQnljK0Y2YnhVeUpUV1BvRWdkY0hPajhyWHdKNW1QTS93bnNHK0lSSUVoQ05OTGJaR09MMnRzeHl4ZzBST2VVaG9PQzV6YjR5WXprU0REMldPSUxTV0xRVlBRbldvaGtRVUFtUWU3QitrWERoOUUwaFczOG1rTG4xc21KZ240ZU40PQ" } } } ``` ## Add a component configuration version `PUT https://archivist.terraform.io/v1/object/` HCP Terraform provides a URL in the `upload` links attribute in the `registry-component-versions` resource. ### Expected archive format HCP Terraform expects the component configuration version uploaded to be a `gzip tarball` with the component configuration in the root directory. Given the following example folder structure: ```shell-session terraform-component-eks-cluster ├── README.md ├── examples │ └── default │ ├── README.md │ └── main.tf └── components.tfcomponent.hcl ``` Package the files in an archive format by running `tar zcvf component.tar.gz \*` in the component configuration's directory: ```shell-session $ cd terraform-component-eks-cluster terraform-component-eks-cluster $ tar zcvf component.tar.gz \* a README.md a examples a examples/default a examples/default/main.tf a examples/default/README.md a components.tfcomponent.hcl ``` ### Sample request The following example request uploads a component configuration version archive: ```shell curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/octet-stream" \ --request PUT \ --data-binary @component.tar.gz \ https://archivist.terraform.io/v1/object/dmF1bHQ6djE6NWJPbHQ4QjV4R1ox... ``` After the Stack component configuration version is successfully parsed, its status changes to `"completed"`. ## Get a Stack component configuration `GET /api/v2/registry-components/:component\_id` ### Parameters | Parameter | Description | | -------------------- | ----------------------------------------------------------------------------- | | `:component\_id` | The ID of the component configuration to retrieve, such as `comp-7GjfsTX1Yc5E1boD`. | | Status | Response | Reason | | ------- | ------------------------------------------------------- | -------------------------------------------------------------------------------------- | | [200][] | [JSON API document][] (`type: "registry-components"`) | The request was successful | | [404][] | [JSON API error object][] | Not found, or the user is unauthorized to perform this action. | ### Sample request The following example request gets details about a Stack component configuration: ```shell curl \ --request GET \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ https://app.terraform.io/api/v2/registry-components/comp-7GjfsTX1Yc5E1boD ``` ### Sample response for an API-published configuration The following example response body returns an API-published component configuration's | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/private-registry/stack-component-configurations.mdx | main | terraform | [
-0.06238982081413269,
0.06160818785429001,
0.03816867619752884,
-0.0038139887619763613,
0.0015690902946516871,
-0.02973945438861847,
-0.04591360688209534,
-0.057449664920568466,
-0.03300342336297035,
0.007177738938480616,
0.015424888581037521,
-0.0986514464020729,
0.041075997054576874,
0.0... | 0.010834 |
action. | ### Sample request The following example request gets details about a Stack component configuration: ```shell curl \ --request GET \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ https://app.terraform.io/api/v2/registry-components/comp-7GjfsTX1Yc5E1boD ``` ### Sample response for an API-published configuration The following example response body returns an API-published component configuration's details: ```json { "data": { "id": "comp-7GjfsTX1Yc5E1boD", "type": "registry-components", "attributes": { "name": "test-stacks-1764762762", "namespace": "hashicorp", "status": "completed", "created-at": "2025-12-03T11:52:43Z", "updated-at": "2025-12-03T11:52:44Z", "version-statuses": [ { "version": "1.0.0", "status": "completed" } ], "vcs-repo": null }, "relationships": { "organization": { "data": { "id": "org-rT5Smhs7tBfjGnsZ", "type": "organizations" } }, "registry-component-versions": { "links": { "related": "/api/v2/registry-components/comp-7GjfsTX1Yc5E1boD/versions" } } }, "links": { "self": "/api/v2/registry-components/comp-7GjfsTX1Yc5E1boD" } } } ``` ### Sample response for a VCS-backed configuration The following example response body returns the VCS-backed component configuration's details: ```json { "data": { "id": "comp-UnpBkfLQJZUXARc6", "type": "registry-components", "attributes": { "name": "hashibank-app-security", "namespace": "my-organization", "status": "completed", "created-at": "2024-12-03T10:31:53Z", "updated-at": "2024-12-03T10:31:53Z", "version-statuses": [ { "version": "1.0.0", "status": "completed" }, { "version": "1.1.0", "status": "completed" } ], "vcs-repo": { "identifier": "my-org/hashibank-app-security", "display-identifier": "my-org/hashibank-app-security", "source-directory": "components/security", "tag-prefix": "security/", "oauth-token-id": "ot-eNzYfKyB11MMTqEx" } }, "relationships": { "organization": { "data": { "id": "org-rT5Smhs7tBfjGnsZ", "type": "organizations" } }, "registry-component-versions": { "links": { "related": "/api/v2/registry-components/comp-UnpBkfLQJZUXARc6/versions" } } }, "links": { "self": "/api/v2/registry-components/comp-UnpBkfLQJZUXARc6" } } } ``` ## Delete a component configuration version `DELETE /api/v2/registry-components/:component\_id/versions/:version` | Parameter | Description | | -------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `:component\_id` | The ID of the version of the component configuration to delete, such as `comp-jKXTSGwC8uV6vACK`. The token authenticating the API request must belong to a team member with [\*\*Manage Stack component configurations\*\*](/terraform/cloud-docs/users-teams-organizations/permissions/organization#manage-stack-component-configurations) permissions. | | `:version` | The version number to delete, such as `2.0.0`. | You can delete a specific version of a component configuration, or the entire component configuration. This endpoint deletes a specific version of a component configuration from your private registry. | Status | Response | Reason | | ------- | ------------------------- | ------------------------------------------------------------------------ | | [204][] | No Content | Success | | [404][] | [JSON API error object][] | Not found, or the user is unauthorized to perform this action. | ### Sample request The following example request deletes a specific version of a component configuration: ```shell curl \ --request DELETE \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ https://app.terraform.io/api/v2/registry-components/comp-jKXTSGwC8uV6vACK/versions/2.0.0 ``` ## Delete a Stack component configuration `DELETE /api/v2/registry-components/:component\_id` | Parameter | Description | | -------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `:component\_id` | The ID of the version of the component configuration to delete, such as `comp-jKXTSGwC8uV6vACK`. The token authenticating the API request must belong to a team member with [\*\*Manage Stack component configurations\*\*](/terraform/cloud-docs/users-teams-organizations/permissions/organization#manage-stack-component-configurations) permissions. | You can delete a specific version of a component configuration, or the entire component configuration. This endpoint deletes the entire component configuration from your private registry. | Status | Response | Reason | | ------- | ------------------------- | ------------------------------------------------------------------------ | | [204][] | No Content | Success | | [404][] | [JSON API error object][] | Not found, or the user is unauthorized to perform this action. | ### Sample request The following example deletes an entire component configuration from the private registry: ```shell curl \ --request DELETE \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ https://app.terraform.io/api/v2/registry-components/comp-YF7Avu8dHpJev9Cc ``` | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/private-registry/stack-component-configurations.mdx | main | terraform | [
-0.035544153302907944,
0.04547751694917679,
0.010856551118195057,
0.038489971309900284,
-0.00487350020557642,
-0.08507425338029861,
-0.06388378143310547,
-0.03659786283969879,
0.05796271562576294,
0.08797761052846909,
0.018393663689494133,
-0.05152427405118942,
-0.016128486022353172,
0.012... | 0.013504 |
[200]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/200 [201]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/201 [202]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/202 [204]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/204 [400]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/400 [401]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/401 [403]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/403 [404]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/404 [409]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/409 [412]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/412 [422]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/422 [429]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429 [500]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500 [504]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504 [JSON API document]: /terraform/cloud-docs/api-docs#json-api-documents [JSON API error object]: https://jsonapi.org/format/#error-objects # GPG keys API reference These endpoints are only relevant to private providers. When you [publish a private provider](/terraform/cloud-docs/registry/publish-providers) to the HCP Terraform private registry, you must upload the public key of the GPG key-pair that you used to sign the release. The HCP Terraform registry supports RSA or DSA formatted GPG keys. Refer to [Preparing and adding a signing key](/terraform/registry/providers/publishing#preparing-and-adding-a-signing-key) for more details. You need [owners team](/terraform/cloud-docs/users-teams-organizations/permissions/organization#organization-owners) or [Manage Private Registry](/terraform/cloud-docs/users-teams-organizations/permissions/organization#private-registry-permissions) permissions to add, update, or delete GPG keys in a private registry. ## List GPG Keys `GET /api/registry/:registry\_name/v2/gpg-keys` ### Parameters | Parameter | Description | |------------------|--------------------| | `:registry\_name` | Must be `private`. | ### Query Parameters This endpoint supports pagination [with standard URL query parameters](/terraform/cloud-docs/api-docs#query-parameters). Remember to percent-encode `[` as `%5B` and `]` as `%5D` if your tooling does not automatically encode URLs. | Parameter | Description | |---------------------|----------------------------------------------------------------------------------------------------------------------| | `filter[namespace]` | \*\*Required.\*\* A comma-separated list of one or more namespaces. The namespaces must be an authorized HCP Terraform or Terraform Enterprise organization name. | | `page[number]` | \*\*Optional.\*\* If omitted, the endpoint returns the first page. | | `page[size]` | \*\*Optional.\*\* If omitted, the endpoint returns 20 GPG keys per page. | Gets a list of GPG keys belonging to the specified namespaces. | Status | Response | Reason | |---------|--------------------------------------------|-----------------------------------------------------------| | [200][] | [JSON API document][] (`type: "gpg-keys"`) | Successfully fetched GPG keys | | [400][] | [JSON API error object][] | Error - missing namespaces in request | | [403][] | [JSON API error object][] | Forbidden - no authorized namespaces specified in request | ### Sample Request ```shell curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request GET \ "https://app.terraform.io/api/registry/private/v2/gpg-keys?filter%5Bnamespace%5D=my-organization,my-other-organization" ``` ### Sample Response ```json { "data": [ { "type": "gpg-keys", "id": "1", "attributes": { "ascii-armor": "-----BEGIN PGP PUBLIC KEY BLOCK-----...", "created-at": "2022-02-08T19:15:47Z", "key-id": "C4E5E6C66C79C778", "namespace": "my-other-organization", "source": "", "source-url": null, "trust-signature": "", "updated-at": "2022-02-08T19:15:47Z" }, "links": { "self": "/v2/gpg-keys/1" } }, { "type": "gpg-keys", "id": "140", "attributes": { "ascii-armor": "-----BEGIN PGP PUBLIC KEY BLOCK-----...", "created-at": "2022-04-28T21:32:11Z", "key-id": "C4E5E6C66C79C778", "namespace": "my-organization", "source": "", "source-url": null, "trust-signature": "", "updated-at": "2022-04-28T21:32:11Z" }, "links": { "self": "/v2/gpg-keys/140" } } ], "links": { "first": "/v2/gpg-keys?filter%5Bnamespace%5D=my-organization%2Cmy-other-organization&page%5Bnumber%5D=1&page%5Bsize%5D=15", "last": "/v2/gpg-keys?filter%5Bnamespace%5D=my-organization%2Cmy-other-organization&page%5Bnumber%5D=1&page%5Bsize%5D=15", "next": null, "prev": null }, "meta": { "pagination": { "page-size": 15, "current-page": 1, "next-page": null, "prev-page": null, "total-pages": 1, "total-count": 2 } } } ``` ## Add a GPG Key `POST /api/registry/:registry\_name/v2/gpg-keys` ### Parameters | Parameter | Description | | -------------------- | -------------------- | | `:registry\_name` | Must be `private`. | Uploads a GPG Key to a private registry scoped with a namespace. The response will provide a "key-id", which is required to [Create a Provider Version](/terraform/cloud-docs/api-docs/private-registry/provider-versions-platforms#create-a-provider-version). | Status | Response | Reason | | ------- | ---------------------------------------------------------- | -------------------------------------------------------------- | | [201][] | [JSON API document][] (`type: "gpg-keys"`) | Successfully uploads a GPG key to a private provider | | [422][] | [JSON API error object][] | Malformed request body (missing attributes, wrong types, etc.) | | [403][] | [JSON API error object][] | Forbidden - not available for public providers | | [404][] | [JSON API error object][] | User not authorized | ### Request Body This POST endpoint requires a JSON object with the following properties as a request payload. Properties without a default value are required. | Key path | Type | Default | Description | | ----------------------------- | ------ | ------- | -------------------------------------------------------------------------------------------- | | `data.type` | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/private-registry/gpg-keys.mdx | main | terraform | [
-0.015784088522195816,
-0.01700746826827526,
-0.018668580800294876,
-0.028096551075577736,
-0.024631375446915627,
-0.08318780362606049,
-0.0621652752161026,
-0.07521579414606094,
-0.005580500699579716,
-0.03855427727103233,
0.03281282261013985,
0.0540321059525013,
0.006812138482928276,
-0.... | 0.052879 |
User not authorized | ### Request Body This POST endpoint requires a JSON object with the following properties as a request payload. Properties without a default value are required. | Key path | Type | Default | Description | | ----------------------------- | ------ | ------- | -------------------------------------------------------------------------------------------- | | `data.type` | string | | Must be `"gpg-keys"`. | | `data.attributes.namespace` | string | | The namespace of the provider. Must be the same as the `organization\_name` for the provider. | | `data.attributes.ascii-armor` | string | | A valid gpg-key string. | ### Sample Payload ```json { "data": { "type": "gpg-keys", "attributes": { "namespace": "hashicorp", "ascii-armor": "-----BEGIN PGP PUBLIC KEY BLOCK-----\n\nmQINB...=txfz\n-----END PGP PUBLIC KEY BLOCK-----\n" } } } ``` ### Sample Request ```shell curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request POST \ --data @payload.json \ https://app.terraform.io/api/registry/private/v2/gpg-keys ``` ### Sample Response ```json { "data": { "type": "gpg-keys", "id": "23", "attributes": { "ascii-armor": "-----BEGIN PGP PUBLIC KEY BLOCK-----\n\nmQINB...=txfz\n-----END PGP PUBLIC KEY BLOCK-----\n", "created-at": "2022-02-11T19:16:59Z", "key-id": "32966F3FB5AC1129", "namespace": "hashicorp", "source": "", "source-url": null, "trust-signature": "", "updated-at": "2022-02-11T19:16:59Z" }, "links": { "self": "/v2/gpg-keys/23" } } } ``` ## Get GPG Key `GET /api/registry/:registry\_name/v2/gpg-keys/:namespace/:key\_id` ### Parameters | Parameter | Description | | -------------------- | ---------------------------------------------------- | | `:registry\_name` | Must be `private`. | | `:namespace` | The namespace of the provider scoped to the GPG key. | | `:key\_id` | The id of the GPG key. | Gets the content of a GPG key. | Status | Response | Reason | | ------- | ---------------------------------------------------------- | -------------------------------------------------------------- | | [200][] | [JSON API document][] (`type: "gpg-keys"`) | Successfully fetched GPG key | | [403][] | [JSON API error object][] | Forbidden - not available for public providers | | [404][] | [JSON API error object][] | GPG key not found or user not authorized | ### Sample Request ```shell curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request GET \ https://app.terraform.io/api/registry/private/v2/gpg-keys/hashicorp/32966F3FB5AC1129 ``` ### Sample Response ```json { "data": { "type": "gpg-keys", "id": "2", "attributes": { "ascii-armor": "-----BEGIN PGP PUBLIC KEY BLOCK-----\n\nmQINB...=txfz\n-----END PGP PUBLIC KEY BLOCK-----\n", "created-at": "2022-02-24T17:07:25Z", "key-id": "32966F3FB5AC1129", "namespace": "hashicorp", "source": "", "source-url": null, "trust-signature": "", "updated-at": "2022-02-24T17:07:25Z" }, "links": { "self": "/v2/gpg-keys/2" } } } ``` ## Update a GPG Key `PATCH /api/registry/:registry\_name/v2/gpg-keys/:namespace/:key\_id` ### Parameters | Parameter | Description | | -------------------- | ---------------------------------------------------- | | `:registry\_name` | Must be `private`. | | `:namespace` | The namespace of the provider scoped to the GPG key. | | `:key\_id` | The id of the GPG key. | Updates the specified GPG key. Only the `namespace` attribute can be updated, and `namespace` has to match an `organization` the user has permission to access. | Status | Response | Reason | | ------- | ---------------------------------------------------------- | -------------------------------------------------------------- | | [201][] | [JSON API document][] (`type: "gpg-keys"`) | Successfully updates a GPG key | | [422][] | [JSON API error object][] | Malformed request body (missing attributes, wrong types, etc.) | | [403][] | [JSON API error object][] | Forbidden - not available for public providers | | [404][] | [JSON API error object][] | GPG key not found or user not authorized | ### Request Body This PATCH endpoint requires a JSON object with the following properties as a request payload. Properties without a default value are required. | Key path | Type | Default | Description | | ----------------------------- | ------ | ------- | -------------------------------------------------------------------------------------------- | | `data.type` | string | | Must be `"gpg-keys"`. | | `data.attributes.namespace` | string | | The namespace of the provider. Must be the same as the `organization\_name` for the provider. | | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/private-registry/gpg-keys.mdx | main | terraform | [
-0.042757704854011536,
0.05439895763993263,
-0.04626915603876114,
0.03286312147974968,
-0.0924292802810669,
-0.07467033714056015,
0.05397510901093483,
0.013652256689965725,
-0.023888085037469864,
-0.004729119129478931,
-0.0038259802386164665,
-0.08396323770284653,
0.019832992926239967,
0.0... | -0.060811 |
Key path | Type | Default | Description | | ----------------------------- | ------ | ------- | -------------------------------------------------------------------------------------------- | | `data.type` | string | | Must be `"gpg-keys"`. | | `data.attributes.namespace` | string | | The namespace of the provider. Must be the same as the `organization\_name` for the provider. | ### Sample Payload ```json { "data": { "type": "gpg-keys", "attributes": { "namespace": "new-namespace", } } } ``` ### Sample Request ```shell curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request PATCH \ --data @payload.json \ https://app.terraform.io/api/registry/private/v2/gpg-keys/hashicorp/32966F3FB5AC1129 ``` ### Sample Response ```json { "data": { "type": "gpg-keys", "id": "2", "attributes": { "ascii-armor": "-----BEGIN PGP PUBLIC KEY BLOCK-----\n\nmQINB...=txfz\n-----END PGP PUBLIC KEY BLOCK-----\n", "created-at": "2022-02-24T17:07:25Z", "key-id": "32966F3FB5AC1129", "namespace": "new-name", "source": "", "source-url": null, "trust-signature": "", "updated-at": "2022-02-24T17:12:10Z" }, "links": { "self": "/v2/gpg-keys/2" } } } ``` ## Delete a GPG Key `DELETE /api/registry/:registry\_name/v2/gpg-keys/:namespace/:key\_id` ### Parameters | Parameter | Description | | -------------------- | ---------------------------------------------------- | | `:registry\_name` | Must be `private`. | | `:namespace` | The namespace of the provider scoped to the GPG key. | | `:key\_id` | The id of the GPG key. | [permissions-citation]: #intentionally-unused---keep-for-maintainers | Status | Response | Reason | | ------- | ---------------------------------------------------------- | -------------------------------------------------------------- | | [201][] | [JSON API document][] (`type: "gpg-keys"`) | Successfully deletes a GPG key | | [422][] | [JSON API error object][] | Malformed request body (missing attributes, wrong types, etc.) | | [403][] | [JSON API error object][] | Forbidden - not available for public providers | | [404][] | [JSON API error object][] | GPG key not found or user not authorized | ### Sample Request ```shell curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request DELETE \ --data @payload.json \ https://app.terraform.io/api/registry/private/v2/gpg-keys/hashicorp/32966F3FB5AC1129 ``` | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/private-registry/gpg-keys.mdx | main | terraform | [
-0.05092944577336311,
0.025871440768241882,
-0.005484056193381548,
0.05917933210730553,
-0.023607483133673668,
-0.05323881283402443,
0.04138839244842529,
0.02010604925453663,
0.0008283553179353476,
-0.01629030331969261,
-0.02879074029624462,
-0.059272415935993195,
-0.013685262762010098,
0.... | -0.070512 |
[200]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/200 [201]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/201 [202]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/202 [204]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/204 [400]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/400 [401]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/401 [403]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/403 [404]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/404 [409]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/409 [412]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/412 [422]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/422 [429]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429 [500]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500 [504]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504 [JSON API document]: /terraform/cloud-docs/api-docs#json-api-documents [JSON API error object]: https://jsonapi.org/format/#error-objects # Registry providers API reference You can add publicly curated providers from the [Terraform Registry](https://registry.terraform.io/) and custom, private providers to your HCP Terraform private registry. The private registry stores a pointer to public providers so that you can view their data from within HCP Terraform. This lets you clearly designate all of the providers that are recommended for the organization and makes them centrally accessible. All members of an organization can view and use both public and private providers, but you need [owners team](/terraform/cloud-docs/users-teams-organizations/permissions/organization#organization-owners) or [Manage Private Registry](/terraform/cloud-docs/users-teams-organizations/permissions/organization#private-registry-permissions) permissions to add, update, or delete them them in private registry. ## HCP Terraform Registry Implementation For publicly curated providers, the HCP Terraform Registry acts as a proxy to the [Terraform Registry](https://registry.terraform.io) for the following: - The public registry discovery endpoints have the path prefix provided in the [discovery document](/terraform/registry/api-docs#service-discovery) which is currently `/api/registry/public/v1`. - [Authentication](/terraform/cloud-docs/api-docs#authentication) is handled the same as all other HCP Terraform endpoints. ## List Terraform Registry Providers for an Organization `GET /organizations/:organization\_name/registry-providers` ### Parameters | Parameter | Description | | -------------------- | -------------------------------------------------------------- | | `:organization\_name` | The name of the organization to list available providers from. | Lists the providers included in the private registry for the specified organization. | Status | Response | Reason | | ------- | ---------------------------------------------------- | ---------------------------------------------------------- | | [200][] | [JSON API document][] (`type: "registry-providers"`) | Success | | [404][] | [JSON API error object][] | Providers not found or user unauthorized to perform action | ### Query Parameters This endpoint supports pagination [with standard URL query parameters](/terraform/cloud-docs/api-docs#query-parameters). Remember to percent-encode `[` as `%5B` and `]` as `%5D` if your tooling doesn't automatically encode URLs. | Parameter | Description | | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ | | `q` | \*\*Optional.\*\* A search query string. Providers are searchable by both their name and their namespace fields. | | `filter[field name]` | \*\*Optional.\*\* If specified, restricts results to those with the matching field name value. Valid values are `registry\_name`, and `organization\_name`. | | `page[number]` | \*\*Optional.\*\* If omitted, the endpoint will return the first page. | | `page[size]` | \*\*Optional.\*\* If omitted, the endpoint will return 20 registry providers per page. | ### Sample Request ```shell curl \ --request GET \ --header "Authorization: Bearer $TOKEN" \ https://app.terraform.io/api/v2/organizations/my-organization/registry-providers ``` ### Sample Response ```json { "data": [ { "id": "prov-kwt1cBiX2SdDz38w", "type": "registry-providers", "attributes": { "name": "aws", "namespace": "my-organization", "created-at": "2021-04-07T19:01:18.528Z", "updated-at": "2021-04-07T19:01:19.863Z", "registry-name": "public", "permissions": { "can-delete": true } }, "relationships": { "organization": { "data": { "id": "my-organization", "type": "organizations" } } }, "links": { "self": "/api/v2/organizations/my-organization/registry-providers/public/my-organization/aws" } }, { "id": "prov-PopQnMtYDCcd3PRX", "type": "registry-providers", "attributes": { "name": "aurora", "namespace": "my-organization", "created-at": "2021-04-07T19:04:41.375Z", "updated-at": "2021-04-07T19:04:42.828Z", "registry-name": "public", "permissions": { "can-delete": true } }, "relationships": { "organization": { "data": { "id": "my-organization", "type": "organizations" } } }, "links": { "self": "/api/v2/organizations/my-organization/registry-providers/public/my-organization/aurora" } }, ..., ], "links": { "self": "https://app.terraform.io/api/v2/organizations/my-organization/registry-providers?page%5Bnumber%5D=1&page%5Bsize%5D=6", "first": "https://app.terraform.io/api/v2/organizations/my-organization/registry-providers?page%5Bnumber%5D=1&page%5Bsize%5D=6", "prev": null, "next": "https://app.terraform.io/api/v2/organizations/my-organization/registry-providers?page%5Bnumber%5D=2&page%5Bsize%5D=6", "last": "https://app.terraform.io/api/v2/organizations/my-organization/registry-providers?page%5Bnumber%5D=29&page%5Bsize%5D=6" }, "meta": { "pagination": { "current-page": 1, "page-size": 6, "prev-page": null, "next-page": 2, "total-pages": 29, "total-count": 169 } } } ``` ## Create a Provider `POST /organizations/:organization\_name/registry-providers` Use this endpoint to create both public and private providers: - \*\*Public providers:\*\* The public provider record will be available in the organization's registry provider list immediately after creation. You cannot create versions for public providers; you must use the versions available on the Terraform Registry. - \*\*Private providers:\*\* The private provider record will be available in | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/private-registry/providers.mdx | main | terraform | [
-0.015784088522195816,
-0.01700746826827526,
-0.018668580800294876,
-0.028096551075577736,
-0.024631375446915627,
-0.08318780362606049,
-0.0621652752161026,
-0.07521579414606094,
-0.005580500699579716,
-0.03855427727103233,
0.03281282261013985,
0.0540321059525013,
0.006812138482928276,
-0.... | 0.052879 |
and private providers: - \*\*Public providers:\*\* The public provider record will be available in the organization's registry provider list immediately after creation. You cannot create versions for public providers; you must use the versions available on the Terraform Registry. - \*\*Private providers:\*\* The private provider record will be available in the organization's registry provider list immediately after creation, but you must [create a version and upload release assets](/terraform/cloud-docs/registry/publish-providers#publishing-a-provider-and-creating-a-version) before consumers can use it. The private registry does not automatically update private providers when you release new versions. You must add each new version with the [Create a Provider Version](/terraform/cloud-docs/api-docs/private-registry/provider-versions-platforms#create-a-provider-version) endpoint. ### Parameters | Parameter | Description | | -------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `:organization\_name` | The name of the organization to create a provider in. The organization must already exist, and the token authenticating the API request must belong to the "owners" team or a member of the "owners" team. | [permissions-citation]: #intentionally-unused---keep-for-maintainers | Status | Response | Reason | | ------- | ---------------------------------------------------- | -------------------------------------------------------------- | | [201][] | [JSON API document][] (`type: "registry-providers"`) | Successfully published provider | | [422][] | [JSON API error object][] | Malformed request body (missing attributes, wrong types, etc.) | | [403][] | [JSON API error object][] | Forbidden - public provider curation disabled | | [404][] | [JSON API error object][] | User not authorized | ### Request Body ~> \*\*Important:\*\* For private providers, you must also create a version, a platform, and upload release assets before consumers can use the provider. Refer to [Publishing a Private Provider](/terraform/cloud-docs/registry/publish-providers) for more details. This POST endpoint requires a JSON object with the following properties as a request payload. Properties without a default value are required. | Key path | Type | Default | Description | | ------------------------------- | ------ | ------- | ------------------------------------------------------------------------------------------------------------ | | `data.type` | string | | Must be `"registry-providers"`. | | `data.attributes.name` | string | | The name of the provider. | | `data.attributes.namespace` | string | | The namespace of the provider. For private providers this is the same as the `:organization\_name` parameter. | | `data.attributes.registry-name` | string | | Whether this is a publicly maintained provider or private. Must be either `public` or `private`. | ### Sample Payload (Private Provider) ```json { "data": { "type": "registry-providers", "attributes": { "name": "aws", "namespace": "hashicorp", "registry-name": "private" } } } ``` ### Sample Payload (Public Provider) ```json { "data": { "type": "registry-providers", "attributes": { "name": "aws", "namespace": "hashicorp", "registry-name": "public" } } } ``` ### Sample Request ```shell curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request POST \ --data @payload.json \ https://app.terraform.io/api/v2/organizations/my-organization/registry-providers ``` ### Sample Response (Private Provider) ```json { "data": { "id": "prov-cmEmLstBfjNNA9F3", "type": "registry-providers", "attributes": { "name": "aws", "namespace": "hashicorp", "registry-name": "private", "created-at": "2022-02-11T19:16:59.533Z", "updated-at": "2022-02-11T19:16:59.533Z", "permissions": { "can-delete": true } }, "relationships": { "organization": { "data": { "id": "hashicorp", "type": "organizations" } }, "versions": { "data": [], "links": { "related": "/api/v2/organizations/hashicorp/registry-providers/private/hashicorp/aws" } } }, "links": { "self": "/api/v2/organizations/hashicorp/registry-providers/private/hashicorp/aws" } } } ``` ### Sample Response (Public Provider) ```json { "data": { "id": "prov-fZn7uHu99ZCpAKZJ", "type": "registry-providers", "attributes": { "name": "aws", "namespace": "hashicorp", "registry-name": "public", "created-at": "2020-07-09T19:36:56.288Z", "updated-at": "2020-07-09T19:36:56.288Z", "permissions": { "can-delete": true } }, "relationships": { "organization": { "data": { "id": "my-organization", "type": "organizations" } } }, "links": { "self": "/api/v2/organizations/my-organization/registry-providers/public/hashicorp/aws" } } } ``` ## Get a Provider `GET /organizations/:organization\_name/registry-providers/:registry\_name/:namespace/:name` ### Parameters | Parameter | Description | | -------------------- | ------------------------------------------------------------------------------------------------------------ | | `:organization\_name` | The name of the organization the provider belongs to. | | `:registry\_name` | Whether this is a publicly maintained provider or private. Must be either `public` or `private`. | | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/private-registry/providers.mdx | main | terraform | [
-0.009183889254927635,
-0.0242206621915102,
0.04980194941163063,
-0.002431065309792757,
0.0016022780910134315,
0.016301099210977554,
-0.060574065893888474,
-0.0726989209651947,
0.0440434031188488,
0.12367960810661316,
0.04159153252840042,
-0.01298565324395895,
0.012970716692507267,
-0.0179... | -0.044805 |
## Get a Provider `GET /organizations/:organization\_name/registry-providers/:registry\_name/:namespace/:name` ### Parameters | Parameter | Description | | -------------------- | ------------------------------------------------------------------------------------------------------------ | | `:organization\_name` | The name of the organization the provider belongs to. | | `:registry\_name` | Whether this is a publicly maintained provider or private. Must be either `public` or `private`. | | `:namespace` | The namespace of the provider. For private providers this is the same as the `:organization\_name` parameter. | | `:name` | The provider name. | | Status | Response | Reason | | ------- | ---------------------------------------------------- | --------------------------------------------------------- | | [200][] | [JSON API document][] (`type: "registry-providers"`) | Success | | [403][] | [JSON API error object][] | Forbidden - public provider curation disabled | | [404][] | [JSON API error object][] | Provider not found or user unauthorized to perform action | ### Sample Request (Private Provider) ```shell curl \ --request GET \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ https://app.terraform.io/api/v2/organizations/hashicorp/registry-providers/private/hashicorp/aws ``` ### Sample Request (Public Provider) ```shell curl \ --request GET \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ https://app.terraform.io/api/v2/organizations/my-organization/registry-providers/public/hashicorp/aws ``` ### Sample Response (Private Provider) ```json { "data": { "id": "prov-cmEmLstBfjNNA9F3", "type": "registry-providers", "attributes": { "name": "aws", "namespace": "hashicorp", "created-at": "2022-02-11T19:16:59.533Z", "updated-at": "2022-02-11T19:16:59.533Z", "registry-name": "private", "permissions": { "can-delete": true } }, "relationships": { "organization": { "data": { "id": "hashicorp", "type": "organizations" } }, "versions": { "data": [ { "id": "provver-y5KZUsSBRLV9zCtL", "type": "registry-provider-versions" } ], "links": { "related": "/api/v2/organizations/hashicorp/registry-providers/private/hashicorp/aws" } } }, "links": { "self": "/api/v2/organizations/hashicorp/registry-providers/private/hashicorp/aws" } } } ``` ### Sample Response (Public Provider) ```json { "data": { "id": "prov-fZn7uHu99ZCpAKZJ", "type": "registry-providers", "attributes": { "name": "aws", "namespace": "hashicorp", "registry-name": "public", "created-at": "2020-07-09T19:36:56.288Z", "updated-at": "2020-07-09T20:16:20.538Z", "permissions": { "can-delete": true } }, "relationships": { "organization": { "data": { "id": "my-organization", "type": "organizations" } } }, "links": { "self": "/api/v2/organizations/my-organization/registry-providers/public/hashicorp/aws" } } } ``` ## Delete a Provider `DELETE /organizations/:organization\_name/registry-providers/:registry\_name/:namespace/:name` ### Parameters | Parameter | Description | | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `:organization\_name` | The name of the organization to delete a provider from. The organization must already exist, and the token authenticating the API request must belong to the "owners" team or a member of the "owners" team. | | `:registry\_name` | Whether this is a publicly maintained provider or private. Must be either `public` or `private`. | | `:namespace` | The namespace of the provider that will be deleted. | | `:name` | The name of the provider that will be deleted. | [permissions-citation]: #intentionally-unused---keep-for-maintainers | Status | Response | Reason | | ------- | ------------------------- | ----------------------------------------------------------- | | [204][] | No Content | Success | | [403][] | [JSON API error object][] | Forbidden - public provider curation disabled | | [404][] | [JSON API error object][] | Provider not found or user not authorized to perform action | ### Sample Request (Private Provider) ```shell curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request DELETE \ https://app.terraform.io/api/v2/organizations/hashicorp/registry-providers/private/hashicorp/aws ``` ### Sample Request (Public Provider) ```shell curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request DELETE \ https://app.terraform.io/api/v2/organizations/my-organization/registry-providers/public/hashicorp/aws ``` | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/private-registry/providers.mdx | main | terraform | [
-0.06471081078052521,
-0.0073589966632425785,
-0.1070750430226326,
0.04247688129544258,
-0.027225874364376068,
-0.02243715710937977,
0.07587455213069916,
-0.026999561116099358,
-0.0290813185274601,
0.0010091278236359358,
0.07127964496612549,
-0.07576795667409897,
-0.02140253409743309,
-0.0... | 0.025005 |
[200]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/200 [201]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/201 [202]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/202 [204]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/204 [400]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/400 [401]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/401 [403]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/403 [404]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/404 [409]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/409 [412]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/412 [422]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/422 [429]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429 [500]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500 [504]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504 [JSON API document]: /terraform/cloud-docs/api-docs#json-api-documents [JSON API error object]: https://jsonapi.org/format/#error-objects # Registry modules API reference -> \*\*Note:\*\* Public Module Curation is only available in HCP Terraform. Where applicable, the `registry\_name` parameter must be `private` for Terraform Enterprise. ## HCP Terraform Registry Implementation The HCP Terraform Module Registry implements the [Registry standard API](/terraform/registry/api-docs) for consuming/exposing private modules. Refer to the [Module Registry HTTP API](/terraform/registry/api-docs) to perform the following: - Browse available modules - Search modules by keyword - List available versions for a specific module - Download source code for a specific module version - List latest version of a module for all providers - Get the latest version for a specific module provider - Get a specific module - Download the latest version of a module For publicly curated modules, the HCP Terraform Module Registry acts as a proxy to the [Terraform Registry](https://registry.terraform.io) for the following: - List available versions for a specific module - Get a specific module - Get the latest version for a specific module provider The HCP Terraform Module Registry endpoints differs from the Module Registry endpoints in the following ways: - The `:namespace` parameter should be replaced with the organization name for private modules. - The private module registry discovery endpoints have the path prefix provided in the [discovery document](/terraform/registry/api-docs#service-discovery) which is currently `/api/registry/v1`. - The public module registry discovery endpoints have the path prefix provided in the [discovery document](/terraform/registry/api-docs#service-discovery) which is currently `/api/registry/public/v1`. - [Authentication](/terraform/cloud-docs/api-docs#authentication) is handled the same as all other HCP Terraform endpoints. ### Sample Registry Request (private module) List available versions for the `consul` module for the `aws` provider on the module registry published from the Github organization `my-gh-repo-org`: ```shell $ curl https://registry.terraform.io/v1/modules/my-gh-repo-org/consul/aws/versions ``` The same request for the same module and provider on the HCP Terraform module registry for the `my-cloud-org` organization: ```shell $ curl \ --header "Authorization: Bearer $TOKEN" \ https://app.terraform.io/api/registry/v1/modules/my-cloud-org/consul/aws/versions ``` ### Sample Proxy Request (public module) List available versions for the `consul` module for the `aws` provider on the module registry published from the Github organization `my-gh-repo-org`: ```shell $ curl https://registry.terraform.io/v1/modules/my-gh-repo-org/consul/aws/versions ``` The same request for the same module and provider on the HCP Terraform module registry: ```shell $ curl \ --header "Authorization: Bearer $TOKEN" \ https://app.terraform.io/api/registry/public/v1/modules/my-gh-repo-org/consul/aws/versions ``` ## List Registry Modules for an Organization `GET /organizations/:organization\_name/registry-modules` | Parameter | Description | | -------------------- | ------------------------------------------------------------ | | `:organization\_name` | The name of the organization to list available modules from. | Lists the modules that are available to a given organization. This includes the full list of publicly curated and private modules and is filterable. | Status | Response | Reason | | ------- | -------------------------------------------------- | -------------------------------------------------------- | | [200][] | [JSON API document][] (`type: "registry-modules"`) | The request was successful | | [404][] | [JSON API error object][] | Modules not found or user unauthorized to perform action | ### Query Parameters This endpoint supports pagination [with standard URL query parameters](/terraform/cloud-docs/api-docs#query-parameters). Remember to percent-encode `[` as `%5B` and `]` as `%5D` if your tooling doesn't automatically encode URLs. | Parameter | Description | | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `q` | \*\*Optional.\*\* A search query string. Modules are searchable by name, namespace, provider fields. | | `filter[field name]` | \*\*Optional.\*\* If specified, restricts results to those with the matching field name value. Valid values are `registry\_name`, `provider`, and `organization\_name`. | | `page[number]` | \*\*Optional.\*\* If omitted, the endpoint will return the first page. | | `page[size]` | \*\*Optional.\*\* | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/private-registry/modules.mdx | main | terraform | [
-0.015784088522195816,
-0.01700746826827526,
-0.018668580800294876,
-0.028096551075577736,
-0.024631375446915627,
-0.08318780362606049,
-0.0621652752161026,
-0.07521579414606094,
-0.005580500699579716,
-0.03855427727103233,
0.03281282261013985,
0.0540321059525013,
0.006812138482928276,
-0.... | 0.052879 |
searchable by name, namespace, provider fields. | | `filter[field name]` | \*\*Optional.\*\* If specified, restricts results to those with the matching field name value. Valid values are `registry\_name`, `provider`, and `organization\_name`. | | `page[number]` | \*\*Optional.\*\* If omitted, the endpoint will return the first page. | | `page[size]` | \*\*Optional.\*\* If omitted, the endpoint will return 20 registry modules per page. | ### Sample Request ```shell curl \ --request GET \ --header "Authorization: Bearer $TOKEN" \ https://app.terraform.io/api/v2/organizations/my-organization/registry-modules ``` ### Sample Response ```json { "data": [ { "id": "mod-kwt1cBiX2SdDz38w", "type": "registry-modules", "attributes": { "name": "api-gateway", "namespace": "my-organization", "provider": "alicloud", "status": "setup\_complete", "version-statuses": [ { "version": "1.1.0", "status": "ok" } ], "created-at": "2021-04-07T19:01:18.528Z", "updated-at": "2021-04-07T19:01:19.863Z", "registry-name": "private", "permissions": { "can-delete": true, "can-resync": true, "can-retry": true } }, "relationships": { "organization": { "data": { "id": "my-organization", "type": "organizations" } } }, "links": { "self": "/api/v2/organizations/my-organization/registry-modules/private/my-organization/api-gateway/alicloud" } }, { "id": "mod-PopQnMtYDCcd3PRX", "type": "registry-modules", "attributes": { "name": "aurora", "namespace": "my-organization", "provider": "aws", "status": "setup\_complete", "version-statuses": [ { "version": "4.1.0", "status": "ok" } ], "created-at": "2021-04-07T19:04:41.375Z", "updated-at": "2021-04-07T19:04:42.828Z", "registry-name": "private", "permissions": { "can-delete": true, "can-resync": true, "can-retry": true } }, "relationships": { "organization": { "data": { "id": "my-organization", "type": "organizations" } } }, "links": { "self": "/api/v2/organizations/my-organization/registry-modules/private/my-organization/aurora/aws" } }, ..., ], "links": { "self": "https://app.terraform.io/api/v2/organizations/my-organization/registry-modules?page%5Bnumber%5D=1&page%5Bsize%5D=6", "first": "https://app.terraform.io/api/v2/organizations/my-organization/registry-modules?page%5Bnumber%5D=1&page%5Bsize%5D=6", "prev": null, "next": "https://app.terraform.io/api/v2/organizations/my-organization/registry-modules?page%5Bnumber%5D=2&page%5Bsize%5D=6", "last": "https://app.terraform.io/api/v2/organizations/my-organization/registry-modules?page%5Bnumber%5D=29&page%5Bsize%5D=6" }, "meta": { "pagination": { "current-page": 1, "page-size": 6, "prev-page": null, "next-page": 2, "total-pages": 29, "total-count": 169 } } } ``` ## Publish a Private Module from a VCS ~> \*\*Deprecation warning\*\*: the following endpoint `POST /registry-modules` is replaced by the below endpoint and will be removed from future versions of the API! `POST /organizations/:organization\_name/registry-modules/vcs` | Parameter | Description | | -------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `:organization\_name` | The name of the organization to create a module in. The organization must already exist, and the token authenticating the API request must belong to a team or team member with the \*\*Manage modules\*\* permission enabled. | Publishes a new registry private module from a VCS repository, with module versions managed automatically by the repository's tags. The publishing process will fetch all tags in the source repository that look like [SemVer](https://semver.org/) versions with optional 'v' prefix. For each version, the tag is cloned and the config parsed to populate module details (input and output variables, readme, submodules, etc.). The [Module Registry Requirements](/terraform/registry/modules/publish#requirements) define additional requirements on naming, standard module structure and tags for releases. | Status | Response | Reason | | ------- | -------------------------------------------------- | -------------------------------------------------------------- | | [201][] | [JSON API document][] (`type: "registry-modules"`) | Successfully published module | | [422][] | [JSON API error object][] | Malformed request body (missing attributes, wrong types, etc.) | | [404][] | [JSON API error object][] | User not authorized | ### Request Body This POST endpoint requires a JSON object with the following properties as a request payload. Properties without a default value are required. | Key path | Type | Default | Description | | --------------------------------------------- | ------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `data.type` | string | | Must be `"registry-modules"`. | | `data.attributes.vcs-repo.identifier` | string | | The repository from which to ingress the configuration. | | `data.attributes.vcs-repo.oauth-token-id` | string | | The VCS Connection (OAuth Connection + Token) to use as identified. Get this ID from the [oauth-tokens](/terraform/cloud-docs/api-docs/oauth-tokens) endpoint. You can not specify this value if `github-app-installation-id` is specified. | | `data.attributes.vcs-repo.github-app-installation-id` | string | | The VCS Connection GitHub App Installation to use. Find this ID on the account settings page. Requires previously authorizing the GitHub App and generating a user-to-server token. Manage the token from \*\*Account Settings\*\* within HCP | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/private-registry/modules.mdx | main | terraform | [
-0.0613325797021389,
0.09886891394853592,
-0.013830442912876606,
0.029491087421774864,
0.005952106788754463,
-0.01959887705743313,
-0.025746138766407967,
-0.05825258791446686,
0.02345210500061512,
0.04517090693116188,
0.0012354818172752857,
-0.07151465862989426,
0.04193819314241409,
0.0242... | 0.031299 |
not specify this value if `github-app-installation-id` is specified. | | `data.attributes.vcs-repo.github-app-installation-id` | string | | The VCS Connection GitHub App Installation to use. Find this ID on the account settings page. Requires previously authorizing the GitHub App and generating a user-to-server token. Manage the token from \*\*Account Settings\*\* within HCP Terraform. You can not specify this value if `oauth-token-id` is specified. | | `data.attributes.vcs-repo.display\_identifier` | string | | The display identifier for the repository. For most VCS providers outside of Bitbucket Cloud, this identifier matches the `data.attributes.vcs-repo.identifier` string. | | `data.attributes.no-code` | boolean | | Allows you to enable or disable the no-code publishing workflow for a module. | | `data.attributes.initial-version` | string | `0.0.0` | The initial version of module. | | `data.attributes.test-config.tests-enabled` | boolean | `false` | Allows you to enable or disable the test configuration for a module. | | `data.attributes.test-config.agent-execution-mode` | string | `remote` | The execution mode for test runs. Must be either `remote` or `agent`. When set to `agent`, tests will run on agents in the specified agent pool. Only available when the enterprise-testing feature is enabled. | | `data.attributes.test-config.agent-pool-id` | string | | The ID of the agent pool to use for test runs. Required when `agent-execution-mode` is set to `agent`. Must not be set when `agent-execution-mode` is `remote`. Only available when the enterprise-testing feature is enabled. | | `data.attributes.vcs-repo.branch` | string | | The repository branch to publish the module from if you are using the branch-based publishing workflow. If omitted, the module will be published using the tag-based publishing workflow. | A VCS repository identifier is a reference to a VCS repository in the format `:org/:repo`, where `:org` and `:repo` refer to the organization, or project key for Bitbucket Data Center, and repository in your VCS provider. The format for Azure DevOps is `:org/:project/\_git/:repo`. The OAuth Token ID identifies the VCS connection, and therefore the organization, that the module will be created in. ### Sample Payload ```json { "data": { "attributes": { "vcs-repo": { "identifier":"lafentres/terraform-aws-my-module", "oauth-token-id":"ot-hmAyP66qk2AMVdbJ", "display\_identifier":"lafentres/terraform-aws-my-module", "branch": "main" }, "no-code": true }, "type":"registry-modules" } } ``` ### Sample Request ```shell curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request POST \ --data @payload.json \ https://app.terraform.io/api/v2/organizations/my-organization/registry-modules/vcs ``` ### Sample Response ```json { "data": { "id": "mod-fZn7uHu99ZCpAKZJ", "type": "registry-modules", "attributes": { "name": "my-module", "namespace": "my-organization", "registry-name": "private", "provider": "aws", "status": "pending", "version-statuses": [], "created-at": "2020-07-09T19:36:56.288Z", "updated-at": "2020-07-09T19:36:56.288Z", "vcs-repo": { "branch": "", "ingress-submodules": true, "identifier": "lafentres/terraform-aws-my-module", "display-identifier": "lafentres/terraform-aws-my-module", "oauth-token-id": "ot-hmAyP66qk2AMVdbJ", "webhook-url": "https://app.terraform.io/webhooks/vcs/a12b3456..." }, "permissions": { "can-delete": true, "can-resync": true, "can-retry": true } }, "relationships": { "organization": { "data": { "id": "my-organization", "type": "organizations" } } }, "links": { "self": "/api/v2/organizations/my-organization/registry-modules/private/my-organization/my-module/aws" } } } ``` ## Create a Module (with no VCS connection) `POST /organizations/:organization\_name/registry-modules` | Parameter | Description | | -------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `:organization\_name` | The name of the organization to create a module in. The organization must already exist, and the token authenticating the API request must belong to a team or team member with the \*\*Manage modules\*\* permission enabled. | [permissions-citation]: #intentionally-unused---keep-for-maintainers Creates a new registry module without a backing VCS repository. #### Private modules After creating a module, a version must be created and uploaded in order to be usable. Modules created this way do not automatically update with new versions; instead, you must explicitly create and upload each new version with the [Create a Module Version](#create-a-module-version) endpoint. #### Public modules When created, the public module record will be available in the organization's registry module list. You cannot create versions for public modules as they are maintained in the public registry. | Status | Response | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/private-registry/modules.mdx | main | terraform | [
-0.006133835297077894,
0.030963314697146416,
-0.020847581326961517,
0.009514519944787025,
-0.0075816684402525425,
-0.004512184299528599,
0.022985154762864113,
-0.01945924200117588,
0.05213883891701698,
0.03886621072888374,
0.004734502639621496,
-0.0978304073214531,
0.08754399418830872,
-0.... | -0.025765 |
create and upload each new version with the [Create a Module Version](#create-a-module-version) endpoint. #### Public modules When created, the public module record will be available in the organization's registry module list. You cannot create versions for public modules as they are maintained in the public registry. | Status | Response | Reason | | ------- | -------------------------------------------------- | -------------------------------------------------------------- | | [201][] | [JSON API document][] (`type: "registry-modules"`) | Successfully published module | | [422][] | [JSON API error object][] | Malformed request body (missing attributes, wrong types, etc.) | | [403][] | [JSON API error object][] | Forbidden - public module curation disabled | | [404][] | [JSON API error object][] | User not authorized | ### Request Body This POST endpoint requires a JSON object with the following properties as a request payload. Properties without a default value are required. | Key path | Type | Default | Description | | ------------------------------- | ------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `data.type` | string | | Must be `"registry-modules"`. | | `data.attributes.name` | string | | The name of this module. May contain alphanumeric characters, with dashes and underscores allowed in non-leading or trailing positions. Maximum length is 64 characters. | | `data.attributes.provider` | string | | Specifies the Terraform provider that this module is used for. May contain lowercase alphanumeric characters. Maximum length is 64 characters. | | `data.attributes.namespace` | string | | The namespace of this module. Cannot be set for private modules. May contain alphanumeric characters, with dashes and underscores allowed in non-leading or trailing positions. Maximum length is 64 characters. | | `data.attributes.registry-name` | string | | Indicates whether this is a publicly maintained module or private. Must be either `public` or `private`. | | `data.attributes.no-code` | boolean | | Allows you to enable or disable the no-code publishing workflow for a module. ### Sample Payload (private module) ```json { "data": { "type": "registry-modules", "attributes": { "name": "my-module", "provider": "aws", "registry-name": "private", "no-code": true } } } ``` ### Sample Payload (public module) ```json { "data": { "type": "registry-modules", "attributes": { "name": "vpc", "namespace": "terraform-aws-modules", "provider": "aws", "registry-name": "public", "no-code": true } } } ``` ### Sample Request ```shell curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request POST \ --data @payload.json \ https://app.terraform.io/api/v2/organizations/my-organization/registry-modules ``` ### Sample Response (private module) ```json { "data": { "id": "mod-fZn7uHu99ZCpAKZJ", "type": "registry-modules", "attributes": { "name": "my-module", "namespace": "my-organization", "registry-name": "private", "provider": "aws", "status": "pending", "version-statuses": [], "created-at": "2020-07-09T19:36:56.288Z", "updated-at": "2020-07-09T19:36:56.288Z", "permissions": { "can-delete": true, "can-resync": true, "can-retry": true } }, "relationships": { "organization": { "data": { "id": "my-organization", "type": "organizations" } } }, "links": { "self": "/api/v2/organizations/my-organization/registry-modules/private/my-organization/my-module/aws" } } } ``` ### Sample Response (public module) ```json { "data": { "id": "mod-fZn7uHu99ZCpAKZJ", "type": "registry-modules", "attributes": { "name": "vpc", "namespace": "terraform-aws-modules", "registry-name": "public", "provider": "aws", "status": "pending", "version-statuses": [], "created-at": "2020-07-09T19:36:56.288Z", "updated-at": "2020-07-09T19:36:56.288Z", "permissions": { "can-delete": true, "can-resync": true, "can-retry": true } }, "relationships": { "organization": { "data": { "id": "my-organization", "type": "organizations" } } }, "links": { "self": "/api/v2/organizations/my-organization/registry-modules/public/terraform-aws-modules/vpc/aws" } } } ``` ## Create a Module Version ~> \*\*Deprecation warning\*\*: the following endpoint `POST /registry-modules/:organization\_name/:name/:provider/versions` is replaced by the below endpoint and will be removed from future versions of the API! `POST /organizations/:organization\_name/registry-modules/:registry\_name/:namespace/:name/:provider/versions` | Parameter | Description | | -------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `:organization\_name` | The name of the organization to create a module in. The organization must already exist, and the token authenticating the API request must belong to a team or team member with the \*\*Manage modules\*\* permission enabled. | | `:namespace` | The namespace of the module for which the version | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/private-registry/modules.mdx | main | terraform | [
-0.03734423965215683,
-0.011018007062375546,
-0.07692604511976242,
0.007557624485343695,
-0.01003614068031311,
-0.011579993180930614,
-0.1143227368593216,
0.015652641654014587,
-0.03063410334289074,
0.02586614340543747,
0.07024423032999039,
-0.019561832770705223,
-0.01044212281703949,
0.02... | 0.023634 |
| The name of the organization to create a module in. The organization must already exist, and the token authenticating the API request must belong to a team or team member with the \*\*Manage modules\*\* permission enabled. | | `:namespace` | The namespace of the module for which the version is being created. For private modules this is the same as the `:organization\_name` parameter | | `:name` | The name of the module for which the version is being created. | | `:provider` | The name of the provider for which the version is being created. | | `:registry-name` | Must be `private`. | [permissions-citation]: #intentionally-unused---keep-for-maintainers Creates a new registry module version. This endpoint only applies to private modules without a VCS repository and VCS-linked branch based modules. VCS-linked tag-based modules automatically create new versions for new tags. After creating the version for a non-VCS backed module, you should upload the module to the link that HCP Terraform returns. | Status | Response | Reason | | ------- | ---------------------------------------------------------- | -------------------------------------------------------------- | | [201][] | [JSON API document][] (`type: "registry-module-versions"`) | Successfully published module version | | [422][] | [JSON API error object][] | Malformed request body (missing attributes, wrong types, etc.) | | [403][] | [JSON API error object][] | Forbidden - not available for public modules | | [404][] | [JSON API error object][] | User not authorized | ### Request Body This POST endpoint requires a JSON object with the following properties as a request payload. Properties without a default value are required. | Key path | Type | Default | Description | | ---------------------------- | ------ | ------- | ------------------------------------------------------------------------------------------------- | | `data.type` | string | | Must be `"registry-module-versions"`. | | `data.attributes.version` | string | | A valid semver version string. | | `data.attributes.commit-sha` | string | `null` | If applicable, the commit SHA you use when creating the module version archive you are uploading. | ### Sample Payload ```json { "data": { "type": "registry-module-versions", "attributes": { "version": "1.2.3", "commit-sha": "abcdef12345" } } } ``` ### Sample Request ```shell curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request POST \ --data @payload.json \ https://app.terraform.io/api/v2/organizations/my-organization/registry-modules/private/my-organization/my-module/aws/versions ``` ### Sample Response ```json { "data": { "id": "modver-qjjF7ArLXJSWU3WU", "type": "registry-module-versions", "attributes": { "source": "tfe-api", "status": "pending", "version": "1.2.3", "created-at": "2018-09-24T20:47:20.931Z", "updated-at": "2018-09-24T20:47:20.931Z" }, "relationships": { "registry-module": { "data": { "id": "1881", "type": "registry-modules" } } }, "links": { "upload": "https://archivist.terraform.io/v1/object/dmF1bHQ6djE6NWJPbHQ4QjV4R1ox..." } } } ``` ## Add a Module Version (Private Module) `PUT https://archivist.terraform.io/v1/object/` \*\*The URL is provided in the `upload` links attribute in the `registry-module-versions` resource.\*\* ### Expected Archive Format HCP Terraform expects the module version uploaded to be a gzip tarball with the module in the root (not in a subdirectory). Given the following folder structure: ``` terraform-null-test ├── README.md ├── examples │ └── default │ ├── README.md │ └── main.tf └── main.tf ``` Package the files in an archive format by running `tar zcvf module.tar.gz \*` in the module's directory. ``` ~$ cd terraform-null-test terraform-null-test$ tar zcvf module.tar.gz \* a README.md a examples a examples/default a examples/default/main.tf a examples/default/README.md a main.tf ``` ### Sample Request ```shell curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/octet-stream" \ --request PUT \ --data-binary @module.tar.gz \ https://archivist.terraform.io/v1/object/dmF1bHQ6djE6NWJPbHQ4QjV4R1ox... ``` After the registry module version is successfully parsed, its status will become `"ok"`. ## Get a Module ~> \*\*Deprecation warning\*\*: the following endpoint `GET /registry-modules/show/:organization\_name/:name/:provider` is replaced by the below endpoint and will be removed from future versions of the API! `GET /organizations/:organization\_name/registry-modules/:registry\_name/:namespace/:name/:provider` ### Parameters | Parameter | Description | | -------------------- | ----------------------------------------------------------------------------------------------------------- | | `:organization\_name` | | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/private-registry/modules.mdx | main | terraform | [
-0.08241786062717438,
-0.026196090504527092,
-0.08087543398141861,
-0.027147231623530388,
0.021801983937621117,
-0.013229449279606342,
-0.046059031039476395,
-0.019701756536960602,
0.01035536639392376,
0.022641971707344055,
0.045601729303598404,
-0.09668511152267456,
0.030987048521637917,
... | 0.056258 |
its status will become `"ok"`. ## Get a Module ~> \*\*Deprecation warning\*\*: the following endpoint `GET /registry-modules/show/:organization\_name/:name/:provider` is replaced by the below endpoint and will be removed from future versions of the API! `GET /organizations/:organization\_name/registry-modules/:registry\_name/:namespace/:name/:provider` ### Parameters | Parameter | Description | | -------------------- | ----------------------------------------------------------------------------------------------------------- | | `:organization\_name` | The name of the organization the module belongs to. | | `:namespace` | The namespace of the module. For private modules this is the name of the organization that owns the module. | | `:name` | The module name. | | `:provider` | The module provider. Must be lowercase alphanumeric. | | `:registry-name` | Either `public` or `private`. | | Status | Response | Reason | | ------- | -------------------------------------------------- | ------------------------------------------------------- | | [200][] | [JSON API document][] (`type: "registry-modules"`) | The request was successful | | [403][] | [JSON API error object][] | Forbidden - public module curation disabled | | [404][] | [JSON API error object][] | Module not found or user unauthorized to perform action | ### Sample Request (private module) ```shell curl \ --request GET \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ https://app.terraform.io/api/v2/organizations/my-organization/registry-modules/private/my-organization/my-module/aws ``` ### Sample Request (public module) ```shell curl \ --request GET \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ https://app.terraform.io/api/v2/organizations/my-organization/registry-modules/public/terraform-aws-modules/vpc/aws ``` ### Sample Response (private module) ```json { "data": { "id": "mod-fZn7uHu99ZCpAKZJ", "type": "registry-modules", "attributes": { "name": "my-module", "provider": "aws", "namespace": "my-organization", "registry-name": "private", "status": "setup\_complete", "version-statuses": [ { "version": "1.0.0", "status": "ok" } ], "created-at": "2020-07-09T19:36:56.288Z", "updated-at": "2020-07-09T20:16:20.538Z", "vcs-repo": { "branch": "", "ingress-submodules": true, "identifier": "lafentres/terraform-aws-my-module", "display-identifier": "lafentres/terraform-aws-my-module", "oauth-token-id": "ot-hmAyP66qk2AMVdbJ", "webhook-url": "https://app.terraform.io/webhooks/vcs/a12b3456..." }, "permissions": { "can-delete": true, "can-resync": true, "can-retry": true } }, "relationships": { "organization": { "data": { "id": "my-organization", "type": "organizations" } } }, "links": { "self": "/api/v2/organizations/my-organization/registry-modules/private/my-organization/my-module/aws" } } } ``` ### Sample Response (public module) ```json { "data": { "id": "mod-fZn7uHu99ZCpAKZJ", "type": "registry-modules", "attributes": { "name": "vpc", "provider": "aws", "namespace": "terraform-aws-modules", "registry-name": "public", "status": "setup\_complete", "version-statuses": [], "created-at": "2020-07-09T19:36:56.288Z", "updated-at": "2020-07-09T20:16:20.538Z", "permissions": { "can-delete": true, "can-resync": true, "can-retry": true } }, "relationships": { "organization": { "data": { "id": "my-organization", "type": "organizations" } } }, "links": { "self": "/api/v2/organizations/my-organization/registry-modules/public/terraform-aws-modules/vpc/aws" } } } ``` ## Update a Private Registry Module `PATCH /organizations/:organization\_name/registry-modules/private/:namespace/:name/:provider/` ### Parameters | Parameter | Description | | -------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `:organization\_name` | The name of the organization to update a module from. The organization must already exist, and the token authenticating the API request must belong to the `owners` team or a member of the `owners` team. | | `:namespace` | The module namespace that the update affects. For private modules this is the name of the organization that owns the module. | | `:name` | The module name that the update affects. | | `:provider` | The name of the provider of the module that is being updated. | ### Request Body These PATCH endpoints require a JSON object with the following properties as a request payload. Properties without a default value are required. | Key path | Type | Default | Description | |-----------------------------------------------|----------------|------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | `data.type` | string | | Must be `"registry-modules"`. | | `data.attributes.vcs-repo.branch` | string | (previous value) | The repository branch that Terraform executes tests and publishes new versions from. This cannot be used with the `data.attributes.vcs-repo.tags` key. | | `data.attributes.vcs-repo.tags` | boolean | (previous value) | Whether the registry module should be tag-based. This cannot be used with the `data.attributes.vcs-repo.branch` key. | | `data.attributes.test-config.tests-enabled` | boolean | (previous value) | Allows you to enable or disable tests for the module. | | `data.attributes.test-config.agent-execution-mode` | string | (previous value) | The execution mode | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/private-registry/modules.mdx | main | terraform | [
-0.06689730286598206,
0.0455697737634182,
-0.07538898289203644,
0.04856380447745323,
-0.030131135135889053,
-0.027490787208080292,
-0.015993662178516388,
-0.02523256652057171,
-0.03062291070818901,
-0.04944973438978195,
0.06330056488513947,
-0.02008737437427044,
-0.039825115352869034,
0.01... | 0.113197 |
| (previous value) | Whether the registry module should be tag-based. This cannot be used with the `data.attributes.vcs-repo.branch` key. | | `data.attributes.test-config.tests-enabled` | boolean | (previous value) | Allows you to enable or disable tests for the module. | | `data.attributes.test-config.agent-execution-mode` | string | (previous value) | The execution mode for test runs. Must be either `remote` or `agent`. When set to `agent`, tests will run on agents in the specified agent pool. Only available when the enterprise-testing feature is enabled. | | `data.attributes.test-config.agent-pool-id` | string | (previous value) | The ID of the agent pool to use for test runs. Required when `agent-execution-mode` is set to `agent`. Must not be set when `agent-execution-mode` is `remote`. Only available when the enterprise-testing feature is enabled. | ### Sample Payload ```json { "data": { "attributes": { "vcs-repo": { "branch": "main", "tags": false }, "test-config": { "tests-enabled": true, "agent-execution-mode": "agent", "agent-pool-id": "apool-yoGUFz5zcRMMz53i" } }, "type": "registry-modules" } } ``` ### Sample Request ```shell $ curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request PATCH \ --data @payload.json \ https://app.terraform.io/api/v2/organizations/my-organization/registry-modules/private/my-organization/registry-name/registry-provider/ ``` ### Sample Response ```json { "data": { "id": "mod-fZn7uHu99ZCpAKZJ", "type": "registry-modules", "attributes": { "name": "my-module", "namespace": "my-organization", "registry-name": "private", "provider": "aws", "status": "pending", "version-statuses": [], "created-at": "2020-07-09T19:36:56.288Z", "updated-at": "2020-07-09T19:36:56.288Z", "vcs-repo": { "branch": "main", "ingress-submodules": true, "identifier": "lafentres/terraform-aws-my-module", "display-identifier": "lafentres/terraform-aws-my-module", "oauth-token-id": "ot-hmAyP66qk2AMVdbJ", "webhook-url": "https://app.terraform.io/webhooks/vcs/a12b3456..." }, "permissions": { "can-delete": true, "can-resync": true, "can-retry": true }, "test-config": { "id": "tc-tcR6bxV5zE75Zb3B", "tests-enabled": true, "agent-execution-mode": "agent", "agent-pool-id": "apool-yoGUFz5zcRMMz53i" } }, "relationships": { "organization": { "data": { "id": "my-organization", "type": "organizations" } } }, "links": { "self": "/api/v2/organizations/my-organization/registry-modules/private/my-organization/my-module/aws" } } } ``` ## Delete a Module \*\*Deprecation warning\*\*: the following endpoints: - `POST /registry-modules/actions/delete/:organization\_name/:name/:provider/:version` - `POST /registry-modules/actions/delete/:organization\_name/:name/:provider` - `POST /registry-modules/actions/delete/:organization\_name/:name` are replaced by the below endpoints and will be removed from future versions of the API! - `DELETE /organizations/:organization\_name/registry-modules/:registry\_name/:namespace/:name/:provider/:version` - `DELETE /organizations/:organization\_name/registry-modules/:registry\_name/:namespace/:name/:provider` - `DELETE /organizations/:organization\_name/registry-modules/:registry\_name/:namespace/:name` ### Parameters | Parameter | Description | | -------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `:organization\_name` | The name of the organization to delete a module from. The organization must already exist, and the token authenticating the API request must belong to the "owners" team or a member of the "owners" team. | | `:namespace` | The module namespace that the deletion will affect. For private modules this is the name of the organization that owns the module. | | `:name` | The module name that the deletion will affect. | | `:provider` | If specified, the provider for the module that the deletion will affect. | | `:version` | If specified, the version for the module and provider that will be deleted. | | `:registry\_name` | Either `public` or `private` | [permissions-citation]: #intentionally-unused---keep-for-maintainers When removing modules, there are three versions of the endpoint, depending on how many parameters are specified. - If all parameters (module namespace, name, provider, and version) are specified, the specified version for the given provider of the module is deleted. - If module namespace, name, and provider are specified, the specified provider for the given module is deleted along with all its versions. - If only module namespace and name are specified, the entire module is deleted. For public modules, only the the endpoint specifying the module namespace and name is valid. The other DELETE endpoints will 404. For public modules, this only removes the record from the organization's HCP Terraform Registry and does not remove the public module from registry.terraform.io. If a version deletion would leave a provider with no versions, the provider will be deleted. If a provider deletion would leave a module with no providers, the module will be deleted. | Status | Response | | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/private-registry/modules.mdx | main | terraform | [
0.006947299465537071,
0.00765312509611249,
-0.07699647545814514,
0.04629913344979286,
-0.003223886713385582,
0.014113969169557095,
-0.008997173048555851,
0.014746921136975288,
-0.03773171827197075,
0.014880015514791012,
0.07618840783834457,
-0.013304615393280983,
-0.00835825689136982,
0.05... | 0.035291 |
organization's HCP Terraform Registry and does not remove the public module from registry.terraform.io. If a version deletion would leave a provider with no versions, the provider will be deleted. If a provider deletion would leave a module with no providers, the module will be deleted. | Status | Response | Reason | | ------- | ------------------------- | ------------------------------------------------------------- | | [204][] | No Content | Success | | [403][] | [JSON API error object][] | Forbidden - public module curation disabled | | [404][] | [JSON API error object][] | Module, provider, or version not found or user not authorized | ### Sample Request (private module) ```shell curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request DELETE \ https://app.terraform.io/api/v2/organizations/my-organization/registry-modules/private/my-organization/my-module/aws/2.0.0 ``` ### Sample Request (public module) ```shell curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request DELETE \ https://app.terraform.io/api/v2/organizations/my-organization/registry-modules/public/terraform-aws-modules/vpc/aws ``` | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/private-registry/modules.mdx | main | terraform | [
-0.04345880076289177,
0.04967889562249184,
-0.021505961194634438,
-0.03292195498943329,
0.02985520474612713,
-0.014026407152414322,
-0.055769890546798706,
-0.1198410913348198,
0.035239044576883316,
0.022093702107667923,
0.062824547290802,
0.0004483992524910718,
0.01027392502874136,
-0.0169... | 0.021254 |
[200]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/200 [201]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/201 [202]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/202 [204]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/204 [400]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/400 [401]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/401 [403]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/403 [404]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/404 [409]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/409 [412]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/412 [422]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/422 [429]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429 [500]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500 [504]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504 [JSON API document]: /terraform/cloud-docs/api-docs#json-api-documents [JSON API error object]: https://jsonapi.org/format/#error-objects # Private provider versions and platforms API reference These endpoints are only relevant to private providers. When you [publish a private provider](/terraform/cloud-docs/registry/publish-providers) to the HCP Terraform private registry, you must also create at least one version and at least one platform for that version before consumers can use the provider in configurations. Unlike the public Terraform Registry, the private registry does not automatically upload new releases. You must manually add new provider versions and the associated release files. All members of an organization can view and use both public and private providers, but you need [owners team](/terraform/cloud-docs/users-teams-organizations/permissions/organization#organization-owners) or [Manage Private Registry](/terraform/cloud-docs/users-teams-organizations/permissions/organization#private-registry-permissions) permissions to add, update, or delete provider versions and platforms in private registry. ## Create a Provider Version `POST /organizations/:organization\_name/registry-providers/:registry\_name/:namespace/:name/versions` The private registry does not automatically update private providers when you release new versions. You must use this endpoint to add each new version. Consumers cannot use new versions until you upload all [required release files](/terraform/cloud-docs/registry/publish-providers#release-files) and [Create a Provider Platform](#create-a-provider-platform). ### Parameters | Parameter | Description | | -------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `:organization\_name` | The name of the organization to create a provider in. The organization must already exist, and the token authenticating the API request must belong to the "owners" team or a member of the "owners" team. | | `:registry\_name` | Must be `private`. | | `:namespace` | The namespace of the provider for which the version is being created. For private providers this is the same as the `:organization\_name` parameter. | | `:name` | The name of the provider for which the version is being created. | Creates a new registry provider version. This endpoint only applies to private providers. | Status | Response | Reason | | ------- | ---------------------------------------------------------- | -------------------------------------------------------------- | | [201][] | [JSON API document][] (`type: "registry-provider-versions"`) | Success | | [422][] | [JSON API error object][] | Malformed request body (missing attributes, wrong types, etc.) | | [403][] | [JSON API error object][] | Forbidden - not available for public providers | | [404][] | [JSON API error object][] | User not authorized | ### Request Body This POST endpoint requires a JSON object with the following properties as a request payload. Properties without a default value are required. | Key path | Type | Default | Description | | --------------------------- | ------ | ------- | ----------------------------------------------------------------- | | `data.type` | string | | Must be `"registry-provider-versions"`. | | `data.attributes.version` | string | | A valid semver version string. | | `data.attributes.key-id` | string | | A valid gpg-key string. | | `data.attributes.protocols` | array | | An array of Terraform provider API versions that this version supports. Must be one or all of the following values `["4.0","5.0","6.0"]`. | -> \*\*Note:\*\* Only Terraform 0.13 and later support third-party provider registries, and that Terraform version requires provider API version 5.0 or later. So you do not need to list major versions 4.0 or earlier in the `protocols` attribute. ### Sample Payload ```json { "data": { "type": "registry-provider-versions", "attributes": { "version": "3.1.1", "key-id": "32966F3FB5AC1129", "protocols": ["5.0"] } } } ``` ### Sample Request ```shell curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request POST \ --data @payload.json \ https://app.terraform.io/api/v2/organizations/hashicorp/registry-providers/private/hashicorp/aws/versions ``` ### Sample Response ```json { "data": { "id": "provver-y5KZUsSBRLV9zCtL", "type": "registry-provider-versions", "attributes": { "version": "3.1.1", "created-at": "2022-02-11T19:16:59.876Z", "updated-at": "2022-02-11T19:16:59.876Z", "key-id": "32966F3FB5AC1129", "protocols": ["5.0"], "permissions": { "can-delete": true, "can-upload-asset": true }, | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/private-registry/provider-versions-platforms.mdx | main | terraform | [
-0.015784088522195816,
-0.01700746826827526,
-0.018668580800294876,
-0.028096551075577736,
-0.024631375446915627,
-0.08318780362606049,
-0.0621652752161026,
-0.07521579414606094,
-0.005580500699579716,
-0.03855427727103233,
0.03281282261013985,
0.0540321059525013,
0.006812138482928276,
-0.... | 0.052879 |
```shell curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request POST \ --data @payload.json \ https://app.terraform.io/api/v2/organizations/hashicorp/registry-providers/private/hashicorp/aws/versions ``` ### Sample Response ```json { "data": { "id": "provver-y5KZUsSBRLV9zCtL", "type": "registry-provider-versions", "attributes": { "version": "3.1.1", "created-at": "2022-02-11T19:16:59.876Z", "updated-at": "2022-02-11T19:16:59.876Z", "key-id": "32966F3FB5AC1129", "protocols": ["5.0"], "permissions": { "can-delete": true, "can-upload-asset": true }, "shasums-uploaded": false, "shasums-sig-uploaded": false }, "relationships": { "registry-provider": { "data": { "id": "prov-cmEmLstBfjNNA9F3", "type": "registry-providers" } }, "platforms": { "data": [], "links": { "related": "/api/v2/organizations/hashicorp/registry-providers/private/hashicorp/aws/versions/3.1.1/platforms" } } }, "links": { "shasums-upload": "https://archivist.terraform.io/v1/object/dmF1b...", "shasums-sig-upload": "https://archivist.terraform.io/v1/object/dmF1b..." } } } ``` ## Get All Versions for a Single Provider `GET /organizations/:organization\_name/registry-providers/:registry\_name/:namespace/:name/versions/` ### Parameters | Parameter | Description | | -------------------- | -------------------------------------------------------------------------------------------- | | `:organization\_name` | The name of the organization the provider belongs to. | | `:registry\_name` | Must be `private`. | | `:namespace` | The namespace of the provider. Must be the same as the `organization\_name` for the provider. | | `:name` | The provider name. | | Status | Response | Reason | | ------- | ---------------------------------------------------- | --------------------------------------------------------- | | [200][] | [JSON API document][] (`type: "registry-providers"`) | Success | | [403][] | [JSON API error object][] | Forbidden - public provider curation disabled | | [404][] | [JSON API error object][] | Provider not found or user unauthorized to perform action | ### Sample Request ```shell curl \ --request GET \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ https://app.terraform.io/api/v2/organizations/hashicorp/registry-providers/private/hashicorp/aws/versions ``` ### Sample Response ```json { "data": [ { "id": "provver-y5KZUsSBRLV9zCtL", "type": "registry-provider-versions", "attributes": { "version": "3.1.1", "created-at": "2022-02-11T19:16:59.876Z", "updated-at": "2022-02-11T19:16:59.876Z", "key-id": "32966F3FB5AC1129", "protocols": ["5.0"], "permissions": { "can-delete": true, "can-upload-asset": true }, "shasums-uploaded": true, "shasums-sig-uploaded": true }, "relationships": { "registry-provider": { "data": { "id": "prov-cmEmLstBfjNNA9F3", "type": "registry-providers" } }, "platforms": { "data": [ { "id": "provpltfrm-GSHhNzptr9s3WoLD", "type": "registry-provider-platforms" }, { "id": "provpltfrm-A1PHitiM2KkKpVoM", "type": "registry-provider-platforms" }, { "id": "provpltfrm-BLJWvWyJ2QMs525k", "type": "registry-provider-platforms" }, { "id": "provpltfrm-qQYosUguetYtXGzJ", "type": "registry-provider-platforms" }, { "id": "provpltfrm-pjDHFN46y193bS7t", "type": "registry-provider-platforms" } ], "links": { "related": "/api/v2/organizations/hashicorp/registry-providers/private/hashicorp/aws/versions/3.1.1/platforms" } } }, "links": { "shasums-download": "https://archivist.terraform.io/v1/object/dmF1b...", "shasums-sig-download": "https://archivist.terraform.io/v1/object/dmF1b..." } } ], "links": { "self": "https://app.terraform.io/api/v2/organizations/hashicorp/registry-providers/private/hashicorp/aws/versions?page%5Bnumber%5D=1&page%5Bsize%5D=20", "first": "https://app.terraform.io/api/v2/organizations/hashicorp/registry-providers/private/hashicorp/aws/versions?page%5Bnumber%5D=1&page%5Bsize%5D=20", "prev": null, "next": null, "last": "https://app.terraform.io/api/v2/organizations/hashicorp/registry-providers/private/hashicorp/aws/versions?page%5Bnumber%5D=1&page%5Bsize%5D=20" }, "meta": { "pagination": { "current-page": 1, "page-size": 20, "prev-page": null, "next-page": null, "total-pages": 1, "total-count": 1 } } } ``` \*\*Note:\*\* The `shasums-uploaded` and `shasums-sig-uploaded` properties will be false if those files have not been uploaded to Archivist. In this case, instead of including links to `shasums-download` and `shasums-sig-download`, the response will include upload links (`shasums-upload` and `shasums-sig-upload`). ## Get a Version `GET /organizations/:organization\_name/registry-providers/:registry\_name/:namespace/:name/versions/:version` ### Parameters | Parameter | Description | | -------------------- | -------------------------------------------------------------------------------------------- | | `:organization\_name` | The name of the organization the provider belongs to. | | `:registry\_name` | Must be `private`. | | `:namespace` | The namespace of the provider. Must be the same as the `organization\_name` for the provider. | | `:name` | The provider name. | | `:version` | The version of the provider being created to which different platforms can be added. | | Status | Response | Reason | | ------- | ---------------------------------------------------- | --------------------------------------------------------- | | [200][] | [JSON API document][] (`type: "registry-providers"`) | Success | | [403][] | [JSON API error object][] | Forbidden - public provider curation disabled | | [404][] | [JSON API error object][] | Provider not found or user unauthorized to perform action | ### Sample Request ```shell curl \ --request GET \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ https://app.terraform.io/api/v2/organizations/hashicorp/registry-providers/private/hashicorp/aws/versions/3.1.1 ``` ### Sample Response ```json { "data": { "id": "provver-y5KZUsSBRLV9zCtL", "type": "registry-provider-versions", "attributes": { "version": "3.1.1", "created-at": "2022-02-11T19:16:59.876Z", "updated-at": "2022-02-11T19:16:59.876Z", "key-id": "32966F3FB5AC1129", "protocols": ["5.0"], "permissions": { "can-delete": true, "can-upload-asset": true }, "shasums-uploaded": true, "shasums-sig-uploaded": true }, "relationships": | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/private-registry/provider-versions-platforms.mdx | main | terraform | [
0.0026896048802882433,
0.0570729561150074,
-0.039895929396152496,
-0.03594807907938957,
-0.004614717792719603,
-0.0597396194934845,
-0.06763362884521484,
-0.046536531299352646,
0.04672115296125412,
0.07403821498155594,
0.028731990605592728,
-0.07067734748125076,
-0.00370099232532084,
-0.01... | 0.04767 |
--request GET \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ https://app.terraform.io/api/v2/organizations/hashicorp/registry-providers/private/hashicorp/aws/versions/3.1.1 ``` ### Sample Response ```json { "data": { "id": "provver-y5KZUsSBRLV9zCtL", "type": "registry-provider-versions", "attributes": { "version": "3.1.1", "created-at": "2022-02-11T19:16:59.876Z", "updated-at": "2022-02-11T19:16:59.876Z", "key-id": "32966F3FB5AC1129", "protocols": ["5.0"], "permissions": { "can-delete": true, "can-upload-asset": true }, "shasums-uploaded": true, "shasums-sig-uploaded": true }, "relationships": { "registry-provider": { "data": { "id": "prov-cmEmLstBfjNNA9F3", "type": "registry-providers" } }, "platforms": { "data": [ { "id": "provpltfrm-GSHhNzptr9s3WoLD", "type": "registry-provider-platforms" }, { "id": "provpltfrm-A1PHitiM2KkKpVoM", "type": "registry-provider-platforms" }, { "id": "provpltfrm-BLJWvWyJ2QMs525k", "type": "registry-provider-platforms" }, { "id": "provpltfrm-qQYosUguetYtXGzJ", "type": "registry-provider-platforms" }, { "id": "provpltfrm-pjDHFN46y193bS7t", "type": "registry-provider-platforms" } ], "links": { "related": "/api/v2/organizations/hashicorp/registry-providers/private/hashicorp/aws/versions/3.1.1/platforms" } } }, "links": { "shasums-download": "https://archivist.terraform.io/v1/object/dmF1b...", "shasums-sig-download": "https://archivist.terraform.io/v1/object/dmF1b..." } } } ``` \*\*Note:\*\* `shasums-uploaded` and `shasums-sig-uploaded` will be false if those files haven't been uploaded to Archivist yet. In this case, instead of including links to `shasums-download` and `shasums-sig-download`, the response will include upload links (`shasums-upload` and `shasums-sig-upload`). ## Delete a Version `DELETE /organizations/:organization\_name/registry-providers/:registry\_name/:namespace/:name/versions/:provider\_version` ### Parameters | Parameter | Description | | -------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `:organization\_name` | The name of the organization to delete a provider version from. The organization must already exist, and the token authenticating the API request must belong to the "owners" team or a member of the "owners" team. | | `:registry\_name` | Must be `private`. | | `:namespace` | The namespace of the provider for which the version is being deleted. For private providers this is the same as the `:organization\_name` parameter. | | `:name` | The name of the provider for which the version is being deleted. | | `:version` | The version for the provider that will be deleted along with its corresponding platforms. | [permissions-citation]: #intentionally-unused---keep-for-maintainers | Status | Response | Reason | | ------- | ------------------------- | ----------------------------------------------------------- | | [204][] | No Content | Success | | [403][] | [JSON API error object][] | Forbidden - public provider curation disabled | | [404][] | [JSON API error object][] | Provider not found or user not authorized to perform action | ### Sample Request ```shell curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request DELETE \ https://app.terraform.io/api/v2/organizations/hashicorp/registry-providers/public/hashicorp/aws/versions/3.1.1 ``` ## Create a Provider Platform `POST /organizations/:organization\_name/registry-providers/:registry\_name/:namespace/:name/versions/:version/platforms` Platforms are binaries that allow the provider to run on a particular operating system and architecture combination (e.g., Linux and AMD64). GoReleaser creates binaries automatically when you [create a release on GitHub](/terraform/registry/providers/publishing#creating-a-github-release) or [create a release locally](/terraform/registry/providers/publishing#using-goreleaser-locally). You must upload one or more platforms for each version of a private provider. After you create a platform, you must upload the platform binary file to the `provider-binary-upload` URL. ### Parameters | Parameter | Description | | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `:organization\_name` | The name of the organization to create a provider platform in. The organization must already exist, and the token authenticating the API request must belong to the "owners" team or a member of the "owners" team. | | `:registry\_name` | Must be `private`. | | `:namespace` | The namespace of the provider for which the platform is being created. For private providers this is the same as the `:organization\_name` parameter. | | `:name` | The name of the provider for which the platform is being created. | | `:version` | The provider version of the provider for which the platform is being created. | Creates a new registry provider platform. This endpoint only applies to private providers. | Status | Response | Reason | | ------- | ------------------------------------------------------------- | -------------------------------------------------------------- | | [201][] | [JSON API document][] (`type: "registry-provider-platforms"`) | Success | | [422][] | [JSON API error object][] | Malformed request body (missing attributes, wrong types, etc.) | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/private-registry/provider-versions-platforms.mdx | main | terraform | [
-0.006703606806695461,
0.06273660063743591,
-0.045415930449962616,
-0.031646762043237686,
0.04314437136054039,
-0.0538204126060009,
-0.024883819743990898,
-0.048164255917072296,
0.053722918033599854,
0.0700235515832901,
0.028100881725549698,
-0.07229720801115036,
0.016145123168826103,
0.00... | 0.033015 |
provider platform. This endpoint only applies to private providers. | Status | Response | Reason | | ------- | ------------------------------------------------------------- | -------------------------------------------------------------- | | [201][] | [JSON API document][] (`type: "registry-provider-platforms"`) | Success | | [422][] | [JSON API error object][] | Malformed request body (missing attributes, wrong types, etc.) | | [403][] | [JSON API error object][] | Forbidden - not available for public providers | | [404][] | [JSON API error object][] | User not authorized | ### Request Body This POST endpoint requires a JSON object with the following properties as a request payload. Properties without a default value are required. | Key path | Type | Default | Description | | ------------------------- | ------ | ------- | ------------------------------------- | | `data.type` | string | | Must be `"registry-provider-platforms"`. | | `data.attributes.os` | string | | A valid operating system string. | | `data.attributes.arch` | string | | A valid architecture string. | | `data.attributes.shasum` | string | | A valid shasum string. | | `data.attributes.filename` | string | | A valid filename string. | ### Sample Payload ```json { "data": { "type": "registry-provider-version-platforms", "attributes": { "os": "linux", "arch": "amd64", "shasum": "8f69533bc8afc227b40d15116358f91505bb638ce5919712fbb38a2dec1bba38", "filename": "terraform-provider-aws\_3.1.1\_linux\_amd64.zip" } } } ``` ### Sample Request ```shell curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request POST \ --data @payload.json \ https://app.terraform.io/api/v2/organizations/hashicorp/registry-providers/private/hashicorp/aws/versions/3.1.1/platforms ``` ### Sample Response ```json { "data": { "id": "provpltfrm-BLJWvWyJ2QMs525k", "type": "registry-provider-platforms", "attributes": { "os": "linux", "arch": "amd64", "filename": "terraform-provider-aws\_3.1.1\_linux\_amd64.zip", "shasum": "8f69533bc8afc227b40d15116358f91505bb638ce5919712fbb38a2dec1bba38", "permissions": { "can-delete": true, "can-upload-asset": true }, "provider-binary-uploaded": false }, "relationships": { "registry-provider-version": { "data": { "id": "provver-y5KZUsSBRLV9zCtL", "type": "registry-provider-versions" } } }, "links": { "provider-binary-upload": "https://archivist.terraform.io/v1/object/dmF1b..." } } } ``` ## Get All Platforms for a Single Version `GET /organizations/:organization\_name/registry-providers/:registry\_name/:namespace/:name/versions/:version/platforms` ### Parameters | Parameter | Description | | -------------------- | -------------------------------------------------------------------------------------------- | | `:organization\_name` | The name of the organization the provider belongs to. | | `:registry\_name` | Must be `private`. | | `:namespace` | The namespace of the provider. Must be the same as the `organization\_name` for the provider. | | `:name` | The provider name. | | `:version` | The version of the provider. | | Status | Response | Reason | | ------- | ---------------------------------------------------- | --------------------------------------------------------- | | [200][] | [JSON API document][] (`type: "registry-providers"`) | Success | | [403][] | [JSON API error object][] | Forbidden - public provider curation disabled | | [404][] | [JSON API error object][] | Provider not found or user unauthorized to perform action | ### Sample Request ```shell curl \ --request GET \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ https://app.terraform.io/api/v2/organizations/hashicorp/registry-providers/private/hashicorp/aws/versions/3.1.1/platforms ``` ### Sample Response ```json { "data": [ { "id": "provpltfrm-GSHhNzptr9s3WoLD", "type": "registry-provider-platforms", "attributes": { "os": "darwin", "arch": "amd64", "filename": "terraform-provider-aws\_3.1.1\_darwin\_amd64.zip", "shasum": "fd580e71bd76d76913e1925f2641be9330c536464af9a08a5b8994da65a26cbc", "permissions": { "can-delete": true, "can-upload-asset": true }, "provider-binary-uploaded": true }, "relationships": { "registry-provider-version": { "data": { "id": "provver-y5KZUsSBRLV9zCtL", "type": "registry-provider-versions" } } }, "links": { "provider-binary-download": "https://archivist.terraform.io/v1/object/dmF1b..." } }, { "id": "provpltfrm-A1PHitiM2KkKpVoM", "type": "registry-provider-platforms", "attributes": { "os": "darwin", "arch": "arm64", "filename": "terraform-provider-aws\_3.1.1\_darwin\_arm64.zip", "shasum": "de3c351d7f35a3c8c583c0da5c1c4d558b8cea3731a49b15f63de5bbbafc0165", "permissions": { "can-delete": true, "can-upload-asset": true }, "provider-binary-uploaded": true }, "relationships": { "registry-provider-version": { "data": { "id": "provver-y5KZUsSBRLV9zCtL", "type": "registry-provider-versions" } } }, "links": { "provider-binary-download": "https://archivist.terraform.io/v1/object/dmF1b..." } } ], "links": { "self": "https://app.terraform.io/api/v2/organizations/hashicorp/registry-providers/private/hashicorp/aws/versions/3.1.1/platforms?page%5Bnumber%5D=1&page%5Bsize%5D=20", "first": "https://app.terraform.io/api/v2/organizations/hashicorp/registry-providers/private/hashicorp/aws/versions/3.1.1/platforms?page%5Bnumber%5D=1&page%5Bsize%5D=20", "prev": null, "next": null, "last": "https://app.terraform.io/api/v2/organizations/hashicorp/registry-providers/private/hashicorp/aws/versions/3.1.1/platforms?page%5Bnumber%5D=1&page%5Bsize%5D=20" }, "meta": { "pagination": { "current-page": 1, "page-size": 20, "prev-page": null, "next-page": null, "total-pages": 1, "total-count": 2 } } } ``` \*\*Note:\*\* The `provider-binary-uploaded` property will be `false` if that file has not been uploaded to Archivist. In this case, instead of including a link to `provider-binary-download`, the response will include an upload link `provider-binary-upload`. ## Get a Platform `GET /organizations/:organization\_name/registry-providers/:registry\_name/:namespace/:name/versions/:version/platforms/:os/:arch` | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/private-registry/provider-versions-platforms.mdx | main | terraform | [
-0.08134625852108002,
0.05373052880167961,
-0.021476158872246742,
-0.03992171213030815,
-0.0005907193990424275,
-0.08369924128055573,
-0.03876281529664993,
-0.023046577349305153,
-0.0005596440751105547,
-0.008866586722433567,
0.02175554819405079,
-0.04072107747197151,
-0.029805628582835197,
... | 0.095034 |
"next-page": null, "total-pages": 1, "total-count": 2 } } } ``` \*\*Note:\*\* The `provider-binary-uploaded` property will be `false` if that file has not been uploaded to Archivist. In this case, instead of including a link to `provider-binary-download`, the response will include an upload link `provider-binary-upload`. ## Get a Platform `GET /organizations/:organization\_name/registry-providers/:registry\_name/:namespace/:name/versions/:version/platforms/:os/:arch` ### Parameters | Parameter | Description | | -------------------- | -------------------------------------------------------------------------------------------- | | `:organization\_name` | The name of the organization the provider belongs to. | | `:registry\_name` | Must be `private`. | | `:namespace` | The namespace of the provider. Must be the same as the `organization\_name` for the provider. | | `:name` | The provider name. | | `:version` | The version of the provider. | | `:os` | The operating system of the provider platform. | | `:arch` | The architecture of the provider platform. | | Status | Response | Reason | | ------- | ---------------------------------------------------- | --------------------------------------------------------- | | [200][] | [JSON API document][] (`type: "registry-providers"`) | Success | | [403][] | [JSON API error object][] | Forbidden - public provider curation disabled | | [404][] | [JSON API error object][] | Provider not found or user unauthorized to perform action | ### Sample Request ```shell curl \ --request GET \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ https://app.terraform.io/api/v2/organizations/hashicorp/registry-providers/private/hashicorp/aws/versions/3.1.1/platforms/linux/amd64 ``` ### Sample Response ```json { "data": { "id": "provpltfrm-BLJWvWyJ2QMs525k", "type": "registry-provider-platforms", "attributes": { "os": "linux", "arch": "amd64", "filename": "terraform-provider-aws\_3.1.1\_linux\_amd64.zip", "shasum": "8f69533bc8afc227b40d15116358f91505bb638ce5919712fbb38a2dec1bba38", "permissions": { "can-delete": true, "can-upload-asset": true }, "provider-binary-uploaded": true }, "relationships": { "registry-provider-version": { "data": { "id": "provver-y5KZUsSBRLV9zCtL", "type": "registry-provider-versions" } } }, "links": { "provider-binary-download": "https://archivist.terraform.io/v1/object/dmF1b..." } } } ``` \*\*Note:\*\* The `provider-binary-uploaded` property will be `false` if that file has not been uploaded to Archivist. In this case, instead of including a link to `provider-binary-download`, the response will include an upload link `provider-binary-upload`. ## Delete a Platform `DELETE /organizations/:organization\_name/registry-providers/:registry\_name/:namespace/:name/versions/:version/platforms/:os/:arch` ### Parameters | Parameter | Description | | -------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `:organization\_name` | The name of the organization to delete a provider platform from. The organization must already exist, and the token authenticating the API request must belong to the "owners" team or a member of the "owners" team. | | `:registry\_name` | Must be `private`. | | `:namespace` | The namespace of the provider for which the platform is being deleted. For private providers this is the same as the `:organization\_name` parameter. | | `:name` | The name of the provider for which the platform is being deleted. | | `:version` | The version for which the platform is being deleted. | | `:os` | The operating system of the provider platform that is being deleted. | | `:arch` | The architecture of the provider platform that is being deleted. | [permissions-citation]: #intentionally-unused---keep-for-maintainers | Status | Response | Reason | | ------- | ------------------------- | ----------------------------------------------------------- | | [204][] | No Content | Success | | [403][] | [JSON API error object][] | Forbidden - public provider curation disabled | | [404][] | [JSON API error object][] | Provider not found or user not authorized to perform action | ### Sample Request ```shell curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request DELETE \ https://app.terraform.io/api/v2/organizations/hashicorp/registry-providers/private/hashicorp/aws/versions/3.1.1/platforms/linux/amd64 ``` | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/private-registry/provider-versions-platforms.mdx | main | terraform | [
-0.045786209404468536,
0.010912560857832432,
-0.03394382447004318,
0.021110398694872856,
-0.0021229053381830454,
0.001964723924174905,
-0.059655144810676575,
-0.008431094698607922,
0.014855488203465939,
0.06443767994642258,
0.05182082951068878,
-0.02994934283196926,
0.03065735474228859,
-0... | 0.017796 |
[200]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/200 [201]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/201 [202]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/202 [400]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/400 [404]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/404 [409]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/409 [422]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/422 [500]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500 [JSON API document]: /terraform/cloud-docs/api-docs#json-api-documents [JSON API error object]: http://jsonapi.org/format/#error-objects # Query API reference Call query API endpoints to execute query runs against your HCP Terraform workspaces. Query runs retrieve information about workspace resources and configurations. They are asynchronous operations that you can monitor for status and results. ## Overview The scope of the API includes the following endpoints: | Method | Path | Action | |----------|-------------------------------------------------- |------------------------------------------------------------------------------------------------------------| | `POST` | `/queries` | Call this endpoint to [create a query run](#create-a-query-run). | | `GET` | `/workspaces/:workspace\_id/queries` | Call this endpoint to [list query runs for a workspace](#list-query-runs-for-a-workspace). | | `GET` | `/queries/:query\_id` | Call this endpoint to [show a query run](#show-a-query-run). | | `POST` | `/queries/:query\_id/actions/cancel` | Call this endpoint to [cancel a query run](#cancel-a-query-run). | ## Create a query run This endpoint creates a new query run. `POST /queries` | Status | Response | Reason | |---------|---------------------------|-----------------------------------------------------------------------| | [201][] | [JSON API document][] | Successfully created a query run. | | [404][] | [JSON API error object][] | Not found or the user is unauthorized to perform this action. | | [422][] | [JSON API error object][] | Malformed request body, such as missing attributes and wrong types. | | [500][] | [JSON API error object][] | Internal system failure. | ### Request body This `POST` endpoint requires a JSON object with the following properties as a request payload. Properties without a default value are required. | Key path | Type | Default | Description | |---------------------------------------------------|---------|------------------|-------------------------------------------------------------------------------------------------------------| | `data.type` | string | | Must be `"queries"`. | | `data.attributes.source` | string | | The source of the query such as query content or reference. | | `data.attributes.variables` | array[{key, value}] | (empty array) | Specifies an optional list of run-specific variable values. Refer to run-specific variables for details. | | `data.relationships.workspace.data.type` | string | | Must be `"workspaces"`. | | `data.relationships.workspace.data.id` | string | | The ID of the workspace to run the query against. | | `data.relationships.configuration-version.data.type` | string | | Must be `"configuration-versions"`. | | `data.relationships.configuration-version.data.id` | string | | The ID of the configuration version to use for the query. | ### Sample Payload ```json { "data": { "type": "queries", "attributes": { "source": "example-query-content", "variables": [ { "key": "replicas", "value": "2" } ] }, "relationships": { "workspace": { "data": { "type": "workspaces", "id": "ws-ABC123" } }, "configuration-version": { "data": { "type": "configuration-versions", "id": "cv-XYZ789" } } } } } ``` ### Sample Request ```shell $ curl\ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request POST \ --data @payload.json \ https://app.terraform.io/api/v2/queries ``` ### Sample Response ```json { "data": { "id": "query-ABC123", "type": "queries", "attributes": { "actions": { "is-cancelable": true, "is-force-cancelable": false }, "canceled-at": null, "updated-at": "2025-01-15T10:30:00.000Z", "created-at": "2025-01-15T10:30:00.000Z", "source": "example-query-content", "variables": [ { "key": "replicas", "value": "2" } ], "status-timestamps": { "pending-at": "2025-01-15T10:30:00.000Z", "queued-at": null, "errored-at": null, "canceled-at": null, "running-at": null, "finished-at": null }, "status": "pending", "log-read-url": "https://archivist.terraform.io/v1/object/...", }, "relationships": { "workspace": { "data": { "type": "workspaces", "id": "ws-ABC123" } }, "configuration-version": { "data": { "type": "configuration-versions", "id": "cv-XYZ789" } }, "created-by": { "data": { "type": "users", "id": "user-123" } }, "canceled-by": { "data": null } }, "links": { "self": "/api/v2/queries/query-ABC123" } } } ``` ## List query runs for a workspace This endpoint lists query runs for a particular workspace. `GET /workspaces/:workspace\_id/queries` | Parameter | Description | |------------------|-------------------------------------------------------| | `:workspace\_id` | The ID of the workspace to list query runs for. | ### Query parameters This endpoint supports pagination [with standard URL query parameters](/terraform/cloud-docs/api-docs#query-parameters). You must use percent-style encoding | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/queries/index.mdx | main | terraform | [
-0.045096538960933685,
0.0006415621028281748,
0.012682794593274593,
-0.03541349992156029,
-0.02271219529211521,
-0.10018382966518402,
-0.10176205635070801,
-0.09220628440380096,
0.00918811559677124,
0.02353793941438198,
0.02551814541220665,
0.04654669016599655,
0.003190860617905855,
0.0010... | 0.030111 |
a workspace This endpoint lists query runs for a particular workspace. `GET /workspaces/:workspace\_id/queries` | Parameter | Description | |------------------|-------------------------------------------------------| | `:workspace\_id` | The ID of the workspace to list query runs for. | ### Query parameters This endpoint supports pagination [with standard URL query parameters](/terraform/cloud-docs/api-docs#query-parameters). You must use percent-style encoding `[` as `%5B` and `]` as `%5D` if your tooling doesn't automatically encode URLs. | Parameter | Description | |----------------|------------------------------------------------------------------------------| | `page[number]` | Optional. If omitted, the endpoint returns the first page. | | `page[size]` | Optional. If omitted, the endpoint returns 20 query runs per page. | | Status | Response | Reason | |---------|---------------------------|----------------------------------------------------------------| | [200][] | [JSON API document][] | Successfully retrieved the list of query runs. | | [404][] | [JSON API error object][] | Not found or the user is unauthorized to perform this action. | ### Sample Request ```shell $ curl\ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ https://app.terraform.io/api/v2/workspaces/ws-ABC123/queries ``` ### Sample Response ```json { "data": [ { "id": "query-ABC123", "type": "queries", "attributes": { "canceled-at": null, "updated-at": "2025-01-15T10:35:00.000Z", "created-at": "2025-01-15T10:30:00.000Z", "source": "example-query-content", "variables": [ { "key": "replicas", "value": "2" } ], "status-timestamps": { "pending-at": "2025-01-15T10:30:00.000Z", "queued-at": "2025-01-15T10:30:05.000Z", "errored-at": null, "canceled-at": null, "running-at": "2025-01-15T10:30:10.000Z", "finished-at": "2025-01-15T10:35:00.000Z" }, "status": "finished", "log-read-url": "https://archivist.terraform.io/v1/object/..." }, "relationships": { "workspace": { "data": { "type": "workspaces", "id": "ws-ABC123" } }, "configuration-version": { "data": { "type": "configuration-versions", "id": "cv-XYZ789" } }, "created-by": { "data": { "type": "users", "id": "user-123" } }, "canceled-by": { "data": null } }, "links": { "self": "/api/v2/queries/query-ABC123" } } ], "links": { "self": "https://app.terraform.io/api/v2/workspaces/ws-ABC123/queries?page%5Bnumber%5D=1&page%5Bsize%5D=20", "first": "https://app.terraform.io/api/v2/workspaces/ws-ABC123/queries?page%5Bnumber%5D=1&page%5Bsize%5D=20", "prev": null, "next": null, "last": "https://app.terraform.io/api/v2/workspaces/ws-ABC123/queries?page%5Bnumber%5D=1&page%5Bsize%5D=20" }, "meta": { "pagination": { "current-page": 1, "page-size": 20, "prev-page": null, "next-page": null, "total-pages": 1, "total-count": 1 } } } ``` ## Show a query run This endpoint shows details for a specific query run. `GET /queries/:query\_id` | Parameter | Description | |-------------|------------------------------------------| | `:query\_id` | The ID of the query run to retrieve. | | Status | Response | Reason | |---------|---------------------------|----------------------------------------------------------------| | [200][] | [JSON API document][] | Successfully retrieved the query run. | | [404][] | [JSON API error object][] | Not found or the user is unauthorized to perform this action. | ### Sample Request ```shell $ curl\ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ https://app.terraform.io/api/v2/queries/query-ABC123 ``` ### Sample Response ```json { "data": { "id": "query-ABC123", "type": "queries", "attributes": { "actions": { "is-cancelable": true, "is-force-cancelable": false }, "canceled-at": null, "updated-at": "2025-01-15T10:30:15.000Z", "created-at": "2025-01-15T10:30:00.000Z", "source": "example-query-content", "variables": [ { "key": "replicas", "value": "2" } ], "status-timestamps": { "pending-at": "2025-01-15T10:30:00.000Z", "queued-at": "2025-01-15T10:30:05.000Z", "errored-at": null, "canceled-at": null, "running-at": "2025-01-15T10:30:10.000Z", "finished-at": null }, "status": "running", "log-read-url": "https://archivist.terraform.io/v1/object/...", }, "relationships": { "workspace": { "data": { "type": "workspaces", "id": "ws-ABC123" } }, "configuration-version": { "data": { "type": "configuration-versions", "id": "cv-XYZ789" } }, "created-by": { "data": { "type": "users", "id": "user-123" } }, "canceled-by": { "data": null } }, "links": { "self": "/api/v2/queries/query-ABC123" } } } ``` ## Cancel a query run This endpoint cancels a query run that is currently pending or running. `POST /queries/:query\_id/actions/cancel` | Parameter | Description | |-------------|--------------------------------------| | `:query\_id` | The ID of the query run to cancel. | | Status | Response | Reason | |---------|---------------------------|-----------------------------------------------------------------------| | [202][] | Empty body | Successfully canceled the query run. | | [409][] | [JSON API error object][] | Failed to transition query run to a canceled state. | ### Sample Request ```shell $ curl\ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request POST \ https://app.terraform.io/api/v2/queries/query-ABC123/actions/cancel ``` ## Query run attributes Query runs have the following attributes: ### Status The `status` attribute indicates the current state of the query run. | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/queries/index.mdx | main | terraform | [
-0.017184661701321602,
0.03611902892589569,
0.04666949808597565,
0.02376621961593628,
-0.05328952893614769,
-0.001065592048689723,
-0.05286038666963577,
-0.08430979400873184,
0.05692559480667114,
0.07594306021928787,
-0.05276930704712868,
-0.05560178682208061,
0.0519077330827713,
-0.016118... | -0.008473 |
query run to a canceled state. | ### Sample Request ```shell $ curl\ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request POST \ https://app.terraform.io/api/v2/queries/query-ABC123/actions/cancel ``` ## Query run attributes Query runs have the following attributes: ### Status The `status` attribute indicates the current state of the query run. Possible values are: - `pending`: The query run has been created but is not yet queued for execution. - `running`: The query run is currently executing. - `finished`: The query run completed successfully. - `canceled`: The query run was canceled before completion. - `errored`: The query run encountered an error during execution. ### Status timestamps The `status-timestamps` object contains timestamps for when the query run entered each status: - `pending-at`: When the query run was created. - `queued-at`: When the query run was queued for execution. - `running-at`: When the query run started executing. - `finished-at`: When the query run completed successfully. - `errored-at`: When the query run encountered an error. - `canceled-at`: When the query run was canceled. ### Log read URL The `log-read-url` attribute contains a URL to retrieve the logs for the query run. ## Available Related Resources The GET endpoints above can optionally return related resources, if requested with the [`include`](/terraform/cloud-docs/api-docs#inclusion-of-related-resources) query parameter. The following resource types are available: - `created-by` - The user who created the query run. - `configuration-version` - The configuration version used for the query run. - `configuration\_version.ingress\_attributes` - The ingress attributes for the configuration version used for the query run. | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/queries/index.mdx | main | terraform | [
-0.044946201145648956,
0.04363832250237465,
-0.01340238656848669,
0.056619275361299515,
-0.043030716478824615,
-0.06538791954517365,
-0.028655607253313065,
-0.09606073796749115,
0.09411806613206863,
0.12360182404518127,
-0.009352357126772404,
-0.0546448640525341,
0.021004220470786095,
-0.0... | 0.05882 |
[200]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/200 [404]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/404 [JSON API document]: /terraform/cloud-docs/api-docs#json-api-documents [JSON API documents]: /terraform/cloud-docs/api-docs#json-api-documents [JSON API error object]: https://jsonapi.org/format/#error-objects [run]: /terraform/cloud-docs/workspaces/run/states # Run task stages and results API reference HCP Terraform uses run task stages and run task results to track workspace [run task](/terraform/cloud-docs/workspaces/settings/run-tasks) execution. @include 'tfc-package-callouts/run-tasks.mdx' When HCP Terraform creates a [run][], it reads the run tasks associated to the workspace. Each run task in the workspace is configured to begin during a specific [run stage](/terraform/cloud-docs/workspaces/run/states). HCP Terraform creates a run task stage object for each run stage that triggers run tasks. You can configure run tasks during the [Pre-Plan Stage](/terraform/cloud-docs/workspaces/run/states#the-pre-plan-stage), [Post-Plan Stage](/terraform/cloud-docs/workspaces/run/states#the-post-plan-stage), [Pre-Apply Stage](/terraform/cloud-docs/workspaces/run/states#the-pre-apply-stage) and [Post-Apply Stage](/terraform/cloud-docs/workspaces/run/states#the-post-apply-stage). Run task stages then create a run task result for each run task. For example, a workspace has two run tasks called `alpha` and `beta`. For each run, HCP Terraform creates one run task stage called `post-plan`. That run task stage has two run task results: one for the `alpha` run task and one for the `beta` run task. This page lists the endpoints to retrieve run task stages and run task results. Refer to the [Run Tasks API](/terraform/cloud-docs/api-docs/run-tasks/run-tasks) for endpoints to create and manage run tasks within HCP Terraform. Refer to the [Run Tasks Integration API](/terraform/cloud-docs/api-docs/run-tasks/run-tasks-integration) for endpoints to build custom run tasks for the HCP Terraform ecosystem. ## Attributes ### Run Task Stage Status The run task stage status is found in `data.attributes.status`, and you can reference the following list of possible values. | Status | Description | |-------------------- |------------------------------------------------------------------------------------------------------------------------------------------- | | `pending` | The initial status of a run task stage after creation. | | `running` | The run task stage is executing one or more tasks, which have not yet completed. | | `passed` | All of the run task results in the stage passed. | | `failed` | One more results in the run task stage failed. | | `awaiting\_override` | The task stage is waiting for user input. Once a user manually overrides the failed run tasks, the run returns to the `running` state. | | `errored` | The run task stage has errored. | | `canceled` | The run task stage has been canceled. | | `unreachable` | The run task stage could not be executed. | ### Run Task Result Status The run task result status is found in `data.attributes.status`, and you can reference the following list of possible values. | Status | Description | |---------------|-----------------------------------------------------------------------| | `pending` | The initial status of a run task result after creation. | | `running` | The associated run task is begun execution and has not yet completed. | | `passed` | The associated run task executed and returned a passing result. | | `failed` | The associated run task executed and returned a failed result. | | `errored` | The associated run task has errored during execution. | | `canceled` | The associated run task execution has been canceled. | | `unreachable` | The associated run task could not be executed. | ## List the Run Task Stages in a Run `GET /runs/:run\_id/task-stages` | Parameter | Description | |-----------|-------------------------------------| | `run\_id` | The run ID to list task stages for. | | Status | Response | Reason | |---------|---------------------------------------------------------|---------------------------------| | [200][] | Array of [JSON API documents][] (`type: "task-stages"`) | Successfully listed task-stages | ### Query Parameters This endpoint supports pagination [with standard URL query parameters](/terraform/cloud-docs/api-docs#query-parameters); remember to percent-encode `[` as `%5B` and `]` as `%5D` if your tooling doesn't automatically encode URLs. | Parameter | Description | |----------------|----------------------------------------------------------------------| | `page[number]` | \*\*Optional.\*\* If omitted, the endpoint will return the first page. | | `page[size]` | \*\*Optional.\*\* | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/run-tasks/run-task-stages-and-results.mdx | main | terraform | [
-0.039210885763168335,
0.040626801550388336,
0.03351721912622452,
-0.012392889708280563,
-0.014130699448287487,
-0.03680389001965523,
-0.08242147415876389,
-0.04918128624558449,
0.05600558593869209,
0.03261880576610565,
-0.024762697517871857,
-0.06558792293071747,
0.02653314545750618,
0.04... | 0.027246 |
This endpoint supports pagination [with standard URL query parameters](/terraform/cloud-docs/api-docs#query-parameters); remember to percent-encode `[` as `%5B` and `]` as `%5D` if your tooling doesn't automatically encode URLs. | Parameter | Description | |----------------|----------------------------------------------------------------------| | `page[number]` | \*\*Optional.\*\* If omitted, the endpoint will return the first page. | | `page[size]` | \*\*Optional.\*\* If omitted, the endpoint will return 20 runs per page. | ### Sample Request ```shell curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ https://app.terraform.io/api/v2/runs/run-XdgtChJuuUwLoSmw/task-stages ``` ### Sample Response ```json { "data": [ { "id": "ts-rL5ZsuwfjqfPJcdi", "type": "task-stages", "attributes": { "status": "passed", "stage": "post\_plan", "status-timestamps": { "passed-at": "2022-06-08T20:32:12+08:00", "running-at": "2022-06-08T20:32:11+08:00" }, "created-at": "2022-06-08T12:31:56.94Z", "updated-at": "2022-06-08T12:32:12.315Z" }, "relationships": { "run": { "data": { "id": "run-XdgtChJuuUwLoSmw", "type": "runs" } }, "task-results": { "data": [ { "id": "taskrs-EmnmsEDL1jgd1GTP", "type": "task-results" } ] }, "policy-evaluations":{ "data":[ { "id":"poleval-iouaha9KLgGWkBRQ", "type":"policy-evaluations" } ] } }, "links": { "self": "/api/v2/task-stages/ts-rL5ZsuwfjqfPJcdi" } } ] } ``` ## Show a Run Task Stage `GET /task-stages/:task\_stage\_id` | Parameter | Description | |------------------|---------------------------| | `:task\_stage\_id` | The run task stage ID to get. | This endpoint shows details of a specific task stage. | Status | Response | Reason | |---------|-----------------------------------------------|---------------------------------------------| | [200][] | [JSON API document][] (`type: "task-stages"`) | Success | | [404][] | [JSON API error object][] | Task stage not found or user not authorized | ### Sample Request ```shell curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ https://app.terraform.io/api/v2/task-stages/ts-rL5ZsuwfjqfPJcdi ``` ### Sample Response ```json { "data": { "id": "ts-rL5ZsuwfjqfPJcdi", "type": "task-stages", "attributes": { "status": "passed", "stage": "post\_plan", "status-timestamps": { "passed-at": "2022-06-08T20:32:12+08:00", "running-at": "2022-06-08T20:32:11+08:00" }, "created-at": "2022-06-08T12:31:56.94Z", "updated-at": "2022-06-08T12:32:12.315Z" }, "relationships": { "run": { "data": { "id": "run-XdgtChJuuUwLoSmw", "type": "runs" } }, "task-results": { "data": [ { "id": "taskrs-EmnmsEDL1jgd1GTP", "type": "task-results" } ] }, "policy-evaluations":{ "data":[ { "id":"poleval-iouaha9KLgGWkBRQ", "type":"policy-evaluations" } ] } }, "links": { "self": "/api/v2/task-stages/ts-rL5ZsuwfjqfPJcdi" } } } ``` ## Show a Run Task Result `GET /task-results/:task\_result\_id` | Parameter | Description | |-------------------|----------------------------| | `:task\_result\_id` | The run task result ID to get. | This endpoint shows the details for a specific run task result. | Status | Response | Reason | |---------|------------------------------------------------|----------------------------------------------| | [200][] | [JSON API document][] (`type: "task-results"`) | Success | | [404][] | [JSON API error object][] | Task result not found or user not authorized | ### Sample Request ```shell curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ https://app.terraform.io/api/v2/task-results/taskrs-EmnmsEDL1jgd1GZz ``` ### Sample Response ```json { "data": { "id": "taskrs-EmnmsEDL1jgd1GZz", "type": "task-results", "attributes": { "message": "No issues found.\nSeverity threshold is set to low.", "status": "passed", "status-timestamps": { "passed-at": "2022-06-08T20:32:12+08:00", "running-at": "2022-06-08T20:32:11+08:00" }, "url": "https://external.service/project/task-123abc", "created-at": "2022-06-08T12:31:56.954Z", "updated-at": "2022-06-08T12:32:12.27Z", "task-id": "task-b6MaHZmGopHDtqhn", "task-name": "example-task", "task-url": "https://external.service/task-123abc", "stage": "post\_plan", "is-speculative": false, "workspace-task-id": "wstask-258juqenQeWb3DZz", "workspace-task-enforcement-level": "mandatory" }, "relationships": { "task-stage": { "data": { "id": "ts-rL5ZsuwfjqfPJczZ", "type": "task-stages" } } }, "links": { "self": "/api/v2/task-results/taskrs-EmnmsEDL1jgd1GZz" } } } ``` ## Available Related Resources ### Task Stage The GET endpoints above can optionally return related resources, if requested with [the `include` query parameter](/terraform/cloud-docs/api-docs#inclusion-of-related-resources). The following resource types are available: | Resource | Description | |--------------------- |---------------------------------------------------------- | | `run` | Information about the associated run. | | `run.workspace` | Information about the associated workspace. | | `task-results` | Information about the results for a task-stage. | | `policy-evaluations` | Information about the policy evaluations for a task-stage. | ## Override a Task Stage `POST /task-stages/:task\_stage\_id/actions/override` | Parameter | Description | | -------------------- | ----------------------------------------------------------------------------------------------- | | `:task\_stage\_id` | The ID of the task stage to override. | ### Sample Request ```shell curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request POST \ https://app.terraform.io/api/v2/task-stages/ts-rL5ZsuwfjqfPJcdi/actions/override ``` ### Sample Response ```json | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/run-tasks/run-task-stages-and-results.mdx | main | terraform | [
-0.03818555921316147,
0.07242624461650848,
0.040880363434553146,
-0.00400567427277565,
-0.07181310653686523,
0.002760050119832158,
-0.08391503244638443,
-0.09009389579296112,
0.06811966001987457,
0.10846797376871109,
-0.04165146127343178,
-0.0483456514775753,
0.07353295385837555,
-0.049947... | -0.023988 |
Task Stage `POST /task-stages/:task\_stage\_id/actions/override` | Parameter | Description | | -------------------- | ----------------------------------------------------------------------------------------------- | | `:task\_stage\_id` | The ID of the task stage to override. | ### Sample Request ```shell curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request POST \ https://app.terraform.io/api/v2/task-stages/ts-rL5ZsuwfjqfPJcdi/actions/override ``` ### Sample Response ```json { "data":{ "id":"ts-F7MumZQcJzVh1ZZk", "type":"task-stages", "attributes":{ "status":"running", "stage":"post\_plan", "status-timestamps":{ "running-at":"2022-09-21T06:36:54+00:00", "awaiting-override-at":"2022-09-21T06:31:50+00:00" }, "created-at":"2022-09-21T06:29:44.632Z", "updated-at":"2022-09-21T06:36:54.952Z", "permissions":{ "can-override-policy":true, "can-override-tasks":false, "can-override":true }, "actions":{ "is-overridable":false } }, "relationships":{ "run":{ "data":{ "id":"run-K6N4BAz8NfUyR2QB", "type":"runs" } }, "task-results":{ "data":[ ] }, "policy-evaluations":{ "data":[ { "id":"poleval-atNKxwvjYy4Gwk3k", "type":"policy-evaluations" } ] } }, "links":{ "self":"/api/v2/task-stages/ts-F7MumZQcJzVh1ZZk" } } } ``` | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/run-tasks/run-task-stages-and-results.mdx | main | terraform | [
-0.047169871628284454,
0.06590048968791962,
0.01397427637130022,
-0.02739892713725567,
-0.01682564988732338,
-0.058601319789886475,
-0.04053458198904991,
-0.014261479489505291,
0.03618759289383888,
0.10993122309446335,
-0.03388141468167305,
-0.05595261976122856,
0.005126637406647205,
-0.01... | 0.030088 |
[200]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/200 [401]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/401 [422]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/422 [JSON API error object]: https://jsonapi.org/format/#error-objects # Run tasks integration API [Run tasks](/terraform/cloud-docs/workspaces/settings/run-tasks) allow HCP Terraform to interact with external systems at specific points in the workspace run lifecycle. This page lists the API endpoints used to trigger a run task and the expected response from the integration. @include 'tfc-package-callouts/run-tasks.mdx' Refer to [run tasks](/terraform/cloud-docs/api-docs/run-tasks/run-tasks) for the API endpoints to create and manage run tasks within HCP Terraform. You can also access a complete list of all run tasks in the [Terraform Registry](https://registry.terraform.io/browse/run-tasks). ## Run Task Request When a run reaches the appropriate phase and a run task is triggered, HCP Terraform will send a request to the run task's URL. Either HCP Terraform itself, or a self-hosted HCP Terraform agent using [request forwarding](/terraform/cloud-docs/agents/request-forwarding) can make the request to a run task's URL. Your organization [must be entitled to `private-run-tasks`](/terraform/cloud-docs/api-docs#feature-entitlements) to use request forwarding. The service receiving the run task request should respond with `200 OK`, or HCP Terraform will retry to trigger the run task. `POST :url` | Parameter | Description | |-----------|---------------------------------------------------------| | `:url` | The URL configured in the run task to send requests to. | | Status | Response | Reason | |---------|------------|-----------------------------------| | [200][] | No Content | Successfully submitted a run task | ### Request Body The POST request submits a JSON object with the following properties as a request payload. #### Common Properties All request payloads contain the following properties. | Key path | Type | Values | Description | | ------------------------------------ | ------- | -------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `payload\_version` | integer | `1` | Schema version of the payload. Only `1` is supported. | | `stage` | string | `pre\_plan`, `post\_plan`, `pre\_apply`, `post\_apply` | The [run stage](/terraform/cloud-docs/workspaces/run/states) when HCP Terraform triggers the run task. | | `access\_token` | string | | Bearer token to use when calling back to HCP Terraform. | | `capabilities` | object | | A map of the capabilities that the caller supports. | | `capabilities.outcomes` | bool | | A flag indicating the caller accepts detailed run task outcomes. | | `configuration\_version\_download\_url` | string | | The URL to [download the configuration version](/terraform/cloud-docs/api-docs/configuration-versions#download-configuration-files). This is `null` if the configuration version is not available to download. | | `configuration\_version\_id` | string | | The ID of the [configuration version](/terraform/cloud-docs/api-docs/configuration-versions) for the run. | | `is\_speculative` | bool | | Whether the task is part of a [speculative run](/terraform/cloud-docs/workspaces/run/remote-operations#speculative-plans). | | `organization\_name` | string | | Name of the organization the task is configured within. | | `run\_app\_url` | string | | URL within HCP Terraform to the run. | | `run\_created\_at` | string | | When the run was started. | | `run\_created\_by` | string | | Who created the run. | | `run\_id` | string | | Id of the run this task is part of. | | `run\_message` | string | | Message that was associated with the run. | | `task\_result\_callback\_url` | string | | URL that should called back with the result of this task. | | `task\_result\_enforcement\_level` | string | `mandatory`, `advisory` | Enforcement level for this task. | | `task\_result\_id` | string | | ID of task result within HCP Terraform. | | `vcs\_branch` | string | | Repository branch that the workspace executes from. This is `null` if the workspace does not have a VCS repository. | | `vcs\_commit\_url` | string | | URL to the commit that triggered this run. This is `null` if the workspace does not a VCS repository. | | `vcs\_pull\_request\_url` | string | | URL to the Pull Request/Merge Request that | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/run-tasks/run-tasks-integration.mdx | main | terraform | [
-0.031506650149822235,
0.018096739426255226,
-0.004280367866158485,
-0.033794332295656204,
-0.04797213897109032,
-0.03961906209588051,
-0.06888885796070099,
-0.05666790157556534,
0.02916710264980793,
0.04141157120466232,
-0.05030439794063568,
-0.06402336806058884,
0.06800346821546555,
0.01... | 0.063739 |
`null` if the workspace does not have a VCS repository. | | `vcs\_commit\_url` | string | | URL to the commit that triggered this run. This is `null` if the workspace does not a VCS repository. | | `vcs\_pull\_request\_url` | string | | URL to the Pull Request/Merge Request that triggered this run. This is `null` if the run was not triggered. | | `vcs\_repo\_url` | string | | URL to the workspace's VCS repository. This is `null` if the workspace does not have a VCS repository. | | `workspace\_app\_url` | string | | URL within HCP Terraform to the workspace. | | `workspace\_id` | string | | Id of the workspace the task is associated with. | | `workspace\_name` | string | | Name of the workspace. | | `workspace\_working\_directory` | string | | The working directory specified in the run's [workspace settings](/terraform/cloud-docs/workspaces/settings#terraform-working-directory). | #### Post-Plan, Pre-Apply, and Post-Apply Properties Requests with `stage` set to `post\_plan`, `pre\_apply` or `post\_apply` contain the following additional properties. | Key path | Type | Values | Description | | ------------------- | ------ | ------ | --------------------------------------------------------- | | `plan\_json\_api\_url` | string | | The URL to retrieve the JSON Terraform plan for this run. | ### Sample Payload ```json { "payload\_version": 1, "stage": "post\_plan", "access\_token": "4QEuyyxug1f2rw.atlasv1.iDyxqhXGVZ0ykes53YdQyHyYtFOrdAWNBxcVUgWvzb64NFHjcquu8gJMEdUwoSLRu4Q", "capabilities": { "outcomes": true }, "configuration\_version\_download\_url": "https://app.terraform.io/api/v2/configuration-versions/cv-ntv3HbhJqvFzamy7/download", "configuration\_version\_id": "cv-ntv3HbhJqvFzamy7", "is\_speculative": false, "organization\_name": "hashicorp", "plan\_json\_api\_url": "https://app.terraform.io/api/v2/plans/plan-6AFmRJW1PFJ7qbAh/json-output", "run\_app\_url": "https://app.terraform.io/app/hashicorp/my-workspace/runs/run-i3Df5to9ELvibKpQ", "run\_created\_at": "2021-09-02T14:47:13.036Z", "run\_created\_by": "username", "run\_id": "run-i3Df5to9ELvibKpQ", "run\_message": "Triggered via UI", "task\_result\_callback\_url": "https://app.terraform.io/api/v2/task-results/5ea8d46c-2ceb-42cd-83f2-82e54697bddd/callback", "task\_result\_enforcement\_level": "mandatory", "task\_result\_id": "taskrs-2nH5dncYoXaMVQmJ", "vcs\_branch": "main", "vcs\_commit\_url": "https://github.com/hashicorp/terraform-random/commit/7d8fb2a2d601edebdb7a59ad2088a96673637d22", "vcs\_pull\_request\_url": null, "vcs\_repo\_url": "https://github.com/hashicorp/terraform-random", "workspace\_app\_url": "https://app.terraform.io/app/hashicorp/my-workspace", "workspace\_id": "ws-ck4G5bb1Yei5szRh", "workspace\_name": "tfr\_github\_0", "workspace\_working\_directory": "/terraform" } ``` ### Request Headers The POST request submits the following properties as the request headers. | Name | Value | Description | | ---------------------- | ------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `Content-Type` | `application/json` | Specifies the type of data in the request body | | `User-Agent` | `TFC/1.0 (+https://app.terraform.io; TFC)` | Identifies the request is coming from HCP Terraform | | `X-TFC-Task-Signature` | string | If the run task is configured with an [HMAC Key](/terraform/cloud-docs/integrations/run-tasks#securing-your-run-task), this header contains the signed SHA512 sum of the request payload using the configured HMAC key. Otherwise, this is an empty string. | ## Run Task Callback While a run task runs, it should send progressive updates to HCP Terraform with a `running` status. Once an integrator determines that Terraform supports detailed run task outcomes, they can send these outcomes by appending to the run task's callback payload. The request errors if HCP Terraform does not receive a progress update within 10 minutes or if the request runs for more than 60 minutes. Once the external integration fulfills the request, that integration must call back into HCP Terraform with the overall result of either `passed` or `failed`. You can send outcomes with a status of `running`, `passed`, or `failed`, but it is a good practice only to send outcomes when a run task is `running`. `PATCH :callback\_url` | Parameter | Description | | --------------- | ---------------------------------------------------------------- | | `:callback\_url` | The `task\_result\_callback\_url` specified in the run task request. Typically `/task-results/:guid/callback`. | | Status | Response | Reason | | ------- | ------------------------- | ---------------------------------------- | | [200][] | No Content | Successfully submitted a run task result | | [401][] | [JSON API error object][] | Not authorized to perform action | | [422][] | [JSON API error object][] | Invalid response payload. This could be caused by invalid attributes, or sending a status that is not accepted. | ### Request Body The PATCH request submits a JSON object with the following properties as a request payload. This payload is also described | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/run-tasks/run-tasks-integration.mdx | main | terraform | [
-0.04173002019524574,
-0.018786754459142685,
-0.003642100840806961,
0.01445764023810625,
-0.014541812241077423,
0.0017754610162228346,
0.007900508120656013,
-0.034098681062459946,
0.0427817739546299,
0.08455545455217361,
0.015394706279039383,
-0.15314677357673645,
-0.010603629052639008,
-0... | 0.048584 |
| [422][] | [JSON API error object][] | Invalid response payload. This could be caused by invalid attributes, or sending a status that is not accepted. | ### Request Body The PATCH request submits a JSON object with the following properties as a request payload. This payload is also described in the [JSON schema for run task results](https://github.com/hashicorp/web-unified-docs/blob/main/content/terraform-docs-common/public/schema/run-tasks/runtask-result.json). | Key path | Type | Description | | ----------------------------- | ------ | --------------------------------------------------------------------------------- | | `data.type` | string | Must be `"task-results"`. | | `data.attributes.status` | string | The current status of the task. Only `passed`, `failed` or `running` are allowed. | | `data.attributes.message` | string | (Recommended, but optional) A short message describing the status of the task. | | `data.attributes.url` | string | (Optional) A URL where users can obtain more information about the task. | | `relationships.outcomes.data` | array | (Recommended, but optional) A collection of detailed run task outcomes. | Status values other than passed, failed, or running return an error. Both the passed and failed statuses represent a final state for a run task. The running status allows one or more partial updates until the task has reached a final state. ```json { "data": { "type": "task-results", "attributes": { "status": "passed", "message": "4 passed, 0 skipped, 0 failed", "url": "https://external.service.dev/terraform-plan-checker/run-i3Df5to9ELvibKpQ" }, "relationships": { "outcomes": { "data": [...] } } } } ``` #### Outcomes Payload Body A run task result may optionally contain one or more detailed outcomes, which improves result visibility and content in the HCP Terraform user interface. The following attributes define the outcome. | Key path | Type | Description | | ------------------ | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `outcome-id` | string | A partner supplied identifier for this outcome. | | `description` | string | A one-line description of the result. | | `body` | string | (Optional) A detailed message for the result in markdown format. We recommend limiting messages to under 1MB with a maximum allowable limit of 5MB. | | `url` | string | (Optional) A URL that a user can navigate to for more information about this result. | | `tags` | object | (Optional) An object containing tag arrays, named by the property key. | | `tags.key` | string | The two or three word name of the header tag. [Special handling](#severity-and-status-tags) is given to `severity` and `status` keys. | | `tags.key[].label` | string | The text value of the tag. | | `tags.key[].level` | enum string | (Optional) The error level for the tag. Defaults to `none`, but accepts `none`, `info`, `warning`, or `error`. For levels other than `none`, labels render with a color and icon for that level. | ##### Severity and Status Tags Run task outcomes with tags named "severity" or "status" are enriched within the outcomes display list in HCP Terraform, enabling an earlier response to issues with severity and status. ```json { "type": "task-result-outcomes", "attributes": { "outcome-id": "PRTNR-CC-TF-127", "description": "ST-2942: S3 Bucket will not enforce MFA login on delete requests", "tags": { "Status": [ { "label": "Denied", "level": "error" } ], "Severity": [ { "label": "High", "level": "error" }, { "label": "Recoverable", "level": "info" } ], "Cost Centre": [ { "label": "IT-OPS" } ] }, "body": "# Resolution for issue ST-2942\n\n## Impact\n\nFollow instructions in the [AWS S3 docs](https://docs.aws.amazon.com/AmazonS3/latest/userguide/MultiFactorAuthenticationDelete.html) to manually configure the MFA setting.\n—-- Payload truncated —--", "url": "https://external.service.dev/result/PRTNR-CC-TF-127" } } ``` ##### Complete Callback Payload Example The example below shows a complete payload explaining the data structure of a callback payload, including all the necessary fields. ```json { "data": { "type": "task-results", "attributes": { "status": "failed", "message": "0 passed, 0 skipped, | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/run-tasks/run-tasks-integration.mdx | main | terraform | [
-0.028497129678726196,
0.04326380416750908,
0.03824716433882713,
0.001162096974439919,
-0.05742257088422775,
-0.09597902745008469,
-0.0742557942867279,
-0.07800816744565964,
-0.004952468443661928,
0.07746981829404831,
-0.012040405534207821,
-0.108838751912117,
0.007178650237619877,
0.01044... | 0.051779 |
MFA setting.\n—-- Payload truncated —--", "url": "https://external.service.dev/result/PRTNR-CC-TF-127" } } ``` ##### Complete Callback Payload Example The example below shows a complete payload explaining the data structure of a callback payload, including all the necessary fields. ```json { "data": { "type": "task-results", "attributes": { "status": "failed", "message": "0 passed, 0 skipped, 1 failed", "url": "https://external.service.dev/terraform-plan-checker/run-i3Df5to9ELvibKpQ" }, "relationships": { "outcomes": { "data": [ { "type": "task-result-outcomes", "attributes": { "outcome-id": "PRTNR-CC-TF-127", "description": "ST-2942: S3 Bucket will not enforce MFA login on delete requests", "tags": { "Status": [ { "label": "Denied", "level": "error" } ], "Severity": [ { "label": "High", "level": "error" }, { "label": "Recoverable", "level": "info" } ], "Cost Centre": [ { "label": "IT-OPS" } ] }, "body": "# Resolution for issue ST-2942\n\n## Impact\n\nFollow instructions in the [AWS S3 docs](https://docs.aws.amazon.com/AmazonS3/latest/userguide/MultiFactorAuthenticationDelete.html) to manually configure the MFA setting.\n—-- Payload truncated —--", "url": "https://external.service.dev/result/PRTNR-CC-TF-127" } } ] } } } } ``` ### Request Headers The PATCH request must use the token supplied in the originating request (`access\_token`) for [authentication](/terraform/cloud-docs/api-docs#authentication). | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/run-tasks/run-tasks-integration.mdx | main | terraform | [
-0.06795560568571091,
0.040290411561727524,
0.014370744116604328,
0.003688468597829342,
0.04100790247321129,
-0.08241811394691467,
-0.048107463866472244,
-0.06297808140516281,
0.08021802455186844,
0.06101967766880989,
-0.004898080602288246,
-0.06929590553045273,
0.022205060347914696,
0.048... | 0.002757 |
[200]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/200 [201]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/201 [202]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/202 [204]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/204 [400]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/400 [401]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/401 [403]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/403 [404]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/404 [409]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/409 [412]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/412 [422]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/422 [429]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429 [500]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500 [504]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504 [JSON API document]: /terraform/cloud-docs/api-docs#json-api-documents [JSON API error object]: https://jsonapi.org/format/#error-objects [JSON API Schema document]: https://github.com/hashicorp/terraform-docs-common/blob/main/website/public/schema/run-tasks/runtask-results.json # Run tasks API reference [Run tasks](/terraform/cloud-docs/workspaces/settings/run-tasks) allow HCP Terraform workspaces interact with external systems at specific points in the HCP Terraform run lifecycle. Run tasks are reusable configurations that you can associate to any workspace in an organization. This page lists the API endpoints for run tasks in an organization and explains how to associate run tasks to workspaces. @include 'tfc-package-callouts/run-tasks.mdx' Refer to [run tasks Integration](/terraform/cloud-docs/api-docs/run-tasks/run-tasks-integration) for the API endpoints related triggering run tasks and the expected integration response. ## Required Permissions To interact with run tasks on an organization, you need the [Manage Run Tasks permission](/terraform/cloud-docs/users-teams-organizations/permissions/organization#manage-run-tasks). To associate or dissociate run tasks in a workspace, you need the [Manage Workspace Run Tasks permission](/terraform/cloud-docs/users-teams-organizations/permissions/workspace#manage-workspace-run-tasks) on that particular workspace. [permissions-citation]: #intentionally-unused---keep-for-maintainers ## Create a Run Task `POST /organizations/:organization\_name/tasks` | Parameter | Description | | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `:organization\_name` | The organization to create a run task in. The organization must already exist in HCP Terraform, and the token authenticating the API request must have [owner permission](/terraform/cloud-docs/users-teams-organizations/permissions/organization#organization-owners). | [permissions-citation]: #intentionally-unused---keep-for-maintainers | Status | Response | Reason | | ------- | --------------------------------------- | -------------------------------------------------------------- | | [201][] | [JSON API document][] (`type: "tasks"`) | Successfully created a run task | | [404][] | [JSON API error object][] | Organization not found, or user unauthorized to perform action | | [422][] | [JSON API error object][] | Malformed request body (missing attributes, wrong types, etc.) | ### Request Body This POST endpoint requires a JSON object with the following properties as a request payload. Properties without a default value are required unless otherwise specified. | Key path | Type | Default | Description | | -------------------------------------------------------- | ------ | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `data.type` | string | | Must be `"tasks"`. | | `data.attributes.name` | string | | The name of the task. Can include letters, numbers, `-`, and `\_`. | | `data.attributes.url` | string | | URL to send a run task payload. | | `data.attributes.description` | string | | The description of the run task. Can be up to 300 characters long including spaces, letters, numbers, and special characters. | | `data.attributes.category` | string | | Must be `"task"`. | | `data.attributes.hmac-key` | string | | (Optional) HMAC key to verify run task. | | `data.attributes.enabled` | bool | true | (Optional) Whether the task will be run. | | `data.attributes.global-configuration.enabled` | bool | false | (Optional) Whether the task will be associated on all workspaces. | | `data.attributes.global-configuration.stages` | array | | (Optional) An array of strings representing the stages of the run lifecycle when the run task should begin. Must be one or more of `"pre\_plan"`, `"post\_plan"`, `"pre\_apply"`, or `"post\_apply"`. | | `data.attributes.global-configuration.enforcement-level` | string | | (Optional) The enforcement level of the workspace task. Must be `"advisory"` or `"mandatory"`. | | `data.relationships.agent-pool.data.id` | string | | (Optional) The agent pool that HCP Terraform uses to make requests for the run task. Requires [HCP Terraform Premium plan](https://www.hashicorp.com/en/pricing?tab=terraform), the [`private\_run\_tasks` feature entitlement](/terraform/cloud-docs/api-docs#feature-entitlements), and a self-hosted HCP Terraform agent with [request forwarding](/terraform/cloud-docs/agents/request-forwarding). | ### Sample Payload ```json { "data": { "type": "tasks", "attributes": { "name": "example", "url": "http://example.com", "description": "Simple description", "hmac\_key": "secret", "enabled": "true", "category": "task", "global-configuration": { "enabled": true, "stages": ["pre\_plan"], "enforcement-level": "mandatory" } }, "relationships": { "agent-pool": { "data": { "id": "apool-yoGUFz5zcRMMz53i", "type": "agent-pools" } } } } } ``` ### Sample Request | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/run-tasks/run-tasks.mdx | main | terraform | [
-0.015784088522195816,
-0.01700746826827526,
-0.018668580800294876,
-0.028096551075577736,
-0.024631375446915627,
-0.08318780362606049,
-0.0621652752161026,
-0.07521579414606094,
-0.005580500699579716,
-0.03855427727103233,
0.03281282261013985,
0.0540321059525013,
0.006812138482928276,
-0.... | 0.052879 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.