Terraform adoption for Redis deployments spans two distinct but complementary patterns: using Terraform Enterprise with a self-managed Redis cache backend for job scheduling, and using the Redis Cloud Terraform provider to provision Redis Enterprise Cloud subscriptions and databases as code. Both patterns rely on declarative configuration, plugin-based extensibility, and credential-driven authentication.
Introduction
Redis infrastructure is increasingly managed through infrastructure-as-code. HashiCorp Terraform provides a consistent CLI workflow to codify cloud APIs into declarative configuration files that can be shared, versioned, reviewed, and reused. For Redis specifically, operators can connect Terraform Enterprise to a Redis server for background job scheduler queue management, and Redis Cloud customers can use the Redis Enterprise Cloud Terraform provider to manage the full lifecycle of subscriptions and related Redis databases.
Redis Enterprise Cloud Terraform Provider Overview
The Redis Enterprise Cloud Terraform provider is a plugin for Terraform that allows Redis Enterprise Cloud customers to manage the full lifecycle of their subscriptions and related Redis databases.
The provider needs to be configured with the proper credentials before it can be used. It is a plugin for Terraform that lets Redis Cloud Flexible customers manage the full lifecycle of their subscriptions and related Redis databases.
A Terraform configuration is a complete document in the Terraform language that tells Terraform how to manage a given collection of infrastructure. It consists of three main components:
- Providers — connect to cloud APIs
- Data sources — read existing infrastructure information
- Resources — define infrastructure to be created
How do you configure a Terraform provider?
A provider is the first resource that must be defined in any Terraform configuration file. It gives you access to the cloud API you will interact with to create resources. Terraform supports more than 100 cloud providers.
A provider defines resources and data for a particular infrastructure, such as AWS. The terraform {} block contains settings including the required providers Terraform will use to provision your infrastructure, for example, the rediscloud provider.
The provider {} block configures the specific provider. In the following example, it is AWS.
What are Terraform resources?
Resources are the most important element in the Terraform language. They describe the infrastructure to be created, from compute instances to specific permissions and more.
The resource {} block defines components of your infrastructure.
Redis has developed a Terraform provider for Redis Cloud that allows you to deploy and manage Redis Cloud subscriptions, databases, and network peering as code on any cloud provider.
Building and Installing the Redis Cloud Provider
To use the Redis Enterprise Cloud Terraform provider you will need to set the following environment variables, and these are created through the Redis Enterprise Cloud console under the settings menu.
- REDISCLOUDACCESSKEY
- Account Cloud API Access Key
- REDISCLOUDSECRETKEY
- Individual user Cloud API Secret Key
The build workflow for the provider from source is:
- Clone the repository
- Enter the repository directory
- Build the provider using the make build command:
$ make build
The make build command will build a local provider binary into a bin directory at the root of the repository.
After the provider has been built locally it must be placed in the user plugins directory so it can be discovered by the Terraform CLI.
| Step | Action |
|---|---|
| 1 | Clone the repository |
| 2 | Enter the repository directory |
| 3 | Run make build |
| 4 | Output binary placed in bin directory at repository root |
| 5 | Move binary to user plugins directory for Terraform CLI discovery |
Redis Cloud Provider Configuration and Workflow
You can deploy Redis Cloud databases on AWS using Terraform by configuring the Redis Cloud Terraform provider, defining your subscription and database resources in a .tf file, and running terraform apply. This gives you repeatable, version-controlled infrastructure-as-code for your Redis deployments.
What you'll learn
- How to install and configure the Redis Cloud Terraform provider
- How to define Redis Cloud subscriptions and databases as Terraform resources
- How to use Terraform data sources for payment methods and cloud accounts
- How to create an execution plan and apply it to provision Redis on AWS
- How to clean up resources with terraform destroy
Prerequisites
- Terraform installed on your machine
- A Redis Cloud account with a Flexible or Annual subscription
- Redis Cloud API access enabled with an API account key and API user key
- An AWS account
| Prerequisite | Detail |
|---|---|
| Terraform | Installed on your machine |
| Redis Cloud account | Flexible or Annual subscription |
| API access | API access enabled with API account key and API user key |
| Cloud account | AWS account for provisioning |
What is Terraform and why use it with Redis?
Development teams today are embracing DevOps principles like continuous integration and continuous delivery. Managing infrastructure-as-code has become essential for any cloud service.
IaC tools let you manage infrastructure with configuration files rather than through a graphical user interface, allowing you to build, change, and manage your infrastructure in a safe, consistent, and repeatable way.
HashiCorp Terraform is a leading open-source IaC tool that provides a consistent CLI workflow to manage hundreds of cloud services. Terraform codifies cloud APIs into declarative configuration files that can be shared among team members, versioned, reviewed, and reused.
Why Terraform for Redis Cloud?
- Multi-cloud support — Terraform works with AWS, Google Cloud, Azure, DigitalOcean, and more, using a single unified syntax.
- Declarative configuration — Describe the desired state of your Redis infrastructure and let Terraform handle the provisioning.
- Immutable infrastructure — Configuration changes are applied smoothly and predictably.
- Plugin-based extensibility — The provider model supports almost any service that exposes APIs, including Redis Cloud.
- Client-only architecture — No server-side configuration management is required.
Get started with Terraform
Shows how to install the Redis Cloud provider and create a subscription.
Here, you'll learn how to use the Redis Cloud Terraform Provider to create a subscription and a database.
Steps to initialize configuration:
- Create a Redis Cloud account if you do not have one already.
- Get your Redis Cloud API keys. Set them to the following environment variables:
- Set REDISCLOUDACCESSKEY to your API account key
- Set REDISCLOUDSECRETKEY to your API user key
- Set a payment method.
- Create a file to contain the Terraform configuration called main.tf
- Go to the Redis Cloud Terraform Registry.
- Select Use Provider and copy the Terraform code located there. Paste the code into main.tf and save the file.
```
provider "rediscloud" { }
Example resource configuration
resource "rediscloud_subscription" "example" {
# ...
}
```
- Run terraform init.
In your Terraform configuration file, you can add resources and data sources to plan and create subscriptions and databases.
Terraform Enterprise Redis Storage Integration
Terraform Enterprise uses Redis to cache and manage the background job scheduler queue across available hosts. Redis server configuration is required for any runtime platform configured to operate in active-active mode.
You can operate Terraform Enterprise in active-active mode on the following runtime platforms:
- Kubernetes
- OpenShift
- Nomad
The requirements for deploying Terraform Enterprise depend on the version you want to deploy, as well as the environment you plan to operate the software in, such as operating system, runtime, and storage systems. Check the software product compatibility report page for details.
| Runtime Platform | Active-Active Support |
|---|---|
| Kubernetes | Yes |
| OpenShift | Yes |
| Nomad | Yes |
Your managed Redis server may require additional configuration. For example, Azure Managed Redis is based on Redis Enterprise, which has additional authentication configuration requirements. Refer to the documentation for your distribution for more information.
For secure Redis servers, create a user with read and write access. The Redis user must have sufficient permissions to authenticate with Terraform Enterprise.
Verify that you meet the following requirements when TLS is required to connect to the Redis server:
- A valid TLS certificate and key are configured on the Redis server.
- The Redis server is properly configured to accept TLS connections.
- The Terraform Enterprise client is configured to use TLS when connecting to Redis
You can configure Terraform Enterprise to use Redis client certificates to authenticate with the server for Redis standalone, Enterprise, and Sentinel. When providing client certificates, the password is not required.
Configure the following settings to use Redis client certificates:
- Set the TFEREDISUSE_MTLS variable to true
- Specify the path to the CA certificate file in the TFEREDISCACERTPATH variable
- Specify the path to the client certificate file in the TFEREDISCLIENTCERTPATH variable
- Specify the path to the client key in the TFEREDISCLIENTKEYPATH variable
For detailed information on configuring TLS for Redis, refer to the official Redis documentation on encryption.
For Azure, you must provision a Redis instance for the main Redis service and an additional instance for Sidekiq.
| TLS Requirement | Check |
|---|---|
| TLS certificate and key configured on Redis server | Valid TLS certificate and key are configured |
| Redis server accepts TLS connections | Server properly configured to accept TLS connections |
| Client configured for TLS | Terraform Enterprise client configured to use TLS when connecting |
Configuration Patterns and Best Practices
Managing infrastructure-as-code has become essential for any cloud service. IaC tools let you manage infrastructure with configuration files rather than through a graphical user interface, allowing you to build, change, and manage your infrastructure in a safe, consistent, and repeatable way.
When working with the Redis Cloud Terraform provider, credential handling is central. REDISCLOUDACCESSKEY corresponds to the Account Cloud API Access Key and REDISCLOUDSECRETKEY corresponds to the Individual user Cloud API Secret Key. Both are created through the Redis Enterprise Cloud console under the settings menu.
Provider configuration follows Terraform conventions. The terraform {} block contains settings including the required providers Terraform will use to provision your infrastructure. The provider {} block configures the specific provider.
For Terraform Enterprise Redis connectivity, operational mode drives requirements. Refer to Configure operational mode for additional information.
Refer to the TLS configuration reference for additional information.
Conclusion
Terraform Redis workflows combine two operational domains: Terraform Enterprise backend storage using a self-managed Redis cluster for job scheduling and caching, and the Redis Cloud Terraform provider for provisioning Redis Enterprise Cloud subscriptions and databases as code. The Redis Cloud provider enables multi-cloud, declarative, immutable infrastructure through a client-only architecture, with full lifecycle management for subscriptions, databases, and network peering. Configuration requires API keys set as REDISCLOUDACCESSKEY and REDISCLOUDSECRETKEY, payment method setup, and Terraform init before apply and destroy operations. Terraform Enterprise Redis integration requires careful attention to active-active runtime platforms, TLS certificate validation, client certificate mutual TLS settings, and distribution-specific authentication requirements such as Azure Managed Redis based on Redis Enterprise. Together these patterns provide repeatable, version-controlled Redis infrastructure with consistent CLI workflows across AWS, Google Cloud, Azure, and other providers.