Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Compiled files
*.tfstate
*.tfstate.backup
.terraform
1 change: 1 addition & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ resource "aws_elasticache_replication_group" "redis" {
number_cache_clusters = var.redis_clusters
node_type = var.redis_node_type
automatic_failover_enabled = var.redis_failover
multi_az_enabled = var.multi_az_enabled
engine_version = var.redis_version
port = var.redis_port
parameter_group_name = aws_elasticache_parameter_group.redis_parameter_group.id
Expand Down
10 changes: 10 additions & 0 deletions security_groups.tf
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,13 @@ resource "aws_security_group_rule" "redis_networks_ingress" {
cidr_blocks = var.allowed_cidr
security_group_id = aws_security_group.redis_security_group.id
}

resource "aws_security_group_rule" "redis_replication_egress" {
count = var.is_migration_cluster ? 1 : 0
type = "egress"
from_port = 0
to_port = 0
protocol = "-1"
cidr_blocks = ["0.0.0.0/0"]
security_group_id = aws_security_group.redis_security_group.id
}
13 changes: 13 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,24 @@ variable "redis_clusters" {
type = string
}

variable "multi_az_enabled" {
description = "Specifies whether to enable Multi-AZ Support for the replication group"
type = bool
default = false
}

variable "redis_failover" {
description = "Specifies whether a read-only replica will be automatically promoted to read/write primary if the existing primary fails"
type = bool
default = false
}

variable "is_migration_cluster" {
description = "Specifies whether this is a cluster for replicating other EC2 redis. Useful for migrations."
type = bool
default = false
}

variable "redis_node_type" {
description = "Instance type to use for creating the Redis cache clusters"
type = string
Expand Down
11 changes: 11 additions & 0 deletions versions.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
terraform {
required_version = ">= 0.12"
}

provider "aws" {
version = "~> 3.31"
}

provider "random" {
version = "~> 3.1"
}