-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #414 from cisagov/cd_add_elasticache
Add AWS Elasticache
- Loading branch information
Showing
4 changed files
with
47 additions
and
1 deletion.
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,39 @@ | ||
resource "aws_security_group" "elasticache_security_group" { | ||
name_prefix = "elasticache-" | ||
description = "ElastiCache security group" | ||
|
||
ingress { | ||
from_port = 6379 | ||
to_port = 6379 | ||
protocol = "tcp" | ||
cidr_blocks = ["10.0.2.0/24"] // Restrict to a specific CIDR block, ideally your VPC's CIDR | ||
} | ||
} | ||
|
||
resource "aws_elasticache_subnet_group" "crossfeed_vpc" { | ||
name = "aws_vpc.crossfeed_vpc" | ||
subnet_ids = [aws_subnet.backend.id] | ||
|
||
tags = { | ||
Name = "crossfeed_vpc" | ||
} | ||
} | ||
|
||
resource "aws_elasticache_cluster" "crossfeed_vpc_elasticache_cluster" { | ||
count = var.create_elasticache_cluster ? 1 : 0 | ||
cluster_id = "crossfeed-vpc-cluster" | ||
engine = "redis" | ||
node_type = "cache.r7g.xlarge" | ||
num_cache_nodes = 1 | ||
parameter_group_name = "default.redis7.1" | ||
engine_version = "7.1" | ||
port = 6379 | ||
subnet_group_name = aws_elasticache_subnet_group.crossfeed_vpc.name | ||
security_group_ids = [aws_security_group.elasticache_security_group.id] | ||
|
||
tags = { | ||
Name = "crossfeed_vpc_elasticache-cluster" | ||
Project = var.project | ||
Stage = var.stage | ||
} | ||
} |
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
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
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