To list resources the user must have permission to read resources for the specified workspace. (More about permissions.)
curl \
--request GET \
--header "Authorization: Bearer $TOKEN" \
--header "Content-Type: application/vnd.api+json" \
https://app.terraform.io/api/v2/workspaces/ws-DiTzUDRpjrArAfSS/resources
curl \
--request GET \
--header "Authorization: Bearer $TOKEN" \
--header "Content-Type: application/vnd.api+json" \
https://app.terraform.io/api/v2/workspaces/ws-DiTzUDRpjrArAfSS/resources
{
"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"
},
...
}
{
"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"
},
...
}