You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Queries let you execute queries against your HCP Terraform workspaces to retrieve information about workspace resources and configurations. Query runs are asynchronous operations that can be monitored for status and results.
29
+
Call query API endpoints to execute query runs against your HCP Terraform workspaces. Query runs retrieve information about workspace resources and configurations. They are asynchronous operations that you can monitor for status and results.
24
30
25
31
## Overview
26
32
27
33
The scope of the API includes the following endpoints:
|`data.attributes.source`| string || The source of the query (e.g., query content or reference). |
60
-
|`data.attributes.variables`| array[{key, value}]| (empty array) | Specifies an optional list of run-specific variable values. Refer to Run-Specific Variables for details. |
65
+
|`data.attributes.source`| string || The source of the query such as query content or reference. |
66
+
|`data.attributes.variables`| array[{key, value}]| (empty array) | Specifies an optional list of run-specific variable values. Refer to run-specific variables for details. |
61
67
|`data.relationships.workspace.data.type`| string || Must be `"workspaces"`. |
62
68
|`data.relationships.workspace.data.id`| string || The ID of the workspace to run the query against. |
63
69
|`data.relationships.configuration-version.data.type`| string || Must be `"configuration-versions"`. |
@@ -164,29 +170,29 @@ $ curl\
164
170
}
165
171
```
166
172
167
-
## List Query Runs for a Workspace
173
+
## List query runs for a workspace
168
174
169
-
This endpoint lists Query Runs for a particular workspace.
175
+
This endpoint lists query runs for a particular workspace.
|`:workspace_id`| The ID of the workspace to list Query Runs for. |
181
+
|`:workspace_id`| The ID of the workspace to list query runs for. |
176
182
177
-
### Query Parameters
183
+
### Query parameters
178
184
179
-
This endpoint supports pagination [with standard URL query parameters](/terraform/cloud-docs/api-docs#query-parameters); remember to percent-encode`[` as `%5B` and `]` as `%5D` if your tooling doesn't automatically encode URLs.
185
+
This endpoint supports pagination [with standard URL query parameters](/terraform/cloud-docs/api-docs#query-parameters). You must use percent-style encoding`[` as `%5B` and `]` as `%5D` if your tooling doesn't automatically encode URLs.
The `status` attribute indicates the current state of the Query Run. Possible values are:
396
+
The `status` attribute indicates the current state of the query run. Possible values are:
397
+
398
+
-`pending`: The query run has been created but is not yet queued for execution.
399
+
-`running`: The query run is currently executing.
400
+
-`finished`: The query run completed successfully.
401
+
-`canceled`: The query run was canceled before completion.
402
+
-`errored`: The query run encountered an error during execution.
403
+
404
+
### Status timestamps
405
+
406
+
The `status-timestamps` object contains timestamps for when the query run entered each status:
391
407
392
-
-`pending` - The Query Run has been created but not yet queued for execution.
393
-
-`running` - The Query Run is currently executing.
394
-
-`finished` - The Query Run has completed successfully.
395
-
-`canceled` - The Query Run was canceled before completion.
396
-
-`errored` - The Query Run encountered an error during execution.
408
+
-`pending-at`: When the query run was created.
409
+
-`queued-at`: When the query run was queued for execution.
410
+
-`running-at`: When the query run started executing.
411
+
-`finished-at`: When the query run completed successfully.
412
+
-`errored-at`: When the query run encountered an error.
413
+
-`canceled-at`: When the query run was canceled.
397
414
398
-
### Status Timestamps
415
+
### Log read URL
399
416
400
-
The `status-timestamps` object contains timestamps for when the Query Run entered each status:
417
+
The `log-read-url` attribute contains a URL to retrieve the logs for the query run.
401
418
402
-
-`pending-at` - When the Query Run was created.
403
-
-`queued-at` - When the Query Run was queued for execution.
404
-
-`running-at` - When the Query Run started executing.
405
-
-`finished-at` - When the Query Run completed successfully.
406
-
-`errored-at` - When the Query Run encountered an error.
407
-
-`canceled-at` - When the Query Run was canceled.
419
+
## Available Related Resources
408
420
409
-
### Log Read URL
421
+
The GET endpoints above can optionally return related resources, if requested with the [`include`](/terraform/cloud-docs/api-docs#inclusion-of-related-resources) query parameter. The following resource types are available:
410
422
411
-
The `log-read-url` attribute contains a URL to retrieve the logs for the Query Run.
423
+
-`created-by` - The user who created the query run.
424
+
-`configuration-version` - The configuration version used for the query run.
425
+
-`configuration_version.ingress_attributes` - The ingress attributes for the configuration version used for the query run.
0 commit comments