Skip to content

Commit 227dc44

Browse files
authored
Merge pull request #105 from sullivtr/pagination-support
feat: pagination support
2 parents 24f101e + 235ed71 commit 227dc44

File tree

16 files changed

+17817
-6669
lines changed

16 files changed

+17817
-6669
lines changed

.github/workflows/e2e.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ on:
66
pull_request:
77
branches: [master]
88

9+
env:
10+
TF_LOG: trace
11+
912
jobs:
1013
test:
1114
runs-on: ubuntu-20.04

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@ e2e/test_*/terraform.tfstate
55
e2e/test_*/terraform.tfstate.backup
66
e2e/test_*/terraform.d
77
e2e/test_*/.terraform
8+
e2e/test_*/test_private.tf
89
dist/
910
*.log
1011
.secrets
1112
*.tfstate
1213
docsite/website/node_modules
13-
cover.out
14+
cover.out

docs/data-sources/query.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,19 @@ data "graphql_query" "basic_query" {
1111
}
1212
```
1313

14+
### Example with pagination (using the Github repo pull requests query as an example):
15+
```hcl
16+
data "graphql_query" "basic_query" {
17+
query = file("../../testdata/readQueryPaginated")
18+
query_variables = {
19+
owner = "repo_owner"
20+
name = "repo_name"
21+
after = ""
22+
}
23+
paginated = true
24+
}
25+
```
26+
1427
## Argument Reference
1528

1629
* `query_variables` - (Required) A map of any variables that will be used in your query. Each variable's value is interpreted as JSON when possible.

docsite/docs/data_graphql_query.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,17 @@ data "graphql_query" "basic_query" {
2828
- **Type**: string (multi-line)
2929
- **Desciption**: The graphql query. ( See basic example below for what that looks like.)
3030

31+
### paginated
32+
- **Required**: false
33+
- **Type**: bool
34+
- **Desciption**: Whether or not the query uses pagination (based on standard GraphQL pageInfo cursor based pagination)
35+
3136
## Outputs
3237

3338
### query_response
3439
- **Type**: string (json encoded http response)
3540
- **Desciption**: A computed json encoded http response object received from the query.
36-
- To use properties from this response, leverage Terraform's built in [jsondecode](https://www.terraform.io/docs/configuration/functions/jsondecode.html) function.
41+
- To use properties from this response, leverage Terraform's built in [jsondecode](https://www.terraform.io/docs/configuration/functions/jsondecode.html) function. Will contain `paginatedResponseData` in place of `data` for query_responses derived from paginated queries.
3742

3843
## Basic Example
3944

0 commit comments

Comments
 (0)