Skip to content

Code sample for managing multiple Aiven services with Terraform

License

Notifications You must be signed in to change notification settings

Aiven-Open/terraform-mgmt-sample

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Managing your Aiven infrastructure with Terraform

This code sample sets up an open source data infrastructure on the Aiven platform using Terraform, consisting of a PostgreSQL® instance sending metrics to InfluxDB®, which can be visualized with Grafana®.

Read more about this setup on the Managing your Aiven infrastructure with Terraform article.

For more information, check the Aiven Terraform Provider official documentation.

Prerequisites

Running it

Populate the terraform.tfvars file with your Aiven access token and project name.

To create the infrastructure, run the following commands:

$ terraform plan
$ terraform apply

Connecting to PostgreSQL

To connect to the deployed PostgreSQL instance, run the following command:

$ psql "$(terraform output -raw postgresql_service_uri)"

Visualizing metrics with Grafana

Run the following command to find the Grafana URL, username and password:

$ terraform output -raw grafana_service_uri
$ terraform output -raw grafana_service_username
$ terraform output -raw grafana_service_password

Open the Grafana URL in your web browser with the outputted username and password.

Clean up

To destroy the infrastructure, set the termination_protection flag under the PostgreSQL resource to false and run the command below:

$ terraform destroy

Trademarks

Postgres, PostgreSQL and the Slonik Logo are trademarks or registered trademarks of the PostgreSQL Community Association of Canada, and used with their permission.

InfluxDB® is a trademark [registered / owned] by InfluxData, which is not affiliated with, and does not endorse, this product.

Terraform and Grafana are trademarks and property of their respective owners. All product and service names used in this website are for identification purposes only and do not imply endorsement.

License

This project is licensed under the Apache License, Version 2.0.