This article provide steps to filter out the list of users which are automatically created by terraform to perform internal operation.
These accounts are called as service-accounts and are not created by admins or manually.
- First you export the user api token by running the below command.
export TOKEN="*****************"
2. Then you will be using the Admin API to list the user and direct the result in a file.
curl \
--header "Authorization: Bearer $TOKEN" \
--header "Content-Type: application/vnd.api+json" \
"https://tfedocker.sbx.hashidemos.io/api/v2/admin/users" | jq > input.json
3. Then filter out the required results using the below query .
jq '.data[] | select(.attributes["is-service-account"] == true)' input.json > result.json
Reference link:
https://developer.hashicorp.com/terraform/enterprise/api-docs/admin/users#list-all-users