
The module creates and manages DigitalOcean DB cluster with Redis engine and flexible configuration.
Once you have a Corewide Solutions Portal account, this one-time action will use your browser session to retrieve credentials:
shellterraform login solutions.corewide.com
Initialize mandatory providers:
Copy and paste into your Terraform configuration and insert the variables:
hclmodule "tf_do_cache" {
source = "solutions.corewide.com/digitalocean/tf-do-cache/digitalocean"
version = "~> 1.2.1"
# specify module inputs here or try one of the examples below
...
}
Initialize the setup:
shellterraform init
Corewide DevOps team strictly follows Semantic Versioning
Specification
to
provide our clients with products that have predictable upgrades between versions. We
recommend
pinning
patch versions of our modules using pessimistic
constraint operator (~>
) to prevent breaking changes during upgrades.
To get new features during the upgrades (without breaking compatibility), use
~> 1.2
and run
terraform init -upgrade
For the safest setup, use strict pinning with version = "1.2.1"
All notable changes to this project are documented here.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
BREAKING CHANGE: DigitalOcean Managed Caching (aka Redis) has reached its end of availability (EOA) and was replaced by Managed Valkey. Management of the Valkey is incompatible with the previous versions. Upgrade from an older version leads to cache cluster re-creation , see Upgrade Notes section
eviction_policy
variabledigitalocean
provider version to 2.53
redis
to valkey
7
to 8
configuration_parameters
variable as its configuration became obsoleteconnection_parameters
output creating with empty key by changing output type to map
trusted_sources
variableFirst stable version
v1.x
to v2.x
Due to the replacement of Redis with Valkey engine for the Digitalocean managed Cache service, the module from version 2.0
switches Cache engine type and updates Cache cluster management, which is incompatible with the previous version. First, update the declaration of the module according to the requirements and examples to match the designed configuration, then re-init the module with an enabled upgrade:
bashterraform init -upgrade
Now the configuration can be applied, this will lead to the Cache cluster re-creation.
Minimal setup with required parameters only:
hclmodule "cache" {
source = "solutions.corewide.com/digitalocean/tf-do-cache/digitalocean"
version = "~> 1.2"
region = "fra1"
name_prefix = "develop"
}
Redis engine with custom parameters configuration:
hclmodule "cache" {
source = "solutions.corewide.com/digitalocean/tf-do-cache/digitalocean"
version = "~> 1.2"
region = "fra1"
name_prefix = "develop"
configuration_parameters = {
maxmemory_policy = "allkeys-lru"
notify_keyspace_events = "KEA"
timeout = 90
}
}
Full setup, configures the Redis with specified parameters, adds trusted sources, and tags the cluster as dev
:
hclmodule "cache" {
source = "solutions.corewide.com/digitalocean/tf-do-cache/digitalocean"
version = "~> 1.2"
region = "fra1"
name_prefix = "develop"
vpc_id = "xxxxxxxx-yyyy-zzzz-xxxx-yyyyyyyyyyyy"
node_count = 2
machine_size = "db-s-2vcpu-2gb"
maintenance_window = {
day = "Tue"
hour = 15
}
trusted_sources = [
{
type = "ip_addr"
value = "10.114.32.24"
},
{
type = "k8s"
value = "123ab45-67c8-de9f0-1ghj23"
},
]
tags = [
"dev",
]
}
Variable | Description | Type | Default | Required | Sensitive |
---|---|---|---|---|---|
name_prefix |
Name prefix for the created resources | string |
yes | no | |
region |
DigitalOcean region to create resources in | string |
yes | no | |
configuration_parameters |
Custom configuration parameters for Redis engine (it's applicable if at least one parameter is provided) | object |
{} |
no | no |
configuration_parameters.acl_channels_default |
Determines default pub/sub channels' ACL for new users if an ACL is not supplied | string |
no | no | |
configuration_parameters.io_threads |
The Redis IO thread count | number |
no | no | |
configuration_parameters.lfu_decay_time |
The LFU maxmemory policy counter decay time in minutes | number |
no | no | |
configuration_parameters.lfu_log_factor |
The counter logarithm factor for volatile-lfu and allkeys-lfu maxmemory policies | number |
no | no | |
configuration_parameters.maxmemory_policy |
A string specifying the desired eviction policy for the Redis cluster | string |
no | no | |
configuration_parameters.notify_keyspace_events |
The notify-keyspace-events option. Requires at least K or E |
string |
no | no | |
configuration_parameters.number_of_databases |
The number of Redis databases (changing this will cause a restart of Redis service) | number |
no | no | |
configuration_parameters.persistence |
Determines RDB dumps management | string |
no | no | |
configuration_parameters.pubsub_client_output_buffer_limit |
The output buffer limit for pub/sub clients in MB | number |
no | no | |
configuration_parameters.ssl |
Toggle whether to require SSL to access Redis | bool |
no | no | |
configuration_parameters.timeout |
The Redis idle connection timeout in seconds | number |
no | no | |
engine_version |
Redis engine version | number |
7 |
no | no |
machine_size |
Database Droplet size associated with the cluster | string |
db-s-1vcpu-1gb |
no | no |
maintenance_window |
Maintenance window configuration | object |
{} |
no | no |
maintenance_window.day |
The day of the week (Mon , Tue , etc.) the maintenance window occurs |
string |
Mon |
no | no |
maintenance_window.hour |
The hour when the maintenance updates are applied, in UTC 24-hour format. Examples: 2 , 3 , 23 |
number |
2 |
no | no |
node_count |
Number of cluster nodes | number |
1 |
no | no |
tags |
List of tags to be assigned to the cluster resource | list(string) |
[] |
no | no |
trusted_sources |
List of trusted sources to restrict connections to the database cluster | list(object) |
[] |
no | no |
trusted_sources[*].type |
Type of resource that the firewall rule allows to access the database cluster. Possible values are: droplet , k8s , ip_addr , tag , or app |
string |
yes | no | |
trusted_sources[*].value |
ID of the specific resource, name of a tag applied to a group of resources, or IP address that the firewall rule allows to access the database cluster | string |
yes | no | |
vpc_id |
The ID of the VPC where the database cluster will be located. If not provided, default DigitalOcean VPC is used | string |
no | no |
Output | Description | Type | Sensitive |
---|---|---|---|
cluster |
Cluster resource attributes | resource |
yes |
connection_parameters |
Connection parameters for Redis | map |
yes |
Dependency | Version | Kind |
---|---|---|
terraform |
>= 1.3 |
CLI |
digitalocean/digitalocean |
~> 2.34 |
provider |