Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/terraform-yacloud-modules/terraform-yandex-redis

Terraform module to manage Redis resources within the Yandex.Cloud
https://github.com/terraform-yacloud-modules/terraform-yandex-redis

iac redis terraform terraform-module yandex yandex-cloud

Last synced: 28 days ago
JSON representation

Terraform module to manage Redis resources within the Yandex.Cloud

Awesome Lists containing this project

README

        

# Yandex Cloud Managed Redis Terraform module

Terraform module which creates Yandex Cloud [Managed Service for Redis](https://yandex.cloud/en/services/managed-redis) resources.

## Usage

See [`examples`](https://github.com/terraform-yacloud-modules/terraform-yandex-redis/tree/main/examples) directory for working examples to reference:

### Redis cluster without persistence

A simple one host Redis cluster with key eviction and no key sync to disk.

```hcl
module "redis_simple" {
source = "terraform-yacloud-modules/redis/yandex"

name = "simple_cluster"
description = "Simple in-memory cluster without sync to disk"

network_id = data.yandex_vpc_network.private.id

persistence_mode = "OFF"
password = "secretpassword"
# default policy is NOEVICTION
maxmemory_policy = "ALLKEYS_LRU"

hosts = {
host1 = {
zone = local.zone
subnet_id = data.yandex_vpc_subnet.private.id
}
}

zone = local.zone
}
```

### Sharded Redis cluster

A simple sharded Redis cluster with key eviction and key sync to disk in one zone.

```hcl
module "redis_sharded" {
source = "terraform-yacloud-modules/redis/yandex"

name = "sharded_cluster"
description = "Sharded zonal cluster"

network_id = data.yandex_vpc_network.private.id

sharded = true
password = "secretpassword"
# default policy is NOEVICTION
maxmemory_policy = "ALLKEYS_LRU"

hosts = {
host1 = {
zone = local.zone
subnet_id = data.yandex_vpc_subnet.private.id
}
host2 = {
zone = local.zone
subnet_id = data.yandex_vpc_subnet.private.id
}
host3 = {
zone = local.zone
subnet_id = data.yandex_vpc_subnet.private.id
}
}

zone = local.zone
}
```

## Examples

Examples codified under
the [`examples`](https://github.com/terraform-yacloud-modules/terraform-yandex-redis/tree/main/examples) are intended
to give users references for how to use the module(s) as well as testing/validating changes to the source code of the
module. If contributing to the project, please be sure to make any appropriate updates to the relevant examples to allow
maintainers to test your changes and to keep the examples up to date for users. Thank you!

- [Redis cluster without persistence](https://github.com/terraform-yacloud-modules/terraform-yandex-redis/tree/main/examples/simple)
- [Sharded Redis cluster](https://github.com/terraform-yacloud-modules/terraform-yandex-redis/tree/main/examples/sharded)

## Requirements

| Name | Version |
|------|---------|
| [terraform](#requirement\_terraform) | >= 1.3 |
| [yandex](#requirement\_yandex) | >= 0.47.0 |

## Providers

| Name | Version |
|------|---------|
| [yandex](#provider\_yandex) | >= 0.47.0 |

## Modules

No modules.

## Resources

| Name | Type |
|------|------|
| [yandex_mdb_redis_cluster.this](https://registry.terraform.io/providers/yandex-cloud/yandex/latest/docs/resources/mdb_redis_cluster) | resource |

## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| [assign\_public\_ip](#input\_assign\_public\_ip) | Sets whether the host should get a public IP address or not | `bool` | `false` | no |
| [client\_output\_buffer\_limit\_normal](#input\_client\_output\_buffer\_limit\_normal) | Normal clients output buffer limits (bytes) | `string` | `"1073741824 536870912 60"` | no |
| [client\_output\_buffer\_limit\_pubsub](#input\_client\_output\_buffer\_limit\_pubsub) | Pubsub clients output buffer limits (bytes) | `string` | `"1073741824 536870912 60"` | no |
| [databases](#input\_databases) | Number of databases (changing requires redis-server restart) | `number` | `16` | no |
| [day](#input\_day) | Day of week for maintenance window if window type is weekly | `string` | `"MON"` | no |
| [deletion\_protection](#input\_deletion\_protection) | Inhibits deletion of the cluster | `bool` | `false` | no |
| [description](#input\_description) | Description of the Redis cluster | `string` | `"Redis cluster"` | no |
| [disk\_size](#input\_disk\_size) | Volume of the storage available to a host, in gigabytes | `number` | `20` | no |
| [disk\_type\_id](#input\_disk\_type\_id) | Type of the storage of Redis hosts - environment default is used if missing | `string` | `"network-ssd"` | no |
| [environment](#input\_environment) | Deployment environment of the Redis cluster. Can be either PRESTABLE or PRODUCTION | `string` | `"PRODUCTION"` | no |
| [folder\_id](#input\_folder\_id) | The ID of the folder that the resource belongs to. If it is not provided, the default provider folder is used | `string` | `null` | no |
| [hosts](#input\_hosts) | Redis hosts definition | `map(any)` | n/a | yes |
| [hour](#input\_hour) | Hour of day in UTC time zone (1-24) for maintenance window if window type is weekly | `number` | `24` | no |
| [labels](#input\_labels) | A set of key/value label pairs to assign to the Redis cluster | `map(string)` | `{}` | no |
| [maxmemory\_policy](#input\_maxmemory\_policy) | Redis key eviction policy for a dataset that reaches maximum memory. See https://docs.redis.com/latest/rs/databases/memory-performance/eviction-policy/ | `string` | `"NOEVICTION"` | no |
| [name](#input\_name) | Name of the Redis cluster | `string` | n/a | yes |
| [network\_id](#input\_network\_id) | ID of the network, to which the Redis cluster belongs | `string` | n/a | yes |
| [notify\_keyspace\_events](#input\_notify\_keyspace\_events) | Select the events that Redis will notify among a set of classes | `string` | `""` | no |
| [password](#input\_password) | Password for the Redis cluster | `string` | n/a | yes |
| [persistence\_mode](#input\_persistence\_mode) | Persistence mode. Must be one of OFF or ON | `string` | `"ON"` | no |
| [redis\_version](#input\_redis\_version) | Version of Redis | `string` | `"6.2"` | no |
| [replica\_priority](#input\_replica\_priority) | Replica priority of a current replica (usable for non-sharded only) | `any` | `null` | no |
| [resource\_preset\_id](#input\_resource\_preset\_id) | The ID of the preset for computational resources available to a host (CPU, memory etc.). See https://cloud.yandex.com/en/docs/managed-redis/concepts/instance-types | `string` | `"b3-c1-m4"` | no |
| [security\_group\_ids](#input\_security\_group\_ids) | A set of ids of security groups assigned to hosts of the cluster | `list(string)` | `[]` | no |
| [sharded](#input\_sharded) | Redis Cluster mode enabled/disabled | `bool` | `false` | no |
| [slowlog\_log\_slower\_than](#input\_slowlog\_log\_slower\_than) | Log slow queries below this number in microseconds | `number` | `10000` | no |
| [slowlog\_max\_len](#input\_slowlog\_max\_len) | Slow queries log length | `number` | `1000` | no |
| [subnet\_id](#input\_subnet\_id) | The ID of the subnet, to which the host belongs. The subnet must be a part of the network to which the cluster belongs | `string` | `null` | no |
| [timeout](#input\_timeout) | Close the connection after a client is idle for N seconds | `number` | `0` | no |
| [tls\_enabled](#input\_tls\_enabled) | TLS support mode enabled/disabled | `bool` | `false` | no |
| [type](#input\_type) | Type of maintenance window. Can be either ANYTIME or WEEKLY. A day and hour of window need to be specified with weekly window | `string` | `"ANYTIME"` | no |
| [zone](#input\_zone) | The availability zone where the Redis host will be created. See https://cloud.yandex.com/en/docs/overview/concepts/geo-scope | `string` | n/a | yes |

## Outputs

| Name | Description |
|------|-------------|
| [config](#output\_config) | Configuration of the Redis cluster |
| [created\_at](#output\_created\_at) | Creation timestamp of the cluster |
| [deletion\_protection](#output\_deletion\_protection) | Inhibits deletion of the cluster |
| [description](#output\_description) | Description of the Redis cluster |
| [environment](#output\_environment) | Deployment environment of the Redis cluster |
| [folder\_id](#output\_folder\_id) | ID of the folder that the resource belongs to |
| [fqdn](#output\_fqdn) | FQDN for the Redis cluster |
| [health](#output\_health) | Aggregated health of the cluster |
| [hosts](#output\_hosts) | A list of hosts in the Redis cluster |
| [id](#output\_id) | ID of the Redis cluster |
| [labels](#output\_labels) | A set of key/value label pairs to assign to the Redis cluster |
| [maintenance\_window](#output\_maintenance\_window) | Maintenance policy of the Redis cluster |
| [name](#output\_name) | Name of the Redis cluster |
| [network\_id](#output\_network\_id) | ID of the network to which the Redis cluster belongs |
| [persistence\_mode](#output\_persistence\_mode) | Persistence mode of the Redis cluster |
| [resources](#output\_resources) | Resources allocated to hosts of the Redis cluster |
| [security\_group\_ids](#output\_security\_group\_ids) | A set of ids of security groups assigned to hosts of the cluster |
| [sharded](#output\_sharded) | Redis Cluster mode enabled/disabled |
| [tls\_enabled](#output\_tls\_enabled) | TLS support mode enabled/disabled |

## License

Apache-2.0 Licensed.
See [LICENSE](https://github.com/terraform-yacloud-modules/terraform-yandex-module-template/blob/main/LICENSE).