diff --git a/content/terraform-docs-common/docs/cloud-docs/api-docs/workspaces.mdx b/content/terraform-docs-common/docs/cloud-docs/api-docs/workspaces.mdx index 8a0d339ec9..0ceedfe608 100644 --- a/content/terraform-docs-common/docs/cloud-docs/api-docs/workspaces.mdx +++ b/content/terraform-docs-common/docs/cloud-docs/api-docs/workspaces.mdx @@ -124,8 +124,9 @@ By supplying the necessary attributes under a `vcs-repository` object, you can c | `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` | Whether the workspace should allow all workspaces in the organization to [access its state data](/terraform/cloud-docs/workspaces/state) during runs. If `false`, then only specifically approved workspaces can access its state. Manage allowed workspaces using the [Remote State Consumers](/terraform/cloud-docs/api-docs/workspaces#get-remote-state-consumers) endpoints, documented later on this page. Terraform Enterprise admins can choose the default value for new workspaces if this attribute is omitted. | +| `data.attributes.global-remote-state` | boolean | `false` | Whether the workspace should allow all workspaces in the organization to [access its state data](/terraform/enterprise/workspaces/state) during runs. If `false`, then only specifically approved workspaces can access its state.It cannot be set to true if `project-remote-state` is also true. If false, access is determined by `project-remote-state` or specified workspaces. Manage allowed workspaces using the [Remote State Consumers](/terraform/enterprise/api-docs/workspaces#get-remote-state-consumers) endpoints, documented later on this page. | | `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). Whether the workspace should allow all workspaces in the project to [access its state data](/terraform/enterprise/workspaces/state) during runs. It cannot be set to true if `global-remote-state` is also true. Manage allowed workspaces using the [Remote State Consumers](/terraform/enterprise/api-docs/workspaces#get-remote-state-consumers) endpoints, documented later on this page. | | `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. | @@ -546,8 +547,9 @@ Properties without a default value are required. | `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) | Whether the workspace should allow all workspaces in the organization to [access its state data](/terraform/cloud-docs/workspaces/state) during runs. If `false`, then only specifically approved workspaces can access its state. Manage allowed workspaces using the [Remote State Consumers](/terraform/cloud-docs/api-docs/workspaces#get-remote-state-consumers) endpoints, documented later on this page. | +| `data.attributes.global-remote-state` | boolean | (previous value) | Whether the workspace should allow all workspaces in the organization to [access its state data](/terraform/enterprise/workspaces/state) during runs. If `false`, then only specifically approved workspaces can access its state.It cannot be set to true if `project-remote-state` is also true. If false, access is determined by `project-remote-state` or specified workspaces. Manage allowed workspaces using the [Remote State Consumers](/terraform/enterprise/api-docs/workspaces#get-remote-state-consumers) endpoints, documented later on this page. | | `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). Whether the workspace should allow all workspaces in the project to [access its state data](/terraform/enterprise/workspaces/state) during runs. It cannot be set to true if `global-remote-state` is also true. Manage allowed workspaces using the [Remote State Consumers](/terraform/enterprise/api-docs/workspaces#get-remote-state-consumers) endpoints, documented later on this page. | | `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. | @@ -1001,10 +1003,26 @@ $ curl \ | --------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `: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. The list returned is determined by the workspace's state-sharing configuration, which follows a hierarchy: + +- Explicitly Authorized Only: + - If `global-remote-state` is set to false AND `project-remote-state` is set to false, the endpoint returns a list of only those other workspaces that have been specifically authorized to access this workspace's state. +- Project-Wide Access: + - If `project-remote-state` is set to true, the endpoint returns a list of every workspace in the same project except for the subject workspace. +- Organization-Wide Access: + - If `global-remote-state` is set to true, the endpoint returns a list of every workspace in the organization except for the subject workspace. + + + + 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, this will return the list of other workspaces that are specifically authorized to access the workspace's state. -* If `global-remote-state` is set to true, this will return a list of every workspace in the organization except for the subject workspace. +- If `global-remote-state` is set to false for the workspace, this will return the list of other workspaces that are specifically authorized to access the workspace's state. +- If `global-remote-state` is set to true, this will return a list of every workspace in the organization except for the subject workspace. + + 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. @@ -1038,7 +1056,7 @@ $ curl \ | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `: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. It can only be used 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. It can only be used for workspaces where `global-remote-state` and `project-remote-state` is 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. @@ -1099,7 +1117,7 @@ Status code `204`. | --------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `: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. It can only be used for workspaces where `global-remote-state` is false. +This endpoint adds one or more remote state consumers to the workspace. It can only be used for workspaces where `global-remote-state` and `project-remote-state` is 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.) @@ -1160,7 +1178,7 @@ Status code `204`. | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `: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. It can only be used 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. It can only be used for workspaces where `global-remote-state` and `project-remote-state` is 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. diff --git a/content/terraform-docs-common/docs/partials/api-code-blocks/workspace-with-vcs.mdx b/content/terraform-docs-common/docs/partials/api-code-blocks/workspace-with-vcs.mdx index e66f633f81..b65162eee8 100644 --- a/content/terraform-docs-common/docs/partials/api-code-blocks/workspace-with-vcs.mdx +++ b/content/terraform-docs-common/docs/partials/api-code-blocks/workspace-with-vcs.mdx @@ -1,3 +1,5 @@ + + ```json { "data": { @@ -103,11 +105,6 @@ "related": "/api/v2/runs/run-hjy7ndEkmCtn31ps" } }, - "effective-tag-bindings": { - "links": { - "related": "/api/v2/workspaces/ws-6jrRyVDv1J8zQMB5/effective-tag-bindings" - } - }, "latest-run": { // Deprecated; same as current-run "data": { "id": "run-hjy7ndEkmCtn31ps", @@ -187,9 +184,205 @@ "related": "/api/v2/users/user-hjy7ndEkmCtn31ps" } }, - "tag-bindings": { + "vars": { + "data": [ + { + "id": "var-hjy7ndEkmCtn31ps", + "type": "vars" + } + ] + }, + } + } +} +``` + + + + +```json +{ + "data": { + "id": "ws-KTuq99JSzgmDSvYj", + "type": "workspaces", + "attributes": { + "actions": { + "is-destroyable": true + }, + "allow-destroy-plan": true, + "apply-duration-average": null, + "assessments-enabled": false, + "auto-apply": false, + "auto-apply-run-trigger": false, + "auto-destroy-at": null, + "auto-destroy-activity-duration": null, + "created-at": "2021-08-16T21:50:58.726Z", + "description": null, + "environment": "default", + "execution-mode": "remote", + "file-triggers-enabled": true, + "global-remote-state": false, + "project-remote-state": false, + "latest-change-at": "2021-08-16T21:50:58.726Z", + "locked": false, + "locked-reason": "", + "name": "workspace-2", + "oauth-client-name": "github example", + "operations": true, + "permissions": { + "can-update": true, + "can-destroy": true, + "can-queue-run": true, + "can-read-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": true, + "can-force-delete": true, + "can-manage-assessments": true, + "can-manage-ephemeral-workspaces": false, + "can-read-assessment-results": true, + "can-queue-destroy": true + }, + "apply-duration-average": 35000, + "plan-duration-average": 53000, + "policy-check-failures": null, + "queue-all-runs": false, + "resource-count": 10, + "run-failures": 3, + "source": "tfe-api", + "source-name": null, + "source-url": null, + "speculative-enabled": true, + "structured-run-output-enabled": true, + "tag-names": [], + "terraform-version": "1.9.4", + "trigger-prefixes": [], + "vcs-repo": { + "branch": "", + "display-identifier": "example/terraform-test-proj", + "identifier": "example/terraform-test-proj", + "ingress-submodules": false, + "oauth-token-id": "ot-hmAyP66qk2AMVdbJ", + "repository-http-url": "https://github.com/example/terraform-test-proj", + "service-provider": "github", + "tags-regex": null, + "webhook-url": "https://app.terraform.io/webhooks/vcs/704ac743-df64-4b8e-b9a3-a4c5fe1bec87" + }, + "vcs-repo-identifier": "example/terraform-test-proj", + "working-directory": "", + "workspace-kpis-runs-count": null, + "setting-overwrites": { + "execution-mode": true, + "agent-pool": true + } + }, + "links": { + "self": "/api/v2/organizations/my-organization/workspaces/workspace-2", + "self-html": "/app/my-organization/workspaces/workspace-2" + }, + "relationships": { + "relationships": { + "agent-pool": { + "data": null + }, + "current-configuration-version": { + "data": null + }, + "current-run": { + "data": { + "id": "run-hjy7ndEkmCtn31ps", + "type": "runs" + }, + "links": { + "related": "/api/v2/runs/run-hjy7ndEkmCtn31ps" + } + }, + "latest-run": { // Deprecated; same as current-run + "data": { + "id": "run-hjy7ndEkmCtn31ps", + "type": "runs" + }, + "links": { + "related": "/api/v2/runs/run-hjy7ndEkmCtn31ps" + } + }, + "current-state-version": { + "data": { + "id": "sv-hjy7ndEkmCtn31ps", + "type": "state-versions" + }, + "links": { + "related": "/api/v2/workspaces/ws-6jrRyVDv1J8zQMB5/current-state-version" + } + }, + "current-configuration-version": { + "data": { + "id": "cv-hjy7ndEkmCtn31ps", + "type": "configuration-versions" + }, + "links": { + "related": "/api/v2/configuration-versions/cv-hjy7ndEkmCtn31ps" + } + }, + "current-assessment-result": { + "data": null + }, + "organization": { + "data": { + "id": "my-organization", + "type": "organizations" + } + }, + "outputs": { + "data": [ + { + "id": "wsout-hjy7ndEkmCtn31ps", + "type": "workspace-outputs" + } + ], "links": { - "related": "/api/v2/workspaces/ws-6jrRyVDv1J8zQMB5/tag-bindings" + "related": "/api/v2/workspaces/ws-6jrRyVDv1J8zQMB5/current-state-version-outputs" + } + }, + "project": { + "data": { + "id": "prj-hjy7ndEkmCtn31ps", + "type": "projects" + } + }, + "readme": { + "data": null + }, + "remote-state-consumers": { + "links": { + "related": "/api/v2/workspaces/ws-6jrRyVDv1J8zQMB5/relationships/remote-state-consumers" + } + }, + "ssh-key": { + "data": { + "id": "sshkey-hjy7ndEkmCtn31ps", + "type": "ssh-keys" + }, + "links": { + "related": "/api/v2/ssh-keys/sshkey-hjy7ndEkmCtn31ps" + } + }, + "locked-by": { + "data": { + "id": "user-hjy7ndEkmCtn31ps", + "type": "users" + }, + "links": { + "related": "/api/v2/users/user-hjy7ndEkmCtn31ps" } }, "vars": { @@ -204,3 +397,5 @@ } } ``` + + diff --git a/content/terraform-docs-common/docs/partials/api-code-blocks/workspace.mdx b/content/terraform-docs-common/docs/partials/api-code-blocks/workspace.mdx index 4964fd36cb..8aa5198567 100644 --- a/content/terraform-docs-common/docs/partials/api-code-blocks/workspace.mdx +++ b/content/terraform-docs-common/docs/partials/api-code-blocks/workspace.mdx @@ -1,3 +1,5 @@ + + ```json { "data": { @@ -66,9 +68,6 @@ "terraform-version": "1.9.4", "trigger-prefixes": [], "updated-at": "2021-08-16T21:22:49.566Z", - // Listed for HCP Terraform users with access to the change request feature - "unarchived_workspace_change_requests_count": 0, - // "vcs-repo": null, "vcs-repo-identifier": null, "working-directory": null, @@ -101,11 +100,6 @@ "related": "/api/v2/runs/run-hjy7ndEkmCtn31ps" } }, - "effective-tag-bindings": { - "links": { - "related": "/api/v2/workspaces/ws-6jrRyVDv1J8zQMB5/effective-tag-bindings" - } - }, "latest-run": { // Deprecated; same as current-run "data": { "id": "run-hjy7ndEkmCtn31ps", @@ -189,9 +183,204 @@ "related": "/api/v2/users/user-hjy7ndEkmCtn31ps" } }, - "tag-bindings": { + "vars": { + "data": [ + { + "id": "var-hjy7ndEkmCtn31ps", + "type": "vars" + } + ] + }, + } + } +} +``` + + + + +```json +{ + "data": { + "id": "ws-6jrRyVDv1J8zQMB5", + "type": "workspaces", + "attributes": { + "actions": { + "is-destroyable": true + }, + "allow-destroy-plan": true, + "assessments-enabled": false, + "auto-apply": false, + "auto-apply-run-trigger": false, + "auto-destroy-at": null, + "auto-destroy-status": null, + "auto-destroy-activity-duration": null, + "inherits-project-auto-destroy": null, + "created-at": "2021-08-16T21:22:49.566Z", + "description": null, + "environment": "default", + "execution-mode": "agent", + "file-triggers-enabled": true, + "global-remote-state": false, + "project-remote-state": false, + "latest-change-at": "2021-08-16T21:22:49.566Z", + "last-assessment-result-at" : "2021-08-17T21:20:12.908Z", + "locked": true, + "locked-reason": null, + "name": "workspace-1", + "oauth-client-name": null, + "operations": true, + "permissions": { + "can-update": true, + "can-destroy": true, + "can-queue-run": true, + "can-read-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": true, + "can-force-delete": true, + "can-manage-assessments": true, + "can-manage-ephemeral-workspaces": false, + "can-read-assessment-results": true, + "can-queue-destroy": true + }, + "apply-duration-average": 35000, + "plan-duration-average": 53000, + "policy-check-failures": null, + "queue-all-runs": false, + "resource-count": 10, + "run-failures": 3, + "source": "tfe-api", + "source-name": null, + "source-url": null, + "speculative-enabled": true, + "structured-run-output-enabled": true, + "tag-names": [], + "terraform-version": "1.9.4", + "trigger-prefixes": [], + "updated-at": "2021-08-16T21:22:49.566Z", + "vcs-repo": null, + "vcs-repo-identifier": null, + "working-directory": null, + "workspace-kpis-runs-count": 8, + "setting-overwrites": { + "execution-mode": true, + "agent-pool": true + } + }, + "links": { + "self": "/api/v2/organizations/my-organization/workspaces/workspace-1", + "self-html": "/app/my-organization/workspaces/workspace-1" + }, + "relationships": { + "agent-pool": { + "data": { + "id": "apool-QxGd2tRjympfMvQc", + "type": "agent-pools" + } + }, + "current-configuration-version": { + "data": null + }, + "current-run": { + "data": { + "id": "run-hjy7ndEkmCtn31ps", + "type": "runs" + }, "links": { - "related": "/api/v2/workspaces/ws-6jrRyVDv1J8zQMB5/tag-bindings" + "related": "/api/v2/runs/run-hjy7ndEkmCtn31ps" + } + }, + "latest-run": { // Deprecated; same as current-run + "data": { + "id": "run-hjy7ndEkmCtn31ps", + "type": "runs" + }, + "links": { + "related": "/api/v2/runs/run-hjy7ndEkmCtn31ps" + } + }, + "current-state-version": { + "data": { + "id": "sv-hjy7ndEkmCtn31ps", + "type": "state-versions" + }, + "links": { + "related": "/api/v2/workspaces/ws-6jrRyVDv1J8zQMB5/current-state-version" + } + }, + "current-configuration-version": { + "data": { + "id": "cv-hjy7ndEkmCtn31ps", + "type": "configuration-versions" + }, + "links": { + "related": "/api/v2/configuration-versions/cv-hjy7ndEkmCtn31ps" + } + }, + "current-assessment-result": { + "data": null + }, + "organization": { + "data": { + "id": "my-organization", + "type": "organizations" + } + }, + "outputs": { + "data": [ + { + "id": "wsout-hjy7ndEkmCtn31ps", + "type": "workspace-outputs" + }, + { + "id": "wsout-hjy7ndEkmCtn31ps", + "type": "workspace-outputs" + } + ], + "links": { + "related": "/api/v2/workspaces/ws-6jrRyVDv1J8zQMB5/current-state-version-outputs" + } + }, + "project": { + "data": { + "id": "prj-hjy7ndEkmCtn31ps", + "type": "projects" + } + }, + "readme": { + "data": null + }, + "remote-state-consumers": { + "links": { + "related": "/api/v2/workspaces/ws-6jrRyVDv1J8zQMB5/relationships/remote-state-consumers" + } + }, + "ssh-key": { + "data": { + "id": "sshkey-hjy7ndEkmCtn31ps", + "type": "ssh-keys" + }, + "links": { + "related": "/api/v2/ssh-keys/sshkey-hjy7ndEkmCtn31ps" + } + }, + "locked-by": { + "data": { + "id": "user-hjy7ndEkmCtn31ps", + "type": "users" + }, + "links": { + "related": "/api/v2/users/user-hjy7ndEkmCtn31ps" } }, "vars": { @@ -206,3 +395,5 @@ } } ``` + + diff --git a/content/terraform-docs-common/docs/partials/api-code-blocks/workspaces-list.mdx b/content/terraform-docs-common/docs/partials/api-code-blocks/workspaces-list.mdx index f647f29418..e143649ca3 100644 --- a/content/terraform-docs-common/docs/partials/api-code-blocks/workspaces-list.mdx +++ b/content/terraform-docs-common/docs/partials/api-code-blocks/workspaces-list.mdx @@ -1,3 +1,5 @@ + + ```json { "data": [ @@ -99,11 +101,6 @@ "related": "/api/v2/runs/run-hjy7ndEkmCtn31ps" } }, - "effective-tag-bindings": { - "links": { - "related": "/api/v2/workspaces/ws-6jrRyVDv1J8zQMB5/effective-tag-bindings" - } - }, "latest-run": { // Deprecated; same as current-run "data": { "id": "run-hjy7ndEkmCtn31ps", @@ -187,9 +184,223 @@ "related": "/api/v2/users/user-hjy7ndEkmCtn31ps" } }, - "tag-bindings": { + "vars": { + "data": [ + { + "id": "var-hjy7ndEkmCtn31ps", + "type": "vars" + } + ] + }, + } + }, + ], + "links": { + "first": "https://app.terraform.io/api/v2/workspaces?page%5Bnumber%5D=1&page%5Bsize%5D=20", + "last": "https://app.terraform.io/api/v2/workspaces?page%5Bnumber%5D=1&page%5Bsize%5D=20", + "next": null, + "prev": null, + "self": "https://app.terraform.io/api/v2/workspaces?page%5Bnumber%5D=1&page%5Bsize%5D=20" + }, + "meta": { + "pagination": { + "current-page": 1, + "next-page": null, + "page-size": 20, + "prev-page": null, + "total-count": 1, + "total-pages": 1 + } + } +} +``` + + + + +```json +{ + "data": [ + { + "id": "ws-6jrRyVDv1J8zQMB5", + "type": "workspaces", + "attributes": { + "actions": { + "is-destroyable": true + }, + "allow-destroy-plan": true, + "assessments-enabled": false, + "auto-apply": false, + "auto-apply-run-trigger": false, + "auto-destroy-at": null, + "auto-destroy-status": null, + "auto-destroy-activity-duration": null, + "inherits-project-auto-destroy": null, + "created-at": "2021-08-16T21:22:49.566Z", + "description": null, + "environment": "default", + "execution-mode": "agent", + "file-triggers-enabled": true, + "global-remote-state": false, + "project-remote-state": false, + "latest-change-at": "2021-08-16T21:22:49.566Z", + "last-assessment-result-at" : "2021-08-17T21:20:12.908Z", + "locked": true, + "locked-reason": null, + "name": "workspace-1", + "oauth-client-name": null, + "operations": true, + "permissions": { + "can-update": true, + "can-destroy": true, + "can-queue-run": true, + "can-read-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": true, + "can-force-delete": true, + "can-manage-assessments": true, + "can-manage-ephemeral-workspaces": false, + "can-read-assessment-results": true, + "can-queue-destroy": true + }, + "apply-duration-average": 35000, + "plan-duration-average": 53000, + "policy-check-failures": null, + "queue-all-runs": false, + "resource-count": 10, + "run-failures": 3, + "source": "tfe-api", + "source-name": null, + "source-url": null, + "speculative-enabled": true, + "structured-run-output-enabled": true, + "tag-names": [], + "terraform-version": "1.9.4", + "trigger-prefixes": [], + "updated-at": "2021-08-16T21:22:49.566Z", + "vcs-repo": null, + "vcs-repo-identifier": null, + "working-directory": null, + "workspace-kpis-runs-count": 8, + "setting-overwrites": { + "execution-mode": true, + "agent-pool": true + } + }, + "links": { + "self": "/api/v2/organizations/my-organization/workspaces/workspace-1", + "self-html": "/app/my-organization/workspaces/workspace-1" + }, + "relationships": { + "agent-pool": { + "data": { + "id": "apool-QxGd2tRjympfMvQc", + "type": "agent-pools" + } + }, + "current-configuration-version": { + "data": null + }, + "current-run": { + "data": { + "id": "run-hjy7ndEkmCtn31ps", + "type": "runs" + }, + "links": { + "related": "/api/v2/runs/run-hjy7ndEkmCtn31ps" + } + }, + "latest-run": { // Deprecated; same as current-run + "data": { + "id": "run-hjy7ndEkmCtn31ps", + "type": "runs" + }, + "links": { + "related": "/api/v2/runs/run-hjy7ndEkmCtn31ps" + } + }, + "current-state-version": { + "data": { + "id": "sv-hjy7ndEkmCtn31ps", + "type": "state-versions" + }, "links": { - "related": "/api/v2/workspaces/ws-6jrRyVDv1J8zQMB5/tag-bindings" + "related": "/api/v2/workspaces/ws-6jrRyVDv1J8zQMB5/current-state-version" + } + }, + "current-configuration-version": { + "data": { + "id": "cv-hjy7ndEkmCtn31ps", + "type": "configuration-versions" + }, + "links": { + "related": "/api/v2/configuration-versions/cv-hjy7ndEkmCtn31ps" + } + }, + "current-assessment-result": { + "data": null + }, + "organization": { + "data": { + "id": "my-organization", + "type": "organizations" + } + }, + "outputs": { + "data": [ + { + "id": "wsout-hjy7ndEkmCtn31ps", + "type": "workspace-outputs" + }, + { + "id": "wsout-hjy7ndEkmCtn31ps", + "type": "workspace-outputs" + } + ], + "links": { + "related": "/api/v2/workspaces/ws-6jrRyVDv1J8zQMB5/current-state-version-outputs" + } + }, + "project": { + "data": { + "id": "prj-hjy7ndEkmCtn31ps", + "type": "projects" + } + }, + "readme": { + "data": null + }, + "remote-state-consumers": { + "links": { + "related": "/api/v2/workspaces/ws-6jrRyVDv1J8zQMB5/relationships/remote-state-consumers" + } + }, + "ssh-key": { + "data": { + "id": "sshkey-hjy7ndEkmCtn31ps", + "type": "ssh-keys" + }, + "links": { + "related": "/api/v2/ssh-keys/sshkey-hjy7ndEkmCtn31ps" + } + }, + "locked-by": { + "data": { + "id": "user-hjy7ndEkmCtn31ps", + "type": "users" + }, + "links": { + "related": "/api/v2/users/user-hjy7ndEkmCtn31ps" } }, "vars": { @@ -222,3 +433,5 @@ } } ``` + +