This repository contains Terraform configurations for setting up and managing databases in Redis Cloud, utilizing HashiCorp Vault for secrets management.
The Terraform setup in this repository is designed to create and manage Redis Cloud database instances securely. It leverages HashiCorp Vault for storing sensitive information like database credentials and API keys.
- Terraform installed on your machine.
- Access to a Redis Cloud account.
- A HashiCorp Vault instance.
Before using this Terraform configuration, set up a KV store in your Vault instance:
-
Create a KV store named
secret
. -
Add the following secrets (single entry, add the entire json) to the path
secret/redis-quintoandar-lab
:{ "db_0_pwd": "secret_42", "db_0_user": "default", "foo": "world", "global_api_key": "<THE_ACCOUNT_API_KEY>", "global_secret_key": "<YOUR_USER_API_KEY_THAT_BECOMES_THE_SECRET>" }
Ensure to replace
<THE_ACCOUNT_API_KEY>
and<YOUR_USER_API_KEY_THAT_BECOMES_THE_SECRET>
with your actual Redis Cloud account and user API keys.
You will need to provide a Vault root token for Terraform to authenticate with Vault. This can be passed via an environment variable or a terraform.tfvars
file.
Example terraform.tfvars
content:
vault_root_token = "hvs.UDublablabla"
Place this file under environments/dev/terraform.tfvars
.
To use this Terraform configuration, follow these steps:
-
Initialize Terraform:
terraform init
-
Create a plan:
terraform plan -var-file="environments/dev/terraform.tfvars"
-
Apply the configuration:
terraform apply -var-file="environments/dev/terraform.tfvars"
This sequence of commands initializes Terraform, creates an execution plan based on your configuration, and applies that plan to set up your Redis Cloud database instances as defined.
Contributions to this project are welcome. Please ensure to follow the standard Git workflow and submit pull requests for any changes.
This project is licensed under the MIT License - see the LICENSE file for details.