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 # Workspace resources API reference ## List Workspace Resources `GET /workspaces/:workspace\_id/resources` | Parameter | Description | | --------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `:workspace\_id` | The ID of the workspace to retrieve resources from. 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: "resources"`) | Request was successful. | | [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 | | -------------- | ----------------------------------------------------------------------------------- | | `page[number]` | \*\*Optional.\*\* If omitted, the endpoint will return the first page. | | `page[size]` | \*\*Optional.\*\* If omitted, the endpoint will return 20 workspace resources per page. | ### Permissions To list resources the user must have permission to read resources 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-DiTzUDRpjrArAfSS/resources ``` ### Sample Response ```json { "data": [ { "id": "wsr-KNYb3Jj3JTBgoBFs", "type": "resources", "attributes": { "address": "random\_pet.animal", "name": "animal", "created-at": "2021-10-27", "updated-at": "2021-10-27", "module": "root", "provider": "hashicorp/random", "provider-type": "random\_pet", "modified-by-state-version-id": "sv-y4pjfGHkGUBAa9AX", "name-index": null } }, { "id": "wsr-kYsf5A3hQ1y9zFWq", "type": "resources", "attributes": { "address": "random\_pet.animal2", "name": "animal2", "created-at": "2021-10-27", "updated-at": "2021-10-27", "module": "root", "provider": "hashicorp/random", "provider-type": "random\_pet", "modified-by-state-version-id": "sv-y4pjfGHkGUBAa9AX", "name-index": null } } ], "links": { "self": "https://app.terraform.io/api/v2/workspaces/ws-DiTzUDRpjrArAfSS/resources?page%5Bnumber%5D=1&page%5Bsize%5D=20", "first": "https://app.terraform.io/api/v2/workspaces/ws-DiTzUDRpjrArAfSS/resources?page%5Bnumber%5D=1&page%5Bsize%5D=20", "prev": null, "next": null, "last": "https://app.terraform.io/api/v2/workspaces/ws-DiTzUDRpjrArAfSS/resources?page%5Bnumber%5D=1&page%5Bsize%5D=20" }, ... } ```
https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/workspace-resources.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 [speculative plans]: /terraform/cloud-docs/run/remote-operations#speculative-plans # Workspaces API reference This topic provides reference information about the workspaces AP. Workspaces represent running infrastructure managed by Terraform. ## Overview The scope of the API includes the following endpoints: | Method | Path | Action | | --- | --- | --- | | `POST` | `/organizations/:organization\_name/workspaces` | Call this endpoint to [create a workspace](#create-a-workspace). You can apply tags stored as key-value pairs when creating the workspace. | | `POST` | `/organizations/:organization\_name/workspaces/:name/actions/safe-delete` | Call this endpoint to [safely delete a workspace](#safe-delete-a-workspace) by querying the organization and workspace names. | | `POST` | `/workspaces/:workspace\_id/actions/safe-delete` | Call this endpoint [safely delete a workspace](#safe-delete-a-workspace) by querying the workspace ID. | |`POST` | `/workspaces/:workspace\_id/actions/lock` | Call this endpoint to [lock a workspace](#lock-a-workspace). | | `POST` | `/workspaces/:workspace\_id/actions/unlock` | Call this endpoint to [unlock a workspace](#unlock-a-workspace).| | `POST` | `/workspaces/:workspace\_id/actions/force-unlock` | Call this endpoint to [force a workspace to unlock](#force-unlock-a-workspace). | | `POST` | `/workspaces/:workspace\_id/relationships/remote-state-consumers` | Call this endpoint to [add remote state consumers](#get-remote-state-consumers). | | `POST` | `/workspaces/:workspace\_id/relationships/tags` | Call this endpoint to [bind flat string tags to an existing workspace](#add-tags-to-a-workspace). | | `POST` | `/workspaces/:workspace\_id/relationships/data-retention-policy` | Call this endpoint to [show the workspace data retention policy](#show-data-retention-policy). | | `GET` | `/organizations/:organization\_name/workspaces` | Call this endpoint to [list existing workspaces](#list-workspaces). Each project in the response contains a link to `effective-tag-bindings` and `tag-bindings` collections. You can filter the response by tag keys and values using a query string parameter. | | `GET` | `/organizations/:organization\_name/workspaces/:name` | Call this endpoint to [show workspace details](#show-workspace) by querying the organization and workspace names. | | `GET` | `/workspaces/:workspace\_id` | Call this endpoint to [show workspace details](#show-workspace). | | `GET` | `/workspaces/:workspace\_id/relationships/remote-state-consumers` | Call this endpoint to [list remote state consumers](#get-remote-state-consumers). | | `GET` | `/workspaces/:workspace\_id/relationships/tags` | Call this endpoint to [list flat string workspace tags](#get-tags). | | `GET` | `/workspaces/:workspace\_id/tag-bindings` | Call this endpoint to [list workspace key-value tags](#get-tags) bound directly to this workspace. | | `GET` | `/workspaces/:workspace\_id/effective-tag-bindings` | Call this endpoint to [list all workspace key-value tags](#get-tags), including both those bound directly to the workspace as well as those inherited from the parent project. | | `GET` | `/workspaces/:workspace\_id/relationships/data-retention-policy` | Call this endpoint to [show the workspace data retention policy](#show-data-retention-policy). | | `PATCH` | `/workspaces/:workspace\_id/relationships/ssh-key` | Call this endpoint to manage SSH key assignments for workspaces. Refer to [Assign an SSH key to a workspace](#assign-an-ssh-key-to-a-workspace) and [Unassign an SSH key from a workspace](#unassign-an-ssh-key-from-a-workspace) for instructions. | | `PATCH` | `/workspaces/:workspace\_id` | Call this endpoint to [update a workspace](#update-a-workspace). You can apply tags stored as key-value pairs when updating the workspace. | | `PATCH` | `/organizations/:organization\_name/workspaces/:name` | Call this endpoint to [update a workspace](#update-a-workspace) by querying the organization and workspace names. | | `PATCH` | `/workspaces/:workspace\_id/relationships/remote-state-consumers` | Call this endpoint to [replace remote state consumers](#replace-remote-state-consumers). | | `DELETE` | `/workspaces/:workspace\_id/relationships/remote-state-consumers` | Call this endpoint to [delete remote state consumers](#delete-remote-state-consumers). | | `DELETE` | `/workspaces/:workspace\_id/relationships/tags` | Call this endpoint to [delete flat string workspace tags](#remove-tags-from-workspace) from the workspace. | | `DELETE` | `/workspaces/:workspace\_id/relationships/data-retention-policy` | Call this endpoint to [remove a workspace data retention policy](#remove-data-retention-policy). | | `DELETE` | `/workspaces/:workspace\_id` | Call this endpoint to [force delete a workspace](#force-delete-a-workspace), which deletes the workspace without first checking for managed resources.| | `DELETE` | `/organizations/:organization\_name/workspaces/:name` | Call this endpoint to [force delete a workspace](#force-delete-a-workspace), which deletes the workspace without first checking for managed resources, by querying the organization and workspace
https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/workspaces.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
| `/workspaces/:workspace\_id` | Call this endpoint to [force delete a workspace](#force-delete-a-workspace), which deletes the workspace without first checking for managed resources.| | `DELETE` | `/organizations/:organization\_name/workspaces/:name` | Call this endpoint to [force delete a workspace](#force-delete-a-workspace), which deletes the workspace without first checking for managed resources, by querying the organization and workspace names. | ## Requirements - You must be a member of a team with the \*\*Read\*\* permission enabled for Terraform runs to view workspaces. - You must be a member of a team with the \*\*Admin\*\* permissions enabled on the workspace to change settings and force-unlock it. - You must be a member of a team with the \*\*Lock/unlock\*\* permission enabled to lock and unlock the workspace. - You must meet one of the following requirements to create a workspace: - Be the team owner - Be on a team with the \*\*Manage all workspaces\*\* permission enabled - Present an [organization API token](/terraform/cloud-docs/users-teams-organizations/api-tokens#organization-api-tokens) when calling the API. Refer to [Workspace Permissions](/terraform/cloud-docs/users-teams-organizations/permissions/workspace) for additional information. [permissions-citation]: #intentionally-unused---keep-for-maintainers ## Create a Workspace Use the following endpoint to create a new workspace: `POST /organizations/:organization\_name/workspaces` | Parameter | Description | | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `:organization\_name` | The name of the organization to create the workspace in. The organization must already exist in the system, and the user must have permissions to create new workspaces. | ### Request Body This POST endpoint requires a JSON object with the following properties as a request payload. Properties without a default value are required. By supplying the necessary attributes under a `vcs-repository` object, you can create a workspace that is configured against a VCS Repository. | Key path | Type | Default | Description | |--- | --- | ---| ---| | `data.type` | string | none | Must be `"workspaces"`. | | `data.attributes.name` | string | none | The name of the workspace. Workspace names can only include letters, numbers, `-`, and `\_`. The name a unique identifier n the organization. | | `data.attributes.agent-pool-id` | string | none | Required when `execution-mode` is set to `agent`. The ID of the agent pool belonging to the workspace's organization. This value must not be specified if `execution-mode` is set to `remote` or `local` or if `operations` is set to `true`. | | `data.attributes.allow-destroy-plan` | boolean | `true` | Whether destroy plans can be queued on the workspace. | | `data.attributes.assessments-enabled` | boolean | `false` | (previously `drift-detection`) Whether or not HCP Terraform performs health assessments for the workspace. May be overridden by the organization setting `assessments-enforced`. Only available for Standard tier organizations, in workspaces running Terraform version 0.15.4+ and operating in [Remote execution mode](/terraform/cloud-docs/workspaces/settings#execution-mode). | | `data.attributes.auto-apply` | boolean | `false` | Whether to automatically apply changes when a Terraform plan is successful in runs initiated by VCS, UI or CLI, [with some exceptions](/terraform/cloud-docs/workspaces/settings#auto-apply-and-manual-apply). | | `data.attributes.auto-apply-run-trigger` | boolean | `false` | Whether to automatically apply changes when a Terraform plan is successful in runs initiated by run triggers. | | `data.attributes.auto-destroy-at` | string | (nothing) | Timestamp when the next scheduled destroy run will occur, refer to [Scheduled Destroy](/terraform/cloud-docs/workspaces/settings/deletion#automatically-destroy). | | `data.attributes.auto-destroy-activity-duration`| string | (nothing) | Value and units for [automatically scheduled destroy runs based on workspace activity](/terraform/cloud-docs/workspaces/settings/deletion#automatically-destroy). Valid values are greater than 0 and four digits or less. Valid units are `d` and `h`. For example, to queue destroy runs after fourteen days of inactivity set `auto-destroy-activity-duration: "14d"`. | | `data.attributes.description` | string | (nothing) | A description for the workspace. | | `data.attributes.execution-mode` | string | (nothing) | Which [execution mode](/terraform/cloud-docs/workspaces/settings#execution-mode) to use. Valid values are `remote`, `local`, and `agent`. When set to `local`,
https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/workspaces.mdx
main
terraform
[ -0.0496993362903595, -0.016819780692458153, -0.019284343346953392, 0.04202168062329292, 0.0462861992418766, -0.06242205202579498, 0.022831177338957787, -0.1542978733778, 0.04819649085402489, 0.09752321243286133, -0.022458551451563835, -0.0506848506629467, 0.04530438408255577, 0.07560034096...
0.058896
example, to queue destroy runs after fourteen days of inactivity set `auto-destroy-activity-duration: "14d"`. | | `data.attributes.description` | string | (nothing) | A description for the workspace. | | `data.attributes.execution-mode` | string | (nothing) | Which [execution mode](/terraform/cloud-docs/workspaces/settings#execution-mode) to use. Valid values are `remote`, `local`, and `agent`. When set to `local`, the workspace will be used for state storage only. This value \_must not\_ be specified if `operations` is specified, and \_must\_ be specified if `setting-overwrites.execution-mode` is set to `true`. | | `data.attributes.file-triggers-enabled` | boolean | `true` | Whether to filter runs based on the changed files in a VCS push. If enabled, it uses either `trigger-prefixes` in conjunction with `working\_directory` or `trigger-patterns` to describe the set of changed files that will start a run. If disabled, any push triggers a run. | | `data.attributes.global-remote-state` | boolean | `false` | Enables all workspaces in the organization to [access this workspace's state data](/terraform/enterprise/workspaces/state) during runs. On HCP Terraform, if it's set to `false`, then only specifically approved workspaces can access its state. On Terraform Enterprise, do not set to `true` if `project-remote-state` is also `true`. Refer to [Remote State Consumers](/terraform/enterprise/api-docs/workspaces#get-remote-state-consumers) for information about managing allowed workspaces. | | `data.attributes.operations` | boolean | `true` | \*\*DEPRECATED\*\* Use `execution-mode` instead. Whether to use remote execution mode. When set to `false`, the workspace will be used for state storage only. This value must not be specified if `execution-mode` is specified. | | `data.attributes.project-remote-state` | boolean | `false` | Requires [Terraform Enterprise](/terraform/enterprise). Enables all workspaces in the project to [access this workspace's state data](/terraform/enterprise/workspaces/state) during runs. Do not set to `true` if `global-remote-state` is also `true`. Refer to [Remote State Consumers](/terraform/enterprise/api-docs/workspaces#get-remote-state-consumers) for information about managing allowed workspaces. Only available in Terraform Enterprise 1.1.0 or later. | | `data.attributes.queue-all-runs` | boolean | `false` | Whether runs should be queued immediately after workspace creation. When set to false, runs triggered by a VCS change will not be queued until at least one run is manually queued. | | `data.attributes.source-name` | string | none | A friendly name for the application or client creating this workspace. If set, this will be displayed on the workspace as "Created via ``". | | `data.attributes.source-url` | string | none | A URL for the application or client creating this workspace. This can be the URL of a related resource in another app, or a link to documentation or other info about the client. | | `data.attributes.speculative-enabled` | boolean | `true` | Whether this workspace 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. It doesn't prevent manual speculative plans via the CLI or the runs API. | | `data.attributes.terraform-version` | string | latest release | Specifies the version of Terraform to use for this workspace. You can specify an exact version or a [version constraint](/terraform/language/expressions/version-constraints) such as `~> 1.0.0`. If you specify a constraint, the workspace always uses the newest release that meets that constraint. If omitted when creating a workspace, this defaults to the latest released version. | | `data.attributes.trigger-patterns` | array | `[]` | List of glob patterns that describe the files HCP Terraform monitors for changes. Trigger patterns are always appended to the root directory of the repository. | | `data.attributes.trigger-prefixes` | array | `[]` | List of trigger prefixes that describe the paths HCP Terraform monitors for changes, in addition to the working directory. Trigger prefixes are always appended to the root directory of the repository. HCP Terraform starts a run when files are changed in
https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/workspaces.mdx
main
terraform
[ -0.01915539987385273, 0.00156175228767097, 0.04924852028489113, 0.05439490079879761, -0.004924539476633072, -0.026114676147699356, 0.018957218155264854, -0.09526253491640091, 0.05089380964636803, 0.09012313932180405, 0.005807965062558651, 0.00007084258686518297, 0.005004756152629852, -0.02...
0.030307
repository. | | `data.attributes.trigger-prefixes` | array | `[]` | List of trigger prefixes that describe the paths HCP Terraform monitors for changes, in addition to the working directory. Trigger prefixes are always appended to the root directory of the repository. HCP Terraform starts a run when files are changed in any directory path matching the provided set of prefixes. | | `data.attributes.vcs-repo.branch` | string | repository's default branch | The repository branch that Terraform executes from. If omitted or submitted as an empty string, this defaults to the repository's default branch. | | `data.attributes.vcs-repo.identifier` | string | none | 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. The format for Azure DevOps is `:org/:project/\_git/:repo`. | | `data.attributes.vcs-repo.ingress-submodules` | boolean | `false` | Whether submodules should be fetched when cloning the VCS repository. | | `data.attributes.vcs-repo.oauth-token-id` | string | none | Specifies the VCS OAuth connection and token. Call the [`oauth-tokens`](/terraform/cloud-docs/api-docs/oauth-tokens) endpoint to retrieve the OAuth ID. | | `data.attributes.vcs-repo.tags-regex` | string | none | A regular expression used to match Git tags. HCP Terraform triggers a run when this value is present and a VCS event occurs that contains a matching Git tag for the regular expression.| | `data.attributes.vcs-repo` | object | none | Settings for the workspace's VCS repository. If omitted, the workspace is created without a VCS repo. If included, you must specify at least the `oauth-token-id` and `identifier` keys. | | `data.attributes.working-directory` | string | (nothing) | A relative path that Terraform will execute within. This defaults to the root of your repository and is typically set to a subdirectory matching the environment when multiple environments exist within the same repository. | | `data.attributes.setting-overwrites` | object | none | The keys in this object are attributes that have project-level defaults. Each attribute key stores a boolean value which is `false` by default. To overwrite the default inherited value, set an attribute's value to `true`. For example, to set `execution-mode` as the project default, set `setting-overwrites.execution-mode` to `true`. | | `data.attributes.hyok-enabled` | boolean | `false` | Whether this workspace secures HCP Terraform artifacts using hold your own key encryption. Hold your own key is only available in HCP Terraform, [learn more](/terraform/cloud-docs/hold-your-own-key). | | `data.relationships` | object | none | Specifies a group of workspace associations. | | `data.relationships.project.data.id` | string | default project | The ID of the project to create the workspace in. If left blank, Terraform creates the workspace in the organization's default project. You must have permission to create workspaces in the project, either by organization-level permissions or team admin access to a specific project. | | `data.relationships.tag-bindings.data` | list of objects | none | Specifies a list of tags to attach to the workspace. | | `data.relationships.tag-bindings.data.type` | string | none | Must be `tag-bindings` for each object in the list. | | `data.relationships.tag-bindings.data.attributes.key` | string | none | Specifies the tag key for each object in the list. | | `data.relationships.tag-bindings.data.attributes.value` | string | none | Specifies the tag value for each object in the list. | ### Sample Payload \_Without a VCS repository\_ ```json { "data": { "attributes": { "name": "workspace-1" }, "type": "workspaces" } } ``` \_With Key/Value Tags\_ ```json { "data": { "attributes": { "name": "workspace-1" }, "type": "workspaces", "relationships": { "tag-bindings": { "data": [{ "type": "tag-bindings", "attributes": { "key": "env", "value": "test"} }] } } } } ``` \_With a VCS repository\_ ```json { "data": { "attributes": { "name": "workspace-2", "terraform\_version": "0.11.1", "working-directory": "", "vcs-repo": { "identifier": "example/terraform-test-proj", "oauth-token-id": "ot-hmAyP66qk2AMVdbJ", "branch": "", "tags-regex":
https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/workspaces.mdx
main
terraform
[ 0.02734472043812275, -0.02995150163769722, 0.04065001755952835, 0.004153097048401833, -0.010324227623641491, -0.005102426279336214, -0.0006096295546740294, -0.06751538813114166, 0.06953898817300797, 0.11077231913805008, 0.014219984412193298, -0.06783805042505264, 0.05481591820716858, -0.03...
0.032187
"name": "workspace-1" }, "type": "workspaces", "relationships": { "tag-bindings": { "data": [{ "type": "tag-bindings", "attributes": { "key": "env", "value": "test"} }] } } } } ``` \_With a VCS repository\_ ```json { "data": { "attributes": { "name": "workspace-2", "terraform\_version": "0.11.1", "working-directory": "", "vcs-repo": { "identifier": "example/terraform-test-proj", "oauth-token-id": "ot-hmAyP66qk2AMVdbJ", "branch": "", "tags-regex": null } }, "type": "workspaces" } } ``` \_Using Git Tags\_ HCP Terraform triggers a run when you push a Git tag that matches the regular expression (SemVer): `1.2.3`, `22.33.44`, etc. ```json { "data": { "attributes": { "name": "workspace-3", "terraform\_version": "0.12.1", "file-triggers-enabled": false, "working-directory": "/networking", "vcs-repo": { "identifier": "example/terraform-test-proj-monorepo", "oauth-token-id": "ot-hmAyP66qk2AMVdbJ", "branch": "", "tags-regex": "\d+.\d+.\d+" } }, "type": "workspaces" } } ``` \_For a monorepo using trigger prefixes\_ A run will be triggered in this workspace when changes are detected in any of the specified directories: `/networking`, `/modules`, or `/vendor`. ```json { "data": { "attributes": { "name": "workspace-3", "terraform\_version": "0.12.1", "file-triggers-enabled": true, "trigger-prefixes": ["/modules", "/vendor"], "working-directory": "/networking", "vcs-repo": { "identifier": "example/terraform-test-proj-monorepo", "oauth-token-id": "ot-hmAyP66qk2AMVdbJ", "branch": "" }, "updated-at": "2017-11-29T19:18:09.976Z" }, "type": "workspaces" } } ``` \_For a monorepo using trigger patterns\_ A run will be triggered in this workspace when HCP Terraform detects any of the following changes: - A file with the extension `tf` in any directory structure in which the last folder is named `networking` (e.g., `root/networking` and `root/module/networking`) - Any file changed in the folder `/base`, no subfolders are included - Any file changed in the folder `/submodule` and all of its subfolders ```json { "data": { "attributes": { "name": "workspace-4", "terraform\_version": "1.2.2", "file-triggers-enabled": true, "trigger-patterns": ["/\*\*/networking/\*.tf", "/base/\*", "/submodule/\*\*/\*"], "vcs-repo": { "identifier": "example/terraform-test-proj-monorepo", "oauth-token-id": "ot-hmAyP66qk2AMVdbJ", "branch": "" }, "updated-at": "2022-06-09T19:18:09.976Z" }, "type": "workspaces" } } ``` \_Using HCP Terraform agents\_ [HCP Terraform agents](/terraform/cloud-docs/api-docs/agents) allow HCP Terraform to communicate with isolated, private, or on-premises infrastructure. ```json { "data": { "attributes": { "name":"workspace-1", "execution-mode": "agent", "agent-pool-id": "apool-ZjT6A7mVFm5WHT5a" } }, "type": "workspaces" } ``` \_Using a project-level default execution mode\_ ```json { "data": { "attributes": { "name":"workspace-with-default", "setting-overwrites": { "execution-mode": false } } }, "type": "workspaces" } ``` \_With a project\_ ```json { "data": { "type": "workspaces", "attributes": { "name": "workspace-in-project" }, "relationships": { "project": { "data": { "type": "projects", "id": "prj-jT92VLSFpv8FwKtc" } } } } } ``` \_With key-value tags\_ ```json { "data": { "type": "workspaces", "attributes": { "name": "workspace-in-project" } } } ``` ### Sample Request ```shell-session $ 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/workspaces ``` ### Sample Response \_Without a VCS repository\_ \*\*Note:\*\* The `assessments-enabled` property is only accepted by or returned from HCP Terraform. @include 'api-code-blocks/workspace.mdx' \_With a VCS repository\_ @include 'api-code-blocks/workspace-with-vcs.mdx' \_With a project\_ ```json { "data": { "id": "ws-HRkJLSYWF97jucqQ", "type": "workspaces", "attributes": { "allow-destroy-plan": true, "auto-apply": false, "auto-apply-run-trigger": false, "auto-destroy-at": null, "auto-destroy-activity-duration": null, "created-at": "2022-12-05T20:57:13.829Z", "environment": "default", "locked": false, "locked-reason": "", "name": "workspace-in-project", "queue-all-runs": false, "speculative-enabled": true, "structured-run-output-enabled": true, "terraform-version": "1.3.5", "working-directory": null, "global-remote-state": true, "updated-at": "2022-12-05T20:57:13.829Z", "resource-count": 0, "apply-duration-average": null, "plan-duration-average": null, "policy-check-failures": null, "run-failures": null, "workspace-kpis-runs-count": null, "latest-change-at": "2022-12-05T20:57:13.829Z", "operations": true, "execution-mode": "remote", "vcs-repo": null, "vcs-repo-identifier": null, "permissions": { "can-update": true, "can-destroy": true, "can-queue-run": true, "can-read-variable": true, "can-update-variable": true, "can-read-state-versions": true, "can-read-state-outputs": true, "can-create-state-versions": true, "can-queue-apply": true, "can-lock": true, "can-unlock": true, "can-force-unlock": true, "can-read-settings": true, "can-manage-tags": true, "can-manage-run-tasks": false, "can-force-delete": true, "can-manage-assessments": true, "can-read-assessment-results": true, "can-queue-destroy": true }, "actions": { "is-destroyable": true }, "description": null, "file-triggers-enabled": true, "trigger-prefixes": [], "trigger-patterns": [], "assessments-enabled": false, "last-assessment-result-at": null, "source": "tfe-api", "source-name": null, "source-url": null, "tag-names": [], "setting-overwrites": { "execution-mode": false, "agent-pool": false } }, "relationships": { "organization": { "data": { "id": "my-organization", "type": "organizations" } }, "current-run": { "data": null }, "effective-tag-bindings": { "links": {
https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/workspaces.mdx
main
terraform
[ -0.04914360120892525, 0.034913450479507446, 0.01612047664821148, 0.05591849982738495, -0.01090156938880682, -0.07817572355270386, 0.03797311708331108, -0.016820400953292847, 0.06960342824459076, 0.04502960294485092, 0.015449409373104572, -0.09438273310661316, 0.048019468784332275, 0.062239...
0.0071
}, "description": null, "file-triggers-enabled": true, "trigger-prefixes": [], "trigger-patterns": [], "assessments-enabled": false, "last-assessment-result-at": null, "source": "tfe-api", "source-name": null, "source-url": null, "tag-names": [], "setting-overwrites": { "execution-mode": false, "agent-pool": false } }, "relationships": { "organization": { "data": { "id": "my-organization", "type": "organizations" } }, "current-run": { "data": null }, "effective-tag-bindings": { "links": { "related": "/api/v2/workspaces/ws-HRkJLSYWF97jucqQ/effective-tag-bindings" } }, "latest-run": { "data": null }, "outputs": { "data": [] }, "remote-state-consumers": { "links": { "related": "/api/v2/workspaces/ws-HRkJLSYWF97jucqQ/relationships/remote-state-consumers" } }, "current-state-version": { "data": null }, "current-configuration-version": { "data": null }, "agent-pool": { "data": null }, "readme": { "data": null }, "project": { "data": { "id": "prj-jT92VLSFpv8FwKtc", "type": "projects" } }, "current-assessment-result": { "data": null }, "tag-bindings": { "links": { "related": "/api/v2/workspaces/ws-HRkJLSYWF97jucqQ/tag-bindings" } }, "vars": { "data": [] }, }, "links": { "self": "/api/v2/organizations/my-organization/workspaces/workspace-in-project" } } } ``` ## Update a Workspace Use one of the following endpoint to update a workspace: - `PATCH /organizations/:organization\_name/workspaces/:name` - `PATCH /workspaces/:workspace\_id` | Parameter | Description | | --------------- | --------------------------------- | | `:workspace\_id` | The ID of the workspace to update | | `:organization\_name` | The name of the organization the workspace belongs to. | | `:name` | The name of the workspace to update. Workspace names are unique identifiers in the organization and can only include letters, numbers, `-`, and `\_`. | ### 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 `"workspaces"`. | | `data.attributes.name` | string | (previous value) | A new name for the workspace, which can only include letters, numbers, `-`, and `\_`. This will be used as an identifier and must be unique in the organization. \*\*Warning:\*\* Changing a workspace's name changes its URL in the API and UI. | | `data.attributes.agent-pool-id` | string | (previous value) | Required when `execution-mode` is set to `agent`. The ID of the agent pool belonging to the workspace's organization. This value must not be specified if `execution-mode` is set to `remote` or `local` or if `operations` is set to `true`. | | `data.attributes.allow-destroy-plan` | boolean | (previous value) | Whether destroy plans can be queued on the workspace. | | `data.attributes.assessments-enabled` | boolean | `false` | (previously `drift-detection`) Whether or not HCP Terraform performs health assessments for the workspace. May be overridden by the organization setting `assessments-enforced`. Only available for Standard tier organizations, in workspaces running Terraform version 0.15.4+ and operating in [Remote execution mode](/terraform/cloud-docs/workspaces/settings#execution-mode). | | `data.attributes.auto-apply` | boolean | (previous value) | Whether to automatically apply changes when a Terraform plan is successful in runs initiated by VCS, UI or CLI, [with some exceptions](/terraform/cloud-docs/workspaces/settings#auto-apply-and-manual-apply). | | `data.attributes.auto-apply-run-trigger` | boolean | (previous value) | Whether to automatically apply changes when a Terraform plan is successful in runs initiated by run triggers. | | `data.attributes.auto-destroy-at` | string | (previous value) | Timestamp when the next scheduled destroy run will occur, refer to [Scheduled Destroy](/terraform/cloud-docs/workspaces/settings/deletion#automatically-destroy). | | `data.attributes.auto-destroy-activity-duration`| string | (previous value) | Value and units for [automatically scheduled destroy runs based on workspace activity](/terraform/cloud-docs/workspaces/settings/deletion#automatically-destroy). Valid values are greater than 0 and four digits or less. Valid units are `d` and `h`. For example, to queue destroy runs after fourteen days of inactivity set `auto-destroy-activity-duration: "14d"`. | | `data.attributes.description` | string | (previous value) | A description for the workspace. | | `data.attributes.execution-mode` | string | (previous value) | Which [execution mode](/terraform/cloud-docs/workspaces/settings#execution-mode) to use. Valid values are `remote`, `local`, and `agent`. When set to `local`, the workspace will be used for state storage only. This value
https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/workspaces.mdx
main
terraform
[ -0.030887208878993988, 0.07128996402025223, -0.054798197001218796, 0.06539008021354675, 0.027523662894964218, -0.016805170103907585, -0.044318221509456635, -0.006018337793648243, -0.01433112658560276, 0.007123216986656189, 0.0343715064227581, -0.07050435990095139, 0.030633753165602684, 0.0...
0.104391
| | `data.attributes.description` | string | (previous value) | A description for the workspace. | | `data.attributes.execution-mode` | string | (previous value) | Which [execution mode](/terraform/cloud-docs/workspaces/settings#execution-mode) to use. Valid values are `remote`, `local`, and `agent`. When set to `local`, the workspace will be used for state storage only. This value \_must not\_ be specified if `operations` is specified, and \_must\_ be specified if `setting-overwrites.execution-mode` is set to `true`. | | `data.attributes.file-triggers-enabled` | boolean | (previous value) | Whether to filter runs based on the changed files in a VCS push. If enabled, it uses either `trigger-prefixes` in conjunction with `working\_directory` or `trigger-patterns` to describe the set of changed files that will start a run. If disabled, any push will trigger a run. | | `data.attributes.global-remote-state` | boolean | (previous value) | Enables all workspaces in the organization to [access this workspace's state data](/terraform/enterprise/workspaces/state) during runs. On HCP Terraform, if it's set to `false`, then only specifically approved workspaces can access its state. On Terraform Enterprise, do not set to `true` if `project-remote-state` is also `true`. Refer to [Remote State Consumers](/terraform/enterprise/api-docs/workspaces#get-remote-state-consumers) for information about managing allowed workspaces. | | `data.attributes.operations` | boolean | (previous value) | \*\*DEPRECATED\*\* Use `execution-mode` instead. Whether to use remote execution mode. When set to `false`, the workspace will be used for state storage only. This value must not be specified if `execution-mode` is specified. | | `data.attributes.project-remote-state` | boolean | (previous value) | Requires [Terraform Enterprise](/terraform/enterprise). Enables all workspaces in the project to [access this workspace's state data](/terraform/enterprise/workspaces/state) during runs. Do not set to `true` if `global-remote-state` is also `true`. Refer to [Remote State Consumers](/terraform/enterprise/api-docs/workspaces#get-remote-state-consumers) for information about managing allowed workspaces. Only available in Terraform Enterprise 1.1.0 or later. | | `data.attributes.queue-all-runs` | boolean | (previous value) | Whether runs should be queued immediately after workspace creation. When set to false, runs triggered by a VCS change will not be queued until at least one run is manually queued. | | `data.attributes.speculative-enabled` | boolean | (previous value) | Whether this workspace 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. It doesn't prevent manual speculative plans via the CLI or the runs API. | | `data.attributes.terraform-version` | string | (previous value) | The version of Terraform to use for this workspace. This can be either an exact version or a [version constraint](/terraform/language/expressions/version-constraints) (like `~> 1.0.0`); if you specify a constraint, the workspace will always use the newest release that meets that constraint. | | `data.attributes.trigger-patterns` | array | (previous value) | List of glob patterns that describe the files HCP Terraform monitors for changes. Trigger patterns are always appended to the root directory of the repository. | | `data.attributes.trigger-prefixes` | array | (previous value) | List of trigger prefixes that describe the paths HCP Terraform monitors for changes, in addition to the working directory. Trigger prefixes are always appended to the root directory of the repository. HCP Terraform will start a run when files are changed in any directory path matching the provided set of prefixes. | | `data.attributes.vcs-repo.branch` | string | (previous value) | The repository branch that Terraform will execute from. | | `data.attributes.vcs-repo.identifier` | string | (previous value) | 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. The format for Azure DevOps is `:org/:project/\_git/:repo`. | | `data.attributes.vcs-repo.ingress-submodules` | boolean | (previous value) | Whether submodules should be fetched when cloning the VCS repository. | |
https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/workspaces.mdx
main
terraform
[ -0.015868697315454483, -0.006109872367233038, 0.04984939098358154, 0.0590050034224987, 0.004892616532742977, -0.006275729741901159, 0.0022563280072063208, -0.07283037155866623, 0.035793203860521317, 0.07540351897478104, 0.024727003648877144, -0.021656010299921036, 0.010023270733654499, -0....
-0.01295
to your VCS repository in the format :org/:repo where :org and :repo refer to the organization and repository in your VCS provider. The format for Azure DevOps is `:org/:project/\_git/:repo`. | | `data.attributes.vcs-repo.ingress-submodules` | boolean | (previous value) | Whether submodules should be fetched when cloning the VCS repository. | | `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 Terraform. You can not specify this value if `oauth-token-id` is specified. | | `data.attributes.vcs-repo.tags-regex` | string | (previous value) | A regular expression used to match Git tags. HCP Terraform triggers a run when this value is present and a VCS event occurs that contains a matching Git tag for the regular expression. | | `data.attributes.vcs-repo` | object or null | (previous value) | To delete a workspace's existing VCS repo, specify `null` instead of an object. To modify a workspace's existing VCS repo, include whichever of the keys below you wish to modify. To add a new VCS repo to a workspace that didn't previously have one, include at least the `oauth-token-id` and `identifier` keys. | | `data.attributes.working-directory` | string | (previous value) | A relative path that Terraform will execute within. This defaults to the root of your repository and is typically set to a subdirectory matching the environment when multiple environments exist within the same repository. | | `data.attributes.setting-overwrites` | object | | The keys in this object are attributes that have project-level defaults. Each attribute key stores a boolean value which is `false` by default. To overwrite the default inherited value, set an attribute's value to `true`. For example, to set `execution-mode` as the project default, you set `setting-overwrites.execution-mode = true`. | | `data.relationships` | object | none | Specifies a group of workspace relationships. | | `data.relationships.project.data.id` | string | existing value | The ID of the project to move the workspace to. If left blank or unchanged, the workspace will not be moved. You must have admin permissions on both the source project and destination project in order to move a workspace between projects. | | `data.relationships.tag-bindings.data` | list of objects | none | Specifies a list of tags to attach to the workspace. | | `data.relationships.tag-bindings.data.type` | string | none | Must be `tag-bindings` for each object in the list. | | `data.relationships.tag-bindings.data.attributes.key` | string | none | Specifies the tag key for each object in the list. | | `data.relationships.tag-bindings.data.attributes.value` | string | none | Specifies the tag value for each object in the list. | ### Sample Payload ```json { "data": { "attributes": { "name": "workspace-2", "resource-count": 0, "terraform\_version": "0.11.1", "working-directory": "", "vcs-repo": { "identifier": "example/terraform-test-proj", "branch": "", "ingress-submodules": false, "oauth-token-id": "ot-hmAyP66qk2AMVdbJ" }, "updated-at": "2017-11-29T19:18:09.976Z" }, "relationships": { "project": { "data": { "type": "projects", "id": "prj-7HWWPGY3fYxztELU" } }, "tag-bindings": { "data": [ { "type": "tag-bindings", "attributes": { "key": "environment", "value": "development" } }, ] } }, "type": "workspaces" } } ``` ### 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/my-organization/workspaces/workspace-2 ``` ### Sample Response @include 'api-code-blocks/workspace-with-vcs.mdx' ## List workspaces This endpoint lists workspaces in the organization. `GET /organizations/:organization\_name/workspaces` | Parameter | Description | | -------------------- | ------------------------------------------------------- | | `:organization\_name` | The
https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/workspaces.mdx
main
terraform
[ -0.007161751389503479, -0.014011076651513577, 0.00506634684279561, 0.013774142600595951, 0.03669653832912445, -0.006684767082333565, 0.033827345818281174, -0.007098012138158083, 0.1425790637731552, 0.11059361696243286, -0.023420073091983795, -0.09419281035661697, 0.052344318479299545, -0.0...
0.014481
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/workspaces/workspace-2 ``` ### Sample Response @include 'api-code-blocks/workspace-with-vcs.mdx' ## List workspaces This endpoint lists workspaces in the organization. `GET /organizations/:organization\_name/workspaces` | Parameter | Description | | -------------------- | ------------------------------------------------------- | | `:organization\_name` | The name of the organization to list the workspaces 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 workspaces per page. | | `search[name]` | \*\*Optional.\*\* If specified, restricts results to workspaces with a name that matches the search string using a fuzzy search. | | `search[tags]` | \*\*Optional.\*\* If specified, restricts results to workspaces with that tag. If multiple comma separated values are specified, results matching all of the tags are returned. | | `search[exclude-tags]` | \*\*Optional.\*\* If specified, results exclude workspaces with that tag. If multiple comma separated values are specified, workspaces with tags matching any of the tags are excluded. | | `search[wildcard-name]` | \*\*Optional.\*\* If specified, restricts results to workspaces with partial matching, using `\*` on prefix, suffix, or both. For example, `search[wildcard-name]=\*-prod` returns all workspaces ending in `-prod`, `search[wildcard-name]=prod-\*` returns all workspaces beginning with `prod-`, and `search[wildcard-name]=\*-prod-\*` returns all workspaces with substring `-prod-` regardless of prefix and/or suffix. | | `sort` | \*\*Optional.\*\* Allows sorting the organization's workspaces by a provided value. You can sort by `"name"`, `"current-run.created-at"` (the time of the current run), and `"latest-change-at"` (the creation time of the latest state version or the workspace itself if no state version exists). 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. | | `filter[project][id]` | \*\*Optional.\*\* If specified, restricts results to workspaces in the specific project. | | `filter[current-run][status]` | \*\*Optional.\*\* If specified, restricts results to workspaces that match the status of a current run. | | `filter[tagged][i][key]` | \*\*Optional.\*\* If specified, restricts results to workspaces that are tagged with the provided key. Use a value of "0" for `i` if you are only using a single filter. For multiple tag filters, use an incrementing integer value for each filter. Multiple tag filters will be combined together with a logical AND when filtering results. | | `filter[tagged][i][value]` | \*\*Optional.\*\* If specified, restricts results to workspaces that are tagged with the provided value. This is useful when combined with a `key` filter for more specificity. Use a value of "0" for `i` if you are only using a single filter. For multiple tag filters, use an incrementing integer value for each filter. Multiple tag filters will be combined together with a logical AND when filtering results. | ### Sample Request ```shell-session $ curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ https://app.terraform.io/api/v2/organizations/my-organization/workspaces ``` \_With multiple tag filters\_ ```shell-session $ curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ https://app.terraform.io/api/v2/organizations/my-organization/workspaces?filter%5B%tagged5D%5B0%5D%5Bkey%5D=environment&filter%5B%tagged5D%5B0%5D%5Bvalue%5D=development&filter%5B%tagged5D%5B1%5D%5Bkey%5D=meets-compliance ``` ### Sample Response @include 'api-code-blocks/workspaces-list.mdx' ## Show workspace Details on a workspace can be retrieved from two endpoints, which behave identically. One refers to a workspace by its ID: `GET /workspaces/:workspace\_id` | Parameter | Description | | --------------- | ---------------- | | `:workspace\_id` | The workspace ID | The other refers to a workspace by its name and organization: `GET /organizations/:organization\_name/workspaces/:name` | Parameter | Description | | --------------------
https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/workspaces.mdx
main
terraform
[ -0.041315216571092606, 0.02540482021868229, -0.01015679445117712, 0.010591491125524044, -0.026697829365730286, -0.025341838598251343, -0.07154840230941772, -0.07738129794597626, 0.03952997922897339, 0.06290274113416672, -0.019635671749711037, -0.10137863457202911, 0.013887861743569374, -0....
0.0346
which behave identically. One refers to a workspace by its ID: `GET /workspaces/:workspace\_id` | Parameter | Description | | --------------- | ---------------- | | `:workspace\_id` | The workspace ID | The other refers to a workspace by its name and organization: `GET /organizations/:organization\_name/workspaces/:name` | Parameter | Description | | -------------------- | ----------------------------------------------------------------------------------------------------- | | `:organization\_name` | The name of the organization the workspace belongs to. | | `:name` | The name of the workspace to show details for, which can only include letters, numbers, `-`, and `\_`. | ### Workspace performance attributes The following attributes are helpful in determining the overall health and performance of your workspace configuration. These metrics refer to the \*\*past 30 runs that have either resulted in an error or successfully applied\*\*. | Parameter | Type | Description | | ------------------------------------------ | ------ | --------------------------------------------------------------------------------------- | | `data.attributes.apply-duration-average` | number | This is the average time runs spend in the \*\*apply\*\* phase, represented in milliseconds | | `data.attributes.plan-duration-average` | number | This is the average time runs spend in the \*\*plan\*\* phase, represented in milliseconds | | `data.attributes.policy-check-failures` | number | Reports the number of run failures resulting from a policy check failure | | `data.attributes.run-failures` | number | Reports the number of failed runs | | `data.attributes.workspace-kpis-run-count` | number | Total number of runs taken into account by these metrics | ### Sample Request ```shell-session $ curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ https://app.terraform.io/api/v2/organizations/my-organization/workspaces/workspace-1 ``` ### Sample Response @include 'api-code-blocks/workspace.mdx' ## Safe Delete a workspace When you delete an HCP Terraform workspace with resources, Terraform can no longer track or manage that infrastructure. During a safe delete, HCP Terraform only deletes the workspace if it is not managing resources. You can safe delete a workspace using two endpoints that behave identically. The first endpoint identifies a workspace with the workspace ID, and the other identifies the workspace by its name and organization. `POST /workspaces/:workspace\_id/actions/safe-delete` | Parameter | Description | | --------------- | --------------------------------- | | `:workspace\_id` | The ID of the workspace to delete. | `POST /organizations/:organization\_name/workspaces/:name/actions/safe-delete` | Parameter | Description | | -------------------- | ------------------------------------------------------------------------------------------- | | `:organization\_name` | The name of the workspace's organization. | | `:name` | The name of the workspace to delete, which can only include letters, numbers, `-`, and `\_`. | | Status | Response | Reason(s) | | ------- | --------------------------| --------------------------------------------------------------------- | | [204][] | No Content | Successfully deleted the workspace | | [404][] | [JSON API error object][] | Workspace not found, or user unauthorized to perform workspace delete | | [409][] | [JSON API error object][] | Workspace is not safe to delete because it is managing resources | ## Force Delete a workspace During a force delete, HCP Terraform removes the specified workspace without checking whether it is managing resources. We recommend using the [safe delete endpoint](#safe-delete-a-workspace) instead, when possible. !> \*\*Warning:\*\* Terraform cannot track or manage the workspace's infrastructure after deletion. We recommend [destroying the workspace's infrastructure](/terraform/cloud-docs/run/modes-and-options#destroy-mode) before you delete it. By default, only organization owners can force delete workspaces. Organization owners can also update [organization's settings](/terraform/cloud-docs/users-teams organizations/organizations#general) to let workspace admins force delete their own workspaces. You can use two endpoints to force delete a workspace, which behave identically. One endpoint identifies the workspace with its workspace ID and the other endpoint identifies the workspace with its name and organization. `DELETE /workspaces/:workspace\_id` | Parameter | Description | | --------------- | --------------------------------- | | `:workspace\_id` | The ID of the workspace to delete | `DELETE /organizations/:organization\_name/workspaces/:name` | Parameter | Description | | -------------------- | ------------------------------------------------------------------------------------------- | | `:organization\_name`
https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/workspaces.mdx
main
terraform
[ -0.07215937972068787, 0.012544212862849236, -0.05977444350719452, 0.06532323360443115, -0.03997914865612984, -0.038206517696380615, 0.0224715955555439, -0.0463469997048378, 0.07175655663013458, -0.06750921905040741, 0.025196492671966553, -0.05711847171187401, 0.018018178641796112, -0.00078...
0.057628
ID and the other endpoint identifies the workspace with its name and organization. `DELETE /workspaces/:workspace\_id` | Parameter | Description | | --------------- | --------------------------------- | | `:workspace\_id` | The ID of the workspace to delete | `DELETE /organizations/:organization\_name/workspaces/:name` | Parameter | Description | | -------------------- | ------------------------------------------------------------------------------------------- | | `:organization\_name` | The name of the organization the workspace belongs to. | | `:name` | The name of the workspace to delete, which can only include letters, numbers, `-`, and `\_`. | | Status | Response | Reason(s) | | ------- | --------------------------| --------------------------------------------------------------------- | | [204][] | No Content | Successfully deleted the workspace | | [403][] | [JSON API error object][] | Not authorized to perform a force delete on the workspace | | [404][] | [JSON API error object][] | Workspace not found, or user unauthorized to perform workspace delete | ### Sample Request ```shell-session $ curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request DELETE \ https://app.terraform.io/api/v2/organizations/my-organization/workspaces/workspace-1 ``` ## Lock a workspace This endpoint locks a workspace. `POST /workspaces/:workspace\_id/actions/lock` | Parameter | Description | | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- | | `:workspace\_id` | The workspace ID to lock. Obtain this from the [workspace settings](/terraform/cloud-docs/workspaces/settings) or the [Show Workspace](#show-workspace) endpoint. | | Status | Response | Reason(s) | | ------- | -------------------------------------------- | ----------------------------------------------------------- | | [200][] | [JSON API document][] (`type: "workspaces"`) | Successfully locked the workspace | | [404][] | [JSON API error object][] | Workspace not found, or user unauthorized to perform action | | [409][] | [JSON API error object][] | Workspace already locked | ### 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 | | -------- | ------ | ------- | ------------------------------------- | | `reason` | string | `""` | The reason for locking the workspace. | ### Sample Payload ```json { "reason": "Locking workspace-1" } ``` ### Sample Request ```shell-session $ curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request POST \ --data @payload.json \ https://app.terraform.io/api/v2/workspaces/ws-SihZTyXKfNXUWuUa/actions/lock ``` ### Sample Response @include 'api-code-blocks/workspace.mdx' ## Unlock a workspace This endpoint unlocks a workspace. Unlocking a workspace sets the current state version to the latest finalized intermediate state version. If intermediate state versions are available, but HCP Terraform has not yet finalized the latest intermediate state version, the unlock will fail with a 503 response. For this particular error, it's recommended to retry the unlock operation for a short period of time until the platform finalizes the state version. If you must force-unlock a workspace under these conditions, ensure that state was saved successfully by inspecting the latest state version using the [State Version List API](/terraform/cloud-docs/api-docs/state-versions#list-state-versions-for-a-workspace) `POST /workspaces/:workspace\_id/actions/unlock` | Parameter | Description | | --------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- | | `:workspace\_id` | The workspace ID to unlock. Obtain this from the [workspace settings](/terraform/cloud-docs/workspaces/settings) or the [Show Workspace](#show-workspace) endpoint. | | Status | Response | Reason(s) | | ------- | -------------------------------------------- | ----------------------------------------------------------- | | [200][] | [JSON API document][] (`type: "workspaces"`) | Successfully unlocked the workspace | | [404][] | [JSON API error object][] | Workspace not found, or user unauthorized to perform action | | [409][] | [JSON API error object][] | Workspace already unlocked, or locked by a different user | ### Sample Request ```shell-session $ curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request POST \ https://app.terraform.io/api/v2/workspaces/ws-SihZTyXKfNXUWuUa/actions/unlock ``` ### Sample Response @include 'api-code-blocks/workspace.mdx' ## Force Unlock a workspace This endpoint force unlocks a workspace. Only users with admin access are
https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/workspaces.mdx
main
terraform
[ -0.016956493258476257, 0.02724730782210827, -0.05633843317627907, 0.03826918825507164, 0.00921214371919632, -0.029639912769198418, 0.03810779005289078, -0.09124018996953964, 0.0913132056593895, -0.015621691010892391, 0.004479107912629843, -0.041226066648960114, 0.026340864598751068, 0.0022...
0.068747
or locked by a different user | ### Sample Request ```shell-session $ curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request POST \ https://app.terraform.io/api/v2/workspaces/ws-SihZTyXKfNXUWuUa/actions/unlock ``` ### Sample Response @include 'api-code-blocks/workspace.mdx' ## Force Unlock a workspace This endpoint force unlocks a workspace. Only users with admin access are authorized to force unlock a workspace. `POST /workspaces/:workspace\_id/actions/force-unlock` | Parameter | Description | | --------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `:workspace\_id` | The workspace ID to force unlock. Obtain this from the [workspace settings](/terraform/cloud-docs/workspaces/settings) or the [Show Workspace](#show-workspace) endpoint. | | Status | Response | Reason(s) | | ------- | -------------------------------------------- | ----------------------------------------------------------- | | [200][] | [JSON API document][] (`type: "workspaces"`) | Successfully force unlocked the workspace | | [404][] | [JSON API error object][] | Workspace not found, or user unauthorized to perform action | | [409][] | [JSON API error object][] | Workspace already unlocked | ### Sample Request ```shell-session $ curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request POST \ https://app.terraform.io/api/v2/workspaces/ws-SihZTyXKfNXUWuUa/actions/force-unlock ``` ### Sample Response @include 'api-code-blocks/workspace-with-vcs.mdx' ## Assign an SSH key to a workspace This endpoint assigns an SSH key to a workspace. `PATCH /workspaces/:workspace\_id/relationships/ssh-key` | Parameter | Description | | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `:workspace\_id` | The workspace ID to assign the SSH key to. Obtain this from the [workspace settings](/terraform/cloud-docs/workspaces/settings) or the [Show Workspace](#show-workspace) endpoint. | ### 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 `"workspaces"`. | | `data.attributes.id` | string | | The SSH key ID to assign. Obtain this from the [ssh-keys](/terraform/cloud-docs/api-docs/ssh-keys) endpoint. | #### Sample Payload ```json { "data": { "attributes": { "id": "sshkey-GxrePWre1Ezug7aM" }, "type": "workspaces" } } ``` ### 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/workspaces/ws-SihZTyXKfNXUWuUa/relationships/ssh-key ``` ### Sample Response @include 'api-code-blocks/workspace-with-vcs.mdx' ## Unassign an SSH key from a workspace This endpoint unassigns the currently assigned SSH key from a workspace. `PATCH /workspaces/:workspace\_id/relationships/ssh-key` | Parameter | Description | | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `:workspace\_id` | The workspace ID to assign the SSH key to. Obtain this from the [workspace settings](/terraform/cloud-docs/workspaces/settings) or the [Show Workspace](#show-workspace) endpoint. | ### 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 `"workspaces"`. | | `data.attributes.id` | string | | Must be `null`. | ### Sample Payload ```json { "data": { "attributes": { "id": null }, "type": "workspaces" } } ``` ### 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/workspaces/ws-SihZTyXKfNXUWuUa/relationships/ssh-key ``` ### Sample Response @include 'api-code-blocks/workspace-with-vcs.mdx' ## Get Remote State Consumers `GET /workspaces/:workspace\_id/relationships/remote-state-consumers` | Parameter | Description | | --------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `:workspace\_id` | The workspace ID to get remote state consumers for. Obtain this from the [workspace settings](/terraform/cloud-docs/workspaces/settings) or the [Show Workspace](#show-workspace) endpoint. | This endpoint retrieves the list of other workspaces that are allowed to access the given workspace's state during runs according to the workspace's state-sharing configuration. The following table describes how Terraform Enterprise determines access to the state data: | Authorization type | Attributes | Results | | ---
https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/workspaces.mdx
main
terraform
[ -0.09532565623521805, 0.0012434181990101933, -0.007638001348823309, -0.01727418415248394, -0.02032490260899067, -0.029726922512054443, -0.012900051660835743, -0.08497858792543411, 0.059520937502384186, 0.11871219426393509, -0.004717724863439798, -0.016753194853663445, 0.016274718567728996, ...
0.024435
endpoint. | This endpoint retrieves the list of other workspaces that are allowed to access the given workspace's state during runs according to the workspace's state-sharing configuration. The following table describes how Terraform Enterprise determines access to the state data: | Authorization type | Attributes | Results | | --- | --- | --- | | Explicit authorization | `global-remote-state` is `false` `project-remote-state` is `false` | The endpoint returns a list of only the workspaces that have been specifically authorized to access this workspace's state. | | Project-wide access | `project-remote-state` is `true` | The endpoint returns a list of all other workspace in the same project. | | Organization-wide access | `global-remote-state` is `true` | The endpoint returns a list of all other workspaces in the organization. | This endpoint retrieves the list of other workspaces that are allowed to access the given workspace's state during runs. - If `global-remote-state` is set to `false` for the workspace, the endpoint returns the list of other workspaces that are specifically authorized to access the workspace's state. - If `global-remote-state` is set to `true`, the endpoint returns a list of all other workspace in the organization. The list returned by this endpoint is subject to the caller's normal workspace permissions; it will not include workspaces that the provided API token is unable to read. ### 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 workspaces per page. | ### Sample Request ```shell-session $ curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ https://app.terraform.io/api/v2/workspaces/ws-SihZTyXKfNXUWuUa/relationships/remote-state-consumers ``` ### Sample Response @include 'api-code-blocks/workspaces-list.mdx' ## Replace Remote State Consumers `PATCH /workspaces/:workspace\_id/relationships/remote-state-consumers` | Parameter | Description | | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `:workspace\_id` | The workspace ID to replace remote state consumers for. Obtain this from the [workspace settings](/terraform/cloud-docs/workspaces/settings) or the [Show Workspace](#show-workspace) endpoint. | This endpoint updates the workspace's remote state consumers to be exactly the list of workspaces specified in the payload. You can only use this endpoint for workspaces where `global-remote-state` is `false`. This endpoint updates the workspace's remote state consumers to be exactly the list of workspaces specified in the payload. You can only use this endpoint for workspaces where `global-remote-state` and `project-remote-state` are `false`. This endpoint can only be used by teams with permission to manage workspaces for the entire organization — only those who can \_view\_ the entire list of consumers can \_replace\_ the entire list. ([More about permissions.](/terraform/cloud-docs/users-teams-organizations/permissions)) Teams with admin permissions on specific workspaces can still modify remote state consumers for those workspaces, but must use the add (POST) and remove (DELETE) endpoints listed below instead of this PATCH endpoint. [permissions-citation]: #intentionally-unused---keep-for-maintainers | Status | Response | Reason(s) | | ------- | ------------------------- | --------------------------------------------------------------------- | | [204][] | No Content | Successfully updated remote state consumers | | [404][] | [JSON API error object][] | Workspace not found, or user unauthorized to perform action | | [422][] | [JSON API error object][] | Problem with payload or request; details provided in the error object | ### 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` |
https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/workspaces.mdx
main
terraform
[ -0.009728326462209225, -0.007047001738101244, -0.008678131736814976, 0.0031206957064568996, 0.03303927183151245, -0.010745376348495483, 0.020119480788707733, -0.09856484085321426, 0.0284638199955225, 0.05826593562960625, -0.021838245913386345, -0.0357627347111702, 0.008790940977633, 0.0042...
0.095483
error object | ### 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 `"workspaces"`. | | `data[].id` | string | | The ID of a workspace to be set as a remote state consumer. | ### Sample Payload ```json { "data": [ { "id": "ws-7aiqKYf6ejMFdtWS", "type": "workspaces" } ] } ``` ### 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/workspaces/ws-UYv6RYM8fVhzeGG5/relationships/remote-state-consumers ``` ### Response No response body. Status code `204`. ## Add Remote State Consumers `POST /workspaces/:workspace\_id/relationships/remote-state-consumers` | Parameter | Description | | --------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `:workspace\_id` | The workspace ID to add remote state consumers for. Obtain this from the [workspace settings](/terraform/cloud-docs/workspaces/settings) or the [Show Workspace](#show-workspace) endpoint. | This endpoint adds one or more remote state consumers to the workspace. You can only use this endpoint for workspaces where `global-remote-state` is `false`. This endpoint adds one or more remote state consumers to the workspace. You can only use this endpoint for workspaces where `global-remote-state` and `project-remote-state` are `false`. \* The workspaces specified as consumers must be readable to the API token that makes the request. \* A workspace cannot be added as a consumer of itself. (A workspace can always read its own state, regardless of access settings.) \* You can safely add a consumer workspace that is already present; it will be ignored, and the rest of the consumers in the request will be processed normally. | Status | Response | Reason(s) | | ------- | ------------------------- | --------------------------------------------------------------------- | | [204][] | No Content | Successfully updated remote state consumers | | [404][] | [JSON API error object][] | Workspace not found, or user unauthorized to perform action | | [422][] | [JSON API error object][] | Problem with payload or request; details provided in the error object | ### 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 `"workspaces"`. | | `data[].id` | string | | The ID of a workspace to be set as a remote state consumer. | ### Sample Payload ```json { "data": [ { "id": "ws-7aiqKYf6ejMFdtWS", "type": "workspaces" } ] } ``` ### Sample Request ```shell-session $ curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request POST \ --data @payload.json \ https://app.terraform.io/api/v2/workspaces/ws-UYv6RYM8fVhzeGG5/relationships/remote-state-consumers ``` ### Response No response body. Status code `204`. ## Delete Remote State Consumers `DELETE /workspaces/:workspace\_id/relationships/remote-state-consumers` | Parameter | Description | | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `:workspace\_id` | The workspace ID to remove remote state consumers for. Obtain this from the [workspace settings](/terraform/cloud-docs/workspaces/settings) or the [Show Workspace](#show-workspace) endpoint. | This endpoint removes one or more remote state consumers from a workspace, according to the contents of the payload. You can only use this endpoint for workspaces where `global-remote-state` is `false`. This endpoint removes one or more remote state consumers from a workspace, according to the contents of the payload. You can only use this endpoint for workspaces where `global-remote-state` and `project-remote-state` are `false`. \* The workspaces specified as consumers must be readable to the API token that makes the request. \* You can safely remove a consumer
https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/workspaces.mdx
main
terraform
[ -0.03159734234213829, 0.06380848586559296, -0.017165828496217728, 0.012649447657167912, -0.07785850763320923, -0.03529740497469902, 0.012227440252900124, 0.01423587929457426, 0.004466892685741186, 0.058990199118852615, -0.04396170377731323, -0.08725325763225555, -0.021508585661649704, 0.04...
0.06249
state consumers from a workspace, according to the contents of the payload. You can only use this endpoint for workspaces where `global-remote-state` and `project-remote-state` are `false`. \* The workspaces specified as consumers must be readable to the API token that makes the request. \* You can safely remove a consumer workspace that is already absent; it will be ignored, and the rest of the consumers in the request will be processed normally. | Status | Response | Reason(s) | | ------- | ------------------------- | --------------------------------------------------------------------- | | [204][] | No Content | Successfully updated remote state consumers | | [404][] | [JSON API error object][] | Workspace not found, or user unauthorized to perform action | | [422][] | [JSON API error object][] | Problem with payload or request; details provided in the error object | ### 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 `"workspaces"`. | | `data[].id` | string | | The ID of a workspace to remove from the remote state consumers. | ### Sample Payload ```json { "data": [ { "id": "ws-7aiqKYf6ejMFdtWS", "type": "workspaces" } ] } ``` ### Sample Request ```shell-session $ curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request DELETE \ --data @payload.json \ https://app.terraform.io/api/v2/workspaces/ws-UYv6RYM8fVhzeGG5/relationships/remote-state-consumers ``` ### Response No response body. Status code `204`. ## List workspace tags Workspace tags are [organization tags](/terraform/cloud-docs/api-docs/organization-tags) added to a workspace. They are a flat list of keys that can only be applied to workspaces when using the `tags` attribute in the Terraform `cloud` block in Terraform v1.9 and older. To list key-value tags supported in Terraform v1.10 and newer, refer to [List workspace tag bindings](#list-workspace-tag-bindings). `GET /workspaces/:workspace\_id/relationships/tags`: Paginated list of flat string tags attached to the workspace. ### Path parameters | Parameter | Description | | --------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `:workspace\_id` | The workspace ID to fetch tags for. Obtain this from the [workspace settings](/terraform/cloud-docs/workspaces/settings) or the [Show Workspace](#show-workspace) endpoint. | ### Query Parameters Only the flat string tags 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. Conversely, all tags are returned when using fetching tag-bindings or effective-tag-bindings endpoints. | Parameter | Description | | -------------- | -------------------------------------------------------------------------- | | `page[number]` | \*\*Optional.\*\* If omitted, the endpoint will return the first page. | | `page[size]` | \*\*Optional.\*\* If omitted, the endpoint will return 20 workspaces per page. | ### Sample Requests ```shell-session $ curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ https://app.terraform.io/api/v2/workspaces/ws-db61c9eb5cab5ae2/relationships/tags ``` ### Sample Responses ```json { "data": [ { "id": "tag-1", "type": "tags", "attributes": { "name": "tag1", "created-at": "2022-03-09T06:04:39.585Z", "instance-count": 1 }, "relationships": { "organization": { "data": { "id": "my-organization", "type": "organizations" } } } }, { "id": "tag-2", "type": "tags", "attributes": { "name": "tag2", "created-at": "2022-03-09T06:04:39.585Z", "instance-count": 2 }, "relationships": { "organization": { "data": { "id": "my-organization", "type": "organizations" } } } } ] } ``` ## List workspace tag bindings Call the following endpoints to list the tags attached to a workspace: - `GET /workspaces/:workspace\_id/tag-bindings`: Lists key-value tags directly bound to the workspace. - `GET /workspaces/:workspace\_id/effective-tag-bindings`: Lists all key-value tags bound to the workspace, including those inherited from the parent project. ### Path parameters | Parameter | Description | | --------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `:workspace\_id` | The workspace ID to fetch tags for. Obtain
https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/workspaces.mdx
main
terraform
[ -0.08700941503047943, 0.03808605298399925, -0.02166486717760563, 0.020513223484158516, 0.005928729195147753, -0.06104768440127373, -0.04457630217075348, -0.059508923441171646, 0.022460877895355225, 0.011096207424998283, 0.015372092835605145, -0.07475966215133667, 0.006074607837945223, 0.01...
0.059917
Lists key-value tags directly bound to the workspace. - `GET /workspaces/:workspace\_id/effective-tag-bindings`: Lists all key-value tags bound to the workspace, including those inherited from the parent project. ### Path parameters | Parameter | Description | | --------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `:workspace\_id` | The workspace ID to fetch tags for. Obtain this from the [workspace settings](/terraform/cloud-docs/workspaces/settings) or the [Show Workspace](#show-workspace) endpoint. | ### Sample Requests ```shell-session $ curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ https://app.terraform.io/api/v2/workspaces/ws-db61c9eb5cab5ae2/tag-bindings ``` ```shell-session $ curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ https://app.terraform.io/api/v2/workspaces/ws-db61c9eb5cab5ae2/effective-tag-bindings ``` ### Sample Responses ```json { "data": [ { "id": "tb-232e23631380f79e", "type": "tag-bindings", "attributes": { "key": "costcenter", "value": "123", "created-at": "2024-11-19T23:59:24.648Z" } } ], "links": { "target": "/api/v2/workspaces/ws-db61c9eb5cab5ae2" } } ``` ```json { "data": [ { "id": "07cc44202a430fc2", "type": "effective-tag-bindings", "attributes": { "key": "costcenter", "value": "123" } }, { "id": "f8b11951f98e11f8", "type": "effective-tag-bindings", "attributes": { "key": "dept", "value": "r+d" }, "links": { "inherited-from": "/api/v2/projects/prj-Lg4wmRZEpDUf8ZhB" } } ] } ``` ## Add flat string tags to a workspace `POST /workspaces/:workspace\_id/relationships/tags` To add key-value tags to an existing workspace, call the `PATCH /workspaces/:workspace\_id` and provide workspace tag bindings in the JSON payload. Refer to [Update a workspace](#update-a-workspace) for additional information. You can also bind key-value tags when creating a workspace. Refer to [Create a workspace](#create-a-workspace) for additional information. Refer to [Define project tags](/terraform/cloud-docs/projects/manage#define-project-tags) for information about supported tag values. | Parameter | Description | | --------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `:workspace\_id` | The workspace ID to add tags to. Obtain this from the [workspace settings](/terraform/cloud-docs/workspaces/settings) or the [Show Workspace](#show-workspace) endpoint. | | Status | Response | Reason(s) | | ------- | ------------------------- | ----------------------------------------------------------- | | [204][] | No Content | Successfully added tags to workspace | | [404][] | [JSON API error object][] | Workspace not found, or user unauthorized to perform action | ### Request Body This POST endpoint requires a JSON object with the following properties as a request payload. It is important to note that `type`, as well as one of `id` \_or\_ `attributes.name` is required. | Key path | Type | Default | Description | | ------------------------ | ------ | ------- | --------------------------- | | `data[].type` | string | | Must be `"tags"`. | | `data[].id` | string | | The ID of the tag to add. | | `data[].attributes.name` | string | | The name of the tag to add. | ### Sample Payload ```json { "data": [ { "type": "tags", "attributes": { "name": "foo" } }, { "type": "tags", "attributes": { "name": "bar" } } ] } ``` ### Sample Request ```shell-session $ curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request POST \ --data @payload.json \ https://app.terraform.io/api/v2/workspaces/workspace-2/relationships/tags ``` ### Sample Response No response body. Status code `204`. ## Remove tags from workspace This endpoint removes one or more tags from a workspace. The workspace must already exist, and tag element that supplies an `id` attribute must exist. If the `name` attribute is used, and no matching organization tag is found, no action will occur for that entry. Tags removed from all workspaces will be removed from the organization-wide list. To remove key-value tags to an existing workspace, call the `PATCH /workspaces/:workspace\_id` and provide workspace tag bindings in the JSON payload. Refer to [Update a workspace](#update-a-workspace) for additional information. `DELETE /workspaces/:workspace\_id/relationships/tags` | Parameter | Description | | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `:workspace\_id` | The workspace ID to remove tags from. Obtain this from the [workspace settings](/terraform/cloud-docs/workspaces/settings) or the [Show Workspace](#show-workspace) endpoint. | | Status | Response | Reason(s) | | ------- | ------------------------- | ----------------------------------------------------------- | | [204][]
https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/workspaces.mdx
main
terraform
[ -0.014047039672732353, 0.04278210550546646, -0.029143085703253746, 0.045690279453992844, -0.01816863939166069, -0.010373289696872234, 0.09007848054170609, 0.03522811830043793, 0.0041810451075434685, -0.05276164412498474, 0.005056367255747318, -0.07428209483623505, 0.026378097012639046, -0....
0.002049
`DELETE /workspaces/:workspace\_id/relationships/tags` | Parameter | Description | | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `:workspace\_id` | The workspace ID to remove tags from. Obtain this from the [workspace settings](/terraform/cloud-docs/workspaces/settings) or the [Show Workspace](#show-workspace) endpoint. | | Status | Response | Reason(s) | | ------- | ------------------------- | ----------------------------------------------------------- | | [204][] | No Content | Successfully removed tags to workspace | | [404][] | [JSON API error object][] | Workspace not found, or user unauthorized to perform action | ### Request Body This POST endpoint requires a JSON object with the following properties as a request payload. It is important to note that `type`, as well as one of `id` \_or\_ `attributes.name` is required. | Key path | Type | Default | Description | | ------------------------ | ------ | ------- | ------------------------------ | | `data[].type` | string | | Must be `"tags"`. | | `data[].id` | string | | The ID of the tag to remove. | | `data[].attributes.name` | string | | The name of the tag to remove. | ### Sample Payload ```json { "data": [ { "type": "tags", "id": "tag-Yfha4YpPievQ8wJw" } ] } ``` ### Sample Request ```shell-session $ curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request DELETE \ --data @payload.json \ https://app.terraform.io/api/v2/workspaces/workspace-2/relationships/tags ``` ### Sample Response No response body. Status code `204`. ## Add/update tag-bindings on a workspace This endpoint adds keys and values or updates values of tag-bindings on an existing resource by key. It does not remove any keys from the collection. This endpoint is useful when you want to ensure a modification is additive. Tag bindings have special constraints and behaviors: - You can apply up to 10 tags per workspace. - Workspaces can inherit an additional 10 tags from its project. - Keys can have up to 128 characters. - Keys can contain all alphanumeric characters and the symbols `\_`, `.`, `=`, `+`, `-`, `@`, `:`. - values can have up to 256 characters. - Values can contain all alphanumeric characters and the symbols `\_`, `.`, `=`, `+`, `-`, `@`, `:`. - You cannot use `hc:` and `hcp:` as key prefixes. `PATCH /workspaces/:workspace\_id/tag-bindings` | Parameter | Description | | ---------------------| --------------------------------------------------------------------| | `:workspace\_id` | The ID of the workspace to update | ### Request Body This PATCH endpoint requires a JSON object with the following properties as a request payload. It is important to note that for each data item, `type`, as well as `attributes.key` is required. | Key path | Type | Default | Description | | ------------------------- | ------ | ------- | ---------------------------------- | | `data[].type` | string | | Must be `"tag-bindings"`. | | `data[].attributes.key` | string | | The key of the tag to add/update. | | `data[].attributes.value` | string | | The name of the tag to add/update. | ### Sample Payload ```json { "data": [ { "type": "tag-bindings", "attributes": { "key": "costcenter", "value": "123" } }, { "type": "tag-bindings", "attributes": { "key": "bar", "value": "baz" } } ] } ``` ### 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/workspaces/ws-82d2281aa259ba09/tag-bindings ``` ### Sample Response Status Code 200 ```json { "data": [ { "id": "tb-e4a5847b2cf06559", "type": "tag-bindings", "attributes": { "key": "costcenter", "value": "123" } }, { "id": "tb-97ce954636f93a6c", "type": "tag-bindings", "attributes": { "key": "bar", "value": "baz" } } ] } ``` ## Show data retention policy This endpoint is exclusive to Terraform Enterprise and is not available in HCP Terraform. `GET /workspaces/:workspace\_id/relationships/data-retention-policy` | Parameter | Description | | ---------------------| --------------------------------------------------------------------| | `:workspace\_id` | The ID of the workspace to show the
https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/workspaces.mdx
main
terraform
[ -0.05240079015493393, 0.07770909368991852, -0.00935386586934328, 0.05782904103398323, 0.03238363936543465, -0.0646304115653038, 0.04947584867477417, -0.11604021489620209, 0.08428468555212021, 0.014802137389779091, 0.005839101038873196, -0.06355349719524384, 0.041308362036943436, -0.0175414...
-0.021195
{ "key": "bar", "value": "baz" } } ] } ``` ## Show data retention policy This endpoint is exclusive to Terraform Enterprise and is not available in HCP Terraform. `GET /workspaces/:workspace\_id/relationships/data-retention-policy` | Parameter | Description | | ---------------------| --------------------------------------------------------------------| | `:workspace\_id` | The ID of the workspace to show the data retention policy for. Obtain this from the [workspace settings](/terraform/enterprise/workspaces/settings) or by sending a `GET` request to the [`/workspaces`](#show-workspace) endpoint. | This endpoint shows the data retention policy set explicitly on the workspace. When no data retention policy is set for the workspace, the endpoint returns the default policy configured for the organization. Refer to [Data Retention Policies](/terraform/enterprise/workspaces/settings/deletion#data-retention-policies) for instructions on configuring data retention policies for workspaces. Refer to [Data Retention Policy API](/terraform/enterprise/api-docs/data-retention-policies#show-data-retention-policy) in the Terraform Enterprise documentation for details. ## Create or update data retention policy This endpoint is exclusive to Terraform Enterprise and is not available in HCP Terraform. `POST /workspaces/:workspace\_id/relationships/data-retention-policy` | Parameter | Description | | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `:workspace\_id` | The workspace ID to update the data retention policy for. Obtain this from the [workspace settings](/terraform/enterprise/workspaces/settings) or by sending a `GET` request to the [`/workspaces`](#show-workspace) endpoint. | This endpoint creates a data retention policy for a workspace or updates the existing policy. Refer to [Data Retention Policies](/terraform/enterprise/workspaces/settings/deletion#data-retention-policies) for additional information. 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 This endpoint is exclusive to Terraform Enterprise and is not available in HCP Terraform. `DELETE /workspaces/:workspace\_id/relationships/data-retention-policy` | Parameter | Description | | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `:workspace\_id` | The workspace ID to remove the data retenetion policy for. Obtain this from the [workspace settings](/terraform/enterprise/workspaces/settings) or by sending a `GET` request to the [`/workspaces`](#show-workspace) endpoint. | This endpoint removes the data retention policy explicitly set on a workspace. When no data retention policy is set for the workspace, the endpoint returns the default policy configured for the organization. Refer to [Data Retention Policies](/terraform/enterprise/users-teams-organizations/organizations#destruction-and-deletion) for instructions on configuring data retention policies for organizations. Read more about [workspace data retention policies](/terraform/enterprise/workspaces/settings/deletion#data-retention-policies). 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: \* `current\_configuration\_version` - The last configuration this workspace received, excluding plan-only configurations. Terraform uses this configuration for new runs, unless you provide a different one. \* `current\_configuration\_version.ingress\_attributes` - The commit information for the current configuration version. \* `current\_run` - Additional information about the current run. \* `current\_run.configuration\_version` - The configuration used in the current run. \* `current\_run.configuration\_version.ingress\_attributes` - The commit information used in the current run. \* `current\_run.plan` - The plan used in the current run. \* `locked\_by` - The user, team, or run responsible for locking the workspace, if the workspace is currently locked. \* `organization` - The full organization record. \* `outputs` - The outputs for the most recently applied run. \* `project` - The full project record. \* `readme` - The most recent workspace README.md.
https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/workspaces.mdx
main
terraform
[ -0.016446944326162338, 0.05104701966047287, 0.020023133605718613, 0.027858750894665718, -0.04639606177806854, 0.05128186568617821, 0.026636047288775444, -0.09091993421316147, 0.03477016091346741, 0.03174131363630295, 0.012959454208612442, -0.08557627350091934, 0.0453655831515789, -0.049362...
0.007504
[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 # Audit trail tokens API reference Audit trail tokens are used to authenticate integrations pulling audit trail data, for example, using the [HCP Terraform for Splunk](/terraform/cloud-docs/integrations/splunk) app. ## Generate a new token `POST /organizations/:organization\_name/authentication-token?token=audit-trails` | Parameter | Description | | -------------------- | ----------------------------------------------------- | | `:organization\_name` | The name of the organization to generate a token for. | Generates a new [audit trails token](/terraform/cloud-docs/users-teams-organizations/api-tokens#audit-trails-tokens), replacing any existing token. Only members of the owners team, the owners [team API token](/terraform/cloud-docs/users-teams-organizations/api-tokens#team-api-tokens), and the [organization API token](/terraform/cloud-docs/users-teams-organizations/api-tokens#organization-api-tokens) can access this endpoint. This endpoint returns the secret text of the new authentication token. You can only access this token when you create it and can not recover it later. [permissions-citation]: #intentionally-unused---keep-for-maintainers | Status | Response | Reason | | ------- | ------------------------------------------------------- | ------------------- | | [201][] | [JSON API document][] (`type: "authentication-tokens"`) | Success | | [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. | Key path | Type | Default | Description | | ----------------------------- | ------ | ------- | ----------------------------------------------------------------------------------------------------------------------- | | `data.type` | string | | Must be `"authentication-token"`. | | `data.attributes.expired-at` | string | `null` | The UTC date and time that the audit trails token expires, in ISO 8601 format. If omitted or set to `null` the token will never expire. | ### Sample Payload ```json { "data": { "type": "authentication-token", "attributes": { "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/organizations/my-organization/authentication-token?token=audit-trails ``` ### Sample Response ```json { "data": { "id": "4111756", "type": "authentication-tokens", "attributes": { "created-at": "2017-11-29T19:11:28.075Z", "last-used-at": null, "description": null, "token": "ZgqYdzuvlv8Iyg.atlasv1.6nV7t1OyFls341jo1xdZTP72fN0uu9VL55ozqzekfmToGFbhoFvvygIRy2mwVAXomOE", "expired-at": "2023-04-06T12:00:00.000Z" }, "relationships": { "created-by": { "data": { "id": "user-62goNpx1ThQf689e", "type": "users" } } } } } ``` ## Delete a token `DELETE /organizations/:organization/authentication-token?token=audit-trails` | Parameter | Description | | -------------------- | --------------------------------------------- | | `:organization\_name` | Which organization's token should be deleted. | Only members of the owners team, the owners [team API token](/terraform/cloud-docs/users-teams-organizations/api-tokens#team-api-tokens), and the [organization API token](/terraform/cloud-docs/users-teams-organizations/api-tokens#organization-api-tokens) can access this endpoint. [permissions-citation]: #intentionally-unused---keep-for-maintainers | Status | Response | Reason | | ------- | ------------------------- | ------------------- | | [204][] | No Content | Success | | [404][] | [JSON API error object][] | 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/organizations/my-organization/authentication-token?token=audit-trails ```
https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/audit-trails-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
[200]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/200 [307]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/307 [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 # Applies API reference An apply represents the results of applying a Terraform workspace execution plan. If you are using a Stack and want to interact with Stack deployment runs, refer to [deployment runs](/terraform/cloud-docs/stacks/runs). ## Attributes The `/applies` endpoint has the following attributes. ### Apply States You'll find the apply state in `data.attributes.status`, as one of the following values. | State | Description | | ------------------------- | ------------------------------------------------------------------------------ | | `pending` | The initial status of a apply once it has been created. | | `managed\_queued`/`queued` | The apply has been queued, awaiting backend service capacity to run terraform. | | `running` | The apply is running. | | `errored` | The apply has errored. This is a final state. | | `canceled` | The apply has been canceled. This is a final state. | | `finished` | The apply has completed successfully. This is a final state. | | `unreachable` | The apply will not run. This is a final state. | ## Show an apply `GET /applies/:id` | Parameter | Description | | --------- | ---------------------------- | | `id` | The ID of the apply to show. | There is no endpoint to list applies. You can find the ID for an apply in the `relationships.apply` property of a run object. | Status | Response | Reason | | ------- | ----------------------------------------- | ------------------------------------------------------- | | [200][] | [JSON API document][] (`type: "applies"`) | The request was successful | | [404][] | [JSON API error object][] | Apply 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/applies/apply-47MBvjwzBG8YKc2v ``` ### Sample Response ```json { "data": { "id": "apply-47MBvjwzBG8YKc2v", "type": "applies", "attributes": { "execution-details": { "mode": "remote", }, "status": "finished", "status-timestamps": { "queued-at": "2018-10-17T18:58:27+00:00", "started-at": "2018-10-17T18:58:29+00:00", "finished-at": "2018-10-17T18:58:37+00:00" }, "log-read-url": "https://archivist.terraform.io/v1/object/dmF1bHQ6djE6OFA1eEdlSFVHRSs4YUcwaW83a1dRRDA0U2E3T3FiWk1HM2NyQlNtcS9JS1hHN3dmTXJmaFhEYTlHdTF1ZlgxZ2wzVC9kVTlNcjRPOEJkK050VFI3U3dvS2ZuaUhFSGpVenJVUFYzSFVZQ1VZYno3T3UyYjdDRVRPRE5pbWJDVTIrNllQTENyTndYd1Y0ak1DL1dPVlN1VlNxKzYzbWlIcnJPa2dRRkJZZGtFeTNiaU84YlZ4QWs2QzlLY3VJb3lmWlIrajF4a1hYZTlsWnFYemRkL2pNOG9Zc0ZDakdVMCtURUE3dDNMODRsRnY4cWl1dUN5dUVuUzdnZzFwL3BNeHlwbXNXZWRrUDhXdzhGNnF4c3dqaXlZS29oL3FKakI5dm9uYU5ZKzAybnloREdnQ3J2Rk5WMlBJemZQTg", "resource-additions": 1, "resource-changes": 0, "resource-destructions": 0, "resource-imports": 0 }, "relationships": { "state-versions": { "data": [ { "id": "sv-TpnsuD3iewwsfeRD", "type": "state-versions" }, { "id": "sv-Fu1n6a3TgJ1Typq9", "type": "state-versions" } ] } }, "links": { "self": "/api/v2/applies/apply-47MBvjwzBG8YKc2v" } } } ``` \_Using HCP Terraform agents\_ [HCP Terraform agents](/terraform/cloud-docs/api-docs/agents) allow HCP Terraform to communicate with isolated, private, or on-premises infrastructure. When a workspace is set to use the agent execution mode, the apply response will include additional details about the agent pool and agent used. ```json { "data": { "id": "apply-47MBvjwzBG8YKc2v", "type": "applies", "attributes": { "execution-details": { "agent-id": "agent-S1Y7tcKxXPJDQAvq", "agent-name": "agent\_01", "agent-pool-id": "apool-Zigq2VGreKq7nwph", "agent-pool-name": "first-pool", "mode": "agent", }, "status": "finished", "status-timestamps": { "queued-at": "2018-10-17T18:58:27+00:00", "started-at": "2018-10-17T18:58:29+00:00", "finished-at": "2018-10-17T18:58:37+00:00" }, "log-read-url": "https://archivist.terraform.io/v1/object/dmF1bHQ6djE6OFA1eEdlSFVHRSs4YUcwaW83a1dRRDA0U2E3T3FiWk1HM2NyQlNtcS9JS1hHN3dmTXJmaFhEYTlHdTF1ZlgxZ2wzVC9kVTlNcjRPOEJkK050VFI3U3dvS2ZuaUhFSGpVenJVUFYzSFVZQ1VZYno3T3UyYjdDRVRPRE5pbWJDVTIrNllQTENyTndYd1Y0ak1DL1dPVlN1VlNxKzYzbWlIcnJPa2dRRkJZZGtFeTNiaU84YlZ4QWs2QzlLY3VJb3lmWlIrajF4a1hYZTlsWnFYemRkL2pNOG9Zc0ZDakdVMCtURUE3dDNMODRsRnY4cWl1dUN5dUVuUzdnZzFwL3BNeHlwbXNXZWRrUDhXdzhGNnF4c3dqaXlZS29oL3FKakI5dm9uYU5ZKzAybnloREdnQ3J2Rk5WMlBJemZQTg", "resource-additions": 1, "resource-changes": 0, "resource-destructions": 0, "resource-imports": 0 }, "relationships": { "state-versions": { "data": [ { "id": "sv-TpnsuD3iewwsfeRD", "type": "state-versions" }, { "id": "sv-Fu1n6a3TgJ1Typq9", "type": "state-versions" } ] } }, "links": { "self": "/api/v2/applies/apply-47MBvjwzBG8YKc2v" } } } ``` ## Recover a failed state upload after applying `GET /applies/:id/errored-state` | Parameter | Description | | --------- | ----------------------------------------- | | `id` | The ID of the apply to recover state for. | It is possible that during the course of a Run, Terraform may fail to upload a state file. This can happen for a variety of reasons, but should be an exceptionally rare occurrence. HCP Terraform agent versions greater than 1.12.0 include a fallback mechanism which attempts to upload the state directly to HCP Terraform's backend storage system in these cases. This endpoint then makes the raw data from these failed uploads available to users who are authorized to read the state contents. | Status | Response | Reason | |
https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/applies.mdx
main
terraform
[ -0.0668284073472023, 0.01898636296391487, 0.05389320105314255, 0.005449567921459675, -0.023174498230218887, -0.05492975190281868, -0.06841515004634857, -0.034653156995773315, 0.05326699838042259, 0.07290538400411606, -0.023033058270812035, -0.05347114056348801, 0.028521958738565445, -0.004...
0.046008
include a fallback mechanism which attempts to upload the state directly to HCP Terraform's backend storage system in these cases. This endpoint then makes the raw data from these failed uploads available to users who are authorized to read the state contents. | Status | Response | Reason | | ------- | -------------------------------------------- | ----------------------------------------------------------------------------------- | | [307][] | HTTP temporary redirect to state storage URL | Errored state available and user is authorized to read it | | [404][] | [JSON API error object][] | Apply not found, errored state not uploaded, or user unauthorized to perform action | When a 307 redirect is returned, the storage URL to the raw state file will be present in the `Location` header of the response. The URL in the `Location` header will expire after one minute. It is recommended for the API client to follow the redirect immediately. Each successful request to the errored-state endpoint will generate a new, unique storage URL with the same one minute expiration window. ### Sample Request ```shell curl \ --header "Authorization: Bearer $TOKEN" \ https://app.terraform.io/api/v2/applies/apply-47MBvjwzBG8YKc2v/errored-state ``` ### Sample Response ``` HTTP/1.1 307 Temporary Redirect Content-Length: 22 Content-Type: text/plain Location: https://archivist.terraform.io/v1/object/dmF1bHQ6djE6OFA1eEdlSFVHRSs4YUcwaW83a1dRRDA0U2E3T3FiWk1HM2NyQlNtcS9JS1hHN3dmTXJmaFhEYTlHdTF1ZlgxZ2wzVC9kVTlNcjRPOEJkK050VFI3U3dvS2ZuaUhFSGpVenJVUFYzSFVZQ1VZYno3T3UyYjdDRVRPRE5pbWJDVTIrNllQTENyTndYd1Y0ak1DL1dPVlN1VlNxKzYzbWlIcnJPa2dRRkJZZGtFeTNiaU84YlZ4QWs2QzlLY3VJb3lmWlIrajF4a1hYZTlsWnFYemRkL2pNOG9Zc0ZDakdVMCtURUE3dDNMODRsRnY4cWl1dUN5dUVuUzdnZzFwL3BNeHlwbXNXZWRrUDhXdzhGNnF4c3dqaXlZS29oL3FKakI5dm9uYU5ZKzAybnloREdnQ3J2Rk5WMlBJemZQTg 307 Temporary Redirect ```
https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/applies.mdx
main
terraform
[ -0.07395043224096298, 0.11413031071424484, 0.003036334179341793, -0.006965418346226215, -0.010809745639562607, -0.024636292830109596, -0.06968122720718384, -0.01678571291267872, -0.0326310396194458, 0.060651641339063644, -0.018974926322698593, -0.08797726780176163, 0.09766222536563873, -0....
0.031236
[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 # Cost estimates API reference Use the cost estimate API to estimate the cost of your HCP Terraform workspaces. ## Show a cost estimate -> \*\*Note\*\*: The hash in the `resources` attribute structure represents low-level Cost Estimation details. The keys or structure may change over time. Use the data in this hash at your own risk. `GET /cost-estimates/:id` | Parameter | Description | | --------- | ------------------------------------ | | `id` | The ID of the cost estimate to show. | There is no endpoint to list cost estimates. You can find the ID for a cost estimate in the `relationships.cost-estimate` property of a run object. | Status | Response | Reason | | ------- | ------------------------------------------------ | --------------------------------------------------------------- | | [200][] | [JSON API document][] (`type: "cost-estimates"`) | The request was successful | | [404][] | [JSON API error object][] | Cost estimate not found, or user unauthorized to perform action | ### Sample Request ```shell curl \ --header "Authorization: Bearer $TOKEN" \ https://app.terraform.io/api/v2/cost-estimates/ce-BPvFFrYCqRV6qVBK ``` ### Sample Response ```json { "data": [ { "id": "ce-BPvFFrYCqRV6qVBK", "type": "cost-estimates", "attributes": { "error-message": null, "status": "finished", "status-timestamps": { "queued-at": "2017-11-29T20:02:17+00:00", "finished-at": "2017-11-29T20:02:20+00:00" }, "resources": {...}, "resources-count": 4, "matched-resources-count": 3, "unmatched-resources-count": 1, "prior-monthly-cost": "0.0", "proposed-monthly-cost": "25.488", "delta-monthly-cost": "25.488", }, "links": { "self": "/api/v2/cost-estimate/ce-9VYRc9bpfJEsnwum" } } ] } ```
https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/cost-estimates.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 # Change requests API reference @include 'beta/explorer.mdx' You can use change requests to keep track of workspace to-dos directly on that workspace. Change requests are a backlog of the changes that a workspace requires, often to ensure that workspace keeps up with compliance and best practices of your company. Change requests can also trigger [team notifications](/terraform/cloud-docs/users-teams-organizations/teams/notifications) to directly notify team members whenever someone creates a new change request. @include 'tfc-package-callouts/change-requests.mdx' ## List change requests Use this endpoint to list a workspace's change requests. `GET api/v2/workspaces/:workspace\_name/change-requests` | Parameter | Description | | ----------------------- | ------------------------ | | `:workspace\_name` | The name of workspace you want to list the change requests 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 teams 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/workspaces/:workspace\_name/change-requests ``` ### Sample response ```json { "data": [{ "type": "workspace\_change\_requests", "id": "wscr-yjLcKUMFTs6kr9iC" "attributes": { "subject": "[Action Required] Github Actions Pinning (SEC-090)", "message": "Some long description here", "archived-by": null, "archived-at": null, "created-at": "2024-06-12T21:45:11.594Z", "updated-at": "2024-06-12T21:45:11.594Z" }, "relationships": { "workspace" : { "data": { "id": "ws-FTs6kr9iCwweku", "type": "workspaces" } } } }, { "type": "workspace\_change\_requests", "id": "wscr-jXQMBkPAFGD6eyFs", "attributes": { "subject": "[Action Required] Github Actions Pinning (SEC-100)", "message": "Some long description here", "archived-by": null, "archived-at": null, "created-at": "2024-06-12T21:45:11.594Z", "updated-at": "2024-06-12T21:45:11.594Z" }, "relationships": { "workspace" : { "data": { "id": "ws-FTs6kr9iCwweku", "type": "workspaces" } } } }], "links": { "self": "https://localhost/api/v2/workspaces/example-workspace-name/change-requests?page%5Bnumber%5D=1\u0026page%5Bsize%5D=20", "first": "https://localhost/api/v2/workspaces/example-workspace-name/change-requests?page%5Bnumber%5D=1\u0026page%5Bsize%5D=20", "prev": null, "next": null, "last": "https://localhost/api/v2/workspaces/example-workspace-name/change-requests?page%5Bnumber%5D=1\u0026page%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 change request Use this endpoint to list the details of a specific change request. `GET api/v2/workspaces/change-requests/:change\_request\_id` | Parameter | Description | | ----------------------- | ------------------------ | | `:change\_request\_id` | The change request ID | ### Sample request ```shell $ curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request GET \ https://app.terraform.io/api/v2/change-requests/wscr-jXQMBkPAFGD6eyFs ``` ### Sample response ```json { "data": { "type": "workspace\_change\_requests", "id": "wscr-jXQMBkPAFGD6eyFs", "attributes": { "subject": "[Action Required] Github Actions Pinning (SEC-100)", "message": "Some long description here", "archived-by": null, "archived-at": null, "created-at": "2024-06-12T21:45:11.594Z", "updated-at": "2024-06-12T21:45:11.594Z" }, "relationships": { "workspace" : { "data": { "id": "ws-FTs6kr9iCwweku", "type": "workspaces" } } } } } ``` ## Archive change request If someone completes a change request, they can archive it to reflect the request's completion. You can still view archived change requests, however they are be sorted separated and marked as `"archived"`. `POST api/v2/workspaces/change-requests/:change\_request\_id` | Parameter | Description | | ----------------------- | ------------------------ | | `:change\_request\_id` | The ID of the change request to archive. | ### Sample request ```shell $ curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request PATCH \ https://app.terraform.io/api/v2/workspaces/change-requests/wscr-jXQMBkPAFGD6eyFs` ``` ### Sample response ```json { "data": { "type": "workspace\_change\_requests", "id": "wscr-jXQMBkPAFGD6eyFs", "attributes": { "subject": "[Action Required] Github Actions Pinning (SEC-100)", "message": "Some long description here", "archived-by": "user-2n4yj45149kf", "archived-at": "2024-08-12T10:12:44.745Z", "created-at": "2024-06-12T21:45:11.594Z", "updated-at": "2024-06-12T21:45:11.594Z" }, "relationships": { "workspace" : { "data": { "id": "ws-FTs6kr9iCwweku", "type": "workspaces" } } }
https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/change-requests.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
https://app.terraform.io/api/v2/workspaces/change-requests/wscr-jXQMBkPAFGD6eyFs` ``` ### Sample response ```json { "data": { "type": "workspace\_change\_requests", "id": "wscr-jXQMBkPAFGD6eyFs", "attributes": { "subject": "[Action Required] Github Actions Pinning (SEC-100)", "message": "Some long description here", "archived-by": "user-2n4yj45149kf", "archived-at": "2024-08-12T10:12:44.745Z", "created-at": "2024-06-12T21:45:11.594Z", "updated-at": "2024-06-12T21:45:11.594Z" }, "relationships": { "workspace" : { "data": { "id": "ws-FTs6kr9iCwweku", "type": "workspaces" } } } } } ``` ## Create new change request You can make change requests through the [explorer's](/terraform/cloud-docs/api-docs/explorer) experimental `"bulk actions"` endpoint. `POST /api/v2/organizations/:organization\_name/explorer/bulk-actions` | Parameter | Description | | ----------------------- | ------------------------ | | `:organization\_id` | The ID of the organization you want to create a change request in. | You must specify the following fields in your payload when creating a new change request. | Key path | Type | Required | Description | |------------|------|---------|-------------| | `data.attributes.action\_type` | string | Required | The action to take. To create a change request, specify `"change\_request"`. | | `data.attributes.action\_inputs` | object | Required | Arguments for the bulk action. | | `data.attributes.action\_inputs.subject` | string | Required | The change request's subject line. | `data.attributes.action\_inputs.message` | string | Required | The change request's message, which HCP Terraform treats as markdown. | | `data.attributes.target\_ids` | array | Optional | The IDs of the workspace you want to associate with this change request. You do not need to specify this field if you provide `data.attribute.query`. | | `data.attributes.query` | object | Optional | An [explorer query](/terraform/cloud-docs/api-docs/explorer#execute-a-query) with workspace data. You do not need to specify this field if you provide `data.attribute.target\_ids`. | ### Sample Payload ```json { "data": { "type": "bulk\_actions", "attributes": { "action\_type": "change\_requests", "action\_inputs": { "subject": "[Action Required] Github Actions Pinning (SEC-090)", "message": "Some long description here", }, "query": { "type": "workspaces", "filter": [ { "workspace\_name": { "contains": [ "dev" ] } } ] } } } } ``` ### 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/:organization\_name/explorer/bulk-actions ``` ### Sample response ```json { "data": { "id": "eba-3jk34n5k2bs", "attributes": { "organization\_id": "org-9mvjfwpq098", "action\_type": "change\_requests", "action\_inputs": { "subject": "[Action Required] Github Actions Pinning (SEC-090)", "message": "Some long description here", }, "created\_by": { "id": "user-n86dcbcrwtw9", "type": "users" } }, "type": "explorer\_bulk\_actions", } } ``` @include 'beta/explorer-limitations.mdx'
https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/change-requests.mdx
main
terraform
[ -0.09113755077123642, 0.024833254516124725, 0.03869309276342392, 0.031137919053435326, 0.01927478238940239, -0.07259581983089447, -0.06434320658445358, -0.08330056071281433, 0.08227723836898804, 0.10160734504461288, -0.00994723942130804, -0.06082848459482193, 0.02104640007019043, 0.0240551...
0.025953
[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 sets API reference [Policy Enforcement](/terraform/cloud-docs/policy-enforcement) lets you use the policy-as-code frameworks Sentinel and Open Policy Agent (OPA) to apply policy checks to HCP Terraform workspaces. [Policy sets](/terraform/cloud-docs/policy-enforcement/manage-policy-sets) are collections of policies that you can apply globally or to specific [projects](/terraform/cloud-docs/projects/manage) and workspaces. For each run in the selected workspaces, HCP Terraform checks the Terraform plan against the policy set. @include 'tfc-package-callouts/policies.mdx' This API provides endpoints to create, read, update, and delete policy sets in an HCP Terraform organization. To view and manage individual policies, use the [Policies API](/terraform/cloud-docs/api-docs/policies). Many of these endpoints let you create policy sets from a designated repository in a Version Control System (VCS). For more information about how to configure a policy set VCS repository, refer to [Sentinel Policy Set VCS Repositories](/terraform/cloud-docs/policy-enforcement/sentinel/vcs) and [OPA Policy Set VCS Repositories](/terraform/cloud-docs/policy-enforcement/opa/vcs). Instead of connecting HCP Terraform to a VCS repository, you can use the the [Policy Set Versions endpoint](#create-a-policy-set-version) to create an entire policy set from a `tar.gz` file. Interacting with policy sets requires permission to manage policies. ([More about permissions](/terraform/cloud-docs/users-teams-organizations/permissions).) [permissions-citation]: #intentionally-unused---keep-for-maintainers ## Create a policy set `POST /organizations/:organization\_name/policy-sets` | Parameter | Description | | -------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `:organization\_name` | The organization to create the policy set in. The organization must already exist in the system, and the token authenticating the API request must have permission to manage policies. ([More about permissions.](/terraform/cloud-docs/users-teams-organizations/permissions)) | [permissions-citation]: #intentionally-unused---keep-for-maintainers | Status | Response | Reason | | ------- | --------------------------------------------- | -------------------------------------------------------------- | | [201][] | [JSON API document][] (`type: "policy-sets"`) | Successfully created a policy set | | [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 `"policy-sets"`. | | `data.attributes.name` | string | | The name of the policy set. Can include letters, numbers, `-`, and `\_`. | | `data.attributes.description` | string | `null` | Text describing the policy set's purpose. This field supports Markdown and appears in the HCP Terraform UI. | | `data.attributes.global` | boolean | `false` | Whether HCP Terraform should automatically apply this policy set to all of an organization's workspaces. | | `data.attributes.kind` | string | `sentinel` | The policy-as-code framework associated with the policy. Valid values are `sentinel` and `opa`. | | `data.attributes.overridable` | boolean | `false` | Whether or not users can override this policy when it fails during a run. Valid for sentinel policies only if `agent-enabled` is set to `true`. | | `data.attributes.vcs-repo` | object | `null` | VCS repository information. When present, HCP Terraform sources the policies and configuration from the specified VCS repository. This attribute and `policies` relationships are mutually exclusive, and you cannot use them simultaneously. | | `data.attributes.vcs-repo.branch` | string | `null` | The branch of the VCS repository where HCP Terraform should retrieve the policy set. If empty, HCP Terraform uses the default branch. | | `data.attributes.vcs-repo.identifier` | string | | The VCS repository identifier in the format `/`. For example, `hashicorp/my-policy-set`. The format for Azure DevOps is
https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/policy-sets.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
string | `null` | The branch of the VCS repository where HCP Terraform should retrieve the policy set. If empty, HCP Terraform uses the default branch. | | `data.attributes.vcs-repo.identifier` | string | | The VCS repository identifier in the format `/`. For example, `hashicorp/my-policy-set`. The format for Azure DevOps is `//\_git/`. | | `data.attributes.vcs-repo.oauth-token-id` | string | | The OAuth Token ID HCP Terraform should use to connect to the VCS host. This value must not be specified 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.ingress-submodules` | boolean | `false` | Whether HCP Terraform should instantiate repository submodules when retrieving the policy set. | | `data.attributes.policies-path` | string | `null` | The VCS repository subdirectory that contains the policies for this policy set. HCP Terraform ignores files and directories outside of this sub-path and does not update the policy set when those files change. This attribute is only valid when you specify a VCS repository for the policy set. | | `data.relationships.projects.data[]` | array\[object] | `[]` | A list of resource identifier objects that defines which projects are associated with the policy set. These objects must contain `id` and `type` properties, and the `type` property must be `projects`. For example, `{ "id": "prj-AwfuCJTkdai4xj9w", "type": "projects" }`. You can only specify this attribute when `data.attributes.global` is `false`. | | `data.relationships.workspaces.data[]` | array\[object] | `[]` | A list of resource identifier objects that defines which workspaces are associated with the policy set. These objects must contain `id` and `type` properties, and the `type` property must be `workspaces`. For example, `{ "id": "ws-2HRvNs49EWPjDqT1", "type": "workspaces" }`. Obtain workspace IDs from the [workspace's settings page](/terraform/enterprise/workspaces/settings) or the [Show Workspace endpoint](/terraform/enterprise/api-docs/workspaces#show-workspace). You can only specify this attribute when `data.attributes.global` is `false`.| | `data.relationships.workspace-exclusions.data[]` | array\[object] | `[]` | A list of resource identifier objects specifying which workspaces HCP Terraform excludes from a policy set's enforcement. These objects must contain `id` and `type` properties, and the `type` property must be `workspaces`. For example, `{ "id": "ws-FVVvzCDaykN1oHiw", "type": "workspaces" }`. | | `data.relationships.policies.data[]` | array\[object] | `[]` | A list of resource identifier objects that defines which policies are members of the policy set. These objects must contain `id` and `type` properties, and the `type` property must be `policies`. For example, `{ "id": "pol-u3S5p2Uwk21keu1s", "type": "policies" }`. | | `data.attributes.agent-enabled` | boolean | `false` | Only valid for `sentinel` policy sets. Whether this policy set should run as a policy evaluation in the HCP Terraform agent. | | `data.attributes.policy-tool-version` | string | `latest` | The version of the tool that HCP Terraform uses to evaluate policies. You can only set a policy tool version for 'sentinel' policy sets if `agent-enabled` is `true`. | ### Sample Payload ```json { "data": { "type": "policy-sets", "attributes": { "name": "production", "description": "This set contains policies that should be checked on all production infrastructure workspaces.", "global": false, "kind": "sentinel", "agent-enabled": true, "policy-tool-version": "0.23.0", "overridable": true, "policies-path": "/policy-sets/foo", "vcs-repo": { "branch": "main", "identifier": "hashicorp/my-policy-sets", "ingress-submodules": false, "oauth-token-id": "ot-7Fr9d83jWsi8u23A" } }, "relationships": { "projects": { "data": [ { "id": "prj-AwfuCJTkdai4xj9w", "type": "projects" } ] }, "workspaces": { "data": [ { "id": "ws-2HRvNs49EWPjDqT1", "type": "workspaces" } ] }, "workspace-exclusions": { "data": [ { "id": "ws-FVVvzCDaykN1oHiw", "type": "workspaces" } ] } } } } ``` ### Sample payload with individual policy relationships ```json {
https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/policy-sets.mdx
main
terraform
[ 0.027349021285772324, 0.027516338974237442, -0.015119390562176704, -0.01526494137942791, -0.04485762119293213, 0.029262568801641464, 0.029107723385095596, 0.0031707838643342257, 0.03482667729258537, 0.0925656110048294, -0.03204675763845444, -0.11734076589345932, 0.08157415688037872, -0.034...
-0.006776
{ "projects": { "data": [ { "id": "prj-AwfuCJTkdai4xj9w", "type": "projects" } ] }, "workspaces": { "data": [ { "id": "ws-2HRvNs49EWPjDqT1", "type": "workspaces" } ] }, "workspace-exclusions": { "data": [ { "id": "ws-FVVvzCDaykN1oHiw", "type": "workspaces" } ] } } } } ``` ### Sample payload with individual policy relationships ```json { "data": { "type": "policy-sets", "attributes": { "name": "production", "description": "This set contains policies that should be checked on all production infrastructure workspaces.", "kind": "sentinel", "global": false, "agent-enabled": true, "policy-tool-version": "0.23.0", "overridable": true }, "relationships": { "policies": { "data": [ { "id": "pol-u3S5p2Uwk21keu1s", "type": "policies" } ] }, "workspaces": { "data": [ { "id": "ws-2HRvNs49EWPjDqT1", "type": "workspaces" } ] } } } } ``` ### 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/policy-sets ``` ### Sample Response ```json { "data": { "id":"polset-3yVQZvHzf5j3WRJ1", "type":"policy-sets", "attributes": { "name": "production", "description": "This set contains policies that should be checked on all production infrastructure workspaces.", "kind": "sentinel", "global": false, "agent-enabled": true, "policy-tool-version": "0.23.0", "overridable": true, "workspace-count": 1, "policies-path": "/policy-sets/foo", "versioned": true, "vcs-repo": { "branch": "main", "identifier": "hashicorp/my-policy-sets", "ingress-submodules": false, "oauth-token-id": "ot-7Fr9d83jWsi8u23A" }, "created-at": "2018-09-11T18:21:21.784Z", "updated-at": "2018-09-11T18:21:21.784Z" }, "relationships": { "organization": { "data": { "id": "my-organization", "type": "organizations" } }, "projects": { "data": [ { "id": "prj-AwfuCJTkdai4xj9w", "type": "projects" } ] }, "workspaces": { "data": [ { "id": "ws-2HRvNs49EWPjDqT1", "type": "workspaces" } ] }, "workspace-exclusions": { "data": [ { "id": "ws-FVVvzCDaykN1oHiw", "type": "workspaces" } ] }, }, "links": { "self":"/api/v2/policy-sets/polset-3yVQZvHzf5j3WRJ1" } } } ``` ### Sample response with individual policy relationships ```json { "data": { "id":"polset-3yVQZvHzf5j3WRJ1", "type":"policy-sets", "attributes": { "name": "production", "description": "This set contains policies that should be checked on all production infrastructure workspaces.", "kind": "sentinel", "global": false, "agent-enabled": true, "policy-tool-version": "0.23.0", "overridable": true, "policy-count": 1, "workspace-count": 1, "versioned": false, "created-at": "2018-09-11T18:21:21.784Z", "updated-at": "2018-09-11T18:21:21.784Z" }, "relationships": { "organization": { "data": { "id": "my-organization", "type": "organizations" } }, "policies": { "data": [ { "id": "pol-u3S5p2Uwk21keu1s", "type": "policies" } ] }, "workspaces": { "data": [ { "id": "ws-2HRvNs49EWPjDqT1", "type": "workspaces" } ] } }, "links": { "self":"/api/v2/policy-sets/polset-3yVQZvHzf5j3WRJ1" } } } ``` ## List policy sets `GET /organizations/:organization\_name/policy-sets` | Parameter | Description | | -------------------- | ----------------------------------------- | | `:organization\_name` | The organization to list policy sets for. | | Status | Response | Reason | | ------- | --------------------------------------------- | -------------------------------------------------------------- | | [200][] | [JSON API document][] (`type: "policy-sets"`) | 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 | | ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `filter[versioned]` | \*\*Optional.\*\* Allows filtering policy sets based on whether they are versioned (VCS-managed or API-managed), or use individual policy relationships. Accepts a boolean true/false value. A `true` value returns versioned sets, and a `false` value returns sets with individual policy relationships. If omitted, all policy sets are returned. | | `filter[kind]` | \*\*Optional.\*\* If specified, restricts results to those with the matching policy kind value. Valid values are `sentinel` and `opa`. | | `include` | \*\*Optional.\*\* Enables you to include related resource data. Value must be a comma-separated list containing one or more of `projects`, `workspaces`, `workspace-exclusions`, `policies`, `newest\_version`, or `current\_version`. See the [relationships section](#relationships) for details. | | `page[number]` | \*\*Optional.\*\* If omitted, the endpoint will return the first page. | | `page[size]` | \*\*Optional.\*\* If omitted, the endpoint will return 20 policy sets per page. | | `search[name]`
https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/policy-sets.mdx
main
terraform
[ -0.04178436100482941, 0.09638090431690216, 0.0010142510291188955, 0.014095459133386612, 0.029662348330020905, -0.05675838515162468, 0.01762772724032402, -0.053512055426836014, 0.034173622727394104, 0.00036662688944488764, 0.0011686625657603145, -0.08425430953502655, 0.030617836862802505, 0...
0.007953
one or more of `projects`, `workspaces`, `workspace-exclusions`, `policies`, `newest\_version`, or `current\_version`. See the [relationships section](#relationships) for details. | | `page[number]` | \*\*Optional.\*\* If omitted, the endpoint will return the first page. | | `page[size]` | \*\*Optional.\*\* If omitted, the endpoint will return 20 policy sets per page. | | `search[name]` | \*\*Optional.\*\* Allows searching the organization's policy sets by name. | ### Sample Request ```shell curl \ --header "Authorization: Bearer $TOKEN" \ https://app.terraform.io/api/v2/organizations/my-organization/policy-sets ``` ### Sample Response ```json { "data": [ { "id":"polset-3yVQZvHzf5j3WRJ1", "type":"policy-sets", "attributes": { "name": "production", "description": "This set contains policies that should be checked on all production infrastructure workspaces.", "kind": "sentinel", "global": false, "agent-enabled": true, "policy-tool-version": "0.23.0", "overridable": true, "workspace-count": 1, "policies-path": "/policy-sets/foo", "versioned": true, "vcs-repo": { "branch": "main", "identifier": "hashicorp/my-policy-sets", "ingress-submodules": false, "oauth-token-id": "ot-7Fr9d83jWsi8u23A" }, "created-at": "2018-09-11T18:21:21.784Z", "updated-at": "2018-09-11T18:21:21.784Z" }, "relationships": { "organization": { "data": { "id": "my-organization", "type": "organizations" } }, "projects": { "data": [ { "id": "prj-AwfuCJTkdai4xj9w", "type": "projects" } ] }, "workspaces": { "data": [ { "id": "ws-2HRvNs49EWPjDqT1", "type": "workspaces" } ] }, "workspace-exclusions": { "data": [ { "id": "ws-FVVvzCDaykN1oHiw", "type": "workspaces" } ] }, }, "links": { "self":"/api/v2/policy-sets/polset-3yVQZvHzf5j3WRJ1" } } ] } ``` ### Sample response with individual policy relationships ```json { "data": [ { "id":"polset-3yVQZvHzf5j3WRJ1", "type":"policy-sets", "attributes": { "name": "production", "description": "This set contains policies that should be checked on all production infrastructure workspaces.", "kind": "sentinel", "global": false, "agent-enabled": true, "policy-tool-version": "0.23.0", "overridable": true, "policy-count": 1, "workspace-count": 1, "versioned": false, "created-at": "2018-09-11T18:21:21.784Z", "updated-at": "2018-09-11T18:21:21.784Z" }, "relationships": { "organization": { "data": { "id": "my-organization", "type": "organizations" } }, "policies": { "data": [ { "id": "pol-u3S5p2Uwk21keu1s", "type": "policies" } ] }, "workspaces": { "data": [ { "id": "ws-2HRvNs49EWPjDqT1", "type": "workspaces" } ] } }, "links": { "self":"/api/v2/policy-sets/polset-3yVQZvHzf5j3WRJ1" } }, ] } ``` ## Show a policy set `GET /policy-sets/:id` | Parameter | Description | | --------- | ---------------------------------------------------------------------------------- | | `:id` | The ID of the policy set to show. Refer to [List Policy Sets](#list-policy-sets) for reference information about finding IDs. | | Status | Response | Reason | | ------- | --------------------------------------------- | ----------------------------------------------------------- | | [200][] | [JSON API document][] (`type: "policy-sets"`) | The request was successful | | [404][] | [JSON API error object][] | Policy set not found or user unauthorized to perform action | | Parameter | Description | | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `include` | \*\*Optional.\*\* Enables you to include related resource data. Value must be a comma-separated list containing one or more of `projects`, `workspaces`, `workspace-exclusions`, `policies`, `newest\_version`, or `current\_version`. See the [relationships section](#relationships) for details. | ### Sample Request ```shell curl --request GET \ -H "Authorization: Bearer $TOKEN" \ -H "Content-Type: application/vnd.api+json" \ https://app.terraform.io/api/v2/policy-sets/polset-3yVQZvHzf5j3WRJ1?include=current\_version ``` ### Sample Response ```json { "data": { "id":"polset-3yVQZvHzf5j3WRJ1", "type":"policy-sets", "attributes": { "name": "production", "description": "This set contains policies that should be checked on all production infrastructure workspaces.", "kind": "sentinel", "global": false, "agent-enabled": true, "policy-tool-version": "0.23.0", "overridable": true, "policy-count": 0, "workspace-count": 1, "policies-path": "/policy-sets/foo", "versioned": true, "vcs-repo": { "branch": "main", "identifier": "hashicorp/my-policy-sets", "ingress-submodules": false, "oauth-token-id": "ot-7Fr9d83jWsi8u23A" }, "created-at": "2018-09-11T18:21:21.784Z", "updated-at": "2018-09-11T18:21:21.784Z" }, "relationships": { "organization": { "data": { "id": "my-organization", "type": "organizations" } }, "current-version": { "data": { "id": "polsetver-m4yhbUBCgyDVpDL4", "type": "policy-set-versions" } }, "projects": { "data": [ { "id": "prj-AwfuCJTkdai4xj9w", "type": "projects" } ] }, "workspaces": { "data": [ { "id": "ws-2HRvNs49EWPjDqT1", "type": "workspaces" } ] }, "workspace-exclusions": { "data": [ { "id": "ws-FVVvzCDaykN1oHiw", "type": "workspaces" } ] }, }, "links": { "self":"/api/v2/policy-sets/polset-3yVQZvHzf5j3WRJ1" } }, "included": [ { "id": "polsetver-m4yhbUBCgyDVpDL4", "type": "policy-set-versions", "attributes": { "source": "github", "status": "ready", "status-timestamps": { "ready-at": "2019-06-21T21:29:48+00:00", "ingressing-at": "2019-06-21T21:29:47+00:00" }, "error": null, "ingress-attributes": { "commit-sha": "8766a423cb902887deb0f7da4d9beaed432984bb", "commit-url": "https://github.com/hashicorp/my-policy-sets/commit/8766a423cb902887deb0f7da4d9beaed432984bb", "identifier": "hashicorp/my-policy-sets" }, "created-at": "2019-06-21T21:29:47.792Z", "updated-at":
https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/policy-sets.mdx
main
terraform
[ -0.07671814411878586, 0.1018625944852829, -0.015590991824865341, 0.02266470529139042, 0.01568642631173134, -0.025136591866612434, -0.03197765722870827, -0.0969180017709732, 0.03804389759898186, 0.08292100578546524, -0.013043956831097603, -0.07948489487171173, 0.07217723876237869, 0.0006723...
0.072821
"data": [ { "id": "ws-FVVvzCDaykN1oHiw", "type": "workspaces" } ] }, }, "links": { "self":"/api/v2/policy-sets/polset-3yVQZvHzf5j3WRJ1" } }, "included": [ { "id": "polsetver-m4yhbUBCgyDVpDL4", "type": "policy-set-versions", "attributes": { "source": "github", "status": "ready", "status-timestamps": { "ready-at": "2019-06-21T21:29:48+00:00", "ingressing-at": "2019-06-21T21:29:47+00:00" }, "error": null, "ingress-attributes": { "commit-sha": "8766a423cb902887deb0f7da4d9beaed432984bb", "commit-url": "https://github.com/hashicorp/my-policy-sets/commit/8766a423cb902887deb0f7da4d9beaed432984bb", "identifier": "hashicorp/my-policy-sets" }, "created-at": "2019-06-21T21:29:47.792Z", "updated-at": "2019-06-21T21:29:48.887Z" }, "relationships": { "policy-set": { "data": { "id": "polset-a2mJwtmKygrA11dh", "type": "policy-sets" } } }, "links": { "self": "/api/v2/policy-set-versions/polsetver-E4S7jz8HMjBienLS" } } ] } ``` ### Sample response with individual policy relationships ```json { "data": { "id":"polset-3yVQZvHzf5j3WRJ1", "type":"policy-sets", "attributes": { "name": "production", "description": "This set contains policies that should be checked on all production infrastructure workspaces.", "kind": "sentinel", "global": false, "agent-enabled": true, "policy-tool-version": "0.23.0", "overridable": true, "policy-count": 1, "workspace-count": 1, "versioned": false, "created-at": "2018-09-11T18:21:21.784Z", "updated-at": "2018-09-11T18:21:21.784Z", }, "relationships": { "organization": { "data": { "id": "my-organization", "type": "organizations" } }, "policies": { "data": [ { "id": "pol-u3S5p2Uwk21keu1s", "type": "policies" } ] }, "workspaces": { "data": [ { "id": "ws-2HRvNs49EWPjDqT1", "type": "workspaces" } ] } }, "links": { "self":"/api/v2/policy-sets/polset-3yVQZvHzf5j3WRJ1" } } } ``` -> \*\*Note:\*\* The `data.relationships.projects` and `data.relationships.workspaces` refer to the projects and workspaces attached to the policy set. HCP Terraform omits these keys for policy sets marked as global, which are implicitly related to all of the organization's workspaces. ## Update a policy set `PATCH /policy-sets/:id` | Parameter | Description | | --------- | ------------------------------------------------------------------------------------ | | `:id` | The ID of the policy set to update. Refer to [List Policy Sets](#list-policy-sets) for reference information about finding IDs. | | Status | Response | Reason | | ------- | --------------------------------------------- | -------------------------------------------------------------- | | [200][] | [JSON API document][] (`type: "policy-sets"`) | The request was successful | | [404][] | [JSON API error object][] | Policy set 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. Properties without a default value are required. | Key path | Type | Default | Description | | ---------------------------------------------------- | -------------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `data.type` | string | | Must be `"policy-sets"`. | | `data.attributes.name` | string | (previous value) | The name of the policy set. Can include letters, numbers, `-`, and `\_`. | | `data.attributes.description` | string | (previous value) | A description of the set's purpose. This field supports markdown and appears in the HCP Terraform UI. | | `data.attributes.global` | boolean | (previous value) | Whether or not the policies in this set should be checked in all of the organization's workspaces or only in workspaces directly attached to the set. | | `data.attributes.vcs-repo` | object | (previous value) | VCS repository information. When present, HCP Terraform sources the policies and configuration from the specified VCS repository instead of using definitions from HCP Terraform. Note that this option and `policies` relationships are mutually exclusive and may not be used simultaneously. | | `data.attributes.vcs-repo.branch` | string | (previous value) | The branch of the VCS repo. When empty, HCP Terraform uses the VCS provider's default branch value. | | `data.attributes.vcs-repo.identifier` | string | (previous value) | The VCS repository identifier in the the following format: `/`. An example identifier in GitHub is `hashicorp/my-policy-set`. The format for Azure DevOps is `//\_git/`. | | `data.attributes.vcs-repo.oauth-token-id` | string | (previous value) | The OAuth token ID to use to connect to the VCS host. | | `data.attributes.vcs-repo.ingress-submodules` | boolean | (previous value) | Determines whether HCP Terraform instantiates repository submodules during the clone operation. | | `data.attributes.policies-path`
https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/policy-sets.mdx
main
terraform
[ -0.04418023303151131, 0.08859925717115402, -0.034685734659433365, 0.01454355102032423, 0.06710485368967056, -0.03425951674580574, -0.0043640583753585815, -0.00285781966522336, 0.01388459000736475, 0.07687853276729584, 0.015252596698701382, -0.0857950896024704, 0.007450493052601814, 0.01079...
0.049487
format for Azure DevOps is `//\_git/`. | | `data.attributes.vcs-repo.oauth-token-id` | string | (previous value) | The OAuth token ID to use to connect to the VCS host. | | `data.attributes.vcs-repo.ingress-submodules` | boolean | (previous value) | Determines whether HCP Terraform instantiates repository submodules during the clone operation. | | `data.attributes.policies-path` | boolean | (previous value) | The subdirectory of the attached VCS repository that contains the policies for this policy set. HCP Terraform ignores files and directories outside of the sub-path. Changes to the unrelated files do not update the policy set. You can only enable this option when a VCS repository is present. | | `data.relationships.projects` | array\[object] | (previous value) | An array of references to projects that the policy set should be assigned to. Sending an empty array clears all project assignments. You can only specify this attribute when `data.attributes.global` is `false`. | | `data.relationships.workspaces` | array\[object] | (previous value) | An array of references to workspaces that the policy set should be assigned to. Sending an empty array clears all workspace assignments. You can only specify this attribute when `data.attributes.global` is `false`. | | `data.relationships.workspace-exclusions` | array\[object] | (previous value) | An array of references to excluded workspaces that HCP Terraform will not enforce this policy set upon. Sending an empty array clears all exclusions assignments. | | `data.attributes.agent-enabled` | boolean | `false` | Only valid for `sentinel` policy sets. Whether this policy set should run as a policy evaluation in the HCP Terraform agent. | |`data.attributes.policy-tool-version` | string | `latest` | The version of the tool that HCP Terraform uses to evaluate policies. You can only set a policy tool version for 'sentinel' policy sets if `agent-enabled` is `true`. | ### Sample Payload ```json { "data": { "type": "policy-sets", "attributes": { "name": "workspace-scoped-policy-set", "description": "Policies added to this policy set will be enforced on specified workspaces", "global": false, "agent-enabled": true, "policy-tool-version": "0.23.0" }, "relationships": { "projects": { "data": [ { "id": "prj-AwfuCJTkdai4xj9w", "type": "projects" } ] }, "workspaces": { "data": [ { "id": "ws-2HRvNs49EWPjDqT1", "type": "workspaces" } ] }, "workspace-exclusions": { "data": [ { "id": "ws-FVVvzCDaykN1oHiw", "type": "workspaces" } ] } } } } ``` ### 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/policy-sets/polset-3yVQZvHzf5j3WRJ1 ``` ### Sample Response ```json { "data": { "id":"polset-3yVQZvHzf5j3WRJ1", "type":"policy-sets", "attributes": { "name": "workspace-scoped-policy-set", "description": "Policies added to this policy set will be enforced on specified workspaces", "global": false, "kind": "sentinel", "agent-enabled": true, "policy-tool-version": "0.23.0", "overridable": true, "policy-count": 1, "workspace-count": 1, "versioned": false, "created-at": "2018-09-11T18:21:21.784Z", "updated-at": "2018-09-11T18:21:21.784Z" }, "relationships": { "organization": { "data": { "id": "my-organization", "type": "organizations" } }, "policies": { "data": [ { "id": "pol-u3S5p2Uwk21keu1s", "type": "policies" } ] }, "projects": { "data": [ { "id": "prj-AwfuCJTkdai4xj9w", "type": "projects" } ] }, "workspaces": { "data": [ { "id": "ws-2HRvNs49EWPjDqT1", "type": "workspaces" } ] }, "workspace-exclusions": { "data": [ { "id": "ws-FVVvzCDaykN1oHiw", "type": "workspaces" } ] } }, "links": { "self":"/api/v2/policy-sets/polset-3yVQZvHzf5j3WRJ1" } } } ``` ## Add policies to the policy set `POST /policy-sets/:id/relationships/policies` | Parameter | Description | | --------- | --------------------------------------------------------------------------------------------- | | `:id` | The ID of the policy set to add policies to. Refer to [List Policy Sets](#list-policy-sets) for reference information about finding IDs. | | Status | Response | Reason | | ------- | ------------------------- | -------------------------------------------------------------------------- | | [204][] | No Content | The request was successful | | [404][] | [JSON API error object][] | Policy set not found or user unauthorized to perform action | | [422][] | [JSON API error object][] | Malformed request body (one or more
https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/policy-sets.mdx
main
terraform
[ -0.02632627636194229, 0.02196778729557991, 0.05127299204468727, 0.008522040210664272, -0.026988990604877472, 0.0009030341752804816, 0.049946803599596024, -0.07108166068792343, 0.04412086308002472, 0.12118002027273178, -0.01445920579135418, -0.06181647256016731, 0.08467474579811096, -0.0079...
-0.024531
------- | ------------------------- | -------------------------------------------------------------------------- | | [204][] | No Content | The request was successful | | [404][] | [JSON API error object][] | Policy set not found or user unauthorized to perform action | | [422][] | [JSON API error object][] | Malformed request body (one or more policies not found, wrong types, etc.) | ~> \*\*Note:\*\* This endpoint may only be used when there is no VCS repository associated with the policy set. ### 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[]` | array\[object] | | A list of resource identifier objects that defines which policies will be added to the set. These objects must contain `id` and `type` properties, and the `type` property must be `policies` (e.g. `{ "id": "pol-u3S5p2Uwk21keu1s", "type": "policies" }`). | ### Sample Payload ```json { "data": [ { "id": "pol-u3S5p2Uwk21keu1s", "type": "policies" }, { "id": "pol-2HRvNs49EWPjDqT1", "type": "policies" } ] } ``` ### Sample Request ```shell curl \ -H "Authorization: Bearer $TOKEN" \ -H "Content-Type: application/vnd.api+json" \ --request POST \ --data @payload.json \ https://app.terraform.io/api/v2/policy-sets/polset-3yVQZvHzf5j3WRJ1/relationships/policies ``` ## Attach a policy set to projects `POST /policy-sets/:id/relationships/projects` | Parameter | Description | | --------- | ------------------------------------------------------------------------------------------------ | | `:id` | The ID of the policy set to attach to projects. Refer to [List Policy Sets](#list-policy-sets) for reference information about finding IDs. | -> \*\*Note:\*\* You can not attach global policy sets to individual projects. | Status | Response | Reason | | ------- | ------------------------- | -------------------------------------------------------------------------- | | [204][] | Nothing | The request was successful | | [404][] | [JSON API error object][] | Policy set not found or user unauthorized to perform action | | [422][] | [JSON API error object][] | Malformed request body (one or more projects not found, 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[]` | array\[object] | | A list of resource identifier objects that defines which projects to attach the policy set to. These objects must contain `id` and `type` properties, and the `type` property must be `projects` (e.g. `{ "id": "prj-AwfuCJTkdai4xj9w", "type": "projects" }`). | ### Sample Payload ```json { "data": [ { "id": "prj-AwfuCJTkdai4xj9w", "type": "projects" }, { "id": "prj-2HRvNs49EWPjDqT1", "type": "projects" } ] } ``` ### Sample Request ```shell curl \ -H "Authorization: Bearer $TOKEN" \ -H "Content-Type: application/vnd.api+json" \ --request POST \ --data @payload.json \ https://app.terraform.io/api/v2/policy-sets/polset-3yVQZvHzf5j3WRJ1/relationships/projects ``` ## Attach a policy set to workspaces `POST /policy-sets/:id/relationships/workspaces` | Parameter | Description | | --------- | -------------------------------------------------------------------------------------------------- | | `:id` | The ID of the policy set to attach to workspaces. Refer to [List Policy Sets](#list-policy-sets) for reference information about finding IDs. | -> \*\*Note:\*\* Policy sets marked as global cannot be attached to individual workspaces. | Status | Response | Reason | | ------- | ------------------------- | ---------------------------------------------------------------------------- | | [204][] | No Content | The request was successful | | [404][] | [JSON API error object][] | Policy set not found or user unauthorized to perform action | | [422][] | [JSON API error object][] | Malformed request body (one or more workspaces not found, wrong types, etc.) | ### Request Body This POST endpoint requires a JSON object with the following properties
https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/policy-sets.mdx
main
terraform
[ -0.08664678782224655, 0.0465003065764904, -0.04885751008987427, -0.061465200036764145, -0.019197450950741768, -0.05792342126369476, -0.05070282891392708, 0.0020565050654113293, 0.01776641421020031, 0.043176379054784775, 0.05989692732691765, -0.017832059413194656, -0.002509121084585786, 0.0...
0.081201
API error object][] | Policy set not found or user unauthorized to perform action | | [422][] | [JSON API error object][] | Malformed request body (one or more workspaces not found, 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[]` | array\[object] | | A list of resource identifier objects that defines the workspaces the policy set will be attached to. These objects must contain `id` and `type` properties, and the `type` property must be `workspaces` (e.g. `{ "id": "ws-2HRvNs49EWPjDqT1", "type": "workspaces" }`). | ### Sample Payload ```json { "data": [ { "id": "ws-u3S5p2Uwk21keu1s", "type": "workspaces" }, { "id": "ws-2HRvNs49EWPjDqT1", "type": "workspaces" } ] } ``` ### Sample Request ```shell curl \ -H "Authorization: Bearer $TOKEN" \ -H "Content-Type: application/vnd.api+json" \ --request POST \ --data @payload.json \ https://app.terraform.io/api/v2/policy-sets/polset-3yVQZvHzf5j3WRJ1/relationships/workspaces ``` ## Exclude a workspace from a policy set `POST /policy-sets/:id/relationships/workspace-exclusions` | Parameter | Description | | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | | `:id` | The ID of a policy set that you want HCP Terraform to exclude from the workspaces you specify. Refer to [List Policy Sets](#list-policy-sets) for reference information about finding IDs. | | Status | Response | Reason | | ------- | ------------------------- | ------------------------------------------------------------------------------------- | | [204][] | No Content | The request was successful | | [404][] | [JSON API error object][] | Policy set not found or user unauthorized to perform action | | [422][] | [JSON API error object][] | Malformed request body (one or more excluded workspaces not found, 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[]` | array\[object] | | A list of resource identifier objects that defines the excluded workspaces the policy set will be attached to. These objects must contain `id` and `type` properties, and the `type` property must be `workspaces` (e.g. `{ "id": "ws-2HRvNs49EWPjDqT1", "type": "workspaces" }`). | ### Sample Payload ```json { "data": [ { "id": "ws-u3S5p2Uwk21keu1s", "type": "workspaces" }, { "id": "ws-2HRvNs49EWPjDqT1", "type": "workspaces" } ] } ``` ### Sample Request ```shell curl \ -H "Authorization: Bearer $TOKEN" \ -H "Content-Type: application/vnd.api+json" \ --request POST \ --data @payload.json \ https://app.terraform.io/api/v2/policy-sets/polset-3yVQZvHzf5j3WRJ1/relationships/workspace-exclusions ``` ## Remove policies from the policy set `DELETE /policy-sets/:id/relationships/policies` | Parameter | Description | | --------- | -------------------------------------------------------------------------------------------------- | | `:id` | The ID of the policy set to remove policies from. Refer to [List Policy Sets](#list-policy-sets) for reference information about finding IDs. | | Status | Response | Reason | | ------- | ------------------------- | ----------------------------------------------------------- | | [204][] | No Content | The request was successful | | [404][] | [JSON API error object][] | Policy set not found or user unauthorized to perform action | | [422][] | [JSON API error object][] | Malformed request body (wrong types, etc.) | ~> \*\*Note:\*\* This endpoint may only be used when there is no VCS repository associated with the policy set. ### Request Body This DELETE 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[]` | array\[object] | | A list
https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/policy-sets.mdx
main
terraform
[ -0.058297690004110336, 0.053045853972435, -0.012830016203224659, -0.009436707012355328, -0.0930820032954216, -0.05307483673095703, -0.031765151768922806, -0.0037209063302725554, 0.010066655464470387, 0.004519333131611347, -0.005369668360799551, -0.07268588244915009, -0.015007605776190758, ...
0.044099
Body This DELETE 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[]` | array\[object] | | A list of resource identifier objects that defines which policies will be removed from the set. These objects must contain `id` and `type` properties, and the `type` property must be `policies` (e.g. `{ "id": "pol-u3S5p2Uwk21keu1s", "type": "policies" }`). | ### Sample Payload ```json { "data": [ { "id": "pol-u3S5p2Uwk21keu1s", "type": "policies" }, { "id": "pol-2HRvNs49EWPjDqT1", "type": "policies" } ] } ``` ### Sample Request ```shell curl \ -H "Authorization: Bearer $TOKEN" \ -H "Content-Type: application/vnd.api+json" \ --request DELETE \ --data @payload.json \ https://app.terraform.io/api/v2/policy-sets/polset-3yVQZvHzf5j3WRJ1/relationships/policies ``` ## Detach a policy set from projects `DELETE /policy-sets/:id/relationships/projects` | Parameter | Description | | --------- | -------------------------------------------------------------------------------------------------- | | `:id` | The ID of the policy set you want to detach from the specified projects. Refer to [List Policy Sets](#list-policy-sets) for reference information about finding IDs. | -> \*\*Note:\*\* You can not attach global policy sets to individual projects. | Status | Response | Reason | | ------- | ------------------------- | -------------------------------------------------------------------------- | | [204][] | Nothing | The request was successful | | [404][] | [JSON API error object][] | Policy set not found or user unauthorized to perform action | | [422][] | [JSON API error object][] | Malformed request body (one or more projects not found, wrong types, etc.) | ### Request Body This DELETE 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[]` | array\[object] | | A list of resource identifier objects that defines the projects the policy set will be detached from. These objects must contain `id` and `type` properties, and the `type` property must be `projects`. For example, `{ "id": "prj-AwfuCJTkdai4xj9w", "type": "projects" }`. | ### Sample Payload ```json { "data": [ { "id": "prj-AwfuCJTkdai4xj9w", "type": "projects" }, { "id": "prj-2HRvNs49EWPjDqT1", "type": "projects" } ] } ``` ### Sample Request ```shell curl \ -H "Authorization: Bearer $TOKEN" \ -H "Content-Type: application/vnd.api+json" \ --request DELETE \ --data @payload.json \ https://app.terraform.io/api/v2/policy-sets/polset-3yVQZvHzf5j3WRJ1/relationships/projects ``` ## Detach the policy set from workspaces `DELETE /policy-sets/:id/relationships/workspaces` | Parameter | Description | | --------- | ---------------------------------------------------------------------------------------------------- | | `:id` | The ID of the policy set to detach from workspaces. Refer to [List Policy Sets](#list-policy-sets) for reference information about finding IDs. | -> \*\*Note:\*\* Policy sets marked as global cannot be detached from individual workspaces. | Status | Response | Reason | | ------- | ------------------------- | ----------------------------------------------------------- | | [204][] | No Content | The request was successful | | [404][] | [JSON API error object][] | Policy set not found or user unauthorized to perform action | | [422][] | [JSON API error object][] | Malformed request body (wrong types, etc.) | ### Request Body This DELETE 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[]` | array\[object] | | A list of resource identifier objects that defines which workspaces the policy set will be detached from. These objects must contain `id` and `type` properties, and the `type` property must be `workspaces` (e.g. `{ "id": "ws-2HRvNs49EWPjDqT1", "type": "workspaces" }`). Obtain workspace IDs
https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/policy-sets.mdx
main
terraform
[ 0.0032615966629236937, 0.023007575422525406, 0.008710754103958607, -0.011619968339800835, -0.050018444657325745, -0.05958719551563263, -0.015268411487340927, -0.048812393099069595, 0.09102234244346619, 0.00007701788854319602, -0.007805296685546637, -0.04537500441074371, -0.032095156610012054...
0.036967
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `data[]` | array\[object] | | A list of resource identifier objects that defines which workspaces the policy set will be detached from. These objects must contain `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": [ { "id": "ws-u3S5p2Uwk21keu1s", "type": "workspaces" }, { "id": "ws-2HRvNs49EWPjDqT1", "type": "workspaces" } ] } ``` ### Sample Request ```shell curl \ -H "Authorization: Bearer $TOKEN" \ -H "Content-Type: application/vnd.api+json" \ --request DELETE \ --data @payload.json \ https://app.terraform.io/api/v2/policy-sets/polset-3yVQZvHzf5j3WRJ1/relationships/workspaces ``` ## Reinclude a workspace to a policy set `DELETE /policy-sets/:id/relationships/workspace-exclusions` | Parameter | Description | | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | | `:id` | The ID of the policy set HCP Terraform should reinclude (enforce) on the specified workspaces. Refer to [List Policy Sets](#list-policy-sets) for reference information about finding IDs. | | Status | Response | Reason | | ------- | ------------------------- | ----------------------------------------------------------- | | [204][] | No Content | The request was successful | | [404][] | [JSON API error object][] | Policy set not found or user unauthorized to perform action | | [422][] | [JSON API error object][] | Malformed request body (wrong types, etc.) | ### Request Body This DELETE 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[]` | array\[object] | | A list of resource identifier objects that defines which workspaces HCP Terraform should reinclude (enforce) this policy set on. These objects must contain `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": [ { "id": "ws-u3S5p2Uwk21keu1s", "type": "workspaces" }, { "id": "ws-2HRvNs49EWPjDqT1", "type": "workspaces" } ] } ``` ### Sample Request ```shell curl \ -H "Authorization: Bearer $TOKEN" \ -H "Content-Type: application/vnd.api+json" \ --request DELETE \ --data @payload.json \ https://app.terraform.io/api/v2/policy-sets/polset-3yVQZvHzf5j3WRJ1/relationships/workspace-exclusions ``` ## Delete a policy set `DELETE /policy-sets/:id` | Parameter | Description | | --------- | ------------------------------------------------------------------------------------ | | `:id` | The ID of the policy set to delete. Refer to [List Policy Sets](#list-policy-sets) for reference information about finding IDs. | | Status | Response | Reason | | ------- | ------------------------- | ------------------------------------------------------------ | | [204][] | No Content | Successfully deleted the policy set | | [404][] | [JSON API error object][] | Policy set 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/policy-sets/polset-3yVQZvHzf5j3WRJ1 ``` ## Create a policy set version For versioned policy sets which have no VCS repository attached, versions of policy code may be uploaded directly to the API by creating a new policy set version and, in a subsequent request, uploading a tarball (tar.gz) of data to it. `POST /policy-sets/:id/versions` | Parameter | Description | | --------- | ----------------------------------------------------- | | `:id` | The ID of the policy set to create a new version for. | | Status | Response | Reason | | ------- | ----------------------------------------------------- | ----------------------------------------------------------- | | [201][] | [JSON API document][] (`type: "policy-set-versions"`) | The request was successful. | | [404][] | [JSON API error object][] | Policy set not found or user unauthorized to perform action | | [422][] | [JSON API error object][] | The policy
https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/policy-sets.mdx
main
terraform
[ -0.04561082646250725, 0.000992842367850244, -0.049325134605169296, -0.034551337361335754, -0.09819324314594269, 0.012629598379135132, -0.001735057681798935, 0.045651014894247055, -0.005526287481188774, -0.05774746090173721, 0.06401685625314713, -0.0250454880297184, -0.0320785790681839, -0....
0.077915
| ------- | ----------------------------------------------------- | ----------------------------------------------------------- | | [201][] | [JSON API document][] (`type: "policy-set-versions"`) | The request was successful. | | [404][] | [JSON API error object][] | Policy set not found or user unauthorized to perform action | | [422][] | [JSON API error object][] | The policy set does not support uploading versions. | ### Sample Request ```shell curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request POST \ https://app.terraform.io/api/v2/policy-sets/polset-3yVQZvHzf5j3WRJ1/versions ``` ### Sample Response ```json { "data": { "id": "polsetver-cXciu9nQwmk9Cfrn", "type": "policy-set-versions", "attributes": { "source": "tfe-api", "status": "pending", "status-timestamps": {}, "error": null, "created-at": "2019-06-28T23:53:15.875Z", "updated-at": "2019-06-28T23:53:15.875Z" }, "relationships": { "policy-set": { "data": { "id": "polset-ws1CZBzm2h5K6ZT5", "type": "policy-sets" } } }, "links": { "self": "/api/v2/policy-set-versions/polsetver-cXciu9nQwmk9Cfrn", "upload": "https://archivist.terraform.io/v1/object/dmF1bHQ6djE6NWJPbHQ4QjV4R1ox..." } } } ``` The `upload` link URL in the above response is valid for one hour after creation. Make a `PUT` request to this URL directly, sending the policy set contents in `tar.gz` format as the request body. Once uploaded successfully, you can request the [Show Policy Set](#show-a-policy-set) endpoint again to verify that the status has changed from `pending` to `ready`. ## Upload policy set versions `PUT https://archivist.terraform.io/v1/object/` The URL is provided in the `upload` attribute in the `policy-set-versions` resource. ### Sample Request In the example below, `policy-set.tar.gz` is the local filename of the policy set version file to upload. ```shell curl \ --header "Content-Type: application/octet-stream" \ --request PUT \ --data-binary @policy-set.tar.gz \ https://archivist.terraform.io/v1/object/dmF1bHQ6djE6NWJPbHQ4QjV4R1ox... ``` ## Show a policy set version `GET /policy-set-versions/:id` | Parameter | Description | | --------- | ----------------------------------------- | | `:id` | The ID of the policy set version to show. | | Status | Response | Reason | | ------- | ----------------------------------------------------- | ------------------------------------------------------------------- | | [200][] | [JSON API document][] (`type: "policy-set-versions"`) | The request was successful. | | [404][] | [JSON API error object][] | Policy set version not found or user unauthorized to perform action | ### Sample Request ```shell curl \ --header "Authorization: Bearer $TOKEN" \ --request GET \ https://app.terraform.io/api/v2/policy-set-versions/polsetver-cXciu9nQwmk9Cfrn ``` ### Sample Response ```json { "data": { "id": "polsetver-cXciu9nQwmk9Cfrn", "type": "policy-set-versions", "attributes": { "source": "tfe-api", "status": "pending", "status-timestamps": {}, "error": null, "created-at": "2019-06-28T23:53:15.875Z", "updated-at": "2019-06-28T23:53:15.875Z" }, "relationships": { "policy-set": { "data": { "id": "polset-ws1CZBzm2h5K6ZT5", "type": "policy-sets" } } }, "links": { "self": "/api/v2/policy-set-versions/polsetver-cXciu9nQwmk9Cfrn", "upload": "https://archivist.terraform.io/v1/object/dmF1bHQ6djE6NWJPbHQ4QjV4R1ox..." } } } ``` The `upload` link URL in the above response is valid for one hour after the `created\_at` timestamp of the policy set version. Make a `PUT` request to this URL directly, sending the policy set contents in `tar.gz` format as the request body. Once uploaded successfully, you can request the [Show Policy Set Version](#show-a-policy-set-version) endpoint again to verify that the status has changed from `pending` to `ready`. ## Available related resources The GET endpoints above can optionally return related resources for policy sets, 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 | | ---------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `current\_version` | The most recent \*\*successful\*\* policy set version. | | `newest\_version` | The most recently created policy set version, regardless of status. Note that this relationship may include an errored and unusable version, and is intended to allow checking for VCS errors. | | `policies` | Individually managed policies which are associated with the policy set. | | `projects` | The projects this policy set applies to. | | `workspaces` | The workspaces this policy set applies to. | | `workspace-exclusions` | The workspaces excluded from this policy set's enforcement. | The following resource types may be included for policy set versions: | Resource Name | Description | | -------------
https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/policy-sets.mdx
main
terraform
[ -0.0496106892824173, 0.05178620666265488, -0.02482776902616024, -0.06477871537208557, 0.0490233413875103, -0.015557864680886269, -0.07677581161260605, -0.00962440762668848, 0.013647203333675861, 0.05769038572907448, 0.05040043964982033, -0.033439651131629944, -0.0204473789781332, -0.009171...
0.028528
The projects this policy set applies to. | | `workspaces` | The workspaces this policy set applies to. | | `workspace-exclusions` | The workspaces excluded from this policy set's enforcement. | The following resource types may be included for policy set versions: | Resource Name | Description | | ------------- | ---------------------------------------------------------------- | | `policy\_set` | The policy set associated with the specified policy set version. | ## Relationships The following relationships may be present in various responses for policy sets: | Resource Name | Description | | ---------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `current-version` | The most recent \*\*successful\*\* policy set version. | | `newest-version` | The most recently created policy set version, regardless of status. Note that this relationship may include an errored and unusable version, and is intended to allow checking for VCS errors. | | `organization` | The organization associated with the specified policy set. | | `policies` | Individually managed policies which are associated with the policy set. | | `projects` | The projects this policy set applies to. | | `workspaces` | The workspaces this policy set applies to. | | `workspace-exclusions` | The workspaces excluded from this policy set's enforcement. | The following relationships may be present in various responses for policy set versions: | Resource Name | Description | | ------------- | ---------------------------------------------------------------- | | `policy-set` | The policy set associated with the specified policy set version. |
https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/policy-sets.mdx
main
terraform
[ -0.05482875928282738, 0.0022311147768050432, -0.008640863932669163, 0.01669037900865078, 0.040817782282829285, 0.025184443220496178, 0.07745736837387085, -0.10481426119804382, 0.011969547718763351, 0.008367292582988739, 0.02032698318362236, -0.036658596247434616, 0.05901087448000908, -0.01...
0.000462
[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 # Teams API reference @include 'tfc-package-callouts/team-management.mdx' Use the Teams API endpoint to create, edit, and destroy teams and to manage a team's organization-level permissions. The [Team Membership API](/terraform/cloud-docs/api-docs/team-members) is used to add or remove users from a team. Use the [Team Access API](/terraform/cloud-docs/api-docs/team-access) to associate a team with privileges on an individual workspace. Any member of an organization can view visible teams and any secret teams they are a member of. Only organization owners can modify teams or view the full set of secret teams. The organization token and the owners team token can act as an owner on these endpoints. ([More about permissions.](/terraform/cloud-docs/users-teams-organizations/permissions)) In HCP Europe organizations, you use HCP \*\*groups\*\* to manage permissions instead of \*\*teams\*\*. To learn more about HCP Europe, refer to [Use HCP Terraform in Europe](/terraform/cloud-docs/europe). To learn how to create and delete groups in HCP, refer to [Create a group](/hcp/docs/hcp/iam/groups#create-a-group). To assign groups permissions in HCP Terraform, refer to the [Member roles API](/terraform/cloud-docs/api-docs/member-roles). [permissions-citation]: #intentionally-unused---keep-for-maintainers ## Organization Membership Users must be invited to join organizations before they can be added to teams. See [the Organization Memberships API documentation](/terraform/cloud-docs/api-docs/organization-memberships) for more information. Invited users who have not yet accepted will not appear in Teams API responses. ## List teams `GET organizations/:organization\_name/teams` | Parameter | Description | | -------------------- | ------------------------------------------------ | | `:organization\_name` | The name of the organization to list teams from. | The response may identify HashiCorp API service accounts, for example `api-team\_XXXXXX`, as a members of a team. However, API service accounts do not appear in the UI. As a result, there may be differences between the number of team members reported by the UI and the API. For example, the UI may report `0` members on a team when and the API reports `1`. ### 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.\*\* Allows querying a list of teams by name. This search is case-insensitive. | | `filter[names]` | \*\*Optional.\*\* If specified, restricts results to a team with a matching name. If multiple comma separated values are specified, teams matching any of the names are returned.| | `page[number]` | \*\*Optional.\*\* If omitted, the endpoint will return the first page. | | `page[size]` | \*\*Optional.\*\* If omitted, the endpoint will return 20 teams 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/organizations/my-organization/teams ``` ### Sample Response The `sso-team-id` attribute is only returned in Terraform Enterprise 202204-1 and later, or in HCP Terraform. The `allow-member-token-management` attribute is set to `false` for Terraform Enterprise versions older than 202408-1. ```json { "data": [ { "id": "team-6p5jTwJQXwqZBncC", "type": "teams", "attributes": { "name": "team-creation-test", "sso-team-id": "cb265c8e41bddf3f9926b2cf3d190f0e1627daa4", "users-count": 0, "visibility": "organization", "allow-member-token-management": true, "permissions": { "can-update-membership": true, "can-destroy": true, "can-update-organization-access": true, "can-update-api-token": true, "can-update-visibility": true }, "organization-access": { "manage-policies": true, "manage-policy-overrides": false, "manage-run-tasks": true, "manage-workspaces": false, "manage-vcs-settings": false, "manage-agent-pools": false, "manage-projects": false, "read-projects": false, "read-workspaces": false } }, "relationships": { "users": { "data": [] }, "authentication-token": { "meta": {} } }, "links": { "self": "/api/v2/teams/team-6p5jTwJQXwqZBncC" } } ] } ``` ## Create a Team `POST /organizations/:organization\_name/teams` | Parameter | Description | | -------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `:organization\_name` | The name of the
https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/teams.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, "read-workspaces": false } }, "relationships": { "users": { "data": [] }, "authentication-token": { "meta": {} } }, "links": { "self": "/api/v2/teams/team-6p5jTwJQXwqZBncC" } } ] } ``` ## Create a Team `POST /organizations/:organization\_name/teams` | Parameter | Description | | -------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `:organization\_name` | The name of the organization to create the team in. The organization must already exist in the system, and the user must have permissions to create new teams. | | Status | Response | Reason | | ------- | --------------------------------------- | -------------------------------------------------------------- | | [200][] | [JSON API document][] (`type: "teams"`) | 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 | ### Request Body This POST endpoint requires a JSON object with the following properties as a request payload. Properties without a default value are required. -> \*\*Note:\*\* You cannot set `manage-workspaces` to `false` when setting `manage-projects` to `true`, since project permissions cascade down to workspaces. This is also the case for `read-workspaces` and `read-projects`. If `read-projects` is `true`, `read-workspaces` must be `true` as well. | Key path | Type | Default | Description | |-----------------------------------------|--------|------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | `data.type` | string | | Must be `"teams"`. | | `data.attributes.name` | string | | The name of the team, which can only include letters, numbers, `-`, and `\_`. This will be used as an identifier and must be unique in the organization. | | `data.attributes.sso-team-id` | string | (nothing) | The unique identifier of the team from the SAML `MemberOf` attribute. Only available in Terraform Enterprise 202204-1 and later, or in HCP Terraform. | | `data.attributes.organization-access` | object | (nothing) | Settings for the team's organization access. This object can include the `manage-policies`, `manage-policy-overrides`, `manage-run-tasks`, `manage-workspaces`, `manage-vcs-settings`, `manage-agent-pools`, `manage-providers`, `manage-modules`, `manage-projects`, `read-projects`, `read-workspaces`, `manage-membership`, `manage-teams`, and `manage-organization-access` properties with boolean values. All properties default to `false`. | | `data.attributes.visibility` | string | `"secret"` | The team's visibility. Must be `"secret"` or `"organization"` (visible). | ### Sample Payload ```json { "data": { "type": "teams", "attributes": { "name": "team-creation-test", "sso-team-id": "cb265c8e41bddf3f9926b2cf3d190f0e1627daa4", "organization-access": { "manage-workspaces": 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/teams ``` ### Sample Response The `sso-team-id` attribute is only returned in Terraform Enterprise 202204-1 and later, or in HCP Terraform. ```json { "data": { "attributes": { "name": "team-creation-test", "sso-team-id": "cb265c8e41bddf3f9926b2cf3d190f0e1627daa4", "organization-access": { "manage-policies": false, "manage-policy-overrides": false, "manage-run-tasks": false, "manage-vcs-settings": false, "manage-agent-pools": false, "manage-workspaces": true, "manage-providers": false, "manage-modules": false, "manage-projects": false, "read-projects": false, "read-workspaces": true, "manage-membership": false, "manage-teams": false, "manage-organization-access": false }, "permissions": { "can-update-membership": true, "can-destroy": true, "can-update-organization-access": true, "can-update-api-token": true, "can-update-visibility": true }, "users-count": 0, "visibility": "secret", "allow-member-token-management": true }, "id": "team-6p5jTwJQXwqZBncC", "links": { "self": "/api/v2/teams/team-6p5jTwJQXwqZBncC" }, "relationships": { "authentication-token": { "meta": {} }, "users": { "data": [] } }, "type": "teams" } } ``` ## Show Team Information `GET /teams/:team\_id` | Parameter | Description | | ---------- | ------------------------ | | `:team\_id` | The team ID to be shown. | ### Sample Request ```shell $ curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request GET \ https://app.terraform.io/api/v2/teams/team-6p5jTwJQXwqZBncC ``` ### Sample Response The `sso-team-id` attribute is only returned in Terraform Enterprise 202204-1 and later, or in HCP Terraform. ```json { "data": { "id": "team-6p5jTwJQXwqZBncC", "type":
https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/teams.mdx
main
terraform
[ -0.059780191630125046, 0.06642360985279083, -0.054124511778354645, 0.07330024242401123, -0.051335182040929794, -0.04475858062505722, -0.047090042382478714, -0.025201957672834396, 0.07818705588579178, -0.044294197112321854, 0.007243589963763952, -0.07878431677818298, 0.024825718253850937, 0...
0.078556
be shown. | ### Sample Request ```shell $ curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request GET \ https://app.terraform.io/api/v2/teams/team-6p5jTwJQXwqZBncC ``` ### Sample Response The `sso-team-id` attribute is only returned in Terraform Enterprise 202204-1 and later, or in HCP Terraform. ```json { "data": { "id": "team-6p5jTwJQXwqZBncC", "type": "teams", "attributes": { "name": "team-creation-test", "sso-team-id": "cb265c8e41bddf3f9926b2cf3d190f0e1627daa4", "users-count": 0, "visibility": "organization", "allow-member-token-management": true, "permissions": { "can-update-membership": true, "can-destroy": true, "can-update-organization-access": true, "can-update-api-token": true, "can-update-visibility": true }, "organization-access": { "manage-policies": true, "manage-policy-overrides": false, "manage-run-tasks": true, "manage-workspaces": false, "manage-vcs-settings": false, "manage-agent-pools": false, "manage-providers": false, "manage-modules": false, "manage-projects": false, "read-projects": false, "read-workspaces": false, "manage-membership": false, "manage-teams": false, "manage-organization-access": false } }, "relationships": { "users": { "data": [] }, "authentication-token": { "meta": {} } }, "links": { "self": "/api/v2/teams/team-6p5jTwJQXwqZBncC" } } } ``` ## Update a Team `PATCH /teams/:team\_id` | Parameter | Description | | ---------- | -------------------------- | | `:team\_id` | The team ID to be updated. | | Status | Response | Reason | | ------- | --------------------------------------- | -------------------------------------------------------------- | | [200][] | [JSON API document][] (`type: "teams"`) | Successfully created a team | | [400][] | [JSON API error object][] | Invalid `include` parameter | | [404][] | [JSON API error object][] | Team 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 | ### Request Body This PATCH endpoint requires a JSON object with the following properties as a request payload. Properties without a default value are required. -> \*\*Note:\*\* You cannot set `manage-workspaces` to `false` when setting `manage-projects` to `true`, since project permissions cascade down to workspaces. This is also the case for `read-workspaces` and `read-projects`. If `read-projects` is `true`, `read-workspaces` must be `true` as well. | Key path | Type | Default | Description | |-----------------------------------------|--------|------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | `data.type` | string | | Must be `"teams"`. | | `data.attributes.name` | string | (previous value) | The name of the team, which can only include letters, numbers, `-`, and `\_`. This will be used as an identifier and must be unique in the organization. | | `data.attributes.sso-team-id` | string | (previous value) | The unique identifier of the team from the SAML `MemberOf` attribute. Only available in Terraform Enterprise 202204-1 and later, or in HCP Terraform. | | `data.attributes.organization-access` | object | (previous value) | Settings for the team's organization access. This object can include the `manage-policies`, `manage-policy-overrides`, `manage-run-tasks`, `manage-workspaces`, `manage-vcs-settings`, `manage-agent-pools`, `manage-providers`, `manage-modules`, `manage-projects`, `read-projects`, `read-workspaces`, `manage-membership`, `manage-teams`, and `manage-organization-access` properties with boolean values. All properties default to `false`. | | `data.attributes.visibility` | string | (previous value) | The team's visibility. Must be `"secret"` or `"organization"` (visible). | | `data.attributes.allow-team-token-management` | boolean | (previous value) | The ability to enable and disable team token management for a team. Defaults to true. | ### Sample Payload ```json { "data": { "type": "teams", "attributes": { "visibility": "organization", "allow-member-token-management": true, "organization-access": { "manage-vcs-settings": true } } } } ``` ### 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/teams/team-6p5jTwJQXwqZBncC ``` ### Sample Response The `sso-team-id` attribute is only returned in Terraform Enterprise 202204-1 and later, or in HCP Terraform. ```json { "data": { "attributes": { "name": "team-creation-test", "sso-team-id": "cb265c8e41bddf3f9926b2cf3d190f0e1627daa4", "organization-access": { "manage-policies": false, "manage-policy-overrides": false, "manage-run-tasks": true, "manage-vcs-settings": true, "manage-agent-pools": false, "manage-workspaces": true, "manage-providers": false, "manage-modules": false, "manage-projects": false, "read-projects": false, "read-workspaces": true, "manage-membership": false, "manage-teams": false, "manage-organization-access": false }, "visibility": "organization", "allow-member-token-management": true, "permissions": { "can-update-membership": true, "can-destroy":
https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/teams.mdx
main
terraform
[ -0.0072343316860497, 0.11249234527349472, 0.010420962236821651, 0.02664399892091751, 0.005296227987855673, 0.009294518269598484, -0.0626017302274704, -0.07425162941217422, 0.06132444366812706, 0.061615776270627975, -0.025075562298297882, -0.1138392761349678, 0.03330521285533905, 0.02752405...
0.0314
```json { "data": { "attributes": { "name": "team-creation-test", "sso-team-id": "cb265c8e41bddf3f9926b2cf3d190f0e1627daa4", "organization-access": { "manage-policies": false, "manage-policy-overrides": false, "manage-run-tasks": true, "manage-vcs-settings": true, "manage-agent-pools": false, "manage-workspaces": true, "manage-providers": false, "manage-modules": false, "manage-projects": false, "read-projects": false, "read-workspaces": true, "manage-membership": false, "manage-teams": false, "manage-organization-access": false }, "visibility": "organization", "allow-member-token-management": true, "permissions": { "can-update-membership": true, "can-destroy": true, "can-update-organization-access": true, "can-update-api-token": true, "can-update-visibility": true }, "users-count": 0 }, "id": "team-6p5jTwJQXwqZBncC", "links": { "self": "/api/v2/teams/team-6p5jTwJQXwqZBncC" }, "relationships": { "authentication-token": { "meta": {} }, "users": { "data": [] } }, "type": "teams" } } ``` ## Delete a Team `DELETE /teams/:team\_id` | Parameter | Description | | ---------- | -------------------------- | | `:team\_id` | The team ID to be deleted. | ### Sample Request ```shell $ curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request DELETE \ https://app.terraform.io/api/v2/teams/team-6p5jTwJQXwqZBncC ``` ## 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: - `users` (`string`) - Returns the full user record for every member of a team. - `organization-memberships` (`string`) - Returns the full organization membership record for every member of a team.
https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/teams.mdx
main
terraform
[ -0.04697224125266075, 0.00578287523239851, -0.08185943961143494, 0.08907561004161835, 0.013784256763756275, -0.023412130773067474, -0.055644191801548004, -0.04086567088961601, 0.025554386898875237, 0.036224182695150375, 0.047090645879507065, -0.02774248830974102, 0.003081394825130701, 0.09...
0.11318
[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 # Policy evaluations API reference Policy evaluations are run within the [HCP Terraform agents](/terraform/cloud-docs/api-docs/agents) in HCP Terraform's infrastructure to evaluate policies on workspaces. Policy evaluations do not have access to cost estimation data. This set of APIs provides endpoints to list and get policy evaluations and policy outcomes. ## List Policy Evaluations in the Task Stage Each run passes through several stages of action (pending, plan, policy check, apply, and completion), and shows the progress through those stages as [run states](/terraform/cloud-docs/workspaces/run/states). This endpoint allows you to list policy evaluations that are part of the task stage. `GET /task-stages/:task\_stage\_id/policy-evaluations` | Parameter | Description | | --------------------------- | ------------------------------------------- | | `:task\_stage\_id` | The task stage ID to get. | | Status | Response | Reason | | ------- | --------------------------------------------- | --------------------------------------------------- | | [200][] | [JSON API document][] | Success | | [404][] | [JSON API error object][] | Task stage 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 does not 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 agent pools 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/task-stages/ts-rL5ZsuwfjqfPJcdi/policy-evaluations ``` ### Sample Response ```json { "data":[ { "id":"poleval-8Jj9Hfoz892D9WMX", "type":"policy-evaluations", "attributes":{ "status":"passed", "policy-kind":"opa", "policy-tool-version": "0.44.0", "result-count": { "advisory-failed":0, "errored":0, "mandatory-failed":0, "passed":1 } "status-timestamps":{ "passed-at":"2022-09-16T01:40:30+00:00", "queued-at":"2022-09-16T01:40:04+00:00", "running-at":"2022-09-16T01:40:08+00:00" }, "created-at":"2022-09-16T01:39:07.782Z", "updated-at":"2022-09-16T01:40:30.010Z" }, "relationships":{ "policy-attachable":{ "data":{ "id":"ts-yxskot8Gz5yHa38W", "type":"task-stages" } }, "policy-set-outcomes":{ "links":{ "related":"/api/v2/policy-evaluations/poleval-8Jj9Hfoz892D9WMX/policy-set-outcomes" } } }, "links":{ "self":"/api/v2/policy-evaluations/poleval-8Jj9Hfoz892D9WMX" } } ] } ``` ## List Policy Outcomes `GET /policy-evaluations/:policy\_evaluation\_id/policy-set-outcomes` | Parameter | Description | | --------------------------- | ---------------------------------------------------------- | | `:policy\_evaluation\_id` | The ID of the policy evaluation the outcome belongs to get | This endpoint allows you to list policy set outcomes that are part of the policy evaluation. | Status | Response | Reason | | ------- | --------------------------------------------- | ------------------------------------------------------- | | [200][] | [JSON API document][] | Success | | [404][] | [JSON API error object][] | Policy evaluation 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 does not 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 policy sets per page. | | `filter[n][status]` | \*\*Optional.\*\* If omitted, the endpoint returns all policies regardless of status. Must be either "passed", "failed", or "errored". | | `filter[n][enforcementLevel]` | \*\*Optional.\*\* Only used if paired with a non-errored status filter. Must be either "advisory" or "mandatory." | You can use `filter[n]` to combine combinations of statuses and enforcement levels. Policy outcomes with an errored status do not have an enforcement level. The filter returns all policy-set-outcomes that include at least one outcome matching the filter criteria. ### Sample Request The following example requests demonstrate how to call the `policy-set-outcomes` endpoint using cuRL. #### All Policy Outcomes The following example call returns all policy set outcomes. ```shell curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request GET \ https://app.terraform.io/api/v2/policy-evaluations/poleval-8Jj9Hfoz892D9WMX/policy-set-outcomes ``` #### Failed and Errored Policy Outcomes The API applies filters when retrieving policy-set-outcomes, but it does not filter within
https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/policy-evaluations.mdx
main
terraform
[ -0.051727257668972015, 0.07324568927288055, 0.01851542666554451, 0.012231124565005302, 0.015937091782689095, -0.021044133231043816, -0.048581529408693314, -0.05072639882564545, 0.030165260657668114, 0.07913190871477127, -0.028261937201023102, -0.05350099876523018, 0.05456877499818802, 0.00...
0.076075
cuRL. #### All Policy Outcomes The following example call returns all policy set outcomes. ```shell curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request GET \ https://app.terraform.io/api/v2/policy-evaluations/poleval-8Jj9Hfoz892D9WMX/policy-set-outcomes ``` #### Failed and Errored Policy Outcomes The API applies filters when retrieving policy-set-outcomes, but it does not filter within the individual outcomes. As a result, the filter returns all policy-set-outcomes that include at least one outcome matching the filter criteria. If the policy-set-outcomes contains a failed outcome, then all the outcomes for that policy set are returned, not just the failed policy outcome in that set. The following example call filters the response so that it only contains failed policy-set-outcomes and errors. ```shell curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request GET \ https://app.terraform.io/api/v2/policy-evaluations/poleval-8Jj9Hfoz892D9WMX/policy-set-outcomes?filter[0][status]=errored&filter[1][status]=failed&filter[1][enforcementLevel]=mandatory ``` ### Sample Response The following example response shows that the `policyVCS` policy failed. ```json { "data":[ { "id":"psout-cu8E9a97LBepZZXd", "type":"policy-set-outcomes", "attributes":{ "outcomes":[ { "enforcement\_level":"advisory", "query":"data.terraform.main.main", "status":"failed", "policy\_name":"policyVCS", "description":"" } ], "error":"", "overridable":true, "policy-set-name":"opa-policies-vcs", "policy-set-description":null, "result-count":{ "advisory-failed":1, "errored":0, "mandatory-failed":0, "passed":0 }, "policy-tool-version": "0.54.0" }, "relationships":{ "policy-evaluation":{ "data":{ "id":"poleval-8Jj9Hfoz892D9WMX", "type":"policy-evaluations" } } } } ], "links":{ "self":"/api/v2/policy-evaluations/poleval-8Jj9Hfoz892D9WMX/policy-set-outcomes?page%5Bnumber%5D=1\u0026page%5Bsize%5D=20", "first":"/api/v2/policy-evaluations/poleval-8Jj9Hfoz892D9WMX/policy-set-outcomes?page%5Bnumber%5D=1\u0026page%5Bsize%5D=20", "prev":null, "next":null, "last":"/api/v2/policy-evaluations/poleval-8Jj9Hfoz892D9WMX/policy-set-outcomes?page%5Bnumber%5D=1\u0026page%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 Policy Outcome `GET /policy-set-outcomes/:policy\_set\_outcome\_id` | Parameter | Description | | ------------------------ | ----------------------------------------------------------------------------------------------------------------------- | | `:policy\_set\_outcome\_id` | The ID of the policy outcome to show. Refer to [List the Policy Outcomes](#list-policy-outcomes) for reference information about finding IDs. | | Status | Response | Reason | | ------- | ------------------------------------------ | ------------------------------------------------------------------- | | [200][] | [JSON API document][] | The request was successful | | [404][] | [JSON API error object][] | Policy set outcome not found or user unauthorized to perform action | ### Sample Request The following example request gets the outcomes for the `psout-cu8E9a97LBepZZXd` policy set. ```shell curl --request GET \ -H "Authorization: Bearer $TOKEN" \ -H "Content-Type: application/vnd.api+json" \ https://app.terraform.io/api/v2/policy-set-outcomes/psout-cu8E9a97LBepZZXd ``` ### Sample Response The following example response shows that the `policyVCS` policy failed. ```json { "data":{ "id":"psout-cu8E9a97LBepZZXd", "type":"policy-set-outcomes", "attributes":{ "outcomes":[ { "enforcement\_level":"advisory", "query":"data.terraform.main.main", "status":"failed", "policy\_name":"policyVCS", "description":"" } ], "error":"", "overridable":true, "policy-set-name":"opa-policies-vcs", "policy-set-description":null, "result-count":{ "advisory-failed":1, "errored":0, "mandatory-failed":0, "passed":0 }, "policy-tool-version": "0.54.0" }, "relationships":{ "policy-evaluation":{ "data":{ "id":"poleval-8Jj9Hfoz892D9WMX", "type":"policy-evaluations" } } } } } ```
https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/policy-evaluations.mdx
main
terraform
[ -0.03393155336380005, 0.1255427747964859, 0.05688273534178734, -0.018981395289301872, 0.03860821574926376, -0.01661364734172821, 0.018315894529223442, -0.04887380450963974, 0.05500056594610214, 0.05538962408900261, -0.03935028985142708, -0.096122145652771, 0.015570320188999176, -0.00820135...
-0.008846
# API Changelog Keep track of changes to the API for HCP Terraform and Terraform Enterprise. ## 2025-12-18 \* Document the new `/registry-components` endpoints that let you read, publish, update, and delete Stack component configurations in your organization's private registry. For more details, refer to the [Stack component configurations API reference](/terraform/cloud-docs/api-docs/private-registry/stack-component-configurations). ## 2025-10-31 \* Document API filtering parameters when [`listing projects`](/terraform/cloud-docs/api-docs/projects) ## 2025-9-30 \* Add a new page for [group member roles](/terraform/cloud-docs/api-docs/group-member-roles) APIs for retrieving information about group permissions for HCP EU organizations. To learn more about HCP Europe, refer to [Use HCP Terraform in Europe](/terraform/cloud-docs/europe). \* In HashiCorp Cloud Platform (HCP) Europe organizations, you manage user access through HCP groups. HCP Terraform inherits groups and roles from HCP. To learn more about HCP Europe, refer to [Use HCP Terraform in Europe](/terraform/cloud-docs/europe). - The following API endpoints are supported by HCP Europe organizations if you use group attributes instead of team attributes: - [`project-team-access`](/terraform/cloud-docs/api-docs/project-team-access) - [`team-tokens`](/terraform/cloud-docs/api-docs/team-tokens) - [`team-access`](/terraform/cloud-docs/api-docs/team-access) - The following API endpoints are \*\*not\*\* supported by HCP Europe organizations: - [`team-members`](/terraform/cloud-docs/api-docs/team-members) - [`teams`](/terraform/cloud-docs/api-docs/teams) ## 2025-07-11 \* Update existing [workspaces API documentation](/terraform/cloud-docs/api-docs/workspaces) to reflect that a workspace's default execution mode now matches the project and not the organization default. \* Update existing [projects API documentation](/terraform/cloud-docs/api-docs/projects) to include `default-execution-mode`, `default-agent-pool`, and `settings-overwrites` for projects. \* Update existing [agent pools API documentation](/terraform/cloud-docs/api-docs/agents) to include new agent pool scoping options, including adding allowed projects and adding exclusions for workspaces. ## 2025-05-1 \* Add `agent-pool` relationship to the [run task API](/terraform/cloud-docs/api-docs/run-tasks/run-tasks), which you can use to assign a run task to an agent pool. \* Add `private-run-tasks` to [feature entitlements](/terraform/cloud-docs/api-docs#feature-entitlements). \* You can now revoke, and revert the revocation of, module versions. Learn more about [Managing module versions](/terraform/cloud-docs/api-docs/private-registry/manage-module-versions). ## 2025-4-17 \* Document inherited-from link associated with effective tag bindings. ## 2025-03-20 \* Add API documentation for multiple [team tokens](/terraform/cloud-docs/users-teams-organizations/api-tokens#team-api-tokens), and update documentation around [legacy team tokens](/terraform/cloud-docs/api-docs/team-tokens##legacy-team-tokens-api-reference). \* Update existing API documentation for [team tokens](/terraform/cloud-docs/api-docs/team-tokens) to distinguish multiple team tokens from [legacy team tokens](/terraform/cloud-docs/api-docs/team-tokens##legacy-team-tokens-api-reference). ## 2025-3-10 \* Document unique pagination metadata given in the response of [Organization Runs Index API](/terraform/cloud-docs/api-docs/run##list-runs-in-an-organization). ## 2025-03-10 \* Add new field `current\_rum\_count` to the [explorer API](/terraform/cloud-docs/api-docs/explorer) in the `workspaces` view type that lists a workspace's current resources under management. ## 2024-11-19 - Clarify `tag-bindings` and `effective-tag-bindings` on [workspaces](/terraform/cloud-docs/api-docs/workspaces) and [projects](/terraform/cloud-docs/api-docs/projects) - Adds new documentation for `PATCH`ing tag bindings on [projects](/terraform/cloud-docs/api-docs/projects) and [workspaces](/terraform/cloud-docs/api-docs/workspaces) ## 2024-10-15 \* Add new documentation for the ability to deprecate, and revert the deprecation of, module versions. Learn more about [Managing module versions](/terraform/cloud-docs/api-docs/private-registry/manage-module-versions). ## 2024-10-14 \* Update the [Organizations API](/terraform/cloud-docs/api-docs/organizations) to support the `speculative-plan-management-enabled` attribute, which controls [automatic cancellation of plan-only runs triggered by outdated commits](/terraform/cloud-docs/users-teams-organizations/organizations/vcs-speculative-plan-management). ## 2024-10-11 \* Add documentation for new timeframe filter on List endpoints for [Runs](/terraform/cloud-docs/api-docs/run) API ## 2024-09-02 \* Add warning about the deprecation and future removal of the [Policy Checks](/terraform/cloud-docs/api-docs/policy-checks) API. ## 2024-08-16 \* Fixes Workspace API responses to be consistent and contain all attributes and relationships. ## 2024-08-14 \* Add documentation for a new API endpoint that lists an [organization's team tokens](/terraform/cloud-docs/api-docs/team-tokens). ## 2024-08-01 This endpoint is exclusive to Terraform Enterprise, and not available in HCP Terraform. \* Update the [admin settings API](/terraform/enterprise/api-docs/admin/settings##update-general-settings) and [admin organizations API](/terraform/enterprise/api-docs/admin/organizations#update-an-organization) to indicate that the `terraform-build-worker-plan-timeout` and `terraform-build-worker-apply-timeout` attributes are deprecated and will be replaced by `plan-timeout` and `apply-timeout`, respectively. ## 2024-07-24 \* Remove beta tags from documentation for audit trail tokens. ## 2024-07-15 \* Update the [Team API](/terraform/cloud-docs/api-docs/teams) to include `allow-member-token-management`. ## 2024-07-12 \* Add beta tags to documentation for audit trail tokens. ## 2024-06-25 \* Add API documentation for new [team token management setting](/terraform/cloud-docs/users-teams-organizations/api-tokens). \* Update API documentation for the [manage teams
https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/changelog.mdx
main
terraform
[ -0.004907364025712013, 0.0057039568200707436, 0.00972309336066246, -0.029254591092467308, -0.005068670492619276, -0.0000267630548478337, -0.059962041676044464, -0.052993711084127426, -0.023172173649072647, 0.04056626185774803, -0.016056668013334274, -0.0748496726155281, 0.01461454015225172, ...
0.029925
beta tags from documentation for audit trail tokens. ## 2024-07-15 \* Update the [Team API](/terraform/cloud-docs/api-docs/teams) to include `allow-member-token-management`. ## 2024-07-12 \* Add beta tags to documentation for audit trail tokens. ## 2024-06-25 \* Add API documentation for new [team token management setting](/terraform/cloud-docs/users-teams-organizations/api-tokens). \* Update API documentation for the [manage teams permission](/terraform/cloud-docs/users-teams-organizations/permissions#team-management-permissions). ## 2024-05-29 \* Add API documentation for the new [audit trails token](/terraform/cloud-docs/api-docs/audit-trails-tokens). ## 2024-05-23 \* Update the [registry modules API](/terraform/cloud-docs/api-docs/private-registry/modules#create-a-module-version) for publishing new versions of branch based modules. ## 2024-05-10 \* Add API documentation for new [manage agent pools permission](/terraform/cloud-docs/users-teams-organizations/permissions#manage-agent-pools). ## 2024-04-25 \* Project names can now be up to 40 characters. ## 2024-04-08 \* Add API documentation for new [team management permissions](/terraform/cloud-docs/users-teams-organizations/permissions#team-management-permissions). ## 2024-04-04 \* Add a `sort` parameter to the [Projects list API](/terraform/cloud-docs/api-docs/projects#query-parameters) to allow sorting projects by name. \* Add a `description` attribute to the [Projects API](/terraform/cloud-docs/api-docs/projects). \* Add `project-count` and `workspace-count` attributes to sample [Projects API](/terraform/cloud-docs/api-docs/projects) responses. ## 2024-3-27 \* Add `private-vcs` to [Feature Entitlements](/terraform/cloud-docs/api-docs#feature-entitlements). ## 2024-3-26 \* Add API documentation for searching [variable sets](/terraform/cloud-docs/api-docs/variable-sets#list-variable-sets) by name. ## 2024-3-14 \* Add documentation for creating runs with debugging mode enabled. ## 2024-3-12 \* Update OAuth Client API endpoints to create, update, and return projects associated with an oauth client. \* Add API endpoints to [Attach an OAuth Client](/terraform/cloud-docs/api-docs/oauth-clients#attach-an-oauth-client-to-projects) and [Detach an OAuth Client](/terraform/cloud-docs/api-docs/oauth-clients#detach-an-oauth-client-from-projects) from a project. \* Add `organization-scoped` attribute to the [OAuth Clients API](/terraform/cloud-docs/api-docs/oauth-clients). ## 2024-2-29 \* Update [run task stages](/terraform/cloud-docs/api-docs/run-tasks/run-task-stages-and-results) with new multi-stage payload format. \* Update [run tasks](/terraform/cloud-docs/api-docs/run-tasks/run-tasks) with global run tasks request/response payloads. ## 2024-2-27 \* Add `private-policy-agents` to [Feature Entitlements](/terraform/cloud-docs/api-docs#feature-entitlements). ## 2024-2-20 \* Add documentation for configuring organization and workspace data retention policies through the API and on the different [types of data retention policies](/terraform/enterprise/api-docs/data-retention-policies). ## 2024-2-8 \* Add [Explorer API documentation](/terraform/cloud-docs/api-docs/explorer) ## 2024-1-30 \* Update the [Audit trails](/terraform/cloud-docs/api-docs/audit-trails) documentation to expand on the payloads for each event. ## 2024-1-24 - Introduce configurable data retention policies at the site-wide level and extend data retention policies at the organization and workspace levels. - Added and/or updated data retention policy documentation to the following topics: - [Admin Settings Documentation](/terraform/enterprise/application-administration/general#data-retention-policies) - [Admin API Documentation](/terraform/enterprise/api-docs/admin/settings#data-retention-policies) - [Organization Documentation](/terraform/enterprise/users-teams-organizations/organizations#data-retention-policies) - [Workspace Documentation](/terraform/enterprise/workspaces/settings/deletion#data-retention-policies) ## 2024-1-4 \* Update the [Organizations API](/terraform/cloud-docs/api-docs/organizations) to support the `aggregated-commit-status-enabled` attribute, which controls whether [Aggregated Status Checks](/terraform/cloud-docs/users-teams-organizations/organizations/vcs-status-checks) are enabled. ## 2023-11-17 - Added the [`opa-versions` endpoint](/terraform/enterprise/api-docs/admin/opa-versions) to allow administrators to manage available Open Policy Agent (OPA) versions. - Added the [`sentinel-versions` endpoint](/terraform/enterprise/api-docs/admin/sentinel-versions) to allow administrators to manage available Sentinel versions. - Add `authenticated-resource` relationship to the [`account` API](/terraform/enterprise/api-docs/account). ## 2023-11-15 - Introduce configurable data retention policies at the [organization](/terraform/enterprise/users-teams-organizations/organizations#data-retention-policies) and [workspace](/terraform/enterprise/workspaces/settings/deletion#data-retention-policies) levels. - Added data retention policy documentation to the following topics: - [`state-versions` API documentation](/terraform/enterprise/api-docs/state-versions) - [`configuration-versions` API documentation](/terraform/enterprise/api-docs/configuration-versions) - [Organizations documentation](/terraform/enterprise/users-teams-organizations/organizations#destruction-and-deletion) - [Workspaces documentation](/terraform/enterprise/workspaces/settings/deletion#data-retention-policies) ## 2023-11-07 \* Add `auto\_destroy\_activity\_duration` to the [Workspaces API](/terraform/cloud-docs/api-docs/workspaces), which allows Terraform Cloud to schedule auto-destroy runs [based on workspace inactivity](/terraform/cloud-docs/workspaces/settings/deletion#automatically-destroy). ## 2023-10-31 \* Update the [Workspaces API](/terraform/cloud-docs/api-docs/workspaces) to support the `auto-apply-run-trigger` attribute, which controls if run trigger runs are auto-applied. ## 2023-10-30 \* Add `priority` attribute to the [Variable Sets API](/terraform/cloud-docs/api-docs/variable-sets). ## 2023-10-04 \* Updates to [run task integration API](/terraform/cloud-docs/api-docs/run-tasks/run-tasks-integration) \* Fix invalid JSON in the example payload. \* Clarify the expected JSON:API payload fields. \* Add `policy-tool-version` attribute to [Policy Set Outcomes](/terraform/cloud-docs/api-docs/policy-evaluations#list-policy-outcomes). ## 2023-10-03 \* Update [Policy Sets API](/terraform/cloud-docs/api-docs/policy-sets) to include `agent-enabled` and `policy-tool-version`. \* Update [Policy Evaluations API](/terraform/cloud-docs/api-docs/policy-evaluations) to include `policy-tool-version`. ## 2023-09-29 \* Add support for [streamlined run task reviews](/terraform/cloud-docs/integrations/run-tasks), enabling run task integrations to return high fidelity results. \* Update the [Terraform cloud run task API](/terraform/cloud-docs/api-docs/run-tasks/run-tasks) to enable streamlined run task reviews. \* The [run task integration API](/terraform/cloud-docs/api-docs/run-tasks/run-tasks-integration) now guides integrations through
https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/changelog.mdx
main
terraform
[ -0.030814602971076965, 0.007933614775538445, 0.016364414244890213, 0.02111370675265789, 0.03964073210954666, -0.012965774163603783, -0.008762096986174583, -0.052100155502557755, 0.025774909183382988, 0.09567918628454208, -0.020516710355877876, -0.03554572910070419, 0.015531353652477264, 0....
0.067951
Update [Policy Evaluations API](/terraform/cloud-docs/api-docs/policy-evaluations) to include `policy-tool-version`. ## 2023-09-29 \* Add support for [streamlined run task reviews](/terraform/cloud-docs/integrations/run-tasks), enabling run task integrations to return high fidelity results. \* Update the [Terraform cloud run task API](/terraform/cloud-docs/api-docs/run-tasks/run-tasks) to enable streamlined run task reviews. \* The [run task integration API](/terraform/cloud-docs/api-docs/run-tasks/run-tasks-integration) now guides integrations through sending rich results. \* Updated the run task payload [JSON schema](https://github.com/hashicorp/web-unified-docs/blob/main/content/terraform-docs-common/public/schema/run-tasks/runtask-result.json). ## 2023-09-25 \* Add `intermediate` boolean attribute to the [State Versions API](/terraform/cloud-docs/api-docs/state-versions). ## 2023-09-19 \* Add [failed state upload recovery](/terraform/cloud-docs/api-docs/applies#recover-a-failed-state-upload-after-applying) endpoint. ## 2023-09-15 \* Add `auto-destroy-at` attribute to the [Workspaces API](/terraform/cloud-docs/api-docs/workspaces). \* Update the [Notification Configurations API](/terraform/cloud-docs/api-docs/notification-configurations) to include [automatic destroy run](/terraform/cloud-docs/api-docs/notification-configurations#automatic-destroy-runs) details. ## 2023-09-08 \* Update the [Organizations API](/terraform/cloud-docs/api-docs/organizations) to include `default-execution-mode` and `default-agent-pool`. \* Update the [Workspaces API](/terraform/cloud-docs/api-docs/workspaces) to add a `setting-overwrites` object to allow you to overwrite `default-execution-mode` and `default-agent-pool`. ## 2023-09-06 \* Update Policy Sets API endpoints to create, update, and return excluded workspaces associated with a policy set. \* Add API endpoints to [Attach a Policy Set](/terraform/cloud-docs/api-docs/policy-sets#attach-a-policy-set-to-exclusions) and [Detach a Policy Set](/terraform/cloud-docs/api-docs/policy-sets#detach-a-policy-set-to-exclusions) from excluded workspaces. ## 2023-08-21 \* Add `save-plan` attribute, `planned\_and\_saved` status, and `save\_plan` operation type to [Runs endpoints](/terraform/cloud-docs/api-docs/run). ## 2023-08-10 \* Add `provisional` to `configuration-versions` endpoint. ## 2023-07-26 \* Add support for a `custom` option to the `team\_project` access level along with various customizable permissions. The `project-access` permissions apply to the project itself, and `workspace-access` permissions apply to all workspaces within the project. For more information, see [Project Team Access](/terraform/cloud-docs/api-docs/project-team-access). ## 2023-06-09 \* Introduce support for [`import` blocks](/terraform/language/import/generating-configuration). \* [Runs](/terraform/cloud-docs/api-docs/run#create-a-run) have a new `allow-config-generation` option. \* [Plans](/terraform/cloud-docs/api-docs/plans#show-a-plan) have new `resource-imports` and `generated-configuration` properties. \* [Applies](/terraform/cloud-docs/api-docs/applies#show-an-apply) have a new `resource-imports` property. \* The workspaces associated with a policy set can now be updated using the [Policy Sets PATCH endpoint](/terraform/cloud-docs/api-docs/policy-sets#update-a-policy-set) \* Update the [Workspaces](/terraform/cloud-docs/api-docs/workspaces) API endpoints to include the associated [project](/terraform/cloud-docs/api-docs/projects). ## 2023-05-25 \* Terraform Cloud sets the `configuration\_version\_download\_url`, `configuration\_version\_id`, and `workspace\_working\_directory` properties for all stages of the [Run Task Request](/terraform/enterprise/api-docs/run-tasks/run-tasks-integration#request-body). \* Add the new `enforcement-level` property in the request and response of [Policies endpoints](/terraform/cloud-docs/api-docs/policies). \* Deprecate the old `enforce` property in the request and response of [Policies endpoints](/terraform/cloud-docs/api-docs/policies). \* Add new properties to limit run tasks and policies for the Terraform Cloud free tier. We updated the [entitlement set](/terraform/cloud-docs/api-docs/organizations#show-the-entitlement-set), [feature set](/terraform/cloud-docs/api-docs/feature-sets#sample-response), and [subscription](/terraform/cloud-docs/api-docs/subscriptions#sample-response) endpoints with the following properties: \* `run-task-limit` \* `run-task-workspace-limit` \* `run-task-mandatory-enforcement-limit` \* `policy-set-limit` \* `policy-limit` \* `policy-mandatory-enforcement-limit` \* `versioned-policy-set-limit` ## 2023-04-25 \* Add the `version-id` property to the response for the Create, List, and Update [Workspace Variables endpoints](terraform/cloud-docs/api-docs/variables). ## 2023-03-30 \* Add the `sort` query parameter to the Workspaces API's [list workspaces endpoint](/terraform/cloud-docs/api-docs/workspaces#list-workspaces). ## 2023-03-24 \* Update the [Variable Sets](/terraform/cloud-docs/api-docs/variable-sets) API endpoints to include assigning variable sets to projects. ## 2023-03-20 \* Add a names filter to the [Projects list API](/terraform/cloud-docs/api-docs/projects#query-parameters) to allow fetching a list of projects by name. ## 2023-03-13 \* Update [Project Team Access API](/terraform/cloud-docs/api-docs/project-team-access) to include additional Project roles. \* Update [Permissions](/terraform/cloud-docs/users-teams-organizations/permissions) to reflect the decoupling of projects and workspaces in the Organization Permissions UI. ## 2023-03-08 \* Introduced the [GitHub App Installation APIs](/terraform/cloud-docs/api-docs/github-app-installations). \* Updated [Workspaces API](/terraform/cloud-docs/api-docs/workspaces) to accept `vcs-repo.github-app-installation-id` to connect a workspace to a GitHub App Installation. \* Updated [Registry Module API](/terraform/cloud-docs/api-docs/private-registry/modules) to accept `vcs-repo.github-app-installation-id` to connect to a GitHub App Installation. \* Updated [Policy Sets API](/terraform/cloud-docs/api-docs/policy-sets) to accept `vcs-repo.github-app-installation-id` to connect to a GitHub App Installation. ## 2023-02-16 \* Add `manage-membership` to the organization access settings of the [Team API](/terraform/cloud-docs/api-docs/teams). ## 2023-02-03 \* Updated the [List Runs API](/terraform/cloud-docs/api-docs/run#list-runs-in-a-workspace) to note that the filter query parameters accept comma-separated lists. ## 2023-01-18 \* Updated the [Team API](/terraform/cloud-docs/api-docs/teams) to include the `read-workspaces` and `read-projects` permissions which grants teams view access to workspaces and projects. ##
https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/changelog.mdx
main
terraform
[ -0.05328909307718277, 0.024888845160603523, 0.029992345720529556, 0.02539677731692791, 0.02057448960840702, -0.06199491396546364, -0.07236504554748535, -0.07013991475105286, -0.01827721856534481, 0.12036449462175369, -0.03368536755442619, -0.046819280833005905, 0.039752066135406494, 0.0021...
0.055605
the organization access settings of the [Team API](/terraform/cloud-docs/api-docs/teams). ## 2023-02-03 \* Updated the [List Runs API](/terraform/cloud-docs/api-docs/run#list-runs-in-a-workspace) to note that the filter query parameters accept comma-separated lists. ## 2023-01-18 \* Updated the [Team API](/terraform/cloud-docs/api-docs/teams) to include the `read-workspaces` and `read-projects` permissions which grants teams view access to workspaces and projects. ## 2023-01-17 \* Add [Projects API](/terraform/cloud-docs/api-docs/projects) for creating, updating and deleting projects. \* Add [Project Team Access API](/terraform/cloud-docs/api-docs/project-team-access) for managing access for teams to individual projects. \* Update [Workspaces API](/terraform/cloud-docs/api-docs/workspaces) to include examples of creating a workspace in a project and moving a workspace between projects. \* Update [List Teams API](/terraform/cloud-docs/api-docs/teams#query-parameters) to accept a search parameter `q`, so that teams can be searched by name. ## 2023-01-12 \* Added new rollback to previous state endpoint to [State Versions API](/terraform/cloud-docs/api-docs/state-versions) ## 2022-12-22 \* Updated [Safe Delete a workspace](/terraform/cloud-docs/api-docs/workspaces#safe-delete-a-workspace) to fix HTTP verb as `POST`. ## 2022-11-18 \* Update [Policies API](/terraform/cloud-docs/api-docs/policies) to fix policy enforcement level defaults. Enforcement level is a required field, so no defaults are available. ## 2022-11-03 \* Update [Policy Checks](/terraform/cloud-docs/api-docs/policy-checks) to fix policy set outcome return data type. ### 2022-10-17 \* Updated the [Organizations API](/terraform/cloud-docs/api-docs/organizations) with the `allow-force-delete-workspaces`, which controls whether workspace administrators can delete workspaces with resources under management. \* Updated the [Workspaces API](/terraform/cloud-docs/api-docs/workspaces) with a safe delete endpoint that guards against deleting workspaces that are managing resources. ### 2022-10-12 \* Update [Policy Checks](/terraform/cloud-docs/api-docs/policy-checks) with result counts and support for filtering policy set outcomes. \* Update [Team Membership API](/terraform/cloud-docs/api-docs/team-members) to include adding and removing users from teams using organization membership ID. ### 2022-10-06 \* Updated the [Policies API](/terraform/cloud-docs/api-docs/policies) with support for Open Policy Agent (OPA) policies. \* Update [Policy Sets](/terraform/cloud-docs/api-docs/policy-sets) with support for OPA policy sets. \* Updated [Policy Checks](/terraform/cloud-docs/api-docs/policy-checks) to add support for listing policy evaluations and policy set outcomes. \* Update [Run Tasks Stage](/terraform/cloud-docs/api-docs/run-tasks/run-task-stages-and-results) to include the new `policy\_evaluations` attribute in the output. ### 2022-09-21 \* Update [State Versions](/terraform/cloud-docs/api-docs/state-versions#create) with optional `json-state-outputs` and `json-state` attributes, which are base-64 encoded external JSON representations of the terraform state. The read-only `hosted-json-state-download-url` attribute links to this version of the state file when available. \* Update [State Version Outputs](/terraform/cloud-docs/api-docs/state-version-outputs) with a `detailed-type` attribute, which refines the output with the precise Terraform type. ### 2022-07-26 \* Updated the [Run status list](/terraform/cloud-docs/api-docs/run#run-states) with `fetching`, `queuing`, `pre\_plan\_running` and `pre\_plan\_completed` \* Update [Run Tasks](/terraform/cloud-docs/api-docs/run-tasks/run-tasks) to include the new `stages` attribute when attaching or updating workspace tasks. \* Updated [Run Tasks Integration](/terraform/cloud-docs/api-docs/run-tasks/run-tasks-integration) to specify the different request payloads for different stages. ### 2022-06-23 \* Added the [Assessments](/terraform/cloud-docs/api-docs/assessment-results). \* Updated [Workspace](/terraform/cloud-docs/api-docs/workspaces#create-a-workspace) and [Notification Configurations](/terraform/cloud-docs/api-docs/notification-configurations#notification-triggers) to account for assessments. \* Added new query parameter(s) to [List Runs endpoint](/terraform/cloud-docs/api-docs/run#list-runs-in-a-workspace). ### 2022-06-21 \* Updated [Admin Organizations](/terraform/enterprise/api-docs/admin/organizations) endpoints with new `workspace-limit` setting. This is available in Terraform Enterprise v202207-1 and later. \* Updated [List Agent Pools](/terraform/cloud-docs/api-docs/agents#list-agent-pools) to accept a filter parameter `filter[allowed\_workspaces][name]` so that agent pools can be filtered by name of an associated workspace. The given workspace must be allowed to use the agent pool. Refer to [Scoping Agent Pools to Specific Workspaces](/terraform/cloud-docs/agents#scope-an-agent-pool). \* Added new `organization-scoped` attribute and `allowed-workspaces` relationship to the request/response body of the below endpoints. This is available in Terraform Enterprise v202207-1 and later. \* [Show an Agent Pool](/terraform/cloud-docs/api-docs/agents#show-an-agent-pool) \* [Create an Agent Pool](/terraform/cloud-docs/api-docs/agents#create-an-agent-pool) \* [Update an Agent Pool](/terraform/cloud-docs/api-docs/agents#update-an-agent-pool) ### 2022-06-17 \* Updated [Creating a Run Task](/terraform/cloud-docs/workspaces/settings/run-tasks#creating-a-run-task) section to include the new description information for the run task to be configured. \* Update [Run Tasks](/terraform/cloud-docs/api-docs/run-tasks/run-tasks) to include the new description attribute. ### 2022-06-09 \* Updated [List Agent Pools](/terraform/cloud-docs/api-docs/agents#list-agent-pools) to accept a search parameter `q`, so that agent pools can be searched by `name`. This is available in Terraform Enterprise v202207-1 and later. \* Fixed [List
https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/changelog.mdx
main
terraform
[ -0.042912229895591736, -0.005766687449067831, 0.0135189862921834, 0.022208813577890396, 0.006416768301278353, -0.030170267447829247, -0.04303411394357681, -0.09787845611572266, 0.0463746003806591, 0.09324406087398529, -0.04340042918920517, -0.028719929978251457, 0.03789319843053818, 0.0356...
0.021992
the run task to be configured. \* Update [Run Tasks](/terraform/cloud-docs/api-docs/run-tasks/run-tasks) to include the new description attribute. ### 2022-06-09 \* Updated [List Agent Pools](/terraform/cloud-docs/api-docs/agents#list-agent-pools) to accept a search parameter `q`, so that agent pools can be searched by `name`. This is available in Terraform Enterprise v202207-1 and later. \* Fixed [List Workspaces](/terraform/cloud-docs/api-docs/workspaces#list-workspaces) to add missing `search[tags]` query parameter. \* Updated [List Workspaces](/terraform/cloud-docs/api-docs/workspaces#list-workspaces) to add new `search[exclude\_tags]` query parameter. This is available in Terraform Enterprise v202207-1 and later. ### 2022-05-11 \* Updated Run Tasks permission to the following endpoints: \* [Organizations](/terraform/cloud-docs/api-docs/organizations#list-organizations). \* [Team Access](/terraform/cloud-docs/api-docs/team-access#list-team-access-to-a-workspace). \* [Teams](/terraform/cloud-docs/api-docs/teams#list-teams). ### 2022-05-04 \* Updated [Feature Sets](/terraform/cloud-docs/api-docs/feature-sets#list-feature-sets) to add new `run-tasks` attribute. ### 2022-05-03 \* Added Run Tasks permission to the following endpoints: \* [Organizations](/terraform/cloud-docs/api-docs/organizations#list-organizations) \* [Workspaces](/terraform/cloud-docs/api-docs/workspaces#show-workspace) ### 2022-04-29 \* Updated [Run Tasks Integration](/terraform/cloud-docs/api-docs/run-tasks/run-tasks-integration) to specify the allowed `status` attribute values. \* Updated [Organization Memberships](/terraform/cloud-docs/api-docs/organization-memberships#query-parameters) to add new `filter[email]` query parameter. \* Updated [Teams](/terraform/cloud-docs/api-docs/teams#query-parameters) to add new `filter[names]` query parameter. ### 2022-04-04 \* Added the [Run Tasks Integration](/terraform/cloud-docs/api-docs/run-tasks/run-tasks-integration) endpoint. ### 2022-03-14 \* Added the [Download Configuration Files](/terraform/cloud-docs/api-docs/configuration-versions#download-configuration-files) endpoints. ### 2022-03-11 \* Introduced [Archiving Configuration Versions](/terraform/cloud-docs/workspaces/configurations#archiving-configuration-versions). \* Updated [Configuration Versions](/terraform/cloud-docs/api-docs/configuration-versions#attributes) to add new `fetching` and `archived` states. \* Updated [Runs](/terraform/cloud-docs/api-docs/run#attributes) to add new `fetching` state. \* Added the [Archive a Configuration Version](/terraform/cloud-docs/api-docs/configuration-versions#archive-a-configuration-version) endpoint. ### 2022-02-25 \* Updated [Workspace Run Tasks](/terraform/cloud-docs/api-docs/run-tasks/run-tasks#show-a-run-task) to add new `enabled`attribute. ### 2022-02-28 \* Introduced the [Registry Providers](/terraform/cloud-docs/api-docs/private-registry/providers) endpoints to manage private providers for a private registry. ### 2021-12-09 \* Added `variables` field for POST /runs and the run resource, enabling run-specific variable values. ### 2021-12-03 \* OAuth API updated to handle `secret` and `rsa\_public\_key` fields for POST/PUT. ### 2021-11-17 \* Added pagination support to the following endpoints: \* [Feature Sets](/terraform/cloud-docs/api-docs/feature-sets#list-feature-sets) - `GET /feature-sets` \* [Notification Configurations](/terraform/cloud-docs/api-docs/notification-configurations#list-notification-configurations) - `GET /workspaces/:workspace\_id/notification-configurations` \* [Oauth Clients](/terraform/cloud-docs/api-docs/oauth-clients#list-oauth-clients) - `GET /organizations/:organization\_name/oauth-clients` \* [Oauth Tokens](/terraform/cloud-docs/api-docs/oauth-tokens#list-oauth-tokens) - `GET /oauth-clients/:oauth\_client\_id/oauth-tokens` \* [Organization Feature Sets](/terraform/cloud-docs/api-docs/feature-sets#list-feature-sets-for-organization) - `GET /organizations/:organization\_name/feature-sets` \* [Organizations](/terraform/cloud-docs/api-docs/organizations#list-organizations) - `GET /organizations` \* [Policy Checks](/terraform/cloud-docs/api-docs/policy-checks#list-policy-checks) - `GET /runs/:run\_id/policy-checks` \* [Policy Set Parameters](/terraform/cloud-docs/api-docs/policy-set-params#list-parameters) - `GET /policy-sets/:policy\_set\_id/parameters` \* [SSH Keys](/terraform/cloud-docs/api-docs/ssh-keys#list-ssh-keys) - `GET /organizations/:organization\_name/ssh-keys` \* [User Tokens](/terraform/cloud-docs/api-docs/user-tokens#list-user-tokens) - `GET /users/:user\_id/authentication-tokens` ### 2021-11-11 \* Introduced the [Variable Sets](/terraform/cloud-docs/api-docs/variable-sets) endpoints for viewing and administering Variable Sets ### 2021-11-18 \* Introduced the [Registry Providers](/terraform/cloud-docs/api-docs/private-registry/providers) endpoint to manage public providers for a private registry. These endpoints will be available in the following Terraform Enterprise Release: `v202112-1` ### 2021-09-12 \* Added [Run Tasks Stages and Results](/terraform/cloud-docs/api-docs/run-tasks/run-task-stages-and-results) endpoint. ### 2021-08-18 \* Introduced the [State Version Outputs](/terraform/cloud-docs/api-docs/state-versions) endpoint to retrieve the Outputs for a given State Version ### 2021-08-11 \* \*\*BREAKING CHANGE:\*\* Security fix to [Configuration versions](/terraform/cloud-docs/api-docs/configuration-versions): upload-url attribute for [uploading configuration files](/terraform/cloud-docs/api-docs/configuration-versions#upload-configuration-files) is now only available on the create response. ### 2021-07-30 \* Introduced Workspace Tagging \* Updated [Workspaces](/terraform/cloud-docs/api-docs/workspaces): \* added `tag-names` attribute. \* added `POST /workspaces/:workspace\_id/relationships/tags` \* added `DELETE /workspaces/:workspace\_id/relationships/tags` \* Added [Organization Tags](/terraform/cloud-docs/api-docs/organization-tags). \* Added `tags` attribute to [`tfrun`](/terraform/cloud-docs/policy-enforcement/sentinel/import/tfrun) ### 2021-07-19 \* [Notification configurations](/terraform/cloud-docs/api-docs/notification-configurations): Gave organization tokens permission to create and manage notification configurations. ### 2021-07-09 \* [State versions](/terraform/cloud-docs/api-docs/state-versions): Fixed the ID format for the workspace relationship of a state version. Previously, the reported ID was unusable due to a bug. \* [Workspaces](/terraform/cloud-docs/api-docs/workspaces): Added `locked\_by` as an includable related resource. \* Added [Run Tasks](/terraform/cloud-docs/api-docs/run-tasks/run-tasks) API endpoint. ### 2021-06-8 \* Updated [Registry Module APIs](/terraform/cloud-docs/api-docs/private-registry/modules). \* added `registry\_name` scoped APIs. \* added `organization\_name` scoped APIs. \* added [Module List API](/terraform/cloud-docs/api-docs/private-registry/modules#list-registry-modules-for-an-organization). \* updated [Module Delete APIs](/terraform/cloud-docs/api-docs/private-registry/modules#delete-a-module) (see deprecation note below). \* \*\*CLOUD\*\*: added public registry module related APIs. \* \*\*DEPRECATION\*\*: The following [Registry Module APIs](/terraform/cloud-docs/api-docs/private-registry/modules) have been replaced with newer apis and will be removed in the future. \* The following endpoints to delete modules are replaced with [Module Delete APIs](/terraform/cloud-docs/api-docs/private-registry/modules#delete-a-module) \* `POST /registry-modules/actions/delete/:organization\_name/:name/:provider/:version` replaced with `DELETE /organizations/:organization\_name/registry-modules/:registry\_name/:namespace/:name/:provider/:version` \* `POST /registry-modules/actions/delete/:organization\_name/:name/:provider` replaced with
https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/changelog.mdx
main
terraform
[ -0.015114858746528625, 0.030144870281219482, 0.022342098876833916, 0.035541485995054245, -0.0020936494693160057, -0.0021348088048398495, -0.017615552991628647, -0.06055235490202904, 0.025612441822886467, 0.060374531894922256, -0.03309835493564606, -0.0926811620593071, 0.055320966988801956, ...
0.028649
public registry module related APIs. \* \*\*DEPRECATION\*\*: The following [Registry Module APIs](/terraform/cloud-docs/api-docs/private-registry/modules) have been replaced with newer apis and will be removed in the future. \* The following endpoints to delete modules are replaced with [Module Delete APIs](/terraform/cloud-docs/api-docs/private-registry/modules#delete-a-module) \* `POST /registry-modules/actions/delete/:organization\_name/:name/:provider/:version` replaced with `DELETE /organizations/:organization\_name/registry-modules/:registry\_name/:namespace/:name/:provider/:version` \* `POST /registry-modules/actions/delete/:organization\_name/:name/:provider` replaced with `DELETE /organizations/:organization\_name/registry-modules/:registry\_name/:namespace/:name/:provider` \* `POST /registry-modules/actions/delete/:organization\_name/:name` replaced with `DELETE /organizations/:organization\_name/registry-modules/:registry\_name/:namespace/:name` \* `POST /registry-modules` replaced with [`POST /organizations/:organization\_name/registry-modules/vcs`](/terraform/cloud-docs/api-docs/private-registry/modules#publish-a-private-module-from-a-vcs) \* `POST /registry-modules/:organization\_name/:name/:provider/versions` replaced with [`POST /organizations/:organization\_name/registry-modules/:registry\_name/:namespace/:name/:provider/versions`](/terraform/cloud-docs/api-docs/private-registry/modules#create-a-module-version) \* `GET /registry-modules/show/:organization\_name/:name/:provider` replaced with [`GET /organizations/:organization\_name/registry-modules/:registry\_name/:namespace/:name/:provider`](/terraform/cloud-docs/api-docs/private-registry/modules#get-a-module) ### 2021-05-27 \* \*\*CLOUD\*\*: [Agents](/terraform/cloud-docs/api-docs/agents): added [delete endpoint](/terraform/cloud-docs/api-docs/agents#delete-an-agent). ### 2021-05-19 \* [Runs](/terraform/cloud-docs/api-docs/run): added `refresh`, `refresh-only`, and `replace-addrs` attributes. ### 2021-04-16 \* Introduced [Controlled Remote State Access](https://www.hashicorp.com/blog/announcing-controlled-remote-state-access-for-terraform-cloud-and-enterprise). \* [Admin Settings](/terraform/enterprise/api-docs/admin/settings): added `default-remote-state-access` attribute. \* [Workspaces](/terraform/cloud-docs/api-docs/workspaces): \* added `global-remote-state` attribute. \* added [Remote State Consumers](/terraform/cloud-docs/api-docs/workspaces#get-remote-state-consumers) relationship. ### 2021-04-13 \* [Teams](/terraform/cloud-docs/api-docs/teams): added `manage-policy-overrides` property to the `organization-access` attribute. ### 2021-03-23 \* \*\*ENTERPRISE\*\*: `v202103-1` Introduced [Share Modules Across Organizations with Terraform Enterprise](https://www.hashicorp.com/blog/share-modules-across-organizations-terraform-enterprise). \* [Admin Organizations](/terraform/enterprise/api-docs/admin/organizations): \* added new query parameters to [List all Organizations endpoint](/terraform/enterprise/api-docs/admin/organizations#query-parameters) \* added module-consumers link in `relationships` response \* added [update module consumers endpoint](/terraform/enterprise/api-docs/admin/organizations#update-an-organization-39-s-module-consumers) \* added [list module consumers endpoint](/terraform/enterprise/api-docs/admin/organizations#list-module-consumers-for-an-organization) \* [Organizations](/terraform/cloud-docs/api-docs/organizations): added [Module Producers](/terraform/cloud-docs/api-docs/organizations#show-module-producers) \* \*\*DEPRECATION\*\*: [Admin Module Sharing](/terraform/enterprise/api-docs/admin/module-sharing): is replaced with a new JSON::Api compliant [endpoint](/terraform/enterprise/api-docs/admin/organizations#update-an-organization-39-s-module-consumers) ### 2021-03-18 \* \*\*CLOUD\*\*: Introduced [New Workspace Overview for Terraform Cloud](https://www.hashicorp.com/blog/new-workspace-overview-for-terraform-cloud). \* [Workspaces](/terraform/cloud-docs/api-docs/workspaces): \* added `resource-count` and `updated-at` attributes. \* added [performance attributes](/terraform/cloud-docs/api-docs/workspaces#workspace-performance-attributes) (`apply-duration-average`, `plan-duration-average`, `policy-check-failures`, `run-failures`, `workspaces-kpis-run-count`). \* added `readme` and `outputs` [related resources](/terraform/cloud-docs/api-docs/workspaces#available-related-resources). \* [Team Access](/terraform/cloud-docs/api-docs/team-access): updated to support pagination. ### 2021-03-11 \* Added [VCS Events](/terraform/cloud-docs/api-docs/vcs-events), limited to GitLab.com connections. ### 2021-03-08 \* [Workspaces](/terraform/cloud-docs/api-docs/workspaces): added `current\_configuration\_version` and `current\_configuration\_version.ingress\_attributes` as includable related resources.
https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/changelog.mdx
main
terraform
[ -0.0826798528432846, 0.0072306119836866856, -0.005268672946840525, 0.004822602961212397, 0.006831107661128044, -0.014271843247115612, -0.03692900389432907, -0.07356135547161102, 0.05369369685649872, 0.09771670401096344, 0.04723089933395386, -0.006189545150846243, 0.0001219388359459117, 0.0...
0.056663
[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 # Team tokens API reference Team API tokens grant access to a team's workspaces. Teams are not limited to a single token and can have multiple tokens at a time. Team tokens are not associated with a specific user. Teams relying on the [legacy `/teams/:team\_id/authentication-token`](/terraform/cloud-docs/api-docs/team-tokens#legacy-team-tokens-api-reference) endpoint can only create a single valid token at a time. Generating a new legacy token when a team token already exists revokes the existing legacy token and replaces it with a new team token. You can create and delete team tokens and list an organization's team tokens. In HCP Europe organizations, you use HCP \*\*groups\*\* to manage permissions instead of \*\*teams\*\*. To learn more about HCP Europe, refer to [Use HCP Terraform in Europe](/terraform/cloud-docs/europe). You can replace team attributes with HCP group attributes in the following API endpoints. For example, you can replace `team\_id` with `group\_id`, and the API responses return group-related information. You can also manage group API tokens on the [HCP platform](https://portal.cloud.eu.hashicorp.com). ## Generate a new team token Generates a new team token. | Method | Path | | :----- | :----------------------------------- | | POST | /teams/:team\_id/authentication-tokens | This endpoint returns the secret text of the new authentication token. You can only access the secret text when you create it and cannot recover it later. ### Parameters - `:team\_id` (`string: `) - specifies the team ID for generating the team token ### Request body This POST endpoint requires a JSON object with the following properties as a request payload. | Key path | Type | Default | Description | | ----------------------------- | ------ | ------- | --------------------------------------------------------------------------------------------------------------- | | `data.type` | string | | Must be `"authentication-tokens"`. | | `data.attributes.description` | string | | The description of the team token. Each description \*\*must\*\* be unique within the context of the team. | | `data.attributes.expired-at` | string | `null` | The UTC date and time that the Team 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": "Team API token for team ABC", "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/teams/team-BUHBEM97xboT8TVz/authentication-tokens ``` ### Sample response ```json { "data": { "id": "4111797", "type": "authentication-tokens", "attributes": { "created-at": "2017-11-29T19:18:09.976Z", "last-used-at": null, "description": "Team API token for team ABC", "token": "QnbSxjjhVMHJgw.atlasv1.gxZnWIjI5j752DGqdwEUVLOFf0mtyaQ00H9bA1j90qWb254lEkQyOdfqqcq9zZL7Sm0", "expired-at": "2023-04-06T12:00:00.000Z" }, "relationships": { "team": { "data": { "id": "team-Y7RyjccPVBKVEdp7", "type": "teams" } }, "created-by": { "data": { "id": "user-62goNpx1ThQf689e", "type": "users" } } } } } ``` ## Delete a team token | Method | Path | | :----- | :----------------------------------- | | DELETE | /authentication-tokens/:token\_id | ### Parameters - `:token\_id` (`string: `) - specifies the token\_id from which to delete the token ### 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 ``` ## List team tokens Lists the team tokens for the organization with the option to filter by team name. `GET /organizations/:organization\_name/team-tokens` | Parameter | Description | |----------------------|----------------------------------------------------------| | `:organization\_name` | The name of the organization whose team tokens you want to list. | This endpoint returns object metadata and does not include secret authentication details of tokens. You can only view a token when you create it and cannot recover it
https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/team-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
| Parameter | Description | |----------------------|----------------------------------------------------------| | `:organization\_name` | The name of the organization whose team tokens you want to list. | This endpoint returns object metadata and does not include secret authentication details of tokens. You can only view a token when you create it and cannot recover it later. | Status | Response | Reason | | ------- | ------------------------------------------------------- | ------------------------------------------------------------------------------------- | | [200][] | [JSON API document][] (`type: "team-tokens"`) | The request was successful. | | [200][] | Empty [JSON API document][] | The specified team has no team tokens. | | [404][] | [JSON API error object][] | Team not found. | ### Query parameters This endpoint supports pagination [with standard URL query parameters](/terraform/cloud-docs/api-docs#query-parameters) and searching with the `q` parameter. 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 returns the first page. | | `page[size]` | \*\*Optional.\*\* If omitted, the endpoint returns 20 tokens per page. | | `q` | \*\*Optional.\*\* A search query string. You can search for a team authentication token using the team name. | | `sort` | \*\*Optional.\*\* Allows sorting the team tokens by `"created-by"`, `"expired-at"`, and `"last-used-at"`. Prepending a hyphen to the sort parameter reverses the order. If omitted, the default sort order ascending. | ### Sample response ```json { "data": [ { "id": "at-TLhN8cc6ro6qYDvp", "type": "authentication-tokens", "attributes": { "created-at": "2017-11-29T19:18:09.976Z", "last-used-at": null, "description": "Team API token for team ABC", "token": "QnbSxjjhVMHJgw.atlasv1.gxZnWIjI5j752DGqdwEUVLOFf0mtyaQ00H9bA1j90qWb254lEkQyOdfqqcq9zZL7Sm0", "expired-at": "2023-04-06T12:00:00.000Z" }, "relationships": { "team": { "data": { "id": "team-Y7RyjccPVBKVEdp7", "type": "teams" } }, "created-by": { "data": { "id": "user-ccU6h629sszLJBpY", "type": "users" } } } }, { "id": "at-qfc2wqqJ1T5sCamM", "type": "authentication-tokens", "attributes": { "created-at": "2024-06-19T18:44:44.051Z", "last-used-at": null, "description": "Team API token for team XYZ", "token": null, "expired-at": "2024-07-19T18:44:43.818Z" }, "relationships": { "team": { "data": { "id": "team-58pFiBffTLMxLphR", "type": "teams" } }, "created-by": { "data": { "id": "user-ccU6h629hhzLJBpY", "type": "users" } } } }, ] } ``` ## Show a team token Use this endpoint to display a particular [team token](/terraform/cloud-docs/users-teams-organizations/teams#api-tokens). `GET /authentication-tokens/:token\_id` | Parameter | Description | | ----------- | ------------------------- | | `:token\_id` | The ID of the Team Token. | The object returned by this endpoint only contains metadata, and does not include the secret text of the authentication token. A token's secret text is only shown upon creation and cannot be recovered later. | Status | Response | Reason | | ------- | ------------------------------------------------------- | ------------------------------------------------------------ | | [200][] | [JSON API document][] (`type: "authentication-tokens"`) | The request was successful | | [404][] | [JSON API error object][] | Team Token not found, or unauthorized to view the Team 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": "2017-11-29T19:18:09.976Z", "last-used-at": null, "description": "Team API token for team ABC", "token": "QnbSxjjhVMHJgw.atlasv1.gxZnWIjI5j752DGqdwEUVLOFf0mtyaQ00H9bA1j90qWb254lEkQyOdfqqcq9zZL7Sm0", "expired-at": "2023-04-06T12:00:00.000Z" }, "relationships": { "team": { "data": { "id": "team-LnREdjodkvZFGdXL", "type": "teams" } }, "created-by": { "data": { "id": "user-MA4GL63FmYRpSFxa", "type": "users" } } } } } ``` # Legacy team tokens API reference Legacy team API tokens grant access to a team's workspaces. Each team can have a single legacy API token that is not associated with a specific user. You can create and delete team tokens and list an organization's team tokens. The [team tokens API](/terraform/cloud-docs/api-docs/team-tokens) includes the same functionality as legacy team tokens, and allows you to provision multiple tokens with descriptions per team. ## Generate a new team token
https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/team-tokens.mdx
main
terraform
[ -0.023880861699581146, 0.05238085985183716, -0.085907481610775, 0.030705656856298447, 0.006768336519598961, 0.024992549791932106, 0.007590248249471188, 0.033684976398944855, 0.011461310088634491, 0.006154341157525778, 0.0043151890859007835, -0.082587331533432, 0.014087541028857231, -0.0268...
0.100542
that is not associated with a specific user. You can create and delete team tokens and list an organization's team tokens. The [team tokens API](/terraform/cloud-docs/api-docs/team-tokens) includes the same functionality as legacy team tokens, and allows you to provision multiple tokens with descriptions per team. ## Generate a new team token Generates a new team token and overrides existing token if one exists. | Method | Path | | :----- | :----------------------------------- | | POST | /teams/:team\_id/authentication-token | This endpoint returns the secret text of the new authentication token. You can only access the secret when you create it and cannot recover it later. ### Parameters - `:team\_id` (`string: `) - specifies the team ID for generating the team token ### Request body This POST endpoint requires a JSON object with the following properties as a request payload. | Key path | Type | Default | Description | | ----------------------------- | ------ | ------- | --------------------------------------------------------------------------------------------------------------- | | `data.type` | string | | Must be `"authentication-token"`. | | `data.attributes.expired-at` | string | `null` | The UTC date and time that the Team Token will expire, in ISO 8601 format. If omitted or set to `null` the token will never expire. | ### Sample payload ```json { "data": { "type": "authentication-token", "attributes": { "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/teams/team-BUHBEM97xboT8TVz/authentication-token ``` ### Sample response ```json { "data": { "id": "4111797", "type": "authentication-tokens", "attributes": { "created-at": "2017-11-29T19:18:09.976Z", "last-used-at": null, "description": null, "token": "QnbSxjjhVMHJgw.atlasv1.gxZnWIjI5j752DGqdwEUVLOFf0mtyaQ00H9bA1j90qWb254lEkQyOdfqqcq9zZL7Sm0", "expired-at": "2023-04-06T12:00:00.000Z" }, "relationships": { "team": { "data": { "id": "team-Y7RyjccPVBKVEdp7", "type": "teams" } }, "created-by": { "data": { "id": "user-62goNpx1ThQf689e", "type": "users" } } } } } ``` ## Delete the team token | Method | Path | | :----- | :----------------------------------- | | DELETE | /teams/:team\_id/authentication-token | ### Parameters - `:team\_id` (`string: `) - specifies the team\_id from which to delete the token ### Sample request ```shell curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request DELETE \ https://app.terraform.io/api/v2/teams/team-BUHBEM97xboT8TVz/authentication-token ``` ## List team tokens Lists the [team tokens](/terraform/cloud-docs/users-teams-organizations/teams#api-tokens) in an organization. `GET /organizations/:organization\_name/team-tokens` | Parameter | Description | |----------------------|----------------------------------------------------------| | `:organization\_name` | The name of the organization whose team tokens you want to list. | This endpoint returns object metadata and does not include secret authentication details of tokens. You can only view a token when you create it and cannot recover it later. By default, this endpoint returns tokens by ascending expiration date. | Status | Response | Reason | | ------- | ------------------------------------------------------- | ------------------------------------------------------------------------------------- | | [200][] | [JSON API document][] (`type: "team-tokens"`) | The request was successful. | | [200][] | Empty [JSON API document][] | The specified organization has no team tokens. | | [404][] | [JSON API error object][] | Organization not found. | ### Query parameters This endpoint supports pagination [with standard URL query parameters](/terraform/cloud-docs/api-docs#query-parameters) and searching with the `q` parameter. 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 returns the first page. | | `page[size]` | \*\*Optional.\*\* If omitted, the endpoint returns 20 tokens per page. | | `q` | \*\*Optional.\*\* A search query string. You can search for a team authentication token using the team name. | | `sort` | \*\*Optional.\*\* Allows sorting the team tokens by `"team-name"`, `"created-by"`, `"expired-at"`, and `"last-used-at"`. Prepending a hyphen to the sort parameter reverses the order. For example, `"-team-name"` sorts by name in reverse alphabetical order.
https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/team-tokens.mdx
main
terraform
[ -0.059593476355075836, 0.0355878621339798, 0.004033976700156927, -0.005999711807817221, -0.0067946333438158035, -0.023057185113430023, 0.022642003372311592, -0.05363176017999649, 0.09438084065914154, 0.06208662688732147, -0.029084770008921623, -0.04845624044537544, 0.05099128559231758, 0.0...
0.059567
query string. You can search for a team authentication token using the team name. | | `sort` | \*\*Optional.\*\* Allows sorting the team tokens by `"team-name"`, `"created-by"`, `"expired-at"`, and `"last-used-at"`. Prepending a hyphen to the sort parameter reverses the order. For example, `"-team-name"` sorts by name in reverse alphabetical order. If omitted, the default sort order ascending. | ### Sample response ```json { "data": [ { "id": "at-TLhN8cc6ro6qYDvp", "type": "authentication-tokens", "attributes": { "created-at": "2024-06-19T18:28:25.267Z", "last-used-at": null, "description": null, "token": null, "expired-at": "2024-07-19T18:28:25.030Z" }, "relationships": { "team": { "data": { "id": "team-Y7RyjccPVBKVEdp7", "type": "teams" } }, "created-by": { "data": { "id": "user-ccU6h629sszLJBpY", "type": "users" } } } }, { "id": "at-qfc2wqqJ1T5sCamM", "type": "authentication-tokens", "attributes": { "created-at": "2024-06-19T18:44:44.051Z", "last-used-at": null, "description": null, "token": null, "expired-at": "2024-07-19T18:44:43.818Z" }, "relationships": { "team": { "data": { "id": "team-58pFiBffTLMxLphR", "type": "teams" } }, "created-by": { "data": { "id": "user-ccU6h629hhzLJBpY", "type": "users" } } } }, ] } ``` ## Show a team token Use this endpoint to display a [team token](/terraform/cloud-docs/users-teams-organizations/teams#api-tokens) for a particular team. `GET /teams/:team\_id/authentication-token` | Parameter | Description | | ---------- | ------------------------- | | `:team\_id` | The ID of the Team. | You can also fetch a team token directly by using the token's ID with the `authentication-tokens/` endpoint. `GET /authentication-tokens/:token\_id` | Parameter | Description | | ----------- | ------------------------- | | `:token\_id` | The ID of the Team Token. | The object returned by this endpoint only contains metadata, and does not include the secret text of the authentication token. A token's secret text is only shown upon creation, and cannot be recovered later. | Status | Response | Reason | | ------- | ------------------------------------------------------- | ------------------------------------------------------------ | | [200][] | [JSON API document][] (`type: "authentication-tokens"`) | The request was successful | | [404][] | [JSON API error object][] | Team Token not found, or unauthorized to view the Team Token | ### Sample request ```shell curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request GET \ https://app.terraform.io/api/v2/teams/team-6yEmxNAhaoQLH1Da/authentication-token ``` ### Sample response ```json { "data": { "id": "at-6yEmxNAhaoQLH1Da", "type": "authentication-tokens", "attributes": { "created-at": "2023-11-25T22:31:30.624Z", "last-used-at": "2023-11-26T20:34:59.487Z", "description": null, "token": null, "expired-at": "2024-04-06T12:00:00.000Z" }, "relationships": { "team": { "data": { "id": "team-LnREdjodkvZFGdXL", "type": "teams" } }, "created-by": { "data": { "id": "user-MA4GL63FmYRpSFxa", "type": "users" } } } } } ```
https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/team-tokens.mdx
main
terraform
[ -0.05249689891934395, 0.109468474984169, 0.014147845096886158, 0.019092679023742676, -0.030552448704838753, -0.010671545751392841, -0.037674885243177414, -0.012981856241822243, 0.11137029528617859, -0.013006615452468395, 0.009868769906461239, 0.022348864004015923, 0.0015475223772227764, 0....
0.000257
[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 # Variable sets API reference You can create a set of variables and reuse them aross your organization. Refer to [Scope](/terraform/cloud-docs/variables#scope) to learn more about creating and using variables sets. Projects and organizations can both own variable sets. The owner of a variable set can determine the precedence of that set. Refer to [\*\*Manage variable sets\*\*](/terraform/cloud-docs/variables/managing-variables#permissions) for more details on variable set permissions. To view the variables applied from a variable set on a particular workspace, you must have [\*\*Read\*\* variables permission](/terraform/cloud-docs/users-teams-organizations/permissions/workspace) on that workspace. ## Create a Variable Set `POST organizations/:organization\_name/varsets` | Parameter | Description | | -------------------- | --------------------------------------------------------- | | `:organization\_name` | The name of the organization the variable set belongs to. | ### Request Body Properties without a default value are required. | Key path | Type | Default | Description | | ------------------------------------- | ------- | ------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------- | | `data.attributes.name` | string | | The name of the variable set. | | `data.attributes.description` | string | `""` | Text displayed in the UI to contextualize the variable set and its purpose. | | `data.attributes.global` | boolean | `false` | When true, HCP Terraform automatically applies the variable set to all current and future workspaces in the organization. | | `data.attributes.priority` | boolean | `false` | When true, the variables in the set override any other variable values with a more specific scope, including values set on the command line. | | `data.relationships.workspaces` | array | `[]` | Array of references to workspaces that the variable set should be assigned to. | | `data.relationships.projects` | array | `[]` | Array of references to projects that the variable set should be assigned to. | | `data.relationships.stacks` | array | `[]` | Array of references to Stacks that HCP Terraform assigns the variable set to. Only available in HCP Terraform. | | `data.relationships.vars` | array | `[]` | Array of complete variable definitions that comprise the variable set. | | `data.relationships.parent` | object | Organization that the variable set belongs to | The parent that owns this variable set. If the parent is a project, `data.attributes.global` must be `false`. | | `data.relationships.parent.data.type` | string | `"organizations"` | The resource type of the parent that owns this variable set. Valid values are `organizations` or `projects`. | | `data.relationships.parent.data.id` | string | Name of organization that the variable set belongs to. | The ID of the parent that owns the variable set. For organizations, use name instead of ID. | HCP Terraform does not allow different global variable sets to contain conflicting variables with the same name and type. You will receive a 422 response if you try to create a global variable set that contains conflicting variables. | Status | Response | Reason(s) | | ------- | ------------------------- | --------------------------------------------------------------------- | | [200][] | [JSON API document][] | Successfully added variable set | | [404][] | [JSON API error object][] | Organization not found, or user unauthorized to perform action | | [422][] | [JSON API error object][] | Problem with payload or request; details provided in the error object | ### Sample Payload ```json { "data": { "type": "varsets", "attributes": { "name": "MyVarset", "description": "Full of vars and such for mass reuse", "global": false, "priority": false, }, "relationships": { "workspaces": { "data": [ { "id": "ws-z6YvbWEYoE168kpq", "type": "workspaces" } ] }, "stacks": { "data": [ { "type": "stacks", "id":
https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/variable-sets.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
| ### Sample Payload ```json { "data": { "type": "varsets", "attributes": { "name": "MyVarset", "description": "Full of vars and such for mass reuse", "global": false, "priority": false, }, "relationships": { "workspaces": { "data": [ { "id": "ws-z6YvbWEYoE168kpq", "type": "workspaces" } ] }, "stacks": { "data": [ { "type": "stacks", "id": "st-rrfaQkXz7CuKqt7K" } ] } "vars": { "data": [ { "type": "vars", "attributes": { "key": "c2e4612d993c18e42ef30405ea7d0e9ae", "value": "8676328808c5bf56ac5c8c0def3b7071", "category": "terraform" } } ] }, "parent": { "data": { "id": "prj-kFjgSzcZSr5c3imE", "type": "projects" } } } } } ``` ### 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/varsets ``` ### Sample Response ```json { "data": { "id": "varset-kjkN545LH2Sfercv", "type": "varsets", "attributes": { "name": "MyVarset", "description": "Full of vars and such for mass reuse", "global": false, "priority": false, }, "relationships": { "workspaces": { "data": [ { "id": "ws-z6YvbWEYoE168kpq", "type": "workspaces" } ] }, "projects": { "data": [ { "id": "prj-kFjgSzcZSr5c3imE", "type": "projects" } ] }, "stacks": { "data": [ { "id": "st-rrfaQkXz7CuKqt7K", "type": "stacks" } ] } "vars": { "data": [ { "id": "var-Nh0doz0hzj9hrm34qq", "type": "vars", "attributes": { "key": "c2e4612d993c18e42ef30405ea7d0e9ae", "value": "8676328808c5bf56ac5c8c0def3b7071", "category": "terraform" } } ] }, "parent": { "data": { "id": "prj-kFjgSzcZSr5c3imE", "type": "projects" } } } } } ``` ## Update a Variable Set `PUT/PATCH varsets/:varset\_id` | Parameter | Description | | ------------ | ------------------- | | `:varset\_id` | The variable set ID | HCP Terraform does not allow global variable sets to contain conflicting variables with the same name and type. You will receive a 422 response if you try to create a global variable set that contains conflicting variables. HCP Terraform does not allow you to change the parent organization or project of a variable set. Instead, you must delete the variable set and recreate it in the desired organization or project. ### Request Body | Key path | Type | Default | Description | |---------------------------------|---------|---------|------------------------------------------------------------------------------------------------------------------------------------------------------| | `data.attributes.name` | string | | The name of the variable set. | | `data.attributes.description` | string | | Text displayed in the UI to contextualize the variable set and its purpose. | | `data.attributes.global` | boolean | | When true, HCP Terraform automatically applies the variable set to all current and future workspaces in the organization. | | `data.attributes.priority` | boolean | `false` | When true, the variables in the set override any other variable values set with a more specific scope, including values set on the command line. | | `data.relationships.workspaces` | array | | \*\*Optional\*\* Array of references to workspaces that the variable set should be assigned to. Sending an empty array clears all workspace assignments. | | `data.relationships.projects` | array | | \*\*Optional\*\* Array of references to projects that the variable set should be assigned to. Sending an empty array clears all project assignments. | | `data.relationships.stacks` | array | | \*\*Optional\*\* Array of references to Stacks that HCP Terraform assigns the variable set to. Sending an empty array clears all Stack assignments. Only available in HCP Terraform. | | `data.relationships.vars` | array | | \*\*Optional\*\* Array of complete variable definitions to add to the variable set. | | Status | Response | Reason(s) | | ------- | ------------------------- | ------------------------------------------------------------------------------ | | [200][] | [JSON API document][] | Successfully updated variable set | | [404][] | [JSON API error object][] | Organization or variable set not found, or user unauthorized to perform action | | [422][] | [JSON API error object][] | Problem with payload or request; details provided in the error object | ### Sample Payload ```json { "data": { "type": "varsets", "attributes":
https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/variable-sets.mdx
main
terraform
[ -0.0414169579744339, 0.021344313398003578, 0.024061765521764755, 0.07022221386432648, -0.04375475272536278, -0.02796776406466961, 0.004547442309558392, 0.002051128074526787, 0.04587773233652115, -0.06522110104560852, -0.009838267229497433, -0.029788123443722725, 0.023614533245563507, 0.036...
-0.006383
[404][] | [JSON API error object][] | Organization or variable set not found, or user unauthorized to perform action | | [422][] | [JSON API error object][] | Problem with payload or request; details provided in the error object | ### Sample Payload ```json { "data": { "type": "varsets", "attributes": { "name": "MyVarset", "description": "Full of vars and such for mass reuse. Now global!", "global": true, "priority": true, }, "relationships": { "workspaces": { "data": [ { "id": "ws-FRFwkYoUoGn1e34b", "type": "workspaces" } ] }, "projects": { "data": [ { "id": "prj-kFjgSzcZSr5c3imE", "type": "projects" } ] }, "stacks": { "data": [ { "id": "st-rrfaQkXz7CuKqt7K", "type": "stacks" } ] } "vars": { "data": [ { "type": "vars", "attributes": { "key": "c2e4612d993c18e42ef30405ea7d0e9ae", "value": "8676328808c5bf56ac5c8c0def3b7071", "category": "terraform" } } ] } } } } ``` ### 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/varsets/varset-kjkN545LH2Sfercv ``` ### Sample Response ```json { "data": { "id": "varset-kjkN545LH2Sfercv", "type": "varsets", "attributes": { "name": "MyVarset", "description": "Full of vars and such for mass reuse. Now global!", "global": true, "priority": true }, "relationships": { "organization": { "data": { "id": "hashicorp", "type": "organizations" } }, "workspaces": { "data": [ { "id": "ws-FRFwkYoUoGn1e34b", "type": "workspaces" } ] }, "projects": { "data": [ { "id": "prj-kFjgSzcZSr5c3imE", "type": "projects" } ] }, "stacks": { "data": [ { "id": "st-rrfaQkXz7CuKqt7K", "type": "stacks" } ] } "vars": { "data": [ { "id": "var-Nh0doz0hzj9hrm34qq", "type": "vars", "attributes": { "key": "c2e4612d993c18e42ef30405ea7d0e9ae", "value": "8676328808c5bf56ac5c8c0def3b7071", "category": "terraform" } } ] }, "parent": { "data": { "id": "hashicorp", "type": "organizations" } } } } } ``` ## Delete a Variable Set `DELETE varsets/:varset\_id` | Parameter | Description | | ------------ | ------------------- | | `:varset\_id` | The variable set ID | ### Sample Request ```shell curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request DELETE \ https://app.terraform.io/api/v2/varsets/varset-kjkN545LH2Sfercv ``` On success, this endpoint responds with no content. ## Show Variable Set Fetch details about the specified variable set. `GET varsets/:varset\_id` | Parameter | Description | | ------------ | ------------------- | | `:varset\_id` | The variable set ID | ### Sample Request ```shell curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request GET \ https://app.terraform.io/api/v2/varsets/varset-kjkN545LH2Sfercv ``` ### Sample Response ```json { "data": { "id": "varset-kjkN545LH2Sfercv", "type": "varsets", "attributes": { "name": "MyVarset", "description": "Full of vars and such for mass reuse", "global": false, "priority": false, "updated-at": "2023-03-06T21:48:33.588Z", "var-count": 5, "workspace-count": 2, "project-count": 2 }, "relationships": { "organization": { "data": { "id": "hashicorp", "type": "organizations" } }, "vars": { "data": [ { "id": "var-mMqadSCxZtrQJAv8", "type": "vars" }, { "id": "var-hFxUUKSk35QMsRVH", "type": "vars" }, { "id": "var-fkd6N48tXRmoaPxH", "type": "vars" }, { "id": "var-abcbBMBMWcZw3WiV", "type": "vars" }, { "id": "var-vqvRKK1ZoqQCiMwN", "type": "vars" } ] }, "workspaces": { "data": [ { "id": "ws-UohFdKAHUGsQ8Dtf", "type": "workspaces" }, { "id": "ws-XhGhaaCrsx9ATson", "type": "workspaces" } ] }, "projects": { "data": [ { "id": "prj-1JMwvPHFsdpsPhnt", "type": "projects" }, { "id": "prj-SLDGqbYqELXE1obp", "type": "projects" } ] }, "stacks":{ "data": [ { "id": "st-NYdpLiBwkRXq5aAY", "type": "stacks" }, { "id": "st-waGqbYqELXE1obp", "type": "stacks" } ] }, "parent": { "data": { "id": "hashicorp", "type": "organizations" } } } } } ``` ## List Variable Sets List all variable sets for an organization. `GET organizations/:organization\_name/varsets` | Parameter | Description | |----------------------|----------------------------------------------------------| | `:organization\_name` | The name of the organization the variable sets belong to | List all variable sets for a project. This includes global variable sets from the project's organization. `GET projects/:project\_id/varsets` | Parameter | Description | |---------------|----------------| | `:project\_id` | The project ID | List all variable sets for a workspace. This includes global variable sets from
https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/variable-sets.mdx
main
terraform
[ -0.04514900967478752, 0.02271134778857231, 0.00030139542650431395, 0.04365219920873642, -0.047549474984407425, -0.04372958466410637, -0.02868577092885971, -0.038976848125457764, 0.05553996190428734, -0.011496386490762234, 0.014193505980074406, -0.0050867111422121525, 0.024369368329644203, ...
0.058392
the variable sets belong to | List all variable sets for a project. This includes global variable sets from the project's organization. `GET projects/:project\_id/varsets` | Parameter | Description | |---------------|----------------| | `:project\_id` | The project ID | List all variable sets for a workspace. This includes global variable sets from the workspace's organization and variable sets attached to the project this workspace is contained within. `GET workspaces/:workspace\_id/varsets` | Parameter | Description | |-----------------|------------------| | `:workspace\_id` | The workspace ID | ### Query Parameters All list endpoints support pagination [with standard URL query parameters](/terraform/cloud-docs/api-docs#query-parameters) and searching with the `q` parameter. 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 returns the first page. | | `page[size]` | \*\*Optional.\*\* If omitted, the endpoint returns 20 varsets per page. | | `q` | \*\*Optional.\*\* A search query string. You can search for a variable set using its name. | ### Sample Response ```json { "data": [ { "id": "varset-kjkN545LH2Sfercv", "type": "varsets", "attributes": { "name": "MyVarset", "description": "Full of vars and such for mass reuse", "global": false, "priority": false, "updated-at": "2023-03-06T21:48:33.588Z", "var-count": 5, "workspace-count": 2, "project-count": 2 }, "relationships": { "organization": { "data": { "id": "hashicorp", "type": "organizations" } }, "vars": { "data": [ { "id": "var-mMqadSCxZtrQJAv8", "type": "vars" }, { "id": "var-hFxUUKSk35QMsRVH", "type": "vars" }, { "id": "var-fkd6N48tXRmoaPxH", "type": "vars" }, { "id": "var-abcbBMBMWcZw3WiV", "type": "vars" }, { "id": "var-vqvRKK1ZoqQCiMwN", "type": "vars" } ] }, "workspaces": { "data": [ { "id": "ws-UohFdKAHUGsQ8Dtf", "type": "workspaces" }, { "id": "ws-XhGhaaCrsx9ATson", "type": "workspaces" } ] }, "projects": { "data": [ { "id": "prj-1JMwvPHFsdpsPhnt", "type": "projects" }, { "id": "prj-SLDGqbYqELXE1obp", "type": "projects" } ] }, "stacks":{ "data": [ { "id": "st-NYdpLiBwkRXq5aAY", "type": "stacks" }, { "id": "st-waGqbYqELXE1obp", "type": "stacks" } ] }, "parent": { "data": { "id": "hashicorp", "type": "organizations" } } } } ], "links": { "self": "https://app.terraform.io/api/v2/organizations/hashicorp/varsets?page%5Bnumber%5D=1&page%5Bsize%5D=20", "first": "https://app.terraform.io/api/v2/organizations/hashicorp/varsets?page%5Bnumber%5D=1&page%5Bsize%5D=20", "prev": null, "next": null, "last": "https://app.terraform.io/api/v2/organizations/hashicorp/varsets?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 } } } ``` ### Variable Relationships ## Add Variable `POST varsets/:varset\_external\_id/relationships/vars` | Parameter | Description | | ------------ | ------------------- | | `:varset\_id` | The variable set ID | ### 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 variable. | | `data.attributes.value` | string | `""` | The value of the variable. | | `data.attributes.description` | string | | The description of the variable. | | `data.attributes.category` | string | | Whether this is a Terraform or environment variable. Valid values are `"terraform"` or `"env"`. | | `data.attributes.hcl` | bool | `false` | Whether to evaluate the value of the variable as a string of HCL code. Has no effect for environment variables. | | `data.attributes.sensitive` | bool | `false` | Whether the value is sensitive. If true, variable is not visible in the UI. | HCP Terraform does not allow different global variable sets to contain conflicting variables with the same name and type. You will receive a 422 response if you try to add a conflicting variable to a global variable set. | Status | Response | Reason(s) | | ------- | ------------------------- | --------------------------------------------------------------------- | | [200][] | [JSON API document][] |
https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/variable-sets.mdx
main
terraform
[ -0.015565276145935059, 0.01939915120601654, -0.011338411830365658, 0.037489935755729675, -0.04517476260662079, 0.04491524025797844, 0.0358949676156044, -0.06707169860601425, -0.0006630608695559204, 0.0373832993209362, -0.014513645321130753, -0.06083158031105995, 0.08158007264137268, -0.004...
0.004709
to contain conflicting variables with the same name and type. You will receive a 422 response if you try to add a conflicting variable to a global variable set. | Status | Response | Reason(s) | | ------- | ------------------------- | --------------------------------------------------------------------- | | [200][] | [JSON API document][] | Successfully added variable to variable set | | [404][] | [JSON API error object][] | Variable set not found, or user unauthorized to perform action | | [422][] | [JSON API error object][] | Problem with payload or request; details provided in the error object | ### Sample Payload ```json { "data": { "type": "vars", "attributes": { "key": "g6e45ae7564a17e81ef62fd1c7fa86138", "value": "61e400d5ccffb3782f215344481e6c82", "description": "cheeeese", "sensitive": false, "category": "terraform", "hcl": 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/varsets/varset-4q8f7H0NHG733bBH/relationships/vars ``` ### Sample Response ```json { "data": { "id":"var-EavQ1LztoRTQHSNT", "type": "vars", "attributes": { "key": "g6e45ae7564a17e81ef62fd1c7fa86138", "value": "61e400d5ccffb3782f215344481e6c82", "description": "cheeeese", "sensitive": false, "category": "terraform", "hcl": false } } } ``` ## Update a Variable in a Variable Set `PATCH varsets/:varset\_id/relationships/vars/:var\_id` | Parameter | Description | | ------------ | -------------------------------- | | `:varset\_id` | The variable set ID | | `:var\_id` | The ID of the variable to delete | HCP Terraform does not allow different global variable sets to contain conflicting variables with the same name and type. You will receive a 422 response if you try to add a conflicting variable to a global variable set. | Status | Response | Reason(s) | | ------- | ------------------------- | --------------------------------------------------------------------- | | [200][] | [JSON API document][] | Successfully updated variable for variable set | | [404][] | [JSON API error object][] | Variable set not found, or user unauthorized to perform action | | [422][] | [JSON API error object][] | Problem with payload or request; details provided in the error object | ### Sample Payload ```json { "data": { "type": "vars", "attributes": { "key": "g6e45ae7564a17e81ef62fd1c7fa86138", "value": "61e400d5ccffb3782f215344481e6c82", "description": "new cheeeese", "sensitive": false, "category": "terraform", "hcl": false } } } ``` ### 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/varsets/varset-4q8f7H0NHG733bBH/relationships/vars/var-EavQ1LztoRTQHSNT ``` ### Sample Response ```json { "data": { "id":"var-EavQ1LztoRTQHSNT", "type": "vars", "attributes": { "key": "g6e45ae7564a17e81ef62fd1c7fa86138", "value": "61e400d5ccffb3782f215344481e6c82", "description": "new cheeeese", "sensitive": false, "category": "terraform", "hcl": false } } } ``` ## Delete a Variable in a Variable Set `DELETE varsets/:varset\_id/relationships/vars/:var\_id` | Parameter | Description | | ------------ | -------------------------------- | | `:varset\_id` | The variable set ID | | `:var\_id` | The ID of the variable to delete | ### Sample Request ```shell curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request DELETE \ https://app.terraform.io/api/v2/varsets/varset-4q8f7H0NHG733bBH/relationships/vars/var-EavQ1LztoRTQHSNT ``` On success, this endpoint responds with no content. ## List Variables in a Variable Set `GET varsets/:varset\_id/relationships/vars` | Parameter | Description | | ------------ | ------------------- | | `:varset\_id` | The variable set ID | ### Sample Response ```json { "data": [ { "id": "var-134r1k34nj5kjn", "type": "vars", "attributes": { "key": "F115037558b045dd82da40b089e5db745", "value": "1754288480dfd3060e2c37890422905f", "sensitive": false, "category": "terraform", "hcl": false, "created-at": "2021-10-29T18:54:29.379Z", "description": "" }, "relationships": { "varset": { "data": { "id": "varset-992UMULdeDuebi1x", "type": "varsets" }, "links": { "related": "/api/v2/varsets/1" } } }, "links": { "self": "/api/v2/vars/var-BEPU9NjPVCiCfrXj" } } ], "links": { "self": "app.terraform.io/app/varsets/varset-992UMULdeDuebi1x/vars", "first": "app.terraform.io/app/varsets/varset-992UMULdeDuebi1x/vars?page=1", "prev": null, "next": null, "last": "app.terraform.io/app/varsets/varset-992UMULdeDuebi1x/vars?page=1" } } ``` ## Apply Variable Set to Workspaces Accepts a list of workspaces to add the variable set to. `POST varsets/:varset\_id/relationships/workspaces` | Parameter | Description | | ------------ | ------------------- | | `:varset\_id` | The variable set ID | Properties without
https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/variable-sets.mdx
main
terraform
[ -0.05381434038281441, 0.023353250697255135, 0.007181514985859394, 0.010440274141728878, -0.05162103846669197, -0.0724477469921112, 0.018102101981639862, -0.014669062569737434, 0.03430020064115524, -0.04781874269247055, 0.020792214199900627, -0.061921119689941406, 0.03990376740694046, 0.060...
0.033058
"first": "app.terraform.io/app/varsets/varset-992UMULdeDuebi1x/vars?page=1", "prev": null, "next": null, "last": "app.terraform.io/app/varsets/varset-992UMULdeDuebi1x/vars?page=1" } } ``` ## Apply Variable Set to Workspaces Accepts a list of workspaces to add the variable set to. `POST varsets/:varset\_id/relationships/workspaces` | Parameter | Description | | ------------ | ------------------- | | `:varset\_id` | The variable set ID | Properties without a default value are required. | Key path | Type | Default | Description | | ------------- | ------ | ------- | -------------------------------------------------- | | `data[].type` | string | | Must be `"workspaces"` | | `data[].id` | string | | The id of the workspace to add the variable set to | | Status | Response | Reason(s) | | ------- | ------------------------- | --------------------------------------------------------------------- | | [204][] | | Successfully added variable set to the requested workspaces | | [404][] | [JSON API error object][] | Variable set not found or user unauthorized to perform action | | [422][] | [JSON API error object][] | Problem with payload or request; details provided in the error object | ### Sample Payload ```json { "data": [ { "type": "workspaces", "id": "ws-YwfuBJZkdai4xj9w" } ] } ``` ### 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/varsets/varset-kjkN545LH2Sfercv/relationships/workspaces ``` ## Remove a Variable Set from Workspaces Accepts a list of workspaces to remove the variable set from. `DELETE varsets/:varset\_id/relationships/workspaces` | Parameter | Description | | ------------ | ------------------- | | `:varset\_id` | The variable set ID | Properties without a default value are required. | Key path | Type | Default | Description | | ------------- | ------ | ------- | ------------------------------------------------------- | | `data[].type` | string | | Must be `"workspaces"` | | `data[].id` | string | | The id of the workspace to delete the variable set from | | Status | Response | Reason(s) | | ------- | ------------------------- | --------------------------------------------------------------------- | | [204][] | | Successfully removed variable set from the requested workspaces | | [404][] | [JSON API error object][] | Variable set not found or user unauthorized to perform action | | [422][] | [JSON API error object][] | Problem with payload or request; details provided in the error object | ### Sample Payload ```json { "data": [ { "type": "workspaces", "id": "ws-YwfuBJZkdai4xj9w" }, { "type": "workspaces", "id": "ws-YwfuBJZkdai4xj9w" } ] } ``` ### 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/v2/varsets/varset-kjkN545LH2Sfercv/relationships/workspaces ``` ## Apply Variable Set to Projects Accepts a list of projects to add the variable set to. When you apply a variable set to a project, all the workspaces in that project will have the variable set applied to them. `POST varsets/:varset\_id/relationships/projects` | Parameter | Description | | ------------ | ------------------- | | `:varset\_id` | The variable set ID | Properties without a default value are required. | Key path | Type | Default | Description | | ------------- | ------ | ------- | -------------------------------------------------- | | `data[].type` | string | | Must be `"projects"` | | `data[].id` | string | | The id of the project to add the variable set to | | Status | Response | Reason(s) | | ------- | ------------------------- | --------------------------------------------------------------------- | | [204][] | | Successfully added variable set to the requested projects | | [404][] | [JSON API error object][] | Variable set not found or user unauthorized to perform action | | [422][] | [JSON API error object][] | Problem with payload or request; details provided in the error object | ### Sample Payload ```json { "data": [ { "type": "projects",
https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/variable-sets.mdx
main
terraform
[ -0.005400457419455051, -0.009770901873707771, -0.00042760634096339345, 0.0766400694847107, -0.09002871066331863, 0.036867499351501465, 0.02166367881000042, -0.04031476005911827, -0.0001685611205175519, 0.07738225162029266, -0.03197389468550682, -0.09802663326263428, 0.052949149161577225, -...
-0.03607
| | [404][] | [JSON API error object][] | Variable set not found or user unauthorized to perform action | | [422][] | [JSON API error object][] | Problem with payload or request; details provided in the error object | ### Sample Payload ```json { "data": [ { "type": "projects", "id": "prj-YwfuBJZkdai4xj9w" } ] } ``` ### 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/varsets/varset-kjkN545LH2Sfercv/relationships/projects ``` ## Remove a Variable Set from Projects Accepts a list of projects to remove the variable set from. `DELETE varsets/:varset\_id/relationships/projects` | Parameter | Description | | ------------ | ------------------- | | `:varset\_id` | The variable set ID | Properties without a default value are required. | Key path | Type | Default | Description | | ------------- | ------ | ------- | ------------------------------------------------------- | | `data[].type` | string | | Must be `"projects"` | | `data[].id` | string | | The id of the project to delete the variable set from | | Status | Response | Reason(s) | | ------- | ------------------------- | --------------------------------------------------------------------- | | [204][] | | Successfully removed variable set from the requested projects | | [404][] | [JSON API error object][] | Variable set not found or user unauthorized to perform action | | [422][] | [JSON API error object][] | Problem with payload or request; details provided in the error object | ### Sample Payload ```json { "data": [ { "type": "projects", "id": "prj-YwfuBJZkdai4xj9w" }, { "type": "projects", "id": "prj-lkjasdfiojwerlkj" } ] } ``` ### 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/v2/varsets/varset-kjkN545LH2Sfercv/relationships/projects ``` ## Apply Variable Set to Stacks Accepts a list of Stacks to assign this variable set to. `POST varsets/:varset\_id/relationships/stacks` | Parameter | Description | | ------------ | ------------------- | | `:varset\_id` | The variable set ID | Properties without a default value are required. | Key path | Type | Default | Description | | ------------- | ------ | ------- | -------------------------------------------------- | | `data[].type` | string | | Must be `"stacks"` | | `data[].id` | string | | The ID of the Stack to add the variable set to. | | Status | Response | Reason(s) | | ------- | ------------------------- | --------------------------------------------------------------------- | | [204][] | | Successfully added variable set to the requested stacks | | [404][] | [JSON API error object][] | Variable set not found or user unauthorized to perform action | | [422][] | [JSON API error object][] | Problem with payload or request; details provided in the error object | ### Sample Payload ```json { "data": [ { "type": "stacks", "id": "st-YwfuCJZkdaiSxj2z" } ] } ``` ### 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/varsets/varset-kjkN545LH2Sfercv/relationships/stacks ``` ## Remove a Variable Set from Stacks Accepts a list of Stacks to remove the variable set from. `DELETE varsets/:varset\_id/relationships/stacks` | Parameter | Description | | ------------ | ------------------- | | `:varset\_id` | The variable set ID | Properties without a default value are required. | Key path | Type | Default | Description | | ------------- | ------ | ------- | ------------------------------------------------------- | | `data[].type` | string | | Must be `"stacks"` | | `data[].id` | string | | The ID of the Stack to delete the variable set from. | | Status | Response | Reason(s) | | ------- | ------------------------- | --------------------------------------------------------------------- | | [204][] | | Successfully removed variable set from the requested stacks | | [404][] |
https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/variable-sets.mdx
main
terraform
[ -0.021714096888899803, 0.08410993963479996, -0.00853889249265194, -0.007794144097715616, -0.03047323226928711, -0.04006281495094299, -0.020718885585665703, -0.027279432862997055, 0.05557290092110634, 0.05903538316488266, -0.0054855505004525185, -0.06500936299562454, 0.023249682039022446, 0...
0.051328
`"stacks"` | | `data[].id` | string | | The ID of the Stack to delete the variable set from. | | Status | Response | Reason(s) | | ------- | ------------------------- | --------------------------------------------------------------------- | | [204][] | | Successfully removed variable set from the requested stacks | | [404][] | [JSON API error object][] | Variable set not found or user unauthorized to perform action | | [422][] | [JSON API error object][] | Problem with payload or request; details provided in the error object | ### Sample Payload ```json { "data": [ { "type": "stacks", "id": "st-ZwfuBxZksai4xj9w" }, { "type": "stacks", "id": "st-YwfuBJZkdai4xj9w" } ] } ``` ### 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/v2/varsets/varset-kjkN545LH2Sfercv/relationships/stacks ``` ## 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 | | -------------------- | ------------------------------------------------- | | `vars` | Show each variable in a variable set and all of their attributes including `id`, `key`, `value`, `sensitive`, `category`, `hcl`, `created\_at`, and `description`. |
https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/variable-sets.mdx
main
terraform
[ -0.08858036994934082, 0.04046026989817619, -0.010464878752827644, 0.04908023774623871, -0.030642012134194374, -0.08189012110233307, 0.006150463595986366, -0.01171284168958664, 0.03691026568412781, -0.03490021824836731, 0.03571934625506401, -0.031916458159685135, 0.020032178610563278, -0.00...
0.072437
[200]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/200 [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 [422]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/422 [500]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500 [504]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504 # Health assessment results API reference An Assessment Result is the summary record of an instance of health assessment. HCP Terraform can perform automatic health assessments in a workspace to assess whether its real infrastructure matches the requirements defined in its Terraform configuration. Refer to [Health](/terraform/cloud-docs/workspaces/health) for more details. @include 'tfc-package-callouts/health-assessments.mdx' ## Show Assessment Result Any user with read access to a workspace can retrieve assessment results for the workspace. `GET api/v2/assessment-results/:assessment\_result\_id` | Parameter | Description | | ----------------------- | ------------------------ | | `:assessment\_result\_id` | The assessment result ID | ### Sample Request ```shell $ curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ https://app.terraform.io/api/v2/assessment-results/asmtres-cHh5777xm ``` ### Sample Response ```json { "id": "asmtres-UG5rE9L1373hMYMA", "type": "assessment-results", "data": { "attributes": { "drifted": true, "succeeded": true, "error-msg": null, "created-at": "2022-07-02T22:29:58+00:00", }, "links": { "self": "/api/v2/assessment-results/asmtres-UG5rE9L1373hMYMA/" "json-output": "/api/v2/assessment-results/asmtres-UG5rE9L1373hMYMA/json-output" "json-schema": "/api/v2/assessment-results/asmtres-UG5rE9L1373hMYMA/json-schema" "log-output": "/api/v2/assessment-results/asmtres-UG5rE9L1373hMYMA/log-output" } } } ``` ## Retrieve the JSON output from the assessment execution The following endpoints retrieve files documenting the plan, schema, and logged runtime associated with the specified assessment result. They provide complete context for an assessment result. The responses do not adhere to JSON API spec. You cannot access these endpoints with [organization tokens](/terraform/cloud-docs/users-teams-organizations/api-tokens#organization-api-tokens). You must access them 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) that has admin level access to the workspace. Refer to [Permissions](/terraform/cloud-docs/users-teams-organizations/permissions) for details. [permissions-citation]: #intentionally-unused---keep-for-maintainers ### JSON Plan The following endpoint returns the JSON plan output associated with the assessment result. `GET api/v2/assessment-results/:assessment\_result\_id/json-output` #### Sample Request ```shell $ curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ https://app.terraform.io/api/v2/assessment-results/asmtres-cHh5777xm/json-output ``` ### JSON Schema file The following endpoint returns the JSON [provider schema](/terraform/cli/commands/providers/schema) associated with the assessment result. `GET api/v2/assessment-results/:assessment\_result\_id/json-schema` #### Sample Request ```shell $ curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ https://app.terraform.io/api/v2/assessment-results/asmtres-cHh5777xm/json-schema ``` ### JSON Log Output The following endpoint returns Terraform JSON log output. `GET api/v2/assessment-results/assessment\_result\_id/log-output` #### Sample Request ```shell $ curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ https://app.terraform.io/api/v2/assessment-results/asmtres-cHh5777xm/log-output ```
https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/assessment-results.mdx
main
terraform
[ -0.05895228311419487, 0.04872103035449982, -0.05450577288866043, 0.016206445172429085, -0.01324463076889515, -0.07686988264322281, -0.06857501715421677, -0.04547417536377907, 0.014313585124909878, -0.05567794665694237, 0.022435704246163368, 0.006416401360183954, 0.02293458767235279, 0.0088...
0.066686
# API stability policy The HCP Terraform API will continue to evolve, but we consider it stable for general use, and HashiCorp will maintain all stable API endpoints in a backwards compatible manner. (Stable endpoints are any endpoints \_not\_ marked as beta.) If we need to make a change that we consider backwards incompatible, then we will create a new endpoint that serves the same purpose; the old endpoint will be maintained until declared [deprecated](#deprecation-policy). The following changes are considered to be backwards compatible: \* Adding new API endpoints. \* Adding new attributes, links, or relationships to existing API requests and responses. \* Adding new optional query parameters to existing API requests. Security vulnerabilities are an exception to this stability policy; we will make backwards incompatible changes to stable endpoints if it is necessary to protect our security or the security of our users. Endpoints that are in beta are subject to change without notice. ## Deprecation Policy The deprecation policy provides users the opportunity to continue to consume API endpoints for a period of time after they have been superseded. Deprecation notices for endpoints should be readily available through various channels of communication, including documentation and HTTP responses. An endpoint should be available for at least three (3) months from the date on which it has been declared deprecated. (This time is cited as a minimum; endpoint availability may be longer based on contracted agreements.)
https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/stability-policy.mdx
main
terraform
[ -0.06887973845005035, 0.0436895452439785, 0.05653303116559982, -0.03045945055782795, 0.02139228954911232, 0.0008861026726663113, -0.06923311203718185, -0.02972543053328991, -0.0354527048766613, 0.047825850546360016, -0.0025944188237190247, -0.03608905151486397, 0.021638570353388786, -0.020...
0.116265
[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 # Project team access API reference @include 'tfc-package-callouts/project-permissions.mdx' The team access APIs are used to associate a team to permissions on a project. A single `team-project` resource contains the relationship between the Team and Project, including the privileges the team has on the project. In HCP Europe organizations, you use HCP \*\*groups\*\* to manage permissions instead of \*\*teams\*\*. To learn more about HCP Europe, refer to [Use HCP Terraform in Europe](/terraform/cloud-docs/europe). You can replace team attributes with HCP group attributes in the following `team-project` API endpoints. Each API response can return information about groups and their permissions on projects. ## Resource permissions A `team-project` resource represents a team's local permissions on a specific project. Teams can also have organization-level permissions that grant access to projects. HCP Terraform uses the more restrictive access level. For example, a team with the \*\*Manage projects\*\* permission enabled has admin access on all projects, even if their `team-project` on a particular project only grants read access. For more information, refer to [Managing Project Access](/terraform/cloud-docs/users-teams-organizations/teams/manage#managing-project-access). Any member of an organization can view team access relative to their own team memberships, including secret teams of which they are a member. Organization owners and project admins can modify team access or view the full set of secret team accesses. The organization token and the owners team token can act as an owner on these endpoints. Refer to [Permissions](/terraform/cloud-docs/users-teams-organizations/permissions) for additional information. ## Project Team Access Levels | Access Level | Description | |-----------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------| | `read` | Read project and Read workspace access role on project workspaces | | `write` | Read project and Write workspace access role on project workspaces | | `maintain` | Read project and Admin workspace access role on project workspaces | | `admin` | Admin project, Admin workspace access role on project workspaces, create workspaces within project, move workspaces between projects, manage project team access | | `custom` | Custom access permissions on project and project's workspaces | ## List Team Access to a Project `GET /team-projects` | Status | Response | Reason | |---------|-------------------------------------------------|----------------------------------------------------------| | [200][] | [JSON API document][] (`type: "team-projects"`) | The request was successful | | [404][] | [JSON API error object][] | Project not found or user unauthorized to perform action | ### 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. This endpoint supports pagination [with standard URL query parameters](/terraform/cloud-docs/api-docs#query-parameters). | Parameter | Description | |-----------------------|-------------------------------------------------------| | `filter[project][id]` | \*\*Required.\*\* The project ID to list team access for. | | `page[number]` | \*\*Optional.\*\* | | `page[size]` | \*\*Optional.\*\* | ### Sample Request ```shell $ curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request GET \ "https://app.terraform.io/api/v2/team-projects?filter%5Bproject%5D%5Bid%5D=prj-ckZoJwdERaWcFHwi" ``` ### Sample Response ```json { "data": [ { "id": "tprj-TLznAnYdcsD2Dcmm", "type": "team-projects", "attributes": { "access": "read", "project-access": { "settings": "read", "teams": "none" }, "workspace-access": { "create": false, "move": false, "locking": false, "delete": false, "runs": "read", "variables": "read", "state-versions": "read", "sentinel-mocks": "none", "run-tasks": false } }, "relationships": { "team": { "data": { "id": "team-KpibQGL5GqRAWBwT", "type": "teams" }, "links": { "related": "/api/v2/teams/team-KpibQGL5GqRAWBwT" } }, "project": { "data": { "id": "prj-ckZoJwdERaWcFHwi", "type": "projects" }, "links": { "related": "/api/v2/projects/prj-ckZoJwdERaWcFHwi" } } }, "links": { "self": "/api/v2/team-projects/tprj-TLznAnYdcsD2Dcmm" } } ], "links": { "self": "https://app.terraform.io/api/v2/team-projects?filter%5Bproject%5D%5Bid%5D=prj-ckZoJwdERaWcFHwi&page%5Bnumber%5D=1&page%5Bsize%5D=20", "first": "https://app.terraform.io/api/v2/team-projects?filter%5Bproject%5D%5Bid%5D=prj-ckZoJwdERaWcFHwi&page%5Bnumber%5D=1&page%5Bsize%5D=20", "prev": null, "next": null, "last": "https://app.terraform.io/api/v2/team-projects?filter%5Bproject%5D%5Bid%5D=prj-ckZoJwdERaWcFHwi&page%5Bnumber%5D=1&page%5Bsize%5D=20" }, "meta": { "pagination": { "current-page": 1, "page-size":
https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/project-team-access.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
}, "links": { "related": "/api/v2/teams/team-KpibQGL5GqRAWBwT" } }, "project": { "data": { "id": "prj-ckZoJwdERaWcFHwi", "type": "projects" }, "links": { "related": "/api/v2/projects/prj-ckZoJwdERaWcFHwi" } } }, "links": { "self": "/api/v2/team-projects/tprj-TLznAnYdcsD2Dcmm" } } ], "links": { "self": "https://app.terraform.io/api/v2/team-projects?filter%5Bproject%5D%5Bid%5D=prj-ckZoJwdERaWcFHwi&page%5Bnumber%5D=1&page%5Bsize%5D=20", "first": "https://app.terraform.io/api/v2/team-projects?filter%5Bproject%5D%5Bid%5D=prj-ckZoJwdERaWcFHwi&page%5Bnumber%5D=1&page%5Bsize%5D=20", "prev": null, "next": null, "last": "https://app.terraform.io/api/v2/team-projects?filter%5Bproject%5D%5Bid%5D=prj-ckZoJwdERaWcFHwi&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 Team Access relationship `GET /team-projects/:id` | Status | Response | Reason | |---------|-------------------------------------------------|--------------------------------------------------------------| | [200][] | [JSON API document][] (`type: "team-projects"`) | The request was successful | | [404][] | [JSON API error object][] | Team access not found or user unauthorized to perform action | | Parameter | Description | |-----------|------------------------------------------------------------------------------------------------------------------------------------------| | `:id` | The ID of the team/project relationship. Obtain this from the [list team access action](#list-team-access-to-a-project) described above. | As mentioned in [Add Team Access to a Project](#add-team-access-to-a-project) and [Update to a Project](#update-team-access-to-a-project), several permission attributes are not editable unless you set `access` to `custom`. If you set `access` to `read`, `plan`, `write`, or `admin`, certain attributes are read-only and reflect the \_implicit permissions\_ granted to the current access level. For example, if you set `access` to `read`, the implicit permission level for project settings and workspace run is "read". Conversely, if you set the access level to `admin`, the implicit permission level for the project settings is "delete", while the workspace runs permission is "apply". Several permission attributes are not editable unless `access` is set to `custom`. When access is `read`, `plan`, `write`, or `admin`, these attributes are read-only and reflect the implicit permissions granted to the current access level. For example, when access is `read`, the implicit level for the project settings and workspace runs permissions are "read". Conversely, when the access level is `admin`, the implicit level for the project settings is "delete" and the workspace runs permission is "apply". To see all of the implied permissions at different access levels, see [Implied Custom Permission Levels](#implied-custom-permission-levels). ### Sample Request ```shell $ curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request GET \ https://app.terraform.io/api/v2/team-projects/tprj-s68jV4FWCDwWvQq8 ``` ### Sample Response ```json { "data": { "id": "tprj-TLznAnYdcsD2Dcmm", "type": "team-projects", "attributes": { "access": "read", "project-access": { "settings": "read", "teams": "none" }, "workspace-access": { "create": false, "move": false, "locking": false, "delete": false, "runs": "read", "variables": "read", "state-versions": "read", "sentinel-mocks": "none", "run-tasks": false } }, "relationships": { "team": { "data": { "id": "team-KpibQGL5GqRAWBwT", "type": "teams" }, "links": { "related": "/api/v2/teams/team-KpibQGL5GqRAWBwT" } }, "project": { "data": { "id": "prj-ckZoJwdERaWcFHwi", "type": "projects" }, "links": { "related": "/api/v2/projects/prj-ckZoJwdERaWcFHwi" } } }, "links": { "self": "/api/v2/team-projects/tprj-TLznAnYdcsD2Dcmm" } } } ``` ## Add Team Access to a Project `POST /team-projects` | Status | Response | Reason | |---------|-------------------------------------------------|------------------------------------------------------------------| | [200][] | [JSON API document][] (`type: "team-projects"`) | The request was successful | | [404][] | [JSON API error object][] | Project or Team 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 `"team-projects"`. | | `data.attributes.access` | string | | The type of access to grant. Valid values are `read`, `write`, `maintain`, `admin`, or `custom`. | | `data.relationships.project.data.type` | string | | Must be `projects`. | | `data.relationships.project.data.id` | string | | The project ID to which the team is to be added. | |
https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/project-team-access.mdx
main
terraform
[ -0.052283335477113724, 0.08922958374023438, 0.04489254951477051, 0.0034568144474178553, 0.031214391812682152, -0.013341624289751053, -0.05951623618602753, -0.06271187961101532, 0.03898938372731209, 0.05738181248307228, -0.022328225895762444, -0.1021435484290123, 0.025747500360012054, 0.045...
0.009257
`data.attributes.access` | string | | The type of access to grant. Valid values are `read`, `write`, `maintain`, `admin`, or `custom`. | | `data.relationships.project.data.type` | string | | Must be `projects`. | | `data.relationships.project.data.id` | string | | The project ID to which the team is to be added. | | `data.relationships.team.data.type` | string | | Must be `teams`. | | `data.relationships.team.data.id` | string | | The ID of the team to add to the project. | | `data.attributes.project-access.settings` | string | "read" | If `access` is `custom`, the permission to grant for the project's settings. Can only be used when `access` is `custom`. Valid values include `read`, `update`, or `delete`. | | `data.attributes.project-access.teams` | string | "none" | If `access` is `custom`, the permission to grant for the project's teams. Can only be used when `access` is `custom`. Valid values include `none`, `read`, or `manage`. | | `data.attributes.workspace-access.runs` | string | "read" | If `access` is `custom`, the permission to grant for the project's workspaces' runs. Can only be used when `access` is `custom`. Valid values include `read`, `plan`, or `apply`. | | `data.attributes.workspace-access.sentinel-mocks` | string | "none" | If `access` is `custom`, the permission to grant for the project's workspaces' Sentinel mocks. Can only be used when `access` is `custom`. Valid values include `none`, or `read`. | | `data.attributes.workspace-access.state-versions` | string | "none" | If `access` is `custom`, the permission to grant for the project's workspaces state versions. Can only be used when `access` is `custom`. Valid values include `none`, `read-outputs`, `read`, or `write`. | | `data.attributes.workspace-access.variables` | string | "none" | If `access` is `custom`, the permission to grant for the project's workspaces' variables. Can only be used when `access` is `custom`. Valid values include `none`, `read`, or `write`. | | `data.attributes.workspace-access.create` | boolean | false | If `access` is `custom`, this permission allows the team to create workspaces in the project. | | `data.attributes.workspace-access.locking` | boolean | false | If `access` is `custom`, the permission granting the ability to manually lock or unlock the project's workspaces. Can only be used when `access` is `custom`. | | `data.attributes.workspace-access.delete` | boolean | false | If `access` is `custom`, the permission granting the ability to delete the project's workspaces. Can only be used when `access` is `custom`. | | `data.attributes.workspace-access.move` | boolean | false | If `access` is `move`, this permission allows the team to move workspaces into and out of the project. The team must also have permissions to the project(s) receiving the the workspace(s). | | `data.attributes.workspace-access.run-tasks` | boolean | false | If `access` is `custom`, this permission allows the team to manage run tasks within the project's workspaces. | ### Sample Payload ```json { "data": { "attributes": { "access": "read" }, "relationships": { "project": { "data": { "type": "projects", "id": "prj-ckZoJwdERaWcFHwi" } }, "team": { "data": { "type": "teams", "id": "team-xMGyoUhKmTkTzmAy" } } }, "type": "team-projects" } } ``` ### 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/team-projects ``` ### Sample Response ```json { "data": { "id": "tprj-WbG7p5KnT7S7HZqw", "type": "team-projects", "attributes": { "access": "read", "project-access": { "settings": "read", "teams": "none" }, "workspace-access": { "create": false, "move": false, "locking": false, "runs": "read", "variables": "read", "state-versions": "read", "sentinel-mocks": "none", "run-tasks": false } }, "relationships": { "team": { "data": { "id": "team-xMGyoUhKmTkTzmAy", "type": "teams" }, "links": { "related": "/api/v2/teams/team-xMGyoUhKmTkTzmAy" } }, "project": { "data": { "id": "prj-ckZoJwdERaWcFHwi", "type": "projects" }, "links": { "related": "/api/v2/projects/prj-ckZoJwdERaWcFHwi" } } }, "links": { "self": "/api/v2/team-projects/tprj-WbG7p5KnT7S7HZqw" } } } ``` ## Update Team Access to a Project `PATCH /team-projects/:id` | Status
https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/project-team-access.mdx
main
terraform
[ -0.04621409252285957, 0.026025863364338875, -0.10604995489120483, 0.05109576880931854, -0.04854827746748924, -0.00476250471547246, 0.005785451736301184, -0.03028061054646969, 0.014826975762844086, 0.011755538173019886, -0.001775306067429483, -0.01962323486804962, 0.0707409456372261, 0.0607...
-0.019708
"team": { "data": { "id": "team-xMGyoUhKmTkTzmAy", "type": "teams" }, "links": { "related": "/api/v2/teams/team-xMGyoUhKmTkTzmAy" } }, "project": { "data": { "id": "prj-ckZoJwdERaWcFHwi", "type": "projects" }, "links": { "related": "/api/v2/projects/prj-ckZoJwdERaWcFHwi" } } }, "links": { "self": "/api/v2/team-projects/tprj-WbG7p5KnT7S7HZqw" } } } ``` ## Update Team Access to a Project `PATCH /team-projects/:id` | Status | Response | Reason | |---------|-------------------------------------------------|----------------------------------------------------------------| | [200][] | [JSON API document][] (`type: "team-projects"`) | The request was successful | | [404][] | [JSON API error object][] | Team Access not found or user unauthorized to perform action | | [422][] | [JSON API error object][] | Malformed request body (missing attributes, wrong types, etc.) | | Parameter | | | Description | |--------------------------|--------|-----|------------------------------------------------------------------------------------------------------------------------------------------| | `:id` | | | The ID of the team/project relationship. Obtain this from the [list team access action](#list-team-access-to-a-project) described above. | | `data.attributes.access` | string | | The type of access to grant. Valid values are `read`, `write`, `maintain`, `admin`, or `custom`. | ### 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/team-projects/tprj-WbG7p5KnT7S7HZqw ``` ### Sample Payload ```json { "data": { "id": "tprj-WbG7p5KnT7S7HZqw", "attributes": { "access": "custom", "project-access": { "settings": "delete", "teams": "manage" }, "workspace-access" : { "runs": "apply", "sentinel-mocks": "read", "state-versions": "write", "variables": "write", "create": true, "locking": true, "delete": true, "move": true, "run-tasks": true } } } } ``` ### Sample Response ```json { "data": { "id": "tprj-WbG7p5KnT7S7HZqw", "type": "team-projects", "attributes": { "access": "custom", "project-access": { "settings": "delete" "teams": "manage", }, "workspace-access" : { "runs": "apply", "sentinel-mocks": "read", "state-versions": "write", "variables": "write", "create": true, "locking": true, "delete": true, "move": true, "run-tasks": true } }, "relationships": { "team": { "data": { "id": "team-xMGyoUhKmTkTzmAy", "type": "teams" }, "links": { "related": "/api/v2/teams/team-xMGyoUhKmTkTzmAy" } }, "project": { "data": { "id": "prj-ckZoJwdERaWcFHwi", "type": "projects" }, "links": { "related": "/api/v2/projects/prj-ckZoJwdERaWcFHwi" } } }, "links": { "self": "/api/v2/team-projects/tprj-WbG7p5KnT7S7HZqw" } } } ``` ## Remove Team Access from a Project `DELETE /team-projects/:id` | Status | Response | Reason | |---------|---------------------------|--------------------------------------------------------------| | [204][] | | The Team Access was successfully destroyed | | [404][] | [JSON API error object][] | Team Access not found or user unauthorized to perform action | | Parameter | Description | |-----------|------------------------------------------------------------------------------------------------------------------------------------------| | `:id` | The ID of the team/project relationship. Obtain this from the [list team access action](#list-team-access-to-a-project) described above. | ### Sample Request ```shell $ curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request DELETE \ https://app.terraform.io/api/v2/team-projects/tprj-WbG7p5KnT7S7HZqw ``` ## Implied Custom Permission Levels As mentioned above, when setting team access levels (`read`, `write`, `maintain`, or `admin`), you can individually set the following permissions if you use the `custom` access level. The below table lists each access level alongside its implicit custom permission level. If you use the `custom` access level and do not specify a certain permission's level, that permission uses the default value listed below. | Permissions | `read` | `write` | `maintain` | `admin ` | `custom` default | |---------------------------------|--------|---------|------------|----------|------------------| | project-access.settings | "read" | "read" | "read" | "delete" | "read" | | project-access.teams | "none" | "none" | "none" | "manage" | "none" | | workspace-access.runs | "read" | "apply" | "apply" | "apply" | "read" | | workspace-access.sentinel-mocks | "none" | "read" | "read" | "read" | "none" | | workspace-access.state-versions | "read" | "write" | "write" | "write" | "none" | | workspace-access.variables | "read" | "write" | "write" | "write" | "none" | | workspace-access.create | false | false | true | true | false | | workspace-access.locking | false | true | true | true | false | | workspace-access.delete | false
https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/project-team-access.mdx
main
terraform
[ -0.0477130189538002, 0.11554015427827835, 0.039053112268447876, 0.03310228884220123, 0.012874970212578773, -0.015597760677337646, -0.041640058159828186, 0.0026337027084082365, 0.014953546226024628, 0.030292876064777374, 0.0027735477779060602, -0.04897685348987579, -0.003073496511206031, 0....
0.040031
| "write" | "write" | "none" | | workspace-access.variables | "read" | "write" | "write" | "write" | "none" | | workspace-access.create | false | false | true | true | false | | workspace-access.locking | false | true | true | true | false | | workspace-access.delete | false | false | true | true | false | | workspace-access.move | false | false | false | true | false | | workspace-access.run-tasks | false | false | true | true | false |
https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/project-team-access.mdx
main
terraform
[ -0.00935837347060442, -0.05040828511118889, -0.1272471696138382, 0.11600159853696823, -0.03897159546613693, 0.06963399052619934, 0.09365809708833694, -0.022564681246876717, -0.01155947893857956, 0.06229749694466591, 0.02104336954653263, 0.011946338228881359, 0.06206321343779564, -0.0266240...
0.096217
[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 # Audit trails API reference HCP Terraform retains 14 days of audit log information. The audit trails API exposes a stream of audit events, which describe changes to the application entities (workspaces, runs, etc.) that belong to an HCP Terraform organization. Unlike other APIs, the Audit Trails API does not use the [JSON API specification](/terraform/cloud-docs/api-docs#json-api-formatting). @include 'tfc-package-callouts/audit-trails.mdx' ## List an organization's audit events `GET /organization/audit-trail` -> \*\*Note:\*\* This endpoint cannot be accessed 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). You must access it with an [organization token](/terraform/cloud-docs/users-teams-organizations/api-tokens#organization-api-tokens) or an [audit trail token](/terraform/cloud-docs/users-teams-organizations/api-tokens#audit-trail-tokens). ### 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 | | -------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `since` | \*\*Optional.\*\* Returns only audit trails created after this date (UTC and in [ISO8601 Format](https://www.iso.org/iso-8601-date-and-time-format.html) - YYYY-MM-DDTHH:MM:SS.SSSZ) | | `page[number]` | \*\*Optional.\*\* If omitted, the endpoint will return the first page. | | `page[size]` | \*\*Optional.\*\* If omitted, the endpoint will return 1000 audit events per page. | ### Sample Request ```shell $ curl \ --header "Authorization: Bearer $TOKEN" \ --request GET \ "https://app.terraform.io/api/v2/organization/audit-trail?page[number]=1&since=2020-05-30T17:52:46.000Z" ``` ### Sample Response ```json { "data": [ { "id": "ae66e491-db59-457c-8445-9c908ee726ae", "version": "0", "type": "Resource", "timestamp": "2020-06-30T17:52:46.000Z", "auth": { "accessor\_id": "user-MaPuLxAXvtq2PWTH", "description": "pveverka", "type": "Client", "impersonator\_id": null, "organization\_id": "org-AGLwRmx1snv34Yts" }, "request": { "id": "4df584d4-7e2a-01e6-6cc0-4adbefa020e6" }, "resource": { "id": "at-sjt83qTw3GZatuPm", "type": "authentication\_token", "action": "create", "meta": null } } ], "pagination": { "current\_page": 1, "prev\_page": null, "next\_page": 2, "total\_pages": 8, "total\_count": 778 } } ``` ## Standard response fields Every audit log event in the response array includes the following standard fields: | Key | Data Type or format | Description | | ---------------------- | ------------ | ----------------------------------------------------------- | | `id` | UUID | The ID of this audit trail | | `version` | number | The audit trail schema version | | `type` | string | The type of audit trail (defaults to `Resource`) | | `timestamp` | string | UTC ISO8601 DateTime (for example,`2020-06-16T20:26:58.000Z`) | | `auth.accessor\_id` | string | The ID of audited actor (for example, `user-V3R563qtJNcExAkN`) | | `auth.description` | string | Username of audited actor | | `auth.type` | string | Authentication type, is either `Client`, `Impersonated`, or `System`. | | `auth.impersonator\_id` | string | The ID of impersonating actor (if available) | | `auth.organization\_id` | string | The ID of organization (for example, `org-QpXoEnULx3r2r1CA`) | | `request.id` | UUID | The ID for request (if available) | | `resource.id` | string | The ID of resource (for example,`run-FwnENkvDnrpyFC7M`) | | `resource.type` | string | Type of resource (for example, `run`) | | `resource.action` | string | Action audited (for example, `applied`) | | `resource.meta` | map | Key-value metadata about this audited event (defaults to `null`) | The following audit trail events \_only\_ contain these standard fields: | Event | Action | Description | |----------------------------|--------------------------------------------------------------|------------------------------------------------------------| | `agent` | `destroy` | Logged when an agent is destroyed. | | `authentication\_token` | `create`, `show`, `destroy` | Events related to authentication tokens. | | `configuration\_version` | `show`, `download` | Events related to configuration versions. | | `notification\_configuration` | `create`, `update`, `destroy`, `enable` | Events related to notification configurations. | | `oauth\_client` | `create`, `update`, `destroy` | Events related to OAuth clients. | | `oauth\_token` | `index`, `show`, `update`, `destroy` | Events related to OAuth tokens. | | `organization`
https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/audit-trails.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
| Events related to configuration versions. | | `notification\_configuration` | `create`, `update`, `destroy`, `enable` | Events related to notification configurations. | | `oauth\_client` | `create`, `update`, `destroy` | Events related to OAuth clients. | | `oauth\_token` | `index`, `show`, `update`, `destroy` | Events related to OAuth tokens. | | `organization` | `create`, `update`, `destroy` | Events related to organizations. | | `organization\_user` | `create`, `update`, `destroy` | Events related to organization users. | | `policy` | `update`, `destroy` | Events related to policies. | | `policy\_check` | `override` | Events related to policy checks. | | `policy\_config` | `create` | Events related to policy configurations. | | `policy\_set` | `destroy` | Events related to policy sets. | | `policy\_version` | `create` | Events related to policy versions. | | `project` | `create`, `update`, `destroy` | Events related to projects. | | `registry\_module` | `destroy`, `update` | Events related to registry modules. | | `registry\_provider` | `create`, `destroy` | Events related to registry providers. | | `registry\_provider\_platform` | `create`, `destroy` | Events related to registry provider platforms. | | `registry\_provider\_version` | `create`, `destroy` | Events related to registry provider versions. | | `run` | `apply`, `cancel`, `force\_cancel`, `discard`, `force\_execute`, `create` | Events related to runs. | | `run\_trigger` | `create`, `destroy` | Events related to run triggers. | | `saml\_configuration` | `create`, `update`, `destroy`, `enable`, `disable` | Events related to SAML configurations. | | `ssh\_key` | `index`, `show`, `create`, `update`, `destroy` | Events related to SSH keys. | | `stack` | `create` | Events related to creating Stacks. | | `state\_version` | `index`, `show`, `create`, `soft\_delete\_backing\_data`, `restore\_backing\_data`, `permanently\_delete\_backing\_data` | Events related to state versions. | | `task\_stage` | `override` | Events related to an overridden task stage. | | `user` | `index` | Events related to indexing users. | | `var` | `index`, `show`, `create`, `update`, `destroy` | Events related to variables. | | `vcs\_repo` | `create` | Events related to creating a connection to a VCS repo. | The following sections list the audit log events containing both the standard response schema and a specific payload for each action. ## Data retention policy events You can define [data retention policies](/terraform/cloud-docs/workspaces/settings/deletion#data-retention-policies) to help reduce object storage consumption. ### Destroy An HCP Terraform organization emits this event when it destroys a data retention policy(`data\_retention\_policy`). Alongside the [standard audit trail fields](#standard-response-fields), this event response includes the following fields: | Key | Data Type | Description | | --- | --- | --- | | `delete\_older\_than\_n\_days` | integer | The number of days to retain data before deletion. Must be greater than 0. | | `organization` | string | The organization associated with the data retention policy. | | `organization\_id` | string | The ID of the organization associated with the data retention policy. | ## Project events [Projects](/terraform/cloud-docs/projects/manage) let you organize your workspaces and scope access to workspace resources. ### Add Team An HCP Terraform organization emits this event when someone in your organization adds a team(`add\_team`) to a project. Alongside the [standard audit trail fields](#standard-response-fields), this event response includes the following fields: | Key | Data Type | Description | | --- | --- | --- | | `team` | string | The name or identifier of the team. | | `permissions` | string | The permissions granted to the team. | ### Update Team Permissions An HCP Terraform organization emits this event when someone in your organization updates the permissions(`update\_team\_permissions`) of a team on a project. Alongside the [standard audit trail fields](#standard-response-fields), this event response includes the following fields: | Key | Data Type | Description | | --- | ---
https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/audit-trails.mdx
main
terraform
[ -0.013998785987496376, 0.007008465006947517, -0.031089719384908676, -0.003334506880491972, 0.04583186283707619, -0.04269297420978546, 0.057157084345817566, -0.006797573529183865, -0.017656195908784866, 0.03625301644206047, 0.01826578378677368, 0.023597080260515213, 0.04163900762796402, -0....
0.122538
### Update Team Permissions An HCP Terraform organization emits this event when someone in your organization updates the permissions(`update\_team\_permissions`) of a team on a project. Alongside the [standard audit trail fields](#standard-response-fields), this event response includes the following fields: | Key | Data Type | Description | | --- | --- | --- | | `team` | string | The name or identifier of the team. | | `permissions` | string | The updated permissions for the team. | ### Remove Team An HCP Terraform organization emits this event when someone in your organization removes a team(`remove\_team`) from a project. Alongside the [standard audit trail fields](#standard-response-fields), this event response includes the following fields: | Key | Data Type | Description | | --- | --- | --- | | `team` | string | The name or identifier of the team. | ## Policy checks [Policy checks run Sentinel policies](/terraform/enterprise/policy-enforcement/manage-policy-sets). Policy checks have a lifecycle that includes the following events: \* `passed` \* `queued` \* `passed` \* `soft\_failed` \* `hard\_failed` \* `overridden` \* `canceled` \* `force\_canceled` \* `errored` Every policy check event in the response array includes the following standard fields: | Key | Data Type | Description | | --- | --- | --- | | `comment` | `null` or string | The comment associated with the policy check. | | `run.id` | string | The ID of the associated run. | | `run.message` | string | The message associated with the run. | | `workspace.id` | string | The ID of the associated workspace. | | `workspace.name` | string | The name of the associated workspace. | ### Passed, soft failed, hard failed, and errored Alongside the [standard audit trail fields](#standard-response-fields) and [standard policy check fields](#policy-checks), certain policy check events include a result (`includes\_result`) and return the following fields: | Key | Data Type | Description | | --------------------- | --------------- | ----------------------------------------------- | | `result` | [Policy Result] | An array of policy results. | | `passed` | integer | Number of policy checks passed. | | `total\_failed` | integer | Total number of failed policy checks. | | `hard\_failed` | integer | Number of policy checks with hard failures. | | `soft\_failed` | integer | Number of policy checks with soft failures. | | `advisory\_failed` | integer | Number of policy checks with advisory failures. | | `duration\_ms` | integer | Duration of the policy check in milliseconds. | | `sentinel` | string | The Sentinel policy associated with the check. | ### Overridden, canceled, and force canceled Alongside the [standard audit trail fields](#standard-response-fields) and [standard policy check fields](#policy-checks), certain event responses include the following fields: | Key | Data Type | Description | | --- | --- | --- | | `actor` | string | The user who performed the action. | ## Policy evaluation [Policy evaluations](/terraform/enterprise/policy-enforcement/policy-results#view-policy-results) run in the HCP Terraform agent in HCP Terraform's infrastructure. Policy evaluations have a lifecycle that includes the following events: \* `queue` \* `run` \* `pass` \* `fail` \* `override` \* `error` \* `cancel` \* `force\_cancel` Every policy evaluation event in the response array includes the following standard fields: | Key | Data Type | Description | | --- | --- | --- | | `comment` | `null` or string | The comment associated with policy evaluation. | | `payload.workspace.id` | string | The ID of the associated workspace. | | `payload.workspace.name` | string | The name of the associated workspace. | | `payload.run.id` | string | The ID of the associated run. | | `payload.run.message` | string | The message associated with the run. | | `actor` | string
https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/audit-trails.mdx
main
terraform
[ -0.0358579121530056, 0.09103061258792877, 0.022242845967411995, 0.008875439874827862, 0.06231776252388954, -0.04419564828276634, 0.03652150556445122, -0.13799597322940826, 0.04579374939203262, 0.06468775868415833, 0.029390932992100716, -0.04014585539698601, 0.011152082122862339, 0.01775550...
0.104213
| string | The ID of the associated workspace. | | `payload.workspace.name` | string | The name of the associated workspace. | | `payload.run.id` | string | The ID of the associated run. | | `payload.run.message` | string | The message associated with the run. | | `actor` | string | The policy owner. | Policy checks and policy evaluations serve the same purpose, but have different workflows for enforcing policies. For more information, refer to [Differences between policy checks and policy evaluations](/terraform/enterprise/policy-enforcement/manage-policy-sets#differences-between-policy-checks-and-policy-evaluations). ## Registry module events [HCP Terraform's private registry](/terraform/cloud-docs/registry) lets you share Terraform providers and Terraform modules across your organization. ### Destroy version An HCP Terraform organization emits this event when someone in your organization destroys a specific version of a registry module(`destroy\_version`). Alongside the [standard audit trail fields](#standard-response-fields), this event response includes the following fields: | Key | Data Type | Description | | --- | --- | --- | | `version` | integer | The version number of the registry module to destroy. | ## Run task events You can create HCP Terraform [run tasks](/terraform/cloud-docs/workspaces/settings/run-tasks) at an organization level to directly integrate third-party tools and services at certain stages in the HCP Terraform run lifecycle. You can use run tasks to validate Terraform configuration files, analyze execution plans before applying them, scan for security vulnerabilities, or perform other custom actions. ### Create An HCP Terraform organization emits this event when someone in your organization creates a task. Alongside the [standard audit trail fields](#standard-response-fields), this event response includes the following fields: | Key | Data Type | Description | | --- | --- | --- | | `task\_name` | string | The name of the task. | | `task\_category` | string | The task's category | | `task\_url` | string | The task's URL. | | `task\_enabled` | boolean | Indicates whether the task is enabled or not. | | `task\_hmac\_key\_present` | boolean | Specifies if an HMAC key is present for the task. | ### Destroy An HCP Terraform organization emits this event when someone in your organization destroys a task. Alongside the [standard audit trail fields](#standard-response-fields), this event response includes the following fields: | Key | Data Type | Description | | --- | --- | --- | | `task\_name` | string | The name of the task to be destroyed. | | `task\_category` | string | The category of the task to be destroyed. | | `task\_url` | string | The URL associated with the task to be destroyed. | | `task\_enabled` | boolean | Indicates whether the task to be destroyed is enabled. | | `task\_hmac\_key\_present` | boolean | Specifies if an HMAC key is present for the task to be destroyed. | ### Update An HCP Terraform organization emits this event when someone in your organization updates a task. Alongside the [standard audit trail fields](#standard-response-fields), this event response includes the following fields: | Key | Data Type | Description | | --- | --- | --- | | `task\_name` | string | The name of the task to be updated. | | `task\_category` | string | The updated category of the task. | | `task\_url` | string | The updated URL associated with the task. | | `task\_enabled` | boolean | Indicates whether the task is enabled after the update. | | `task\_hmac\_key\_present` | boolean | Specifies if an HMAC key is present for the updated task. | | `task\_hmac\_key\_changed` | boolean | Indicates whether the HMAC key for the task has changed during the update. | ### Callback An HCP Terraform organization emits this event when a [run task](/terraform/cloud-docs/workspaces/settings/run-tasks) result's (`task\_result`)
https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/audit-trails.mdx
main
terraform
[ -0.03607356175780296, 0.05182841420173645, 0.023332340642809868, -0.03686908259987831, 0.03495369106531143, 0.0009327336447313428, 0.023076031357049942, -0.0755983367562294, 0.005061658099293709, 0.03253673389554024, -0.013884207233786583, -0.048279739916324615, 0.03914091736078262, -0.008...
0.106645
`task\_hmac\_key\_present` | boolean | Specifies if an HMAC key is present for the updated task. | | `task\_hmac\_key\_changed` | boolean | Indicates whether the HMAC key for the task has changed during the update. | ### Callback An HCP Terraform organization emits this event when a [run task](/terraform/cloud-docs/workspaces/settings/run-tasks) result's (`task\_result`) callback action occurs. Alongside the [standard audit trail fields](#standard-response-fields), this event response includes the following fields: | Key | Data Type | Description | | --- | --- | --- | | `task\_result\_status` | string | The status of the task result. | | `task\_result\_url` | string | The URL associated with the task result. | | `task\_result\_message` | string | A message associated with the task result. | | `workspace` | string | The workspace related to the task result. | | `workspace\_id` | string | The ID of the workspace related to the task result. | | `run\_id` | string | The ID of the run associated with the task result. | | `run\_created\_at` | date (iso8601) | The timestamp when the run was created. | | `run\_created\_by` | string | The user who created the run. | | `run\_message` | string | The message associated with the run. | | `run\_is\_speculative` | boolean | Indicates whether the run is speculative or not. | | `workspace\_task\_id` | string | The ID of the workspace task associated with the result. | | `workspace\_task\_stage` | string | The stage of the workspace task. | | `workspace\_task\_enforcement` | string | The enforcement level of the workspace task. | | `organization\_task` | string | The organization task related to the task result. | | `organization\_task\_id` | string | The ID of the organization task related to the result. | | `organization\_task\_url` | string | The URL associated with the organization task. | ### Create a workspace's run task An HCP Terraform organization emits this event when someone in your organization [associates a new run task with a workspace](/terraform/cloud-docs/workspaces/settings/run-tasks#associating-run-tasks-with-a-workspace) (`workspace\_task`). Alongside the [standard audit trail fields](#standard-response-fields), this event response includes the following fields: | Key | Data Type | Description | | --- | --- | --- | | `task\_enforcement\_level` | string | The task's enforcement level. | | `task\_stage` | string | The stage of the task. | | `workspace` | string | The workspace associated with the task. | | `workspace\_id` | string | The ID of the workspace. | | `organization\_task` | string | The organization's task. | | `organization\_task\_id` | string | The ID of the organization's task.| ### Update a workspace's run task An HCP Terraform organization emits this event when someone in your organization updates a workspace's associated run task (`workspace\_task`). Alongside the [standard audit trail fields](#standard-response-fields), this event response includes the following fields: | Key | Data Type | Description | | --- | --- | --- | | `task\_enforcement\_level` | string | The task's enforcement level. | | `task\_stage` | string | The stage of the task. | | `workspace` | string | The workspace associated with the task. | | `workspace\_id` | string | The ID of the workspace. | | `organization\_task` | string | The organization's task. | | `organization\_task\_id` | string | The ID of the organization's task.| ### Destroy a workspace's run task An HCP Terraform organization emits this event when someone in your organization destroys a workspace's associated run task (`workspace\_task`). Alongside the [standard audit trail fields](#standard-response-fields), this event response includes the following fields: | Key | Data Type | Description | | --- | --- | --- | | `task\_enforcement\_level` | string | The task's enforcement level. | |
https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/audit-trails.mdx
main
terraform
[ -0.043408751487731934, 0.04396647587418556, 0.04326643794775009, 0.037460893392562866, 0.023098627105355263, -0.04125183820724487, 0.04755846783518791, -0.10995661467313766, 0.08687864243984222, 0.07963394373655319, -0.012881710194051266, -0.05111224204301834, 0.024547800421714783, -0.0182...
0.054309
someone in your organization destroys a workspace's associated run task (`workspace\_task`). Alongside the [standard audit trail fields](#standard-response-fields), this event response includes the following fields: | Key | Data Type | Description | | --- | --- | --- | | `task\_enforcement\_level` | string | The task's enforcement level. | | `task\_stage` | string | The stage of the task. | | `workspace` | string | The workspace associated with the task. | | `workspace\_id` | string | The ID of the workspace. | | `organization\_task` | string | The organization's task. | | `organization\_task\_id` | string | The ID of the organization's task.| ## Team events Teams are [groups of HCP Terraform users within an organization](/terraform/cloud-docs/users-teams-organizations/teams). ### Add Member An HCP Terraform organization emits this event when someone in your organization adds a member(`add\_member`) to a team. Alongside the [standard audit trail fields](#standard-response-fields), this event response includes the following fields: | Key | Data Type | Description | | --- | --- | --- | | `user` | string | The user being added to the team. | ### Remove Member An HCP Terraform organization emits this event when someone in your organization removes a member(`remove\_member`) from a team. Alongside the [standard audit trail fields](#standard-response-fields), this event response includes the following fields: | Key | Data Type | Description | | --- | --- | --- | | `user` | string | The user being removed from the team. | ## Workspace comment events [Workspace comments](/terraform/cloud-docs/api-docs/comments) allow users to leave feedback or record decisions about a run. ### Create An HCP Terraform organization emits this event when someone in your organization creates a comment on a workspace(`workspace\_comment`). Alongside the [standard audit trail fields](#standard-response-fields), this event response includes the following fields: | Key | Data Type | Description | | --- | --- | --- | | `resource`| string | The resource associated with the comment. | ## Workspace events HCP Terraform manages infrastructure collections with [workspaces](/terraform/cloud-docs/workspaces). ### Add Team An HCP Terraform organization emits this event when someone in your organization adds a team(`add\_team`) to a workspace. Alongside the [standard audit trail fields](#standard-response-fields), this event response includes the following fields: | Key | Data Type | Description | | --- | --- | --- | | `team` | string | The name or identifier of the team. | | `permissions` | string | The permissions granted to the team. | ### Update Team Permissions An HCP Terraform organization emits this event when someone in your organization updates the permissions(`update\_team\_permissions`) of a team on a workspace. Alongside the [standard audit trail fields](#standard-response-fields), this event response includes the following fields: | Key | Data Type | Description | | --- | --- | --- | | `team` | string | The name or identifier of the team. | | `permissions` | string | The updated permissions for the team. | ### Remove Team An HCP Terraform organization emits this event when someone in your organization removes a team(`remove\_team`) from a workspace. Alongside the [standard audit trail fields](#standard-response-fields), this event response includes the following fields: | Key | Data Type | Description | | --- | --- | --- | | `team` | string | The name or identifier of the team. |
https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/audit-trails.mdx
main
terraform
[ -0.028391918167471886, 0.05205947533249855, 0.02547643519937992, 0.027484571561217308, 0.05805949866771698, -0.04422275722026825, 0.03755511716008186, -0.09481316804885864, 0.051500555127859116, 0.06618248671293259, -0.02522442862391472, -0.0840507447719574, 0.03911934792995453, 0.03217567...
0.082775
[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 # Invoices API reference -> \*\*Note:\*\* The invoices API is only available in HCP Terraform. Organizations on credit-card-billed plans may view their previous and upcoming invoices. ## List Invoices This endpoint lists the previous invoices for an organization. It uses a pagination scheme that's somewhat different from [our standard pagination](/terraform/cloud-docs/api-docs#pagination). The page size is always 10 items and is not configurable; if there are no more items, `meta.continuation` will be null. The current page is controlled by the `cursor` parameter, described below. `GET /organizations/:organization\_name/invoices` | Parameter | Description | | -------------------- | --------------------------------------------------------------------------------------------------------------------- | | `:organization\_name` | The name of the organization you'd like to view invoices for | | `:cursor` | \*\*Optional.\*\* The ID of the invoice where the page should start. If omitted, the endpoint will return the first page. | ### Sample Request ```shell curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ https://app.terraform.io/api/v2/organizations/hashicorp/invoices ``` ### Sample Response ```json { "data": [ { "id": "in\_1I4sraHcjZv6Wm0g7nC34mAi", "type": "billing-invoices", "attributes": { "created-at": "2021-01-01T19:00:38Z", "external-link": "https://pay.stripe.com/invoice/acct\_1Eov7THcjZv6Wm0g/invst\_IgFMMfdzAZzMQq8GXyUbrk9lFMqvp9SX/pdf", "number": "2F8CA1AE-0006", "paid": true, "status": "paid", "total": 21000 } }, {...} { "id": "in\_1Hte5nHcjZv6Wm0g2Q8hFctH", "type": "billing-invoices", "attributes": { "created-at": "2020-06-01T19:00:51Z", "external-link": "https://pay.stripe.com/invoice/acct\_1Eov7THcjZv6Wm0g/invst\_IUdMM6wl0JfA95tgWGZxpBGXYtJwmBgY/pdf", "number": "2F8CA1AE-0005", "paid": true, "status": "paid", "total": 21000 } } ], "meta": { "continuation": "in\_1IBpkEHcjZv6Wm0gHcgc2uwN" } } ``` ## Get Next Invoice This endpoint lists the next month's invoice for an organization. `GET /organizations/:organization\_name/invoices/next` | Parameter | Description | | ------------------- | ---------------------------- | | `organization\_name` | The name of the organization | ### Sample Request ```shell curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ https://app.terraform.io/api/v2/organizations/hashicorp/invoices/next ``` ### Sample Response ```json { "data": { "id": "in\_upcoming\_510DEB1F-0002", "type": "billing-invoices", "attributes": { "created-at": "2021-02-01T20:00:00Z", "external-link": "", "number": "510DEB1F-0002", "paid": false, "status": "draft", "total": 21000 } } } ```
https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/invoices.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 # Team membership API reference -> \*\*Note:\*\* Team management is available in HCP Terraform \*\*Essentials\*\*, \*\*Standard\*\*, and \*\*Premium\*\* editions. Free organizations can also use this API, but can only manage membership of their owners team. Refer to the [Terraform pricing page](https://www.hashicorp.com/en/pricing?tab=terraform) for more information. The Team Membership API is used to add or remove users from teams. The [Team API](/terraform/cloud-docs/api-docs/teams) is used to create or destroy teams. In HCP Europe organizations, you use HCP \*\*groups\*\* to manage permissions instead of \*\*teams\*\*. To learn more about HCP Europe, refer to [Use HCP Terraform in Europe](/terraform/cloud-docs/europe). The following team membership APIs are \*\*not\*\* available for HCP Europe organizations. Manage user membership to a group on the [HCP platform](https://portal.cloud.eu.hashicorp.com). ## Organization Membership -> \*\*Note:\*\* To add users to a team, they must first receive and accept the invitation to join the organization by email. This process ensures that you do not accidentally add the wrong person by mistyping a username. Refer to [the Organization Memberships API documentation](/terraform/cloud-docs/api-docs/organization-memberships) for more information. ## Add a User to Team (With user ID) This method adds multiple users to a team using the user ID. Both users and teams must already exist. `POST /teams/:team\_id/relationships/users` | Parameter | Description | | ---------- | ------------------- | | `:team\_id` | The ID of the team. | ### 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 `"users"`. | | `data[].id` | string | | The ID of the user you want to add to this team. | ### Sample Payload ```json { "data": [ { "type": "users", "id": "myuser1" }, { "type": "users", "id": "myuser2" } ] } ``` ### 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/teams/257525/relationships/users ``` ## Add a User to Team (With organization membership ID) This method adds multiple users to a team using the organization membership ID. Unlike the user ID method, the user only needs an invitation to the organization. `POST /teams/:team\_id/relationships/organization-memberships` | Parameter | Description | | ---------- | ------------------- | | `:team\_id` | The ID of the team. | ### 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[].id` | string | | The organization membership ID of the user to add. | ### Sample Payload ```json { "data": [ { "type": "organization-memberships", "id": "ou-nX7inDHhmC3quYgy" }, { "type": "organization-memberships", "id": "ou-tTJph1AQVK5ZmdND" } ] } ``` ### 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/teams/257525/relationships/organization-memberships ``` ## Delete a User from Team (With username) This method removes multiple users from a team using the username. Both users and teams must already exist. This method only removes a user from this team. It does not delete that user overall. `DELETE /teams/:team\_id/relationships/users` | Parameter | Description | | ---------- | ------------------- | | `:team\_id`
https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/team-members.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
(With username) This method removes multiple users from a team using the username. Both users and teams must already exist. This method only removes a user from this team. It does not delete that user overall. `DELETE /teams/:team\_id/relationships/users` | Parameter | Description | | ---------- | ------------------- | | `:team\_id` | The ID of the team. | ### Request Body This DELETE 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 `"users"`. | | `data[].id` | string | | The username of the user to remove from this team. | ### Sample Payload ```json { "data": [ { "type": "users", "id": "myuser1" }, { "type": "users", "id": "myuser2" } ] } ``` ### 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/v2/teams/257525/relationships/users ``` ## Delete a User from Team (With organization membership ID) This method removes multiple users from a team using the organization membership ID. This method only removes a user from this team. It does not delete that user overall. `DELETE /teams/:team\_id/relationships/organization-memberships` | Parameter | Description | | ---------- | ------------------- | | `:team\_id` | The ID of the team. | ### Request Body This DELETE 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[].id` | string | | The organization membership ID of the user to remove. | ### Sample Payload ```json { "data": [ { "type": "organization-memberships", "id": "ou-nX7inDHhmC3quYgy" }, { "type": "organization-memberships", "id": "ou-tTJph1AQVK5ZmdND" } ] } ``` ### 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/v2/teams/257525/relationships/organization-memberships ```
https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/team-members.mdx
main
terraform
[ -0.05836748704314232, 0.049758486449718475, -0.032608650624752045, 0.001955788815394044, -0.06276758760213852, -0.05318862944841385, 0.02314545027911663, -0.051121387630701065, 0.09296315908432007, -0.016058314591646194, 0.021541427820920944, -0.01947331242263317, 0.04686050862073898, 0.04...
0.056054
# Plan exports API reference Plan exports allow users to download data exported from the plan of a Run in a Terraform workspace. Currently, the only supported format for exporting plan data is to generate mock data for Sentinel. ## Create a plan export `POST /plan-exports` This endpoint exports data from a plan in the specified format. The export process is asynchronous, and the resulting data becomes downloadable when its status is `"finished"`. The data is then available for one hour before expiring. After the hour is up, a new export can be created. | Status | Response | Reason | | ------- | ---------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | | [201][] | [JSON API document][] (`type: "plan-exports"`) | Successfully created a plan export | | [404][] | [JSON API error object][] | Plan not found, or user unauthorized to perform action | | [422][] | [JSON API error object][] | Malformed request body (missing attributes, wrong types, etc.), or a plan export of the provided `data-type` is already pending or downloadable for this plan | [201]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/201 [404]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/404 [422]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/422 [JSON API document]: /terraform/cloud-docs/api-docs#json-api-documents [JSON API error object]: https://jsonapi.org/format/#error-objects ### 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 `"plan-exports"`. | | `data.attributes.data-type` | string | | The format for the export. Currently, the only supported format is `"sentinel-mock-bundle-v0"`. | | `data.relationships.plan.data` | object | | A JSON API relationship object that represents the plan being exported. This object must have a `type` of `plans`, and the `id` of a finished Terraform plan that does not already have a downloadable export of the specified `data-type` (e.g: `{"type": "plans", "id": "plan-8F5JFydVYAmtTjET"}`) | ### Sample Payload ```json { "data": { "type": "plan-exports", "attributes": { "data-type": "sentinel-mock-bundle-v0" }, "relationships": { "plan": { "data": { "id": "plan-8F5JFydVYAmtTjET", "type": "plans" } } } } } ``` ### 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/plan-exports ``` ### Sample Response ```json { "data": { "id": "pe-3yVQZvHzf5j3WRJ1", "type": "plan-exports", "attributes": { "data-type": "sentinel-mock-bundle-v0", "status": "queued", "status-timestamps": { "queued-at": "2019-03-04T22:29:53+00:00", }, }, "relationships": { "plan": { "data": { "id": "plan-8F5JFydVYAmtTjET", "type": "plans" } } }, "links": { "self": "/api/v2/plan-exports/pe-3yVQZvHzf5j3WRJ1", } } } ``` ## Show a plan export `GET /plan-exports/:id` | Parameter | Description | | --------- | ---------------------------------- | | `id` | The ID of the plan export to show. | There is no endpoint to list plan exports. You can find IDs for plan exports in the `relationships.exports` property of a plan object. | Status | Response | Reason | | ------- | ---------------------------------------------- | ------------------------------------------------------------- | | [200][] | [JSON API document][] (`type: "plan-exports"`) | The request was successful | | [404][] | [JSON API error object][] | Plan export not found, or user unauthorized to perform action | [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 ### Sample Request ```shell curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ https://app.terraform.io/api/v2/plan-exports/pe-3yVQZvHzf5j3WRJ1 ``` ### Sample Response ```json { "data": { "id": "pe-3yVQZvHzf5j3WRJ1", "type": "plan-exports", "attributes": { "data-type": "sentinel-mock-bundle-v0", "status": "finished", "status-timestamps": { "queued-at": "2019-03-04T22:29:53+00:00", "finished-at": "2019-03-04T22:29:58+00:00", "expired-at": "2019-03-04T23:29:58+00:00" }, }, "relationships": { "plan": { "data": { "id": "plan-8F5JFydVYAmtTjET", "type": "plans" } } }, "links": { "self": "/api/v2/plan-exports/pe-3yVQZvHzf5j3WRJ1", "download": "/api/v2/plan-exports/pe-3yVQZvHzf5j3WRJ1/download" } } } ``` ## Download exported plan data `GET /plan-exports/:id/download` This endpoint generates a
https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/plan-exports.mdx
main
terraform
[ -0.0503418929874897, 0.053855232894420624, -0.038354482501745224, 0.0756860226392746, 0.05453535541892052, -0.03753896430134773, -0.0838109478354454, -0.0333583690226078, 0.00032986566657200456, 0.08466919511556625, -0.030451877042651176, -0.02518824115395546, -0.03853682801127434, -0.0738...
0.040583
"attributes": { "data-type": "sentinel-mock-bundle-v0", "status": "finished", "status-timestamps": { "queued-at": "2019-03-04T22:29:53+00:00", "finished-at": "2019-03-04T22:29:58+00:00", "expired-at": "2019-03-04T23:29:58+00:00" }, }, "relationships": { "plan": { "data": { "id": "plan-8F5JFydVYAmtTjET", "type": "plans" } } }, "links": { "self": "/api/v2/plan-exports/pe-3yVQZvHzf5j3WRJ1", "download": "/api/v2/plan-exports/pe-3yVQZvHzf5j3WRJ1/download" } } } ``` ## Download exported plan data `GET /plan-exports/:id/download` This endpoint generates a temporary URL to the location of the exported plan data in a `.tar.gz` archive, and then redirects to that link. If using a client that can follow redirects, you can use this endpoint to save the `.tar.gz` archive locally without needing to save the temporary URL. | Status | Response | Reason | | ------- | ------------------------- | ------------------------------------------------------------- | | [302][] | HTTP Redirect | Plan export found and temporary download URL generated | | [404][] | [JSON API error object][] | Plan export not found, or user unauthorized to perform action | [302]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/302 [404]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/404 [JSON API error object]: https://jsonapi.org/format/#error-objects ### Sample Request ```shell curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --location \ https://app.terraform.io/api/v2/plan-exports/pe-3yVQZvHzf5j3WRJ1/download \ > export.tar.gz ``` ## Delete exported plan data `DELETE /plan-exports/:id` Plan exports expire after being available for one hour, but they can be deleted manually as well. | Status | Response | Reason | | ------- | ------------------------- | ------------------------------------------------------------- | | [204][] | No content | Plan export deleted successfully | | [404][] | [JSON API error object][] | Plan export not found, or user unauthorized to perform action | [204]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/204 [404]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/404 [JSON API error object]: https://jsonapi.org/format/#error-objects ### Sample Request ```shell curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ -X DELETE \ https://app.terraform.io/api/v2/plan-exports/pe-3yVQZvHzf5j3WRJ1 ```
https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/plan-exports.mdx
main
terraform
[ -0.045524850487709045, 0.09527115523815155, 0.027992624789476395, 0.05105696991086006, 0.04645684361457825, 0.015738915652036667, -0.031997475773096085, 0.015673957765102386, 0.007611432112753391, 0.013332628645002842, 0.023331059142947197, -0.04448916018009186, -0.03673822432756424, 0.038...
0.028511
[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 # Workspace variables API reference This set of APIs covers create, update, list and delete operations on workspace variables. Viewing variables requires permission to read variables for their workspace. Creating, updating, and deleting variables requires permission to read and write variables for their workspace. ([More about permissions.](/terraform/cloud-docs/users-teams-organizations/permissions)) [permissions-citation]: #intentionally-unused---keep-for-maintainers ## Create a Variable `POST /workspaces/:workspace\_id/vars` | Parameter | Description | | --------------- | -------------------------------------------------- | | `:workspace\_id` | The ID of the workspace to create the variable 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 variable. | | `data.attributes.value` | string | `""` | The value of the variable. | | `data.attributes.description` | string | | The description of the variable. | | `data.attributes.category` | string | | Whether this is a Terraform or environment variable. Valid values are `"terraform"` or `"env"`. | | `data.attributes.hcl` | bool | `false` | Whether to evaluate the value of the variable as a string of HCL code. Has no effect for environment variables. | | `data.attributes.sensitive` | bool | `false` | Whether the value is sensitive. If true then the variable is written once and not visible thereafter. | \*\*Deprecation warning\*\*: The custom `filter` properties are replaced by JSON API `relationships` and will be removed from future versions of the API! | Key path | Type | Default | Description | | -------------------------- | ------ | ------- | ----------------------------------------------------- | | `filter.workspace.name` | string | | The name of the workspace that owns the variable. | | `filter.organization.name` | string | | The name of the organization that owns the workspace. | ### Sample Payload ```json { "data": { "type":"vars", "attributes": { "key":"some\_key", "value":"some\_value", "description":"some description", "category":"terraform", "hcl":false, "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/workspaces/ws-4j8p6jX1w33MiDC7/vars ``` ### Sample Response ```json { "data": { "id":"var-EavQ1LztoRTQHSNT", "type":"vars", "attributes": { "key":"some\_key", "value":"some\_value", "description":"some description", "sensitive":false, "category":"terraform", "hcl":false, "version-id":"1aa07d63ea8ff4df941c94ca9ddfd5d2bd04" }, "relationships": { "configurable": { "data": { "id":"ws-4j8p6jX1w33MiDC7", "type":"workspaces" }, "links": { "related":"/api/v2/organizations/my-organization/workspaces/my-workspace" } } }, "links": { "self":"/api/v2/workspaces/ws-4j8p6jX1w33MiDC7/vars/var-EavQ1LztoRTQHSNT" } } } ``` ## List Variables `GET /workspaces/:workspace\_id/vars` | Parameter | Description | | --------------- | ---------------------------------------------- | | `:workspace\_id` | The ID of the workspace to list variables for. | ### Sample Request ```shell $ curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ "https://app.terraform.io/api/v2/workspaces/ws-cZE9LERN3rGPRAmH/vars" ``` ### Sample Response ```json { "data": [ { "id":"var-AD4pibb9nxo1468E", "type":"vars","attributes": { "key":"name", "value":"hello", "description":"some description", "sensitive":false, "category":"terraform", "hcl":false, "version-id":"1aa07d63ea8ff4df941c94ca9ddfd5d2bd04" }, "relationships": { "configurable": { "data": { "id":"ws-cZE9LERN3rGPRAmH", "type":"workspaces" }, "links": { "related":"/api/v2/organizations/my-organization/workspaces/my-workspace" } } }, "links": { "self":"/api/v2/workspaces/ws-cZE9LERN3rGPRAmH/vars/var-AD4pibb9nxo1468E" } } ] } ``` ## Update Variables `PATCH /workspaces/:workspace\_id/vars/:variable\_id` | Parameter | Description | | --------------- | ----------------------------------------------- | | `:workspace\_id` | The ID of the workspace that owns the variable. | | `:variable\_id` | The ID of the variable to be updated. | ### 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 |
https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/workspace-variables.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
the workspace that owns the variable. | | `:variable\_id` | The ID of the variable to be updated. | ### 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.id` | string | | The ID of the variable to update. | | `data.attributes` | object | | New attributes for the variable. This object can include `key`, `value`, `description`, `category`, `hcl`, and `sensitive` properties, which are described above under [create a variable](#create-a-variable). 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", "description":"some description", "category":"terraform", "hcl": false, "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/workspaces/ws-4j8p6jX1w33MiDC7/vars/var-yRmifb4PJj7cLkMG ``` ### Sample Response ```json { "data": { "id":"var-yRmifb4PJj7cLkMG", "type":"vars", "attributes": { "key":"name", "value":"mars", "description":"some description", "sensitive":false, "category":"terraform", "hcl":false, "version-id":"1aa07d63ea8ff4df941c94ca9ddfd5d2bd04" }, "relationships": { "configurable": { "data": { "id":"ws-4j8p6jX1w33MiDC7", "type":"workspaces" }, "links": { "related":"/api/v2/organizations/workspace-v2-06/workspaces/workspace-v2-06" } } }, "links": { "self":"/api/v2/workspaces/ws-4j8p6jX1w33MiDC7/vars/var-yRmifb4PJj7cLkMG" } } } ``` ## Delete Variables `DELETE /workspaces/:workspace\_id/vars/:variable\_id` | Parameter | Description | | --------------- | ----------------------------------------------- | | `:workspace\_id` | The ID of the workspace that owns the variable. | | `:variable\_id` | The ID of the variable 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/workspaces/ws-4j8p6jX1w33MiDC7/vars/var-yRmifb4PJj7cLkMG ```
https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/workspace-variables.mdx
main
terraform
[ -0.0427742637693882, 0.019843917340040207, 0.004550270736217499, 0.06143905594944954, -0.09054183214902878, -0.021796630695462227, 0.0017591279465705156, -0.01626402884721756, -0.006076921243220568, 0.015339533798396587, -0.017042063176631927, -0.05994274467229843, -0.023774391040205956, -...
0.065279
[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 # Team access API reference @include 'tfc-package-callouts/team-management.mdx' The team access APIs are used to associate a team to permissions on a workspace. A single `team-workspace` resource contains the relationship between the Team and Workspace, including the privileges the team has on the workspace. In HCP Europe organizations, you use HCP \*\*groups\*\* to manage permissions instead of \*\*teams\*\*. To learn more about HCP Europe, refer to [Use HCP Terraform in Europe](/terraform/cloud-docs/europe). You can replace team attributes with HCP group attributes in the following `team-workspace` API endpoints. Each API response can return information about groups and their permissions on workspaces. ## Resource permissions A `team-workspace` resource represents a team's local permissions on a specific workspace. Teams can also have organization-level permissions that grant access to workspaces. HCP Terraform uses the more restrictive access level. For example, a team with the \*\*Manage workspaces\*\* permission enabled has admin access on all workspaces, even if their `team-workspace` on a particular workspace only grants read access. For more information, refer to [Managing Workspace Access](/terraform/cloud-docs/users-teams-organizations/teams/manage#managing-workspace-access). Any member of an organization can view team access relative to their own team memberships, including secret teams of which they are a member. Organization owners and workspace admins can modify team access or view the full set of secret team accesses. The organization token and the owners team token can act as an owner on these endpoints. Refer to [Permissions](/terraform/cloud-docs/users-teams-organizations/permissions) for additional information. ## List Team Access to a Workspace `GET /team-workspaces` | Status | Response | Reason | | ------- | ------------------------------------------------- | ---------------------------------------------------------- | | [200][] | [JSON API document][] (`type: "team-workspaces"`) | The request was successful | | [404][] | [JSON API error object][] | Workspace not found or user unauthorized to perform action | ### 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. This endpoint supports pagination [with standard URL query parameters](/terraform/cloud-docs/api-docs#query-parameters). If neither pagination query parameters are provided, the endpoint will not be paginated and will return all results. | Parameter | Description | | ----------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `filter[workspace][id]` | \*\*Required.\*\* The workspace ID to list team access 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. | | `page[number]` | \*\*Optional.\*\* | | `page[size]` | \*\*Optional.\*\* | ### Sample Request ```shell $ curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request GET \ "https://app.terraform.io/api/v2/team-workspaces?filter%5Bworkspace%5D%5Bid%5D=ws-XGA52YVykdTgryTN" ``` ### Sample Response ```json { "data": [ { "id": "tws-19iugLwoNgtWZbKP", "type": "team-workspaces", "attributes": { "access": "custom", "runs": "apply", "variables": "none", "state-versions": "none", "sentinel-mocks": "none", "workspace-locking": false, "run-tasks": false }, "relationships": { "team": { "data": { "id": "team-DBycxkdQrGFf5zEM", "type": "teams" }, "links": { "related": "/api/v2/teams/team-DBycxkdQrGFf5zEM" } }, "workspace": { "data": { "id": "ws-XGA52YVykdTgryTN", "type": "workspaces" }, "links": { "related": "/api/v2/organizations/my-organization/workspaces/my-workspace" } } }, "links": { "self": "/api/v2/team-workspaces/tws-19iugLwoNgtWZbKP" } } ] } ``` ## Show a Team Access relationship `GET /team-workspaces/:id` | Status | Response | Reason | | ------- | ------------------------------------------------- | ------------------------------------------------------------ | | [200][] | [JSON API document][] (`type: "team-workspaces"`) | The request was successful | | [404][] | [JSON API error object][] | Team access not found or user unauthorized to perform action | | Parameter | Description | | --------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `:id` | The ID of the team/workspace relationship. Obtain this from the [list team access action](#list-team-access-to-a-workspace) described above. | -> \*\*Note:\*\*
https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/team-access.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
[404][] | [JSON API error object][] | Team access not found or user unauthorized to perform action | | Parameter | Description | | --------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `:id` | The ID of the team/workspace relationship. Obtain this from the [list team access action](#list-team-access-to-a-workspace) described above. | -> \*\*Note:\*\* As mentioned in [Add Team Access to a Workspace](#add-team-access-to-a-workspace) and [Update Team Access to a Workspace](#update-team-access-to-a-workspace), several permission attributes are not editable unless `access` is set to `custom`. When access is `read`, `plan`, `write`, or `admin`, these attributes are read-only and reflect the implicit permissions granted to the current access level. ### Sample Request ```shell $ curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request GET \ https://app.terraform.io/api/v2/team-workspaces/tws-s68jV4FWCDwWvQq8 ``` ### Sample Response ```json { "data": { "id": "tws-s68jV4FWCDwWvQq8", "type": "team-workspaces", "attributes": { "access": "write", "runs": "apply", "variables": "write", "state-versions": "write", "sentinel-mocks": "read", "workspace-locking": true, "run-tasks": false }, "relationships": { "team": { "data": { "id": "team-DBycxkdQrGFf5zEM", "type": "teams" }, "links": { "related": "/api/v2/teams/team-DBycxkdQrGFf5zEM" } }, "workspace": { "data": { "id": "ws-XGA52YVykdTgryTN", "type": "workspaces" }, "links": { "related": "/api/v2/organizations/my-organization/workspaces/my-workspace" } } }, "links": { "self": "/api/v2/team-workspaces/tws-s68jV4FWCDwWvQq8" } } } ``` ## Add Team Access to a Workspace `POST /team-workspaces` | Status | Response | Reason | | ------- | ------------------------------------------------- | ------------------------------------------------------------------ | | [200][] | [JSON API document][] (`type: "team-workspaces"`) | The request was successful | | [404][] | [JSON API error object][] | Workspace or Team 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 `"team-workspaces"`. | | `data.attributes.access` | string | | The type of access to grant. Valid values are `read`, `plan`, `write`, `admin`, or `custom`. | | `data.attributes.runs` | string | "read" | If `access` is `custom`, the permission to grant for the workspace's runs. Can only be used when `access` is `custom`. Valid values include `read`, `plan`, or `apply`. | | `data.attributes.variables` | string | "none" | If `access` is `custom`, the permission to grant for the workspace's variables. Can only be used when `access` is `custom`. Valid values include `none`, `read`, or `write`. | | `data.attributes.state-versions` | string | "none" | If `access` is `custom`, the permission to grant for the workspace's state versions. Can only be used when `access` is `custom`. Valid values include `none`, `read-outputs`, `read`, or `write`. | | `data.attributes.sentinel-mocks` | string | "none" | If `access` is `custom`, the permission to grant for the workspace's Sentinel mocks. Can only be used when `access` is `custom`. Valid values include `none`, or `read`. | | `data.attributes.workspace-locking` | boolean | false | If `access` is `custom`, the permission granting the ability to manually lock or unlock the workspace. Can only be used when `access` is `custom`. | | `data.attributes.run-tasks` | boolean | false | If `access` is `custom`, this permission allows the team to manage run tasks within the workspace. | | `data.relationships.workspace.data.type` | string | | Must be `workspaces`. | | `data.relationships.workspace.data.id` | string | | The workspace ID to which the team is to be added. | | `data.relationships.team.data.type` | string | | Must be `teams`. | | `data.relationships.team.data.id` | string | | The ID of the team to add to the workspace. | ### Sample Payload ```json { "data":
https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/team-access.mdx
main
terraform
[ -0.0742599293589592, 0.0873590037226677, -0.05740441381931305, 0.012482436373829842, -0.034913890063762665, 0.008589811623096466, 0.0013577851932495832, -0.030880769714713097, 0.03648662194609642, -0.04042103514075279, 0.04064469784498215, -0.06675561517477036, 0.0070335171185433865, 0.069...
0.069847
`data.relationships.workspace.data.id` | string | | The workspace ID to which the team is to be added. | | `data.relationships.team.data.type` | string | | Must be `teams`. | | `data.relationships.team.data.id` | string | | The ID of the team to add to the workspace. | ### Sample Payload ```json { "data": { "attributes": { "access": "custom", "runs": "apply", "variables": "none", "state-versions": "read-outputs", "plan-outputs": "none", "sentinel-mocks": "read", "workspace-locking": false, "run-tasks": false }, "relationships": { "workspace": { "data": { "type": "workspaces", "id": "ws-XGA52YVykdTgryTN" } }, "team": { "data": { "type": "teams", "id": "team-DBycxkdQrGFf5zEM" } } }, "type": "team-workspaces" } } ``` ### 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/team-workspaces ``` ### Sample Response ```json { "data": { "id": "tws-sezDAcCYWLnd3xz2", "type": "team-workspaces", "attributes": { "access": "custom", "runs": "apply", "variables": "none", "state-versions": "read-outputs", "sentinel-mocks": "read", "workspace-locking": false, "run-tasks": false }, "relationships": { "team": { "data": { "id": "team-DBycxkdQrGFf5zEM", "type": "teams" }, "links": { "related": "/api/v2/teams/team-DBycxkdQrGFf5zEM" } }, "workspace": { "data": { "id": "ws-XGA52YVykdTgryTN", "type": "workspaces" }, "links": { "related": "/api/v2/organizations/my-organization/workspaces/my-workspace" } } }, "links": { "self": "/api/v2/team-workspaces/tws-sezDAcCYWLnd3xz2" } } } ``` ## Update Team Access to a Workspace `PATCH /team-workspaces/:id` | Status | Response | Reason | | ------- | ------------------------------------------------- | -------------------------------------------------------------- | | [200][] | [JSON API document][] (`type: "team-workspaces"`) | The request was successful | | [404][] | [JSON API error object][] | Team Access not found or user unauthorized to perform action | | [422][] | [JSON API error object][] | Malformed request body (missing attributes, wrong types, etc.) | | Parameter | | | Description | | ----------------------------------- | ------- | ------ | -------------------------------------------------------------------------------------------------------------------------------------------------- | | `:id` | | | The ID of the team/workspace relationship. Obtain this from the [list team access action](#list-team-access-to-a-workspace) described above. | | `data.attributes.access` | string | | The type of access to grant. Valid values are `read`, `plan`, `write`, `admin`, or `custom`. | | `data.attributes.runs` | string | "read" | If `access` is `custom`, the permission to grant for the workspace's runs. Can only be used when `access` is `custom`. | | `data.attributes.variables` | string | "none" | If `access` is `custom`, the permission to grant for the workspace's variables. Can only be used when `access` is `custom`. | | `data.attributes.state-versions` | string | "none" | If `access` is `custom`, the permission to grant for the workspace's state versions. Can only be used when `access` is `custom`. | | `data.attributes.sentinel-mocks` | string | "none" | If `access` is `custom`, the permission to grant for the workspace's Sentinel mocks. Can only be used when `access` is `custom`. | | `data.attributes.workspace-locking` | boolean | false | If `access` is `custom`, the permission granting the ability to manually lock or unlock the workspace. Can only be used when `access` is `custom`. | | `data.attributes.run-tasks` | boolean | false | If `access` is `custom`, this permission allows the team to manage run tasks within the workspace. | ### 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/team-workspaces/tws-s68jV4FWCDwWvQq8 ``` ### Sample Payload ```json { "data": { "attributes": { "access": "custom", "state-versions": "none" } } } ``` ### Sample Response ```json { "data": { "id": "tws-s68jV4FWCDwWvQq8", "type": "team-workspaces", "attributes": { "access": "custom", "runs": "apply", "variables": "write", "state-versions": "none", "sentinel-mocks": "read", "workspace-locking": true, "run-tasks": true }, "relationships": { "team": { "data": { "id": "team-DBycxkdQrGFf5zEM", "type": "teams" }, "links": { "related": "/api/v2/teams/team-DBycxkdQrGFf5zEM" } }, "workspace": { "data": { "id": "ws-XGA52YVykdTgryTN", "type": "workspaces" }, "links": { "related": "/api/v2/organizations/my-organization/workspaces/my-workspace" } } }, "links": { "self": "/api/v2/team-workspaces/tws-s68jV4FWCDwWvQq8"
https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/team-access.mdx
main
terraform
[ -0.057983674108982086, -0.0007186975562945008, -0.019229520112276077, 0.08171205967664719, -0.009842931292951107, -0.017482390627264977, -0.04671464487910271, -0.033245429396629333, 0.061152368783950806, -0.02134832926094532, -0.029987499117851257, -0.013342083431780338, 0.014043197967112064...
0.036226
"runs": "apply", "variables": "write", "state-versions": "none", "sentinel-mocks": "read", "workspace-locking": true, "run-tasks": true }, "relationships": { "team": { "data": { "id": "team-DBycxkdQrGFf5zEM", "type": "teams" }, "links": { "related": "/api/v2/teams/team-DBycxkdQrGFf5zEM" } }, "workspace": { "data": { "id": "ws-XGA52YVykdTgryTN", "type": "workspaces" }, "links": { "related": "/api/v2/organizations/my-organization/workspaces/my-workspace" } } }, "links": { "self": "/api/v2/team-workspaces/tws-s68jV4FWCDwWvQq8" } } } ``` ## Remove Team Access to a Workspace `DELETE /team-workspaces/:id` | Status | Response | Reason | | ------- | ------------------------- | ------------------------------------------------------------ | | [204][] | | The Team Access was successfully destroyed | | [404][] | [JSON API error object][] | Team Access not found or user unauthorized to perform action | | Parameter | Description | | --------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `:id` | The ID of the team/workspace relationship. Obtain this from the [list team access action](#list-team-access-to-a-workspace) described above. | ### Sample Request ```shell $ curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request DELETE \ https://app.terraform.io/api/v2/team-workspaces/tws-sezDAcCYWLnd3xz2 ```
https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/team-access.mdx
main
terraform
[ -0.06057044863700867, 0.01905273273587227, -0.014788799919188023, 0.06284642219543457, -0.0004812986881006509, -0.023670116439461708, -0.05162603780627251, -0.04817371070384979, -0.00881390180438757, 0.00837658904492855, -0.003480189945548773, -0.04610472172498703, 0.02305356226861477, 0.0...
0.032314
[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 [speculative plans]: /terraform/cloud-docs/run/remote-operations#speculative-plans # Reserved tag keys API reference Use the `/reserved-tag-keys` API endpoints to define and manage tag keys that have special meaning for your organization. Reserving tag keys enable project and workspace managers to follow a consistent tagging strategy across the organization. You can also use them to provide project managers with a means of disabling overrides for inherited tags. The following table describes the available endpoints: | Method | Path | Description | | --- | --- | --- | | `GET` | `/organizations/:organization\_name/reserved-tag-keys` | [List reserved tag keys](#list-reserved-tag-keys) for the specified organization. | | `POST` | `/organizations/:organization\_name/reserved-tag-keys` | [Add a reserved tag key](#add-a-reserved-tag-key) to the specified organization. | | `PATCH` | `/reserved-tags/:reserved\_tag\_key\_id` | [Update a reserved tag key](#add-a-reserved-tag-value) with the specified ID. | | `DELETE` | `/reserved-tags/:reserved\_tag\_key\_id` | [Delete a reserved tag key](#delete-a-reserved-tag-key) with the specified ID. | ## Path parameters The `/reserved-tag-keys/` API endpoints require the following path parameters: | Parameter | Description | |---------------|----------------| | `:reserved\_tag\_key\_id` | The external ID of the reserved tag key. | | `:organization\_name` | The name of the organization containing the reserved tags. | ## List reserved tag keys `GET /organizations/:organization\_name/reserved-tag-keys` ### Sample payload This endpoint does not require a payload. ### Sample request ```shell-session $ curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request GET \ https://app.terraform.io/api/v2/organizations/my-organization/reserved-tag-keys ``` ### Sample response ```json { "data": [ { "id": "rtk-jjnTseo8NN1jACbk", "type": "reserved-tag-keys", "attributes": { "key": "environment", "disable-overrides": false, "created-at": "2024-08-13T23:06:42.523Z", "updated-at": "2024-08-13T23:06:42.523Z" } }, { "id": "rtk-F1s7kKUShAQxhA1b", "type": "reserved-tag-keys", "attributes": { "key": "cost-center", "disable-overrides": false, "created-at": "2024-08-13T23:06:51.445Z", "updated-at": "2024-08-13T23:06:51.445Z" } }, ], "links": { "self": "https://app.terraform.io/api/v2/organizations/my-organization/reserved-tag-keys?page%5Bnumber%5D=1&page%5Bsize%5D=20", "first": "https://app.terraform.io/api/v2/organizations/my-organization/reserved-tag-keys?page%5Bnumber%5D=1&page%5Bsize%5D=20", "prev": null, "next": null, "last": "https://app.terraform.io/api/v2/organizations/my-organization/reserved-tag-keys?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 reserved tag key `POST /organizations/:organization\_name/reserved-tag-keys` 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 `reserved-tag-keys`. | | `data.attributes.key` | string | none | The key targeted by this reserved tag key. | | `data.attributes.disable-overrides` | boolean | none | If `true`, disables overriding inherited tags with the specified key at the workspace level. | ### Sample payload ```json { "data": { "type": "reserved-tag-keys", "attributes": { "key": "environment", "disable-overrides": false } } } ``` ### Sample request ```shell-session $ curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request POST \ https://app.terraform.io/api/v2/organizations/${ORGANIZATION\_NAME}/reserved-tag-keys ``` ### Sample response ```json { "data": { "id": "rtk-Tj86UdGahKGDiYXY", "type": "reserved-tag-keys", "attributes": { "key": "environment", "disable-overrides": false, "created-at": "2024-09-04T05:02:06.794Z", "updated-at": "2024-09-04T05:02:06.794Z" } } } ``` ## Update a reserved tag key `PATCH /reserved-tags/:reserved\_tag\_key\_id` 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 | none | Must be `reserved-tag-keys`. | | `data.attributes.key` | string | none | The key targeted by this reserved tag key. | | `data.attributes.disable-overrides` | boolean | none | If `true`, disables overriding inherited tags with the specified key at the workspace level. | ### Sample payload ```json { "data": { "id": "rtk-Tj86UdGahKGDiYXY", "type": "reserved-tag-keys", "attributes": { "key": "env", "disable-overrides": true, "created-at":
https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/reserved-tag-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
| The key targeted by this reserved tag key. | | `data.attributes.disable-overrides` | boolean | none | If `true`, disables overriding inherited tags with the specified key at the workspace level. | ### Sample payload ```json { "data": { "id": "rtk-Tj86UdGahKGDiYXY", "type": "reserved-tag-keys", "attributes": { "key": "env", "disable-overrides": true, "created-at": "2024-09-04T05:02:06.794Z", "updated-at": "2024-09-04T05:02:06.794Z" } } } ``` ### Sample request ```shell-session $ curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request PATCH \ https://app.terraform.io/api/v2/reserved-tags/${RESERVED\_TAG\_ID} ``` ### Sample response ```json { "data": { "id": "rtk-zMtWLDftAjY3b5pA", "type": "reserved-tag-keys", "attributes": { "key": "env", "disable-overrides": true, "created-at": "2024-09-04T05:05:10.449Z", "updated-at": "2024-09-04T05:05:13.486Z" } } } ``` ## Delete a reserved tag key `DELETE /reserved-tags/:reserved\_tag\_key\_id` ### Sample payload This endpoint does not require a payload. ### Sample request ```shell-session $ curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request DELETE \ https://app.terraform.io/api/v2/reserved-tags/rtk-zMtWLDftAjY3b5pA ``` ### Sample response This endpoint does not return a response body.
https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/reserved-tag-keys.mdx
main
terraform
[ -0.0536404587328434, 0.1272617131471634, 0.005730409175157547, 0.0027579606976360083, 0.0366925373673439, -0.05790616199374199, 0.011378965340554714, -0.03501487150788307, 0.03679583594202995, 0.11918734014034271, -0.008936651982367039, -0.06952478736639023, 0.04064081236720085, -0.0131594...
0.009803
[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 # Feature sets API reference -> \*\*Note:\*\* The feature sets API is only available in HCP Terraform. Feature sets represent the different [pricing plans](/terraform/cloud-docs/overview) available to HCP Terraform organizations. An organization's [entitlement set](/terraform/cloud-docs/api-docs#feature-entitlements) is calculated using its [subscription](/terraform/cloud-docs/api-docs/subscriptions) and feature set. ## List Feature Sets This endpoint lists the feature sets available in HCP Terraform. `GET /feature-sets` ### 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 feature sets per page. | ### Sample Request ```shell curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ https://app.terraform.io/api/v2/feature-sets ``` ### Sample Response ```json { "data": [ { "id": "fs-GN3kSR1GqWNfcFaW", "type": "feature-sets", "attributes": { "assessments": false, "audit-logging": false, "concurrency-override": false, "cost-estimation": true, "cost": 0, "default-agents-ceiling": 1, "default-runs-ceiling": 1, "description": "Free 500 managed resources, then downgrade to limited features", "global-run-tasks": false, "identifier": "free\_standard", "is-current": true, "is-free-tier": true, "module-tests-generation": false, "name": "Free", "no-code-modules": false, "plan": null, "policy-enforcement": true, "policy-limit": null, "policy-mandatory-enforcement-limit": null, "policy-set-limit": null, "private-networking": true, "private-policy-agents": false, "private-run-tasks": false, "private-vcs": false, "run-task-limit": null, "run-task-mandatory-enforcement-limit": null, "run-task-workspace-limit": null, "run-tasks": true, "self-serve-billing": true, "sentinel": true, "sso": true, "teams": false, "user-limit": null, "versioned-policy-set-limit": null } }, { "id": "fs-f3xYUkkXwY8ZGP9g", "type": "feature-sets", "attributes": { "assessments": false, "audit-logging": false, "concurrency-override": true, "cost-estimation": true, "cost": 0, "default-agents-ceiling": 10, "default-runs-ceiling": 10, "description": "Automated infrastructure provisioning at any scale. First 500 free managed resources included.", "global-run-tasks": false, "identifier": "standard", "is-current": true, "is-free-tier": true, "module-tests-generation": false, "name": "Standard", "no-code-modules": false, "plan": null, "policy-enforcement": true, "policy-limit": null, "policy-mandatory-enforcement-limit": null, "policy-set-limit": null, "private-networking": true, "private-policy-agents": false, "private-run-tasks": false, "private-vcs": false, "run-task-limit": null, "run-task-mandatory-enforcement-limit": null, "run-task-workspace-limit": null, "run-tasks": true, "self-serve-billing": true, "sentinel": true, "sso": true, "teams": false, "user-limit": null, "versioned-policy-set-limit": null } }, { "id": "fs-JhVd6dwBSZ3THzHV", "type": "feature-sets", "attributes": { "assessments": true, "audit-logging": true, "concurrency-override": true, "cost-estimation": true, "cost": 0, "default-agents-ceiling": 10, "default-runs-ceiling": 10, "description": "Automated infrastructure provisioning and management at any scale", "global-run-tasks": true, "identifier": "standard", "is-current": true, "is-free-tier": true, "module-tests-generation": true, "name": "Standard", "no-code-modules": true, "plan": null, "policy-enforcement": true, "policy-limit": null, "policy-mandatory-enforcement-limit": null, "policy-set-limit": null, "private-networking": true, "private-policy-agents": false, "private-run-tasks": false, "private-vcs": false, "run-task-limit": null, "run-task-mandatory-enforcement-limit": null, "run-task-workspace-limit": null, "run-tasks": true, "self-serve-billing": true, "sentinel": true, "sso": true, "teams": true, "user-limit": null, "versioned-policy-set-limit": null } } ] } ``` ## List Feature Sets for Organization This endpoint lists the feature sets a particular organization is eligible to access. The results may differ from the previous global endpoint - for instance, if the organization has already had a free trial, the trial feature set will not appear in this list. `GET /organizations/:organization\_name/feature-sets` | Parameter | Description | | ------------------- | ---------------------------- | | `organization\_name` | The name of the 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. 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
https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/feature-sets.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
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 organization feature sets per page. | ### Sample Request ```shell curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ https://app.terraform.io/api/v2/organizations/hashicorp/feature-sets ``` ### Sample Response ```json { "data": [ { "id": "fs-GN3kSR1GqWNfcFaW", "type": "feature-sets", "attributes": { "assessments": false, "audit-logging": false, "concurrency-override": false, "cost-estimation": true, "cost": 0, "default-agents-ceiling": 1, "default-runs-ceiling": 1, "description": "Free 500 managed resources, then downgrade to limited features", "global-run-tasks": false, "identifier": "free\_standard", "is-current": true, "is-free-tier": true, "module-tests-generation": false, "name": "Free", "no-code-modules": false, "plan": null, "policy-enforcement": true, "policy-limit": 5, "policy-mandatory-enforcement-limit": 1, "policy-set-limit": 1, "private-networking": true, "private-policy-agents": false, "private-run-tasks": false, "private-vcs": false, "run-task-limit": 1, "run-task-mandatory-enforcement-limit": 1, "run-task-workspace-limit": 10, "run-tasks": true, "self-serve-billing": true, "sentinel": true, "sso": true, "teams": false, "user-limit": null, "versioned-policy-set-limit": 0 } }, { "id": "fs-f3xYUkkXwY8ZGP9g", "type": "feature-sets", "attributes": { "assessments": false, "audit-logging": false, "concurrency-override": true, "cost-estimation": true, "cost": 0, "default-agents-ceiling": 10, "default-runs-ceiling": 10, "description": "Automated infrastructure provisioning at any scale. First 500 free managed resources included.", "global-run-tasks": false, "identifier": "standard", "is-current": true, "is-free-tier": true, "module-tests-generation": false, "name": "Standard", "no-code-modules": false, "plan": null, "policy-enforcement": true, "policy-limit": null, "policy-mandatory-enforcement-limit": null, "policy-set-limit": null, "private-networking": true, "private-policy-agents": false, "private-run-tasks": false, "private-vcs": false, "run-task-limit": null, "run-task-mandatory-enforcement-limit": null, "run-task-workspace-limit": null, "run-tasks": true, "self-serve-billing": true, "sentinel": true, "sso": true, "teams": false, "user-limit": null, "versioned-policy-set-limit": null } }, { "id": "fs-JhVd6dwBSZ3THzHV", "type": "feature-sets", "attributes": { "assessments": true, "audit-logging": true, "concurrency-override": true, "cost-estimation": true, "cost": 0, "default-agents-ceiling": 10, "default-runs-ceiling": 10, "description": "Automated infrastructure provisioning and management at any scale", "global-run-tasks": true, "identifier": "standard", "is-current": true, "is-free-tier": true, "module-tests-generation": true, "name": "Standard", "no-code-modules": true, "plan": null, "policy-enforcement": true, "policy-limit": null, "policy-mandatory-enforcement-limit": null, "policy-set-limit": null, "private-networking": true, "private-policy-agents": false, "private-run-tasks": false, "private-vcs": false, "run-task-limit": null, "run-task-mandatory-enforcement-limit": null, "run-task-workspace-limit": null, "run-tasks": true, "self-serve-billing": true, "sentinel": true, "sso": true, "teams": true, "user-limit": null, "versioned-policy-set-limit": null } } ] } ```
https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/feature-sets.mdx
main
terraform
[ -0.020663950592279434, 0.0708073303103447, -0.04660896584391594, 0.003077967558056116, -0.08968754857778549, 0.024421537294983864, -0.03487015515565872, -0.032130125910043716, -0.022098571062088013, 0.014143240638077259, 0.019180020317435265, -0.08430337905883789, 0.08673025667667389, -0.0...
-0.018875
[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 tags API reference This API returns the list of tags used in workspaces across the organization. Tags can be added to this pool via workspaces. Tags deleted here will be removed from all other workspaces. Tags can be added, applied, removed and deleted in bulk. Tags are subject to the following rules: - Workspace tags or tags must be one or more characters, have a 255 character limit, and can include letters, numbers, colons, hyphens, and underscores. - You can create tags for a workspace using the user interface or the API. After you create a tag, you can assign it to other workspaces in the same organization. - You cannot create tags for a workspace using the CLI. - You cannot set tags at the project level, so there is no tag inheritance from projects to workspaces. ## List Tags `GET /organizations/:organization\_name/tags` | Parameter | Description | | -------------------- | ---------------------------------------------- | | `:organization\_name` | The name of the organization to list tags 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. Organization tags are searchable by name likeness. | | `filter[exclude][taggable][id]` | \*\*Optional.\*\* If specified, omits organization's related workspace's tags. | | `page[number]` | \*\*Optional.\*\* If omitted, the endpoint will return the first page. | | `page[size]` | \*\*Optional.\*\* If omitted, the endpoint will return 20 organization tags per page. | ### Sample Request ```shell $ curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ https://app.terraform.io/api/v2/organizations/hashicorp/tags ``` ### Sample Response ```json { "data": [ { "id": "tag-1", "type": "tags", "attributes": { "name": "tag1", "created-at": "2022-03-09T06:04:39.585Z", "instance-count": 1 }, "relationships": { "organization": { "data": { "id": "my-organization", "type": "organizations" } } } }, { "id": "tag-2", "type": "tags", "attributes": { "name": "tag2", "created-at": "2022-03-09T06:04:39.585Z", "instance-count": 2 }, "relationships": { "organization": { "data": { "id": "my-organization", "type": "organizations" } } } } ] } ``` ## Delete tags This endpoint deletes one or more tags from an organization. The organization and tags must already exist. Tags deleted here will be removed from all other resources. `DELETE /organizations/:organization\_name/tags` | Parameter | Description | | -------------------- | ------------------------------------------------ | | `:organization\_name` | The name of the organization to delete tags from | | Status | Response | Reason(s) | | ------- | ------------------------- | -------------------------------------------------------------- | | [204][] | No Content | Successfully removed tags from organization | | [404][] | [JSON API error object][] | Organization not found, or user unauthorized to perform action | ### Request Body This POST endpoint requires a JSON object with the following properties as a request payload. It is important to note that `type` and `id` are required. | Key path | Type | Default | Description | | ------------- | ------ | ------- | ---------------------------- | | `data[].type` | string | | Must be `"tags"`. | | `data[].id` | string | | The id of the tag to remove. | ### Sample Payload ```json { "data": [ { "type": "tags", "id": "tag-Yfha4YpPievQ8wJw" } ] } ``` ### 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/v2/organizations/hashicorp/tags ``` ## Sample Response No
https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/organization-tags.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
id of the tag to remove. | ### Sample Payload ```json { "data": [ { "type": "tags", "id": "tag-Yfha4YpPievQ8wJw" } ] } ``` ### 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/v2/organizations/hashicorp/tags ``` ## Sample Response No response body. Status code `204`. ## Add workspaces to a tag `POST /tags/:tag\_id/relationships/workspaces` | Parameter | Description | | --------- | ---------------------------------------------------- | | `:tag\_id` | The ID of the tag that workspaces should have added. | | Status | Response | Reason(s) | | ------- | ------------------------- | ----------------------------------------------------- | | [204][] | No Content | Successfully added workspaces to tag | | [404][] | [JSON API error object][] | Tag not found, or user unauthorized to perform action | ### Request Body This POST endpoint requires a JSON object with the following properties as a request payload. | Key path | Type | Default | Description | | ------------- | ------ | ------- | ------------------------------- | | `data[].type` | string | | Must be `"workspaces"`. | | `data[].id` | string | | The id of the workspace to add. | ### 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/tags/tag-2/relationships/workspaces ``` ### Sample Payload ```json { "data": [ { "type": "workspaces", "id": "ws-pmKTbUwH2VPiiTC4" } ] } ``` ### Sample Response No response body. Status code `204`.
https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/organization-tags.mdx
main
terraform
[ -0.03181671351194382, 0.09672395884990692, 0.005440311040729284, 0.021148696541786194, 0.017301589250564575, -0.10057058930397034, -0.028855010867118835, -0.0903264507651329, 0.07257045805454254, 0.034078218042850494, 0.007936234585940838, -0.060335297137498856, 0.011925848200917244, 0.010...
0.051321
[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 # State versions API reference ## Attributes State version API objects represent an instance of Terraform state data for a workspace, but do not directly contain the stored state. Instead, they contain information about the state, its properties, and its contents, and include one or more URLs from which the state can be downloaded. Some of the information returned in a state version API object might be \*\*populated asynchronously\*\* by HCP Terraform. This includes resources, modules, providers, and the [state version outputs](/terraform/cloud-docs/api-docs/state-version-outputs) associated with the state version. These values might not be immediately available after the state version is uploaded. The `resources-processed` property on the state version object 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. | Attribute | Description | | -------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `billable-rum-count` | Count of billable Resources Under Management (RUM). Only present for organization members on HCP Terraform RUM plans with visibility of billable RUM usage. | | `hosted-json-state-download-url` | A URL from which you can download the state data in a [stable format](/terraform/internals/json-format) appropriate for external integrations to consume. Only available if the state was created by Terraform 1.3+. | | `hosted-state-download-url` | A URL from which you can download the raw state data, in the format used internally by Terraform. | | `sanitized-state-download-url` | A URL to which you can download state data with sensitive values redacted. This URL is only available for workspaces using [hold your own key](/terraform/cloud-docs/hold-your-own-key) encryption. | | `hosted-json-state-upload-url` | A URL to which you can upload state data in a [stable format](/terraform/internals/json-format) appropriate for external integrations to consume. You can upload JSON state content once per state version. | | `hosted-state-upload-url` | A URL to which you can upload state data in the format used Terraform uses internally. You can upload state data once per state version. | | `hyok-encrypted-data-key` | A reference to the HYOK encrypted data key used to secure this state version. 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. | | `modules` | Extracted information about the Terraform modules in this state data. Populated asynchronously. | | `providers` | Extracted information about the Terraform providers used for resources in this state data. Populated asynchronously. | | `intermediate` | A boolean flag that indicates the state version is a snapshot and not yet set as the current state version for a workspace. The last intermediate state version becomes the current state version when the workspace is unlocked. Not yet supported in Terraform Enterprise. | | `resources` | Extracted information about the resources in this state data. Populated asynchronously. | | `resources-processed` | A Boolean flag indicating whether HCP Terraform has finished asynchronously extracting outputs, resources, and other information about this state data. | | `serial` | The serial number of this state instance, which increases every time Terraform creates new state in the workspace. | | `state-version` | The version of the internal state format used for this state. Different Terraform versions read and write different format versions, but it only changes infrequently. | | `status` | Indicates a state version's content upload [status](/terraform/enterprise/api-docs/state-versions#state-version-status). This status can be `pending`, `finalized` or `discarded`. | | `terraform-version`
https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/state-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
| `state-version` | The version of the internal state format used for this state. Different Terraform versions read and write different format versions, but it only changes infrequently. | | `status` | Indicates a state version's content upload [status](/terraform/enterprise/api-docs/state-versions#state-version-status). This status can be `pending`, `finalized` or `discarded`. | | `terraform-version` | The Terraform version that created this state. Populated asynchronously. | | `vcs-commit-sha` | The SHA of the configuration commit used in the Terraform run that produced this state. Only present if the workspace is connected to a VCS repository. | | `vcs-commit-url` | A link to the configuration commit used in the Terraform run that produced this state. Only present if the workspace is connected to a VCS repository. | ### State Version Status The state version status is found in `data.attributes.status`, and you can reference the following list of possible statuses. A state version created through the API or CLI will only be listed in the UI if it is has a `finalized` status. | State | Description | | --- | --- | | `pending` | Indicates that a state version has been created but the state data is not encoded within the request. Pending state versions do not contain state data and do not appear in the UI. You cannot unlock the workspace until the latest state version is finalized. | | `finalized` | Indicates that the state version has been successfully uploaded to HCP Terraform or that the state version was created with a valid `state` attribute. | | `discarded` | The state version was discarded because it was superseded by a newer state version before it could be uploaded. | | `backing\_data\_soft\_deleted` | The backing files associated with this state version are marked for garbage collection. Terraform permanently deletes backing files associated with this state version after a set number of days, but you can restore the backing data associated with it before it is permanently deleted. | | `backing\_data\_permanently\_deleted` | The backing files associated with this state version have been permanently deleted and can no longer be restored. | ## Create a State Version > \*\*Hands-on:\*\* Try the [Version Remote State with the HCP Terraform API](/terraform/tutorials/cloud/cloud-state-api) tutorial to download a remote state file and use the Terraform API to create a new state version. `POST /workspaces/:workspace\_id/state-versions` | Parameter | Description | |-----------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | `:workspace\_id` | The workspace ID to create the new state version 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. | Creates a state version and sets it as the current state version for the given workspace. The workspace must be locked by the user creating a state version. The workspace may be locked [with the API](/terraform/cloud-docs/api-docs/workspaces#lock-a-workspace) or [with the UI](/terraform/cloud-docs/workspaces/settings#locking). This is most useful for migrating existing state from Terraform Community edition into a new HCP Terraform workspace. Creating state versions requires permission to read and write state versions for the workspace. ([More about permissions.](/terraform/cloud-docs/users-teams-organizations/permissions)) [permissions-citation]: #intentionally-unused---keep-for-maintainers !> \*\*Warning:\*\* Use caution when uploading state to workspaces that have already performed Terraform runs. Replacing state improperly can result in orphaned or duplicated infrastructure resources. -> \*\*Note:\*\* For Free Tier organizations, HCP Terraform always retains at least the last 100 states (across all workspaces) and at least the most recent state for every workspace. Additional states beyond the last 100 are retained for six months, and are then deleted. -> \*\*Note:\*\* You cannot access this endpoint 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][] | Successfully created a
https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/state-versions.mdx
main
terraform
[ -0.0104310167953372, 0.010393260978162289, 0.03928743302822113, -0.010276814922690392, 0.03433943912386894, -0.012630770914256573, -0.05199931189417839, -0.10221486538648605, 0.039622727781534195, 0.072667695581913, -0.023881621658802032, -0.02102678082883358, 0.013101019896566868, -0.0316...
0.051871
last 100 are retained for six months, and are then deleted. -> \*\*Note:\*\* You cannot access this endpoint 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][] | Successfully created a state version. | | [404][] | [JSON API error object][] | Workspace not found, or user unauthorized to perform action. | | [409][] | [JSON API error object][] | Conflict; check the error object for more information. | | [412][] | [JSON API error object][] | Precondition failed; check the error object for more information. | | [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 `"state-versions"`. | | `data.attributes.serial` | integer | | The serial of the state version. Must match the serial value extracted from the raw state file. | | `data.attributes.md5` | string | | An MD5 hash of the raw state version. | | `data.attributes.state` | string | (nothing) | \*\*Optional\*\* Base64 encoded raw state file. If omitted, you must use the upload method below to complete the state version creation. The workspace may not be unlocked normally until the state version is uploaded. | | `data.attributes.lineage` | string | (nothing) | \*\*Optional\*\* Lineage of the state version. Should match the lineage extracted from the raw state file. Early versions of terraform did not have the concept of lineage, so this is an optional attribute. | | `data.attributes.json-state` | string | (nothing) | \*\*Optional\*\* Base64 encoded json state, as expressed by `terraform show -json`. See [JSON Output Format](/terraform/internals/json-format) for more details. | | `data.attributes.json-state-outputs` | string | (nothing) | \*\*Optional\*\* Base64 encoded output values as represented by `terraform show -json` (the contents of the values/outputs key). If provided, the workspace outputs populate immediately. If omitted, HCP Terraform populates the workspace outputs from the given state after a short time. | | `data.relationships.run.data.id` | string | (nothing) | \*\*Optional\*\* The ID of the run to associate with the state version. | ### Sample Payload ```json { "data": { "type":"state-versions", "attributes": { "serial": 1, "md5": "d41d8cd98f00b204e9800998ecf8427e", "lineage": "871d1b4a-e579-fb7c-ffdb-f0c858a647a7", "state": "...", "json-state": "...", "json-state-outputs": "..." }, "relationships": { "run": { "data": { "type": "runs", "id": "run-bWSq4YeYpfrW4mx7" } } } } } ``` ### 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/workspaces/ws-6fHMCom98SDXSQUv/state-versions ``` ### Sample Response ```json { "data": { "id": "sv-DmoXecHePnNznaA4", "type": "state-versions", "attributes": { "vcs-commit-sha": null, "vcs-commit-url": null, "created-at": "2018-07-12T20:32:01.490Z", "hosted-state-download-url": "https://archivist.terraform.io/v1/object/f55b739b-ff03-4716-b436-726466b96dc4", "hosted-json-state-download-url": "https://archivist.terraform.io/v1/object/4fde7951-93c0-4414-9a40-f3abc4bac490", "hosted-state-upload-url": null, "hosted-json-state-upload-url": null, "status": "finalized", "intermediate": true, "serial": 1 }, "links": { "self": "/api/v2/state-versions/sv-DmoXecHePnNznaA4" } } } ``` ## Upload State and JSON State You can upload state version content in the same request when creating a state version. However, we \_strongly\_ recommend that you upload content separately. `PUT https://archivist.terraform.io/v1/object/` HCP Terraform returns a `hosted-state-upload-url` or `hosted-json-state-upload-url` returned when you create a `state-version`. Once you upload state content, this URL is hidden on the resource and \_no longer available\_. ### Sample Request In the below example, `@filename` is the name of Terraform state 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 State Versions for a Workspace `GET /state-versions` Listing state versions requires permission to read
https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/state-versions.mdx
main
terraform
[ -0.034164074808359146, 0.04758021980524063, 0.035324230790138245, 0.012013575993478298, 0.031794674694538116, -0.03580533713102341, -0.0528382882475853, -0.054724421352148056, 0.1107371523976326, 0.09561988711357117, -0.0022384924814105034, -0.026919052004814148, 0.010405147448182106, -0.0...
0.056201
### Sample Request In the below example, `@filename` is the name of Terraform state 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 State Versions for a Workspace `GET /state-versions` Listing state versions requires permission to read state versions for the workspace. ([More about permissions.](/terraform/cloud-docs/users-teams-organizations/permissions)) [permissions-citation]: #intentionally-unused---keep-for-maintainers ### 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[workspace][name]` | \*\*Required\*\* The name of one workspace to list versions for. | | `filter[organization][name]` | \*\*Required\*\* The name of the organization that owns the desired workspace. | | `filter[status]` | \*\*Optional.\*\* Filter state versions by status: `pending`, `finalized`, or `discarded`. | | `page[number]` | \*\*Optional.\*\* If omitted, the endpoint will return the first page. | | `page[size]` | \*\*Optional.\*\* If omitted, the endpoint will return 20 state versions 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?filter%5Bworkspace%5D%5Bname%5D=my-workspace&filter%5Borganization%5D%5Bname%5D=my-organization" ``` ### Sample Response ```json { "data": [ { "id": "sv-g4rqST72reoHMM5a", "type": "state-versions", "attributes": { "created-at": "2021-06-08T01:22:03.794Z", "size": 940, "hosted-state-download-url": "https://archivist.terraform.io/v1/object/...", "hosted-state-upload-url": null, "hosted-json-state-download-url": "https://archivist.terraform.io/v1/object/...", "hosted-json-state-upload-url": null, "status": "finalized", "intermediate": false, "modules": { "root": { "null-resource": 1, "data.terraform-remote-state": 1 } }, "providers": { "provider[\"terraform.io/builtin/terraform\"]": { "data.terraform-remote-state": 1 }, "provider[\"registry.terraform.io/hashicorp/null\"]": { "null-resource": 1 } }, "resources": [ { "name": "other\_username", "type": "data.terraform\_remote\_state", "count": 1, "module": "root", "provider": "provider[\"terraform.io/builtin/terraform\"]" }, { "name": "random", "type": "null\_resource", "count": 1, "module": "root", "provider": "provider[\"registry.terraform.io/hashicorp/null\"]" } ], "resources-processed": true, "serial": 9, "state-version": 4, "terraform-version": "0.15.4", "vcs-commit-url": "https://gitlab.com/my-organization/terraform-test/-/commit/abcdef12345", "vcs-commit-sha": "abcdef12345" }, "relationships": { "run": { "data": { "id": "run-YfmFLWpgTv31VZsP", "type": "runs" } }, "created-by": { "data": { "id": "user-onZs69ThPZjBK2wo", "type": "users" }, "links": { "self": "/api/v2/users/user-onZs69ThPZjBK2wo", "related": "/api/v2/runs/run-YfmFLWpgTv31VZsP/created-by" } }, "workspace": { "data": { "id": "ws-noZcaGXsac6aZSJR", "type": "workspaces" } }, "outputs": { "data": [ { "id": "wsout-V22qbeM92xb5mw9n", "type": "state-version-outputs" }, { "id": "wsout-ymkuRnrNFeU5wGpV", "type": "state-version-outputs" }, { "id": "wsout-v82BjkZnFEcscipg", "type": "state-version-outputs" } ] } }, "links": { "self": "/api/v2/state-versions/sv-g4rqST72reoHMM5a" } }, { "id": "sv-QYKf6GvNv75ZPTBr", "type": "state-versions", "attributes": { "created-at": "2021-06-01T21:40:25.941Z", "size": 819, "hosted-state-download-url": "https://archivist.terraform.io/v1/object/...", "hosted-state-upload-url": null, "hosted-json-state-download-url": "https://archivist.terraform.io/v1/object/...", "hosted-json-state-upload-url": null, "status": "finalized", "intermediate": false, "modules": { "root": { "data.terraform-remote-state": 1 } }, "providers": { "provider[\"terraform.io/builtin/terraform\"]": { "data.terraform-remote-state": 1 } }, "resources": [ { "name": "other\_username", "type": "data.terraform\_remote\_state", "count": 1, "module": "root", "provider": "provider[\"terraform.io/builtin/terraform\"]" } ], "resources-processed": true, "serial": 8, "state-version": 4, "terraform-version": "0.15.4", "vcs-commit-url": "https://gitlab.com/my-organization/terraform-test/-/commit/12345abcdef", "vcs-commit-sha": "12345abcdef" }, "relationships": { "run": { "data": { "id": "run-cVtxks6R8wsjCZMD", "type": "runs" } }, "created-by": { "data": { "id": "user-onZs69ThPZjBK2wo", "type": "users" }, "links": { "self": "/api/v2/users/user-onZs69ThPZjBK2wo", "related": "/api/v2/runs/run-YfmFLWpgTv31VZsP/created-by" } }, "workspace": { "data": { "id": "ws-noZcaGXsac6aZSJR", "type": "workspaces" } }, "outputs": { "data": [ { "id": "wsout-MmqMhmht6jFmLRvh", "type": "state-version-outputs" }, { "id": "wsout-Kuo9TCHg3oDLDQqa", "type": "state-version-outputs" } ] } }, "links": { "self": "/api/v2/state-versions/sv-QYKf6GvNv75ZPTBr" } } ], "links": { "self": "https://app.terraform.io/api/v2/state-versions?filter%5Borganization%5D%5Bname%5D=hashicorp&filter%5Bworkspace%5D%5Bname%5D=my-workspace&page%5Bnumber%5D=1&page%5Bsize%5D=20", "first": "https://app.terraform.io/api/v2/state-versions?filter%5Borganization%5D%5Bname%5D=hashicorp&filter%5Bworkspace%5D%5Bname%5D=my-workspace&page%5Bnumber%5D=1&page%5Bsize%5D=20", "prev": null, "next": null, "last": "https://app.terraform.io.io/api/v2/state-versions?filter%5Borganization%5D%5Bname%5D=hashicorp&filter%5Bworkspace%5D%5Bname%5D=my-workspace&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": 10 } } } ``` ## Fetch the Current State Version for a Workspace `GET /workspaces/:workspace\_id/current-state-version` | Parameter | Description | |-----------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | `:workspace\_id` | The ID for the workspace whose current state version you want to fetch. Obtain this from the [workspace settings](/terraform/cloud-docs/workspaces/settings) or the [Show Workspace](/terraform/cloud-docs/api-docs/workspaces#show-workspace) endpoint. | Fetches the current state version for the given workspace. This state version will be the input state when running terraform operations. Viewing state versions requires permission to read state versions for the workspace. ([More about permissions.](/terraform/cloud-docs/users-teams-organizations/permissions)) [permissions-citation]: #intentionally-unused---keep-for-maintainers | Status | Response
https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/state-versions.mdx
main
terraform
[ -0.0289582721889019, 0.03326373174786568, 0.006408011075109243, -0.045399218797683716, -0.04224444553256035, 0.010056122206151485, -0.10197591781616211, -0.07032822072505951, 0.005527684930711985, 0.1298910677433014, -0.05190907046198845, -0.025956828147172928, 0.04490005970001221, 0.01040...
0.02824
[workspace settings](/terraform/cloud-docs/workspaces/settings) or the [Show Workspace](/terraform/cloud-docs/api-docs/workspaces#show-workspace) endpoint. | Fetches the current state version for the given workspace. This state version will be the input state when running terraform operations. Viewing state versions requires permission to read state versions for the workspace. ([More about permissions.](/terraform/cloud-docs/users-teams-organizations/permissions)) [permissions-citation]: #intentionally-unused---keep-for-maintainers | Status | Response | Reason | |---------|---------------------------|---------------------------------------------------------------------------------------------------------------| | [200][] | [JSON API document][] | Successfully returned current state version for the given workspace. | | [404][] | [JSON API error object][] | Workspace not found, workspace does not have a current state version, 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/workspaces/ws-6fHMCom98SDXSQUv/current-state-version ``` ### Sample Response ```json { "data": { "id": "sv-g4rqST72reoHMM5a", "type": "state-versions", "attributes": { "billable-rum-count": 0, "created-at": "2021-06-08T01:22:03.794Z", "size": 940, "hosted-state-download-url": "https://archivist.terraform.io/v1/object/...", "hosted-state-upload-url": null, "hosted-json-state-download-url": "https://archivist.terraform.io/v1/object/...", "hosted-json-state-upload-url": null, "status": "finalized", "intermediate": false, "modules": { "root": { "null-resource": 1, "data.terraform-remote-state": 1 } }, "providers": { "provider[\"terraform.io/builtin/terraform\"]": { "data.terraform-remote-state": 1 }, "provider[\"registry.terraform.io/hashicorp/null\"]": { "null-resource": 1 } }, "resources": [ { "name": "other\_username", "type": "data.terraform\_remote\_state", "count": 1, "module": "root", "provider": "provider[\"terraform.io/builtin/terraform\"]" }, { "name": "random", "type": "null\_resource", "count": 1, "module": "root", "provider": "provider[\"registry.terraform.io/hashicorp/null\"]" } ], "resources-processed": true, "serial": 9, "state-version": 4, "terraform-version": "0.15.4", "vcs-commit-url": "https://gitlab.com/my-organization/terraform-test/-/commit/abcdef12345", "vcs-commit-sha": "abcdef12345" }, "relationships": { "run": { "data": { "id": "run-YfmFLWpgTv31VZsP", "type": "runs" } }, "created-by": { "data": { "id": "user-onZs69ThPZjBK2wo", "type": "users" }, "links": { "self": "/api/v2/users/user-onZs69ThPZjBK2wo", "related": "/api/v2/runs/run-YfmFLWpgTv31VZsP/created-by" } }, "workspace": { "data": { "id": "ws-noZcaGXsac6aZSJR", "type": "workspaces" } }, "outputs": { "data": [ { "id": "wsout-V22qbeM92xb5mw9n", "type": "state-version-outputs" }, { "id": "wsout-ymkuRnrNFeU5wGpV", "type": "state-version-outputs" }, { "id": "wsout-v82BjkZnFEcscipg", "type": "state-version-outputs" } ] } }, "links": { "self": "/api/v2/state-versions/sv-g4rqST72reoHMM5a" } } } ``` ## Show a State Version `GET /state-versions/:state\_version\_id` Viewing state versions requires permission to read state versions for the workspace. ([More about permissions.](/terraform/cloud-docs/users-teams-organizations/permissions)) [permissions-citation]: #intentionally-unused---keep-for-maintainers | Parameter | Description | |---------------------|--------------------------------------| | `:state\_version\_id` | The ID of the desired state version. | | Status | Response | Reason | |---------|---------------------------|---------------------------------------------------------------------------------------------------------------| | [200][] | [JSON API document][] | Successfully returned current state version for the given workspace. | | [404][] | [JSON API error object][] | Workspace not found, workspace does not have a current state version, 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/state-versions/sv-SDboVZC8TCxXEneJ ``` ### Sample Response ```json { "data": { "id": "sv-g4rqST72reoHMM5a", "type": "state-versions", "attributes": { "created-at": "2021-06-08T01:22:03.794Z", "size": 940, "hosted-state-download-url": "https://archivist.terraform.io/v1/object/...", "hosted-state-upload-url": null, "hosted-json-state-download-url": "https://archivist.terraform.io/v1/object/...", "hosted-json-state-upload-url": null, "status": "finalized", "intermediate": false, "modules": { "root": { "null-resource": 1, "data.terraform-remote-state": 1 } }, "providers": { "provider[\"terraform.io/builtin/terraform\"]": { "data.terraform-remote-state": 1 }, "provider[\"registry.terraform.io/hashicorp/null\"]": { "null-resource": 1 } }, "resources": [ { "name": "other\_username", "type": "data.terraform\_remote\_state", "count": 1, "module": "root", "provider": "provider[\"terraform.io/builtin/terraform\"]" }, { "name": "random", "type": "null\_resource", "count": 1, "module": "root", "provider": "provider[\"registry.terraform.io/hashicorp/null\"]" } ], "resources-processed": true, "serial": 9, "state-version": 4, "terraform-version": "0.15.4", "vcs-commit-url": "https://gitlab.com/my-organization/terraform-test/-/commit/abcdef12345", "vcs-commit-sha": "abcdef12345" }, "relationships": { "run": { "data": { "id": "run-YfmFLWpgTv31VZsP", "type": "runs" } }, "created-by": { "data": { "id": "user-onZs69ThPZjBK2wo", "type": "users" }, "links": { "self": "/api/v2/users/user-onZs69ThPZjBK2wo", "related": "/api/v2/runs/run-YfmFLWpgTv31VZsP/created-by" } }, "workspace": { "data": { "id": "ws-noZcaGXsac6aZSJR", "type": "workspaces" } }, "outputs": { "data": [ { "id": "wsout-V22qbeM92xb5mw9n", "type": "state-version-outputs" }, { "id": "wsout-ymkuRnrNFeU5wGpV", "type": "state-version-outputs" }, { "id": "wsout-v82BjkZnFEcscipg", "type": "state-version-outputs" } ] } }, "links": { "self": "/api/v2/state-versions/sv-g4rqST72reoHMM5a" } } } ``` ## Rollback to a Previous State Version `PATCH /workspaces/:workspace\_id/state-versions` | Parameter | Description | |-----------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | `:workspace\_id` | The workspace ID to create the new state version 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. | Creates a state version by duplicating the
https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/state-versions.mdx
main
terraform
[ -0.01773301139473915, 0.04047410935163498, 0.03733431175351143, 0.006876502186059952, 0.00542563246563077, -0.022580593824386597, -0.06907131522893906, -0.09946572780609131, 0.031611327081918716, 0.07337964326143265, -0.03466486930847168, -0.033668868243694305, 0.0012794543290510774, -0.00...
0.000293
} } ``` ## Rollback to a Previous State Version `PATCH /workspaces/:workspace\_id/state-versions` | Parameter | Description | |-----------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | `:workspace\_id` | The workspace ID to create the new state version 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. | Creates a state version by duplicating the specified state version and sets it as the current state version for the given workspace. The workspace must be locked by the user creating a state version. The workspace may be locked [with the API](/terraform/cloud-docs/api-docs/workspaces#lock-a-workspace) or [with the UI](/terraform/cloud-docs/workspaces/settings#locking). This is most useful for rolling back to a known-good state after an operation such as a Terraform upgrade didn't go as planned. Creating state versions requires permission to read and write state versions for the workspace. ([More about permissions.](/terraform/cloud-docs/users-teams-organizations/permissions)) [permissions-citation]: #intentionally-unused---keep-for-maintainers !> \*\*Warning:\*\* Use caution when rolling back to a previous state. Replacing state improperly can result in orphaned or duplicated infrastructure resources. -> \*\*Note:\*\* You cannot access this endpoint 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][] | Successfully rolled back. | | [404][] | [JSON API error object][] | Workspace not found, or user unauthorized to perform action. | | [409][] | [JSON API error object][] | Conflict; check the error object for more information. | | [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. Properties without a default value are required. | Key path | Type | Default | Description | |-----------------------------------------------------|--------|---------|----------------------------------------------------------------| | `data.type` | string | | Must be `"state-versions"`. | | `data.relationships.rollback-state-version.data.id` | string | | The ID of the state version to use for the rollback operation. | ### Sample Payload ```json { "data": { "type":"state-versions", "relationships": { "rollback-state-version": { "data": { "type": "state-versions", "id": "sv-bWfq4Y1YpRKW4mx7" } } } } } ``` ### 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/workspaces/ws-6fHMCom98SDXSQUv/state-versions ``` ### Sample Response ```json { "data": { "id": "sv-DmoXecHePnNznaA4", "type": "state-versions", "attributes": { "created-at": "2022-11-22T01:22:03.794Z", "size": 940, "hosted-state-download-url": "https://archivist.terraform.io/v1/object/...", "hosted-state-upload-url": null, "hosted-json-state-download-url": "https://archivist.terraform.io/v1/object/...", "hosted-json-state-upload-url": null, "modules": { "root": { "null-resource": 1, "data.terraform-remote-state": 1 } }, "providers": { "provider[\"terraform.io/builtin/terraform\"]": { "data.terraform-remote-state": 1 }, "provider[\"registry.terraform.io/hashicorp/null\"]": { "null-resource": 1 } }, "resources": [ { "name": "other\_username", "type": "data.terraform\_remote\_state", "count": 1, "module": "root", "provider": "provider[\"terraform.io/builtin/terraform\"]" }, { "name": "random", "type": "null\_resource", "count": 1, "module": "root", "provider": "provider[\"registry.terraform.io/hashicorp/null\"]" } ], "resources-processed": true, "serial": 9, "state-version": 4, "terraform-version": "1.3.5" }, "relationships": { "rollback-state-version": { "data": { "id": "sv-YfmFLgTv31VZsP", "type": "state-versions" } } }, "links": { "self": "/api/v2/state-versions/sv-DmoXecHePnNznaA4" } } } ``` ## Mark a State Version for Garbage Collection This endpoint is exclusive to Terraform Enterprise, and not available in HCP Terraform. [Learn more about Terraform Enterprise](https://developer.hashicorp.com/terraform/enterprise). `POST /api/v2/state-versions/:state\_version\_id/actions/soft\_delete\_backing\_data` This endpoint directs Terraform Enterprise to \_soft delete\_ the backing files associated with this state version. Soft deletion marks the state version for garbage collection. Terraform permanently deletes state versions after a set number of days unless the state version is restored. Once a state version is soft deleted, any attempts to read the state version will fail. Refer to [State Version Status](#state-version-status) for information about all data states. This endpoint can only soft delete state versions that are in an [`finalized` state](#state-version-status) and are not the current state version. Otherwise, calling this endpoint results in an error. You must have organization owner permissions to soft delete state versions. Refer
https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/state-versions.mdx
main
terraform
[ -0.07248768210411072, 0.03160032257437706, 0.025056971237063408, 0.016310853883624077, -0.06108654662966728, 0.036876991391181946, 0.007747410796582699, -0.04792327433824539, -0.05106062814593315, -0.019044024869799614, 0.03663184866309166, 0.030816959217190742, -0.022711878642439842, -0.0...
0.059559
[State Version Status](#state-version-status) for information about all data states. This endpoint can only soft delete state versions that are in an [`finalized` state](#state-version-status) and are not the current state version. Otherwise, calling this endpoint results in an error. You must have organization owner permissions to soft delete state versions. Refer to [Permissions](/terraform/enterprise/users-teams-organizations/permissions) for additional information about permissions. [permissions-citation]: #intentionally-unused---keep-for-maintainers | Parameter | Description | |---------------------|--------------------------------------| | `:state\_version\_id` | The ID of the state version to mark for garbage collection. | | Status | Response | Reason | |---------|---------------------------|---------------------------------------------------------------------------------------------------------------| | [200][] | [JSON API document][] | Terraform successfully marked the data for garbage collection. | | [400][] | [JSON API error object][] | Terraform failed to transition the state to `backing\_data\_soft\_deleted`. | | [404][] | [JSON API error object][] | Terraform did not find the state version or the user is not authorized to modify the state version. | ### Sample Request ```shell curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request POST \ https://app.terraform.io/api/v2/state-versions/sv-ntv3HbhJqvFzamy7/actions/soft\_delete\_backing\_data --data {"data": {"attributes": {"delete-older-than-n-days": 23}}} ``` ### Sample Response ```json { "data": { "id": "sv-g4rqST72reoHMM5a", "type": "state-versions", "attributes": { "created-at": "2021-06-08T01:22:03.794Z", "size": 940, "hosted-state-download-url": "https://archivist.terraform.io/v1/object/...", "hosted-state-upload-url": null, "hosted-json-state-download-url": "https://archivist.terraform.io/v1/object/...", "hosted-json-state-upload-url": null, "status": "backing\_data\_soft\_deleted", "intermediate": false, "delete-older-than-n-days": 23, "modules": { "root": { "null-resource": 1, "data.terraform-remote-state": 1 } }, "providers": { "provider[\"terraform.io/builtin/terraform\"]": { "data.terraform-remote-state": 1 }, "provider[\"registry.terraform.io/hashicorp/null\"]": { "null-resource": 1 } }, "resources": [ { "name": "other\_username", "type": "data.terraform\_remote\_state", "count": 1, "module": "root", "provider": "provider[\"terraform.io/builtin/terraform\"]" }, { "name": "random", "type": "null\_resource", "count": 1, "module": "root", "provider": "provider[\"registry.terraform.io/hashicorp/null\"]" } ], "resources-processed": true, "serial": 9, "state-version": 4, "terraform-version": "0.15.4", "vcs-commit-url": "https://gitlab.com/my-organization/terraform-test/-/commit/abcdef12345", "vcs-commit-sha": "abcdef12345" }, "relationships": { "run": { "data": { "id": "run-YfmFLWpgTv31VZsP", "type": "runs" } }, "created-by": { "data": { "id": "user-onZs69ThPZjBK2wo", "type": "users" }, "links": { "self": "/api/v2/users/user-onZs69ThPZjBK2wo", "related": "/api/v2/runs/run-YfmFLWpgTv31VZsP/created-by" } }, "workspace": { "data": { "id": "ws-noZcaGXsac6aZSJR", "type": "workspaces" } }, "outputs": { "data": [ { "id": "wsout-V22qbeM92xb5mw9n", "type": "state-version-outputs" }, { "id": "wsout-ymkuRnrNFeU5wGpV", "type": "state-version-outputs" }, { "id": "wsout-v82BjkZnFEcscipg", "type": "state-version-outputs" } ] } }, "links": { "self": "/api/v2/state-versions/sv-g4rqST72reoHMM5a" } } } ``` ## Restore a State Version Marked for Garbage Collection This endpoint is exclusive to Terraform Enterprise, and not available in HCP Terraform. [Learn more about Terraform Enterprise](https://developer.hashicorp.com/terraform/enterprise). `POST /api/v2/state-versions/:state\_version\_id/actions/restore\_backing\_data` This endpoint directs Terraform Enterprise to restore backing files associated with this state version. This endpoint can only restore state versions that are not in a [`backing\_data\_permanently\_deleted` state](#state-version-status). Terraform restores applicable state versions back to their `finalized` state. Otherwise, calling this endpoint results in an error. You must have organization owner permissions to restore state versions. Refer to [Permissions](/terraform/enterprise/users-teams-organizations/permissions) for additional information about permissions. [permissions-citation]: #intentionally-unused---keep-for-maintainers | Parameter | Description | |---------------------|--------------------------------------| | `:state\_version\_id` | The ID of the state version to restore. | | Status | Response | Reason | |---------|---------------------------|---------------------------------------------------------------------------------------------------------------| | [200][] | [JSON API document][] | Terraform successfully initiated the restore process. | | [400][] | [JSON API error object][] | Terraform failed to transition the state to `finalized`. | | [404][] | [JSON API error object][] | Terraform did not find the state version or the user is not authorized to modify the state version. | ### Sample Request ```shell curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request POST \ https://app.terraform.io/api/v2/state-versions/sv-ntv3HbhJqvFzamy7/actions/restore\_backing\_data ``` ### Sample Response ```json { "data": { "id": "sv-g4rqST72reoHMM5a", "type": "state-versions", "attributes": { "created-at": "2021-06-08T01:22:03.794Z", "size": 940, "hosted-state-download-url": "https://archivist.terraform.io/v1/object/...", "hosted-state-upload-url": null, "hosted-json-state-download-url": "https://archivist.terraform.io/v1/object/...", "hosted-json-state-upload-url": null, "status": "uploaded", "intermediate": false, "modules": { "root": { "null-resource": 1, "data.terraform-remote-state": 1 } }, "providers": { "provider[\"terraform.io/builtin/terraform\"]": { "data.terraform-remote-state": 1 }, "provider[\"registry.terraform.io/hashicorp/null\"]": { "null-resource": 1 } }, "resources": [ { "name": "other\_username", "type": "data.terraform\_remote\_state", "count": 1, "module":
https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/state-versions.mdx
main
terraform
[ -0.009799609892070293, 0.08451278507709503, 0.022076798602938652, -0.0018619780894368887, 0.018200349062681198, -0.05641178786754608, -0.020902015268802643, -0.12355480343103409, 0.03425632789731026, 0.08375702798366547, -0.011518290266394615, -0.057122278958559036, -0.006559779401868582, ...
0.04045
{ "created-at": "2021-06-08T01:22:03.794Z", "size": 940, "hosted-state-download-url": "https://archivist.terraform.io/v1/object/...", "hosted-state-upload-url": null, "hosted-json-state-download-url": "https://archivist.terraform.io/v1/object/...", "hosted-json-state-upload-url": null, "status": "uploaded", "intermediate": false, "modules": { "root": { "null-resource": 1, "data.terraform-remote-state": 1 } }, "providers": { "provider[\"terraform.io/builtin/terraform\"]": { "data.terraform-remote-state": 1 }, "provider[\"registry.terraform.io/hashicorp/null\"]": { "null-resource": 1 } }, "resources": [ { "name": "other\_username", "type": "data.terraform\_remote\_state", "count": 1, "module": "root", "provider": "provider[\"terraform.io/builtin/terraform\"]" }, { "name": "random", "type": "null\_resource", "count": 1, "module": "root", "provider": "provider[\"registry.terraform.io/hashicorp/null\"]" } ], "resources-processed": true, "serial": 9, "state-version": 4, "terraform-version": "0.15.4", "vcs-commit-url": "https://gitlab.com/my-organization/terraform-test/-/commit/abcdef12345", "vcs-commit-sha": "abcdef12345" }, "relationships": { "run": { "data": { "id": "run-YfmFLWpgTv31VZsP", "type": "runs" } }, "created-by": { "data": { "id": "user-onZs69ThPZjBK2wo", "type": "users" }, "links": { "self": "/api/v2/users/user-onZs69ThPZjBK2wo", "related": "/api/v2/runs/run-YfmFLWpgTv31VZsP/created-by" } }, "workspace": { "data": { "id": "ws-noZcaGXsac6aZSJR", "type": "workspaces" } }, "outputs": { "data": [ { "id": "wsout-V22qbeM92xb5mw9n", "type": "state-version-outputs" }, { "id": "wsout-ymkuRnrNFeU5wGpV", "type": "state-version-outputs" }, { "id": "wsout-v82BjkZnFEcscipg", "type": "state-version-outputs" } ] } }, "links": { "self": "/api/v2/state-versions/sv-g4rqST72reoHMM5a" } } } ``` ## Permanently Delete a State Version This endpoint is exclusive to Terraform Enterprise, and not available in HCP Terraform. [Learn more about Terraform Enterprise](https://developer.hashicorp.com/terraform/enterprise). `POST /api/v2/state-versions/:state\_version\_id/actions/permanently\_delete\_backing\_data` This endpoint directs Terraform Enterprise to permanently delete backing files associated with this state version. This endpoint can only permanently delete state versions that are in an [`backing\_data\_soft\_deleted` state](#state-version-status) and are not the current state version. Otherwise, calling this endpoint results in an error. You must have organization owner permissions to permanently delete state versions. Refer to [Permissions](/terraform/enterprise/users-teams-organizations/permissions) for additional information about permissions. [permissions-citation]: #intentionally-unused---keep-for-maintainers | Parameter | Description | |---------------------|--------------------------------------| | `:state\_version\_id` | The ID of the state version to permanently delete. | | Status | Response | Reason | |---------|---------------------------|---------------------------------------------------------------------------------------------------------------| | [200][] | [JSON API document][] | Terraform deleted the data permanently. | | [400][] | [JSON API error object][] | Terraform failed to transition the state to `backing\_data\_permanently\_deleted`. | | [404][] | [JSON API error object][] | Terraform did not find the state version or the user is not authorized to modify the state version data. | ### Sample Request ```shell curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request POST \ https://app.terraform.io/api/v2/state-versions/sv-ntv3HbhJqvFzamy7/actions/permanently\_delete\_backing\_data ``` ### Sample Response ```json { "data": { "id": "sv-g4rqST72reoHMM5a", "type": "state-versions", "attributes": { "created-at": "2021-06-08T01:22:03.794Z", "size": 940, "hosted-state-download-url": "https://archivist.terraform.io/v1/object/...", "hosted-state-upload-url": null, "hosted-json-state-download-url": "https://archivist.terraform.io/v1/object/...", "hosted-json-state-upload-url": null, "status": "backing\_data\_permanently\_deleted", "intermediate": false, "modules": { "root": { "null-resource": 1, "data.terraform-remote-state": 1 } }, "providers": { "provider[\"terraform.io/builtin/terraform\"]": { "data.terraform-remote-state": 1 }, "provider[\"registry.terraform.io/hashicorp/null\"]": { "null-resource": 1 } }, "resources": [ { "name": "other\_username", "type": "data.terraform\_remote\_state", "count": 1, "module": "root", "provider": "provider[\"terraform.io/builtin/terraform\"]" }, { "name": "random", "type": "null\_resource", "count": 1, "module": "root", "provider": "provider[\"registry.terraform.io/hashicorp/null\"]" } ], "resources-processed": true, "serial": 9, "state-version": 4, "terraform-version": "0.15.4", "vcs-commit-url": "https://gitlab.com/my-organization/terraform-test/-/commit/abcdef12345", "vcs-commit-sha": "abcdef12345" }, "relationships": { "run": { "data": { "id": "run-YfmFLWpgTv31VZsP", "type": "runs" } }, "created-by": { "data": { "id": "user-onZs69ThPZjBK2wo", "type": "users" }, "links": { "self": "/api/v2/users/user-onZs69ThPZjBK2wo", "related": "/api/v2/runs/run-YfmFLWpgTv31VZsP/created-by" } }, "workspace": { "data": { "id": "ws-noZcaGXsac6aZSJR", "type": "workspaces" } }, "outputs": { "data": [ { "id": "wsout-V22qbeM92xb5mw9n", "type": "state-version-outputs" }, { "id": "wsout-ymkuRnrNFeU5wGpV", "type": "state-version-outputs" }, { "id": "wsout-v82BjkZnFEcscipg", "type": "state-version-outputs" } ] } }, "links": { "self": "/api/v2/state-versions/sv-g4rqST72reoHMM5a" } } } ``` ## List State Version Outputs The output values from a state version are also available via the API. For details, see the [state version outputs documentation.](/terraform/cloud-docs/api-docs/state-version-outputs#list-state-version-outputs) ### 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: \* `created\_by` - The user that created the state version. For state versions created via a run executed by HCP Terraform, this is an internal user account. \* `run` - The run that created the state
https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/state-versions.mdx
main
terraform
[ -0.03489664942026138, 0.05274496600031853, 0.01169181615114212, 0.010994021780788898, 0.017303980886936188, -0.05427134409546852, -0.07128389924764633, -0.051782041788101196, 0.001559903146699071, 0.1352338045835495, -0.001042487332597375, -0.05499855428934097, 0.020840806886553764, 0.0402...
0.040559
resources, if requested with [the `include` query parameter](/terraform/cloud-docs/api-docs#inclusion-of-related-resources). The following resource types are available: \* `created\_by` - The user that created the state version. For state versions created via a run executed by HCP Terraform, this is an internal user account. \* `run` - The run that created the state version, if applicable. \* `run.created\_by` - The user that manually triggered the run, if applicable. \* `run.configuration\_version` - The configuration version used in the run. \* `outputs` - The parsed outputs for this state version.
https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/api-docs/state-versions.mdx
main
terraform
[ -0.024675210937857628, 0.0537431575357914, 0.05322576314210892, 0.02088802680373192, 0.015108452178537846, -0.007447168696671724, 0.017008626833558083, -0.09317097067832947, 0.004155981354415417, 0.022801775485277176, -0.03320755064487457, -0.058646589517593384, 0.07840230315923691, -0.042...
0.028656