go-tfe icon indicating copy to clipboard operation
go-tfe copied to clipboard

Pulling Health information from a given workspace in Terraform Cloud

Open astanfel opened this issue 2 years ago • 6 comments

Requesting a feature for being able to pull health information from the workspaces API for a given workspace. I have a use-case where in a would like to call the API to identify workspaces that have had drift since the last health assessment ran for a given workspace to run refresh only plans in an automated fashion to sync the resources within the state.

astanfel avatar Apr 24 '23 14:04 astanfel

We are encountering the same use case. Please make this available.

mnedelko avatar Nov 21 '23 23:11 mnedelko

Hello, thanks for the input. The purpose of this repository is to provide a go interface to interact with the Terraform Cloud API as it currently exists and does not really define the API itself.

To clarify, are you asking for a new API filtering capability on workspaces? Perhaps a way to filter them by last-assessment-result-at ?

brandonc avatar Nov 22 '23 17:11 brandonc

I think the API does exist now assessment-results.

c4po avatar Feb 08 '24 21:02 c4po

Thanks for the API doc. This gives me what I am looking for.

astanfel avatar Jun 01 '24 21:06 astanfel

@astanfel how you get the assessment_result_id? I don't see it return from the workspace

c4po avatar Jun 10 '24 18:06 c4po

@c4po you are correct, there still doesn't seem to be a programatic way to link the assessment_result_id back to a given workspace.

@brandonc Essentially what I would like to do it to gather all of my workspaces in my account and iterate through them pulling the latest health assessment results for reporting. So while it looks like the API is present, the link back to the workspace is not.

astanfel avatar Jun 11 '24 15:06 astanfel