HashiCorp Cloud Platform
Infragraph example queries
This page provides examples of Infragraph queries to help you create and edit custom JSON queries. To learn more about the query language, refer to the Infragraph query language reference documentation.
Do I have any virtual machines that Terraform does not manage?
{
"node": {
"unifiedTypes": ["VIRTUAL_MACHINE"]
},
"edge": {
"edgeTypes": ["MANAGES"],
"direction": "INCOMING",
"absent": true,
"nodeQuery": {
"node": {
"sourceTypes": ["HCP_TERRAFORM_STATE_VERSION"]
}
}
}
}
Are any of my AWS resources provisioned by a non-current version of Terraform?
{
"node": {
"unifiedTypes": ["*"]
},
"edge": {
"edgeTypes": ["MANAGES"],
"direction": "INCOMING",
"nodeQuery": {
"node": {
"unifiedTypes": [
"IAC_STATE_VERSION"
],
"where": [
{
"match": {
"left": {
"property": {
"name": "terraform_version"
}
},
"comparator": "NOT_EQUAL",
"right": {
"value": {
"string": "1.13.2"
}
}
}
}
]
}
}
}
}
Do I have any volumes that aren't encrypted at rest?
{
"node": {
"unifiedTypes": ["VOLUME"],
"where": [
{
"match": {
"left": { "property": { "name": "is_encrypted" } },
"comparator": "EQUAL",
"right": { "value": { "bool": false } }
}
}
]
}
}
Which of my EC2 instances are more than 30 days old?
{
"node": {
"unifiedTypes": ["VIRTUAL_MACHINE"]
},
"edge": {
"edgeTypes": ["ATTACHES_TO"],
"direction": "INCOMING",
"nodeQuery": {
"node": {
"unifiedTypes": ["VOLUME"],
"where": [
{
"match": {
"left": { "property": { "name": "created_at" } },
"comparator": "LESS_THAN",
"right": { "value": { "string": "2026-03-24" } }
}
}
]
}
}
}
}
Which resources are missing an Owner tag?
{
"node": {
"unifiedTypes": ["*"],
"where": [
{
"match": {
"left": { "property": { "name": "tags.Owner" } },
"comparator": "DOES_NOT_EXIST"
}
}
]
}
}
Which of my VMs are using images not provisioned by Packer?
{
"node": {
"unifiedTypes": ["VIRTUAL_MACHINE"]
},
"edge": {
"edgeTypes": ["RUNS"],
"direction": "OUTGOING",
"nodeQuery": {
"node": {
"unifiedTypes": ["VIRTUAL_MACHINE_IMAGE"]
},
"edge": {
"edgeTypes": ["PRODUCES"],
"direction": "INCOMING",
"absent": true,
"nodeQuery": {
"node": {
"unifiedTypes": ["BUILD_ARTIFACT"]
}
}
}
}
}
}
Which of my AWS and Azure VMs are deployed in an US East datacenter?
{
"node": {
"unifiedTypes": [ "VIRTUAL_MACHINE" ]
},
"edge": {
"edgeTypes": [ "CONTAINS" ],
"direction": "INCOMING",
"nodeQuery": {
"node": {
"unifiedTypes": [ "REGION" ],
"where": [
{
"filterGroup": {
"operator": "OR",
"filter": [
{
"match": {
"left": { "property": { "name": "name" } },
"comparator": "EQUAL",
"right": { "value": { "string": "us-east-1" } }
}
},
{
"match": {
"left": { "property": { "name": "name" } },
"comparator": "EQUAL",
"right": { "value": { "string": "eastus2" } }
}
}
]
}
}
]
}
}
}
}
Which Azure VMs have volumes attached with a matching environment tag?
{
"node": {
"sourceTypes": [ "AZURE_VIRTUAL_MACHINE" ],
"alias": "vm"
},
"edge": {
"direction": "INCOMING",
"nodeQuery": {
"node": {
"unifiedTypes": [ "RESOURCE_GROUP" ],
"alias": "group",
"where": [
{
"match": {
"left": { "property": { "alias": "vm", "name": "tags.Environment" } },
"comparator": "EQUAL",
"right": { "property": { "alias": "group", "name": "tags.Environment" } }
}
}
]
}
},
"edgeTypes": [ "CONTAINS" ]
}
}