Resource Reports VQL Schema
VQL for Resource Reports comprises two namespaces:resources and tags, which represent the available filters on Resource Reports in the Vantage console. To reference a filter, use the following syntax: namespace.field (e.g., resources.region or tags.name). The following fields are available within these namespaces.
Availability of the fields listed above varies among different cloud providers. See the Resource Reports documentation for a full list of filter fields available per provider.
The VQL
tags.name and tags.value fields above are filter fields used inside the filter parameter when creating or updating a Resource Report via the API, or in the filter attribute on the vantage_resource_report Terraform resource.These are distinct from the tags.KEY strings (for example, tags.environment) used inside the columns array on the same API endpoints and Terraform resource. Those are column identifiers for adding tag values as dedicated columns in a Resource Report, not VQL. See Add Tag Columns for details.Keywords
VQL includes a set of keywords to create complex filter conditions. These keywords function similar to their SQL equivalents.
With these operators and keywords, you can construct complex filter conditions in VQL.
Syntax
VQL resembles theWHERE clause of a SQL query. Metadata filters require a provider and resource type, and use ->> to select a metadata key:
VQL Examples
The following examples cover common use cases for VQL.Combining Providers
Filter for provider resources associated with either AWS or GCP.Resources from a List of Regions
Filter for AWS resources in two regions. Note that you will need to use the region code, such asus-east-1.
Resources by Account ID
Resources for a specific set of resource types and account ID.Resources by Billing Account
Resources for a specific billing account.Resources by Resource Type
Filter resources to see a specific resource type. In the example below, the query is looking for any AWS resource that is not an AWS CloudFront Distribution. Resource types are represented likeaws_cloudfront_distribution. Expand the box below for a list of all available resource types and their VQL equivalents.
Resource Type VQL Representations
Resource Type VQL Representations
Resources by Label
Resources by specific label.Resources for Specific ARN
The UUID is the unique identifier for the resource. In the case of AWS resources, this is the ARN. The below example shows a query for resources that contain specific text within the ARN.Resources by Metadata
Resource metadata queries require bothprovider and type as well as metadata. Metadata uses a specific syntax (e.g., resources.metadata->>'domain' = 'vantage.sh').
Filter by Tag
Filter resources based on a specific tag, such asterraform, with the value true, in AWS.
Filter for Untagged Resources
On providers that have a Not Tagged filter option in the console, you can use the below VQL to see untagged resources. This example looks for untagged resources in a multi-cloud environment.Real-World Examples
Find production compute resources in approved AWS regions:Troubleshooting
- Wrap string values in single quotes, not double quotes.
- Use the normalized provider and resource type values shown by View as VQL.
- Include both
resources.providerandresources.typewhen filteringresources.metadata. - Keep complete conditions together when mixing
ANDandOR; use parentheses to separate each branch.