Skip to content

Commit

Permalink
ECS: Add ElastiCache Security Group
Browse files Browse the repository at this point in the history
  • Loading branch information
takano32 committed Feb 24, 2024
1 parent 1e3526f commit e8db54f
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions fargate.tf
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,11 @@ resource "aws_iam_policy" "task_policy" {
"Effect": "Allow",
"Action": [
"elasticfilesystem:ClientMount",
"elasticfilesystem:ClientWrite"
"elasticfilesystem:ClientWrite",
"ssmmessages:CreateControlChannel",
"ssmmessages:CreateDataChannel",
"ssmmessages:OpenControlChannel",
"ssmmessages:OpenDataChannel"
],
"Resource": "*"
}
Expand Down Expand Up @@ -138,13 +142,19 @@ resource "aws_security_group" "wordpress" {
}

resource "aws_ecs_service" "this" {
name = "${var.prefix}-${var.environment}"
cluster = aws_ecs_cluster.this.id
task_definition = aws_ecs_task_definition.this.arn
desired_count = var.desired_count
launch_type = "FARGATE"
name = "${var.prefix}-${var.environment}"
cluster = aws_ecs_cluster.this.id
task_definition = aws_ecs_task_definition.this.arn
desired_count = var.desired_count
launch_type = "FARGATE"
enable_execute_command = true
network_configuration {
security_groups = [aws_security_group.alb.id, aws_security_group.db.id, aws_security_group.efs.id]
security_groups = [
aws_security_group.alb.id,
aws_security_group.db.id,
aws_security_group.efs.id,
aws_security_group.elasticache.id
]
subnets = module.vpc.private_subnets
}

Expand Down

0 comments on commit e8db54f

Please sign in to comment.