Skip to content

Instantly share code, notes, and snippets.

@paul-civitas
Created May 31, 2022 17:01
Show Gist options
  • Save paul-civitas/8239a42954650e05beb96471c5e8bc73 to your computer and use it in GitHub Desktop.
Save paul-civitas/8239a42954650e05beb96471c5e8bc73 to your computer and use it in GitHub Desktop.
Hack to get twingate group information from terraform
# export TF_VAR_TWINGATE_API_TOKEN="$TWINGATE_API_TOKEN"
variable TWINGATE_API_TOKEN {
type = string
}
locals {
twingate-query-string = <<EOT
{
groups {
edges {
node {
id
name
}
}
}
}
EOT
twingate-query = urlencode(trimspace(replace(local.twingate-query-string, "/[ \n]+/", " ")))
}
data "http" "grouphack" {
url = "${local.twingate_tenant_url}/api/graphql/?query=${local.twingate-query}"
request_headers = {
"X-API-KEY" = var.TWINGATE_API_TOKEN
}
}
output "debug-twingate-api-call" {
value = jsondecode(data.http.grouphack.body)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment