Introducing the Dragonfly Cloud Terraform Provider—Automate Your High-Performance In-Memory Data Infrastructure
Dragonfly Cloud introduces a Terraform Provider to automate your high-performance in-memory data infrastructure, enabling a seamless Infrastructure-as-Code experience.
March 11, 2025

Since we launched Dragonfly Cloud last year, many of you have been asking about Terraform support to manage your Dragonfly Cloud environments with the same infrastructure-as-code workflows you use elsewhere. Today, we’re excited to deliver exactly that: the official release of the Dragonfly Cloud Terraform Provider. This is a major milestone in our ongoing mission to make high-performance data infrastructure efficient, simple, and cost-effective—and it’s a direct response to your feedback.
What makes this announcement even better is that we’ve also submitted the provider to the OpenTofu Registry. Just like how Dragonfly is fully compatible with Redis, your configuration files will now work seamlessly with both Terraform and OpenTofu—two highly compatible IaC tools. This ensures you have the flexibility to choose the one that best fits your workflow.
Why a Terraform Provider for Dragonfly Cloud?
Infrastructure-as-Code (IaC) has become a cornerstone of modern development and DevOps practices. By defining and managing resources via declarative configuration files, teams gain repeatability, consistency, and speed. Terraform, one of the most popular IaC tools, empowers organizations to manage infrastructure across multiple cloud providers from a single platform.
With the new Dragonfly Cloud Terraform Provider, you can automate and manage your Dragonfly Cloud environments more efficiently than ever before. Most functionality available in the Dragonfly Cloud console—provisioning new data stores, updating existing configurations, creating high-availability replicas, and more—can now be done via Terraform within your existing IaC workflows.
Key Capabilities
1. Provision Data Stores
Quickly spin up Dragonfly Cloud data stores in the cloud and region of your choice in just a few lines of Terraform configuration. Control important parameters like memory size, instance type, and network settings to fit your performance and availability requirements.
# A sample data store definition.
resource "dfcloud_datastore" "cache" {
name = "my-cache-datastore"
location = {
region = "us-central1"
provider = "gcp"
}
tier = {
max_memory_bytes = 3000000000
performance_tier = "dev"
}
}
2. Update Data Stores
Seamlessly roll out changes or upgrades to existing data stores. Need to adjust your memory or update your compute tier? A single terraform apply
takes care of the rest—no manual intervention is necessary.
tier = {
max_memory_bytes = 25000000000 # Adjusting to 25GB.
performance_tier = "standard" # Upgrading to standard compute tier.
}
3. Provision Replicas for High Availability
Achieve high availability by provisioning replicas in multiple availability zones. Keep critical services running even if one instance goes down, all managed entirely from your Terraform configuration.
tier = {
max_memory_bytes = 25000000000
performance_tier = "standard"
replicas = 2 # Adding 2 replicas for high availability.
}
4. Comprehensive Functionality
Everything you can do in the Dragonfly Cloud console—provisioning, upgrading, backing up, replicating—can now be implemented as code with Terraform. This gives you unparalleled consistency and repeatability in managing your infrastructure.
Benefits of Using Terraform with Dragonfly Cloud
- Single Source of Truth: Keep your entire infrastructure configuration in one place, from compute and storage to data stores and network policies.
- Version Control: Track every change in your infrastructure using your preferred version control system.
- Automation at Scale: Roll out configurations across multiple projects or environments with confidence and consistency.
- Reduced Human Error: Replace manual steps with reproducible Terraform configuration files, decreasing the likelihood of human mistakes.
Getting Started with our Terraform Provider
1. Install Terraform
Make sure you have the latest version of Terraform installed. You can find detailed instructions in the Terraform documentation.
2. Add the Dragonfly Cloud Terraform Provider
In your Terraform configuration, reference the new Dragonfly Cloud provider.
terraform {
required_providers {
dfcloud = {
source = "registry.terraform.io/dragonflydb/dfcloud"
}
}
}
3. Configure Your Provider
Provide your Dragonfly Cloud API credentials to authenticate Terraform. This ensures secure and authenticated access to your Dragonfly resources. This can be done either through the DFCLOUD_API_KEY
environment variable or the api_key
provider argument.
# Set your API key as an environment variable.
export DFCLOUD_API_KEY="<YOUR_API_KEY>"
// Or use your API key in the provider configuration.
provider "dfcloud" {
api_key = "<YOUR_API_KEY>"
}
4. Define Your Resources
Write your .tf
configuration files to specify how you want your data stores, replicas, and network rules to be set up. Our documentation (Terraform or OpenTofu) covers detailed explanations on resource definitions and other configurations. Full examples are also available in our provider’s GitHub repository to help you get started quickly.
# A basic but full example creating a data store in Dragonfly Cloud using Terraform.
# Yes, it is that easy.
terraform {
required_providers {
dfcloud = {
source = "registry.terraform.io/dragonflydb/dfcloud"
}
}
}
provider "dfcloud" {
api_key = "<YOUR_API_KEY>"
}
resource "dfcloud_datastore" "cache" {
name = "my-cache-datastore"
location = {
region = "us-central1"
provider = "gcp"
}
tier = {
max_memory_bytes = 3000000000
performance_tier = "dev"
}
dragonfly = {
cache_mode = true
}
}
5. Run terraform apply
With a single command, Terraform provisions, updates, or deletes resources to match your configuration.
$> terraform apply
Terraform used the selected providers to generate the following execution plan.
Resource actions are indicated with the following symbols:
+ create
Terraform will perform the following actions:
# dfcloud_datastore.cache will be created
+ resource "dfcloud_datastore" "cache" {
+ addr = (known after apply)
+ created_at = (known after apply)
+ dragonfly = {
+ acl_rules = (known after apply)
+ bullmq = (known after apply)
+ cache_mode = true
+ memcached = (known after apply)
+ sidekiq = (known after apply)
+ tls = (known after apply)
}
+ id = (known after apply)
+ location = {
+ availability_zones = (known after apply)
+ provider = "gcp"
+ region = "us-central1"
}
+ name = "my-cache-datastore"
+ password = (sensitive value)
+ tier = {
+ max_memory_bytes = 3000000000
+ performance_tier = "dev"
}
}
Plan: 1 to add, 0 to change, 0 to destroy.
Looking Ahead
This is the first public launch of the Terraform provider. We are committed to expanding the capabilities and features of the Dragonfly Cloud Terraform Provider. As we gather feedback and use cases from our community, expect ongoing improvements, new resource types and configurations (such as Dragonfly Swarm), and deeper integration with the Dragonfly Cloud ecosystem.
The Power of Dragonfly Cloud
Dragonfly Cloud is built from the ground up for scale, speed, and simplicity. Its advanced architecture ensures lightning-fast data operations without the complexity or overhead found in other in-memory data stores. As a drop-in replacement for Redis-based solutions, Dragonfly Cloud delivers 25x performance gains for data-intensive workloads and up to 80% cost savings compared to similar Redis deployments.
Join the Community
If you have questions, have feature requests, or want to report issues, we encourage you to join our GitHub repository, Discord server, and community forum. Your feedback is invaluable in helping us refine and improve our tools.
Ready to Automate Your Data Store Management?
Embrace the ease of infrastructure-as-code while harnessing the exceptional speed, scalability, and cost efficiency of Dragonfly Cloud, and get started with the Dragonfly Cloud Terraform Provider today. Thank you for being part of our journey to redefine high-performance data infrastructure. We can’t wait to see what you build!