Policy Checks API
Note: Sentinel and OPA policies are available in the Terraform Cloud Team & Governance tier, and OPA policies are in beta. OPA policies are not available in Terraform Enterprise.
List Policy Checks
This endpoint lists the policy checks in a run.
Note: The sentinel
hash in the result
attribute structure represents low-level Sentinel details generated by the policy engine. The keys or structure may change over time. Use the data in this hash at your own risk.
GET /runs/:run_id/policy-checks
Parameter | Description |
---|---|
run_id | The ID of the run to list policy checks for. |
Query Parameters
This endpoint supports pagination with standard URL query parameters. Remember to percent-encode [
as %5B
and ]
as %5D
if your tooling doesn't automatically encode URLs. If neither pagination query parameters are provided, the endpoint will not be paginated and will return all results.
Parameter | Description |
---|---|
page[number] | Optional. If omitted, the endpoint will return the first page. |
page[size] | Optional. If omitted, the endpoint will return 20 policy checks per page. |
Sample Request
Sample Response
Show Policy Check
This endpoint gets information about a specific policy check ID. Policy check IDs can appear in audit logs.
Note: The sentinel
hash in the result
attribute structure represents low-level Sentinel details generated by the policy engine. The keys or structure may change over time. Use the data in this hash at your own risk.
GET /policy-checks/:id
Parameter | Description |
---|---|
id | The ID of the policy check to show. |
Sample Request
Sample Response
Override Policy
This endpoint overrides a soft-mandatory or warning policy.
Note: The sentinel
hash in the result
attribute structure represents low-level Sentinel details generated by the policy engine. The keys or structure may change over time. Use the data in this hash at your own risk.
POST /policy-checks/:id/actions/override
Parameter | Description |
---|---|
id | The ID of the policy check to override. |
Sample Request
Sample Response
Available Related Resources
The GET endpoints above can optionally return related resources, if requested with the include
query parameter. The following resource types are available:
Resource Name | Description |
---|---|
run | The run this policy check belongs to. |
run.workspace | The associated workspace of the run. |