|
| 1 | +provider "aws" { |
| 2 | + region = "us-east-1" |
| 3 | +} |
| 4 | + |
| 5 | + |
| 6 | +################################################### |
| 7 | +# ElastiCache Redis Cluster |
| 8 | +################################################### |
| 9 | + |
| 10 | +module "cluster" { |
| 11 | + source = "../../modules/elasticache-redis-cluster" |
| 12 | + # source = "tedilabs/db/aws//modules/elasticache-redis-cluster" |
| 13 | + # version = "~> 0.2.0" |
| 14 | + |
| 15 | + name = "example-redis-full" |
| 16 | + description = "Managed by Terraform." |
| 17 | + |
| 18 | + redis_version = "6.2" |
| 19 | + node_instance_type = "cache.t4g.micro" |
| 20 | + # node_size = 1 |
| 21 | + sharding = { |
| 22 | + enabled = true |
| 23 | + shard_size = 3 |
| 24 | + replicas = 2 |
| 25 | + } |
| 26 | + |
| 27 | + |
| 28 | + ## Network |
| 29 | + port = 6379 |
| 30 | + vpc_id = null |
| 31 | + subnet_group = null |
| 32 | + preferred_availability_zones = [] |
| 33 | + |
| 34 | + default_security_group = { |
| 35 | + eanbled = true |
| 36 | + name = "example-redis-full-default-sg" |
| 37 | + description = "Managed by Terraform." |
| 38 | + |
| 39 | + ingress_rules = [ |
| 40 | + { |
| 41 | + cidr_blocks = ["0.0.0.0/0"] |
| 42 | + } |
| 43 | + ] |
| 44 | + } |
| 45 | + security_groups = [] |
| 46 | + |
| 47 | + |
| 48 | + ## Parameters |
| 49 | + parameter_group = { |
| 50 | + enabled = true |
| 51 | + name = "example-redis-full-parameter-group" |
| 52 | + description = "Managed by Terraform." |
| 53 | + parameters = { |
| 54 | + "lazyfree-lazy-eviction" = "yes" |
| 55 | + "lazyfree-lazy-expire" = "yes" |
| 56 | + "lazyfree-lazy-server-del" = "yes" |
| 57 | + "rename-commands" = "KEYS BLOCKED" |
| 58 | + } |
| 59 | + } |
| 60 | + custom_parameter_group = null |
| 61 | + |
| 62 | + |
| 63 | + ## Auth |
| 64 | + password = sensitive("helloworld!#!!1234") |
| 65 | + user_groups = [] |
| 66 | + |
| 67 | + |
| 68 | + ## Encryption |
| 69 | + encryption_at_rest = { |
| 70 | + enabled = true |
| 71 | + kms_key = null |
| 72 | + } |
| 73 | + encryption_in_transit = { |
| 74 | + enabled = true |
| 75 | + } |
| 76 | + |
| 77 | + |
| 78 | + ## Backup |
| 79 | + backup_enabled = true |
| 80 | + backup_window = "16:00-17:00" |
| 81 | + backup_retention = 1 |
| 82 | + backup_final_snapshot_name = "example-redis-full-final" |
| 83 | + |
| 84 | + |
| 85 | + ## Source |
| 86 | + source_backup_name = null |
| 87 | + source_rdb_s3_arns = null |
| 88 | + |
| 89 | + |
| 90 | + ## Maintenance |
| 91 | + maintenance_window = "fri:18:00-fri:20:00" |
| 92 | + auto_upgrade_minor_version_enabled = true |
| 93 | + notification_sns_topic = null |
| 94 | + |
| 95 | + |
| 96 | + ## Logging |
| 97 | + logging_slow_log = { |
| 98 | + enabled = false |
| 99 | + format = "JSON" |
| 100 | + |
| 101 | + destination_type = "CLOUDWATCH_LOGS" |
| 102 | + destination = null |
| 103 | + } |
| 104 | + logging_engine_log = { |
| 105 | + enabled = false |
| 106 | + format = "JSON" |
| 107 | + |
| 108 | + destination_type = "CLOUDWATCH_LOGS" |
| 109 | + destination = null |
| 110 | + } |
| 111 | + |
| 112 | + |
| 113 | + ## Attributes |
| 114 | + multi_az_enabled = true |
| 115 | + auto_failover_enabled = true |
| 116 | + apply_immediately = true |
| 117 | + |
| 118 | + timeouts = { |
| 119 | + create = "60m" |
| 120 | + update = "40m" |
| 121 | + delete = "40m" |
| 122 | + } |
| 123 | + |
| 124 | + tags = { |
| 125 | + "project" = "terraform-aws-db-examples" |
| 126 | + } |
| 127 | +} |
0 commit comments