Terraform
- Terraform Enterprise
- 1.0.x (latest)
- v202507-1
- v202506-1
- v202505-1
- v202504-1
- v202503-1
- v202502-2
- v202502-1
- v202501-1
- v202411-2
- v202411-1
- v202410-1
- v202409-3
- v202409-2
- v202409-1
- No versions of this document exist before v202408-1. Click below to redirect to the version homepage.
- v202408-1
- v202407-1
- v202406-1
- v202405-1
- v202404-2
- v202404-1
- v202402-2
- v202402-1
- v202401-2
- v202401-1
- v202312-1
- v202311-1
- v202310-1
- v202309-1
- v202308-1
- v202307-1
- v202306-1
- v202305-2
- v202305-1
- v202304-1
- v202303-1
- v202302-1
- v202301-2
- v202301-1
- v202212-2
- v202212-1
- v202211-1
- v202210-1
- v202209-2
- v202209-1
- v202208-3
- v202208-1
- v202207-2
- v202207-1
- v202206-1
Workspace Resources API
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 or the 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. 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.)
Sample Request
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
{
  "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"
  },
  ...
}