Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PolicyCheck does not return results hash #790

Closed
snair-woolies opened this issue Oct 12, 2023 · 0 comments
Closed

PolicyCheck does not return results hash #790

snair-woolies opened this issue Oct 12, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@snair-woolies
Copy link

snair-woolies commented Oct 12, 2023

The output of PolicyCheck List does not include the sentinel hash otherwise returned by the API Endpoint as documented here
https://developer.hashicorp.com/terraform/cloud-docs/api-docs/policy-checks#list-policy-checks

go-tfe version

v1.35

Description

As described here - https://developer.hashicorp.com/terraform/cloud-docs/api-docs/policy-checks#list-policy-checks, the output of a policy-check is expected to include the Sentinel hash, while it is understood that the Logs function in the PolicyCheck interface returns the same result, the latter is a data stream (io.Reader) and cannot be marshalled into JSON easily. I wish to understand if this is an intentional decision.
Having go-tfe return the exact output as the Web-API is a reasonable expectation.

Testing plan

curl --header "Authorization: Bearer $TOKEN" https://app.terraform.io/api/v2/runs/<run-ID>/policy-checks
returns a response which includes a "sentinel": hash containing an easily navigable policy-check result schema, however the PolicyCheck.List() function does not return this data, and the PolicyCheck.Logs() function returns an io.Reader which is just a data-stream and makes searching for a specific policy-set result more tedious

Expected Behavior

PolicyCheck.List() returns the data in a similar format to the CURL output , or the PolicyCheck.Logs() function must have an option to return outputs that can be Marshaled into JSON.

Actual Behavior

PolicyCheck.List() does not include data that the CURL output returns and PolicyCheck.Logs() returns a data-stream that can only be Marshaled to string

Additional Context

As an alternative we are using the terrrasnek python Library which provides the output in the format that we need

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant