Question
How to get a report on all drifted workspaces in HCP Terraform / Terraform Cloud
Solution
There are two ways to get a report on all drifted workspaces in Terraform Cloud:
Option 1 - Explorer feature in Terraform Cloud can filter all the drifted workspaces
- Login to Terraform Cloud and click the Explorer tab
- Then select Drifted workspaces. On the next page, you will see all the drifted workspaces and you will see the download/export button as well.
Option 2 - You can find out which workspaces are drifted with API call:
curl \
--header "Authorization: Bearer $TOKEN" \
'https://app.terraform.io/api/v2/organizations/YOUR_ORG_NAME/explorer?type=workspaces&filter%5B0%5D%5Bdrifted%5D%5Bis%5D%5B0%5D=true'
Additional Information
For more information, please check the following official Terraform Cloud API documentation
For more information regarding the Explorer feature, please check the following official documentation.
If you experience issues or you have questions or concerns, please contact HashiCorp Support.