Movatterモバイル変換


[0]ホーム

URL:


HashiConf 2025Don't miss the live stream of HashiConf Day 2 happening now View live stream

You are viewing documentation for version v202410-1.View latest version.

List Workspace Resources

GET /workspaces/:workspace_id/resources

ParameterDescription
:workspace_idThe ID of the workspace to retrieve resources from. Obtain this from theworkspace settings or theshow workspace endpoint.
StatusResponseReason
200JSON API document (type: "resources")Request was successful.
404JSON API error objectWorkspace not found or user unauthorized to perform action.

Query Parameters

This endpoint supports paginationwith standard URL query parameters. Remember to percent-encode[ as%5B and] as%5D if your tooling doesn't automatically encode URLs.

ParameterDescription
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"  },  ...}
Edit this page on GitHub

[8]ページ先頭

©2009-2025 Movatter.jp