Vantage Launches Automated Cost Reporting via Terraform

by Vantage Team


Example usage of the Vantage Terraform provider

Creating a cost report for AWS costs from Terraform.

Today Vantage announces the launch of new resources in the Vantage Terraform provider which automate the setup and maintenance of cost reporting in Vantage. Practitioners utilizing Terraform in Infrastructure as Code environments can now write Terraform that creates cost reports, folders, saved filters, and dashboards automatically based on their cloud environment.

Before, customers could build reports and filters in the Vantage console. While customers have created hundreds of reports and folders this way, it was still significant work to setup and maintain cost reports for complex cloud environments. Additionally, as cloud infrastructure changed, reports and filters had to be updated separately in the Vantage UI, meaning that cost reporting could fall out of sync with the current state of a customer’s cloud.

Now, engineers can use the new Vantage Terraform provider to rapidly and automatically create a cost reporting structure in the same manner they orchestrate cloud resources. As customers update resource names, tags, and other infrastructure, they can sync those changes to Vantage with terraform apply so that their reports and filters are always up to date. Under the hood, the provider uses the Vantage Write API and Vantage Query Language (VQL) to provision reports and other resources. The following code snippets are abbreviated examples of this from our engineering team’s Terraform.

First, we can create a saved filter with the output from an aws_db_instance resource.

resource "aws_db_instance" "rds" {
  name = "primary-database"
}
resource "vantage_saved_filter" "rds" {
  title  = "${var.environment}-rds-costs"
  filter = "(costs.provider='aws'
    AND costs.resource_id = '${aws_db_instance.rds.arn}')"
}

Then, we can use the saved filter in a cost report. We’ll also create a folder to keep the report organized.

resource "vantage_folder" "rds" {
  title = "RDS Costs"
}

resource "vantage_cost_report" "rds_costs" {
  folder_token        = vantage_folder.rds.token
  saved_filter_tokens = [vantage_saved_filter.rds.token]
  title               = "RDS Costs"
}

These new Terraform resources are now available for all users, including users in the free tier. Users with the editor or above role can head to their API Access Tokens page and generate a “Write” API Key. From there you can head to the GitHub repo to read the Terraform examples.

Frequently Asked Questions

1. What is being launched today?

Vantage is launching “FinOps as Code” features including the ability to manage cost reports, folders, dashboards and saved filters as Terraform resources within the Vantage Terraform provider. This feature set is powered by the Vantage Write API.

2. Who is the customer?

The customer is anyone who would like to automate the setup and maintenance of their cost reports, saved filters, folders, or dashboards via Terraform.

3. How much does this cost?

The Terraform provider is free to all users.

4. Which resources can be managed through Terraform?

Folders, Cost Reports, Saved Filters, and Dashboards.

5. Who has permission to use the Provider?

Any user with “Owner” or “Editor” permissions.

6. How do I authenticate with Vantage using the Terraform provider?

The Vantage Terraform provider uses a Vantage API token for authentication. This allows all API calls performed by the Terraform provider to authenticate as your Vantage user.

7. Are there plans to add other primitives to the Terraform provider?

Yes, as resources are added to the Vantage API they will be added to the Terraform provider.

8. Where can I read the documentation?

The Vantage Terraform provider documentation is available on the Terraform Registry. Additional information can be found in the Vantage documentation for Terraform.