HashiCorp Cloud Platform
Infragraph example queries
This page provides examples of Infragraph queries to help you create and edit custom JSON queries.
Do I have any Virtual Machines that Terraform does not manage?
{
"node": {
"unifiedTypes": ["VIRTUAL_MACHINE"]
},
"edge": {
"edgeTypes": ["MANAGES"],
"direction": "EDGE_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": "EDGE_DIRECTION_INCOMING",
"nodeQuery": {
"node": {
"unifiedTypes": [
"HCP_TERRAFORM_STATE_VERSION"
],
"where": [
{
"match": {
"left": {
"property": {
"name": "terraform_version"
}
},
"comparator": "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": "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": "EDGE_DIRECTION_INCOMING",
"nodeQuery": {
"node": {
"unifiedTypes": ["VOLUME"],
"where": [
{
"match": {
"left": { "property": { "name": "created_at" } },
"comparator": "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": "COMPARATOR_DOES_NOT_EXIST"
}
}
]
}
}
Which of my VMs are using images not provisioned by Packer?
{
"node": {
"unifiedTypes": ["VIRTUAL_MACHINE"]
},
"edge": {
"edgeTypes": ["RUNS"],
"direction": "EDGE_DIRECTION_OUTGOING",
"nodeQuery": {
"node": {
"unifiedTypes": ["VIRTUAL_MACHINE_IMAGE"]
},
"edge": {
"edgeTypes": ["PRODUCES"],
"direction": "EDGE_DIRECTION_INCOMING",
"absent": true,
"nodeQuery": {
"node": {
"unifiedTypes": ["PACKER_ARTIFACT"]
}
}
}
}
}
}