TFGQL exposes Terraform Cloud and Terraform Enterprise data through a single GraphQL endpoint with request batching, filtering, and pagination built in.
- Primary reference for deployment, usage, and contributing details.
- Install dependencies:
npm install - Configure the required environment variables (see runtime configuration docs); at minimum set
TFE_BASE_URLfor Terraform Enterprise instances. - Run the server:
npm start
Node.js 20+ and a valid Terraform Cloud/Enterprise token are required.
The /auth/token endpoint validates your Terraform API token against TFC/E
before issuing a JWT; any 4xx response from Terraform is returned unchanged.
- Exchange a Terraform API token for a session JWT:
This will return:
curl -X POST http://<endpoint>/auth/token \ -H 'content-type: application/json' \ -d '{"tfcToken":"<terraform-api-token>"}'
{"token":"<JWT>","expiresAt":"<ISO Date>"} - Call GraphQL with the returned JWT:
curl http://<endpoint>/graphql \ -H 'content-type: application/json' \ -H 'authorization: Bearer <JWT>' \ --data '{"query":"{ __typename }"}'
For end-to-end examples, schema guides, and deployment recipes, continue in the docs site.