-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d21245c
commit 93475aa
Showing
6 changed files
with
139 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
resource "aws_elasticache_subnet_group" "default" { | ||
name = "${var.namespace}-redis-subnet" | ||
subnet_ids = var.subnet_ids | ||
|
||
tags = var.tags | ||
|
||
} | ||
|
||
resource "aws_elasticache_replication_group" "default" { | ||
replication_group_id = var.cluster_id | ||
replication_group_description = var.cluster_description | ||
security_group_ids = [aws_security_group.redis-security-group.id] | ||
node_type = var.node_type | ||
port = var.port | ||
parameter_group_name = var.parameter_group_name | ||
|
||
subnet_group_name = aws_elasticache_subnet_group.default.name | ||
automatic_failover_enabled = var.automatic_failover_enabled | ||
|
||
cluster_mode { | ||
replicas_per_node_group = var.replicas_per_node_group | ||
num_node_groups = var.node_groups | ||
} | ||
|
||
tags = var.tags | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
output "primary_endpoint_address" { | ||
value = "${aws_elasticache_replication_group.default.primary_endpoint_address}" | ||
} | ||
|
||
output "arn" { | ||
value = aws_elasticache_subnet_group.default.arn | ||
} | ||
|
||
output "configuration_endpoint_address" { | ||
value = aws_elasticache_replication_group.default.configuration_endpoint_address | ||
} | ||
|
||
output "security_group_arn" { | ||
value = aws_security_group.redis-security-group.arn | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# this security group for ecs - Traffic to the ECS cluster should only come from the ALB | ||
resource "aws_security_group" "redis-security-group" { | ||
name = var.security_group_name | ||
vpc_id = var.vpc_id | ||
|
||
ingress { | ||
from_port = 0 | ||
to_port = 0 | ||
protocol = "-1" | ||
cidr_blocks = ["0.0.0.0/0"] | ||
} | ||
|
||
egress { | ||
from_port = 0 | ||
to_port = 0 | ||
protocol = "-1" | ||
cidr_blocks = ["0.0.0.0/0"] | ||
} | ||
|
||
tags = var.tags | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
variable "namespace" { | ||
} | ||
|
||
variable "node_groups" { | ||
description = "Number of nodes groups to create in the" | ||
default = 1 | ||
} | ||
|
||
variable "cluster_id" { | ||
description = "cluster name" | ||
default = "redis-cluster" | ||
} | ||
|
||
variable "cluster_description" { | ||
description = "cluster description" | ||
default = "" | ||
} | ||
|
||
variable "port" { | ||
description = "running port" | ||
default = 6379 | ||
} | ||
|
||
variable "automatic_failover_enabled" { | ||
description = "" | ||
default = true | ||
} | ||
|
||
variable "security_group_name" { | ||
description = "redis security group name" | ||
} | ||
|
||
variable "replicas_per_node_group" { | ||
description = "number of replicas run per node group" | ||
} | ||
|
||
variable "parameter_group_name" { | ||
description = "parameter group name" | ||
} | ||
|
||
variable "node_type" { | ||
description = "node type" | ||
} | ||
|
||
variable "subnet_ids" { | ||
description = "subnets" | ||
} | ||
|
||
variable "vpc_id" { | ||
description = "vpc id" | ||
} | ||
|
||
variable "tags" { | ||
description = "tags" | ||
type = map(string) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
terraform { | ||
required_version = ">= 0.14.9" | ||
|
||
required_providers { | ||
aws = { | ||
source = "hashicorp/aws" | ||
version = "~> 3.27" | ||
} | ||
} | ||
} |