File tree Expand file tree Collapse file tree 4 files changed +49
-3
lines changed
infrastructure/applications Expand file tree Collapse file tree 4 files changed +49
-3
lines changed Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ data "aws_iam_policy_document" "server_assume_role" {
2020
2121 principals {
2222 type = " Service"
23- identifiers = [" ec2.amazonaws.com" , " ecs-tasks.amazonaws.com" ]
23+ identifiers = [" ec2.amazonaws.com" , " ecs-tasks.amazonaws.com" , " ecs.amazonaws.com " ]
2424 }
2525
2626 actions = [" sts:AssumeRole" ]
@@ -35,7 +35,6 @@ data "aws_iam_policy_document" "server_role_policy" {
3535 " ses:*" ,
3636 " ecs:*" ,
3737 " ecr:*" ,
38- " ec2:DescribeInstances" ,
3938 ]
4039 resources = [
4140 " *"
@@ -78,6 +77,32 @@ data "aws_iam_policy_document" "server_role_policy" {
7877 resources = [" *" ]
7978 effect = " Allow"
8079 }
80+
81+ statement {
82+ actions = [
83+ " ec2:DescribeAvailabilityZones" ,
84+ " ec2:DescribeInstances" ,
85+ " ec2:CreateVolume" ,
86+ " ec2:AttachVolume" ,
87+ " ec2:DetachVolume" ,
88+ " ec2:CreateTags" ,
89+ " ec2:DeleteVolume" ,
90+ " ec2:DescribeVolumes" ,
91+ ]
92+ resources = [" *" ]
93+ effect = " Allow"
94+ }
95+
96+ statement {
97+ actions = [
98+ " ssmmessages:CreateControlChannel" ,
99+ " ssmmessages:CreateDataChannel" ,
100+ " ssmmessages:OpenControlChannel" ,
101+ " ssmmessages:OpenDataChannel"
102+ ]
103+ resources = [" *" ]
104+ effect = " Allow"
105+ }
81106}
82107
83108output "iam_role_arn" {
Original file line number Diff line number Diff line change @@ -22,6 +22,25 @@ resource "aws_security_group_rule" "server_rds" {
2222 security_group_id = aws_security_group. server . id
2323}
2424
25+ resource "aws_security_group_rule" "in_redis" {
26+ type = " egress"
27+ from_port = 6379
28+ to_port = 6379
29+ protocol = " tcp"
30+ source_security_group_id = aws_security_group. server . id
31+ security_group_id = aws_security_group. server . id
32+ }
33+
34+ resource "aws_security_group_rule" "out_redis" {
35+ # needed by fargate to connect to the server with redis
36+ type = " ingress"
37+ from_port = 6379
38+ to_port = 6379
39+ protocol = " tcp"
40+ source_security_group_id = aws_security_group. server . id
41+ security_group_id = aws_security_group. server . id
42+ }
43+
2544resource "aws_security_group_rule" "web_http" {
2645 type = " ingress"
2746 from_port = 80
Original file line number Diff line number Diff line change @@ -175,7 +175,7 @@ locals {
175175 },
176176 {
177177 name = " ECS_SERVICE_ROLE" ,
178- value = aws_iam_role.ecs_service.arn
178+ value = var.iam_role_arn
179179 },
180180 {
181181 name = " AWS_SES_CONFIGURATION_SET"
Original file line number Diff line number Diff line change @@ -10,10 +10,12 @@ resource "aws_ecs_task_definition" "heavy_processing_worker" {
1010 ephemeral_storage {
1111 size_in_gib = 21
1212 }
13+
1314 runtime_platform {
1415 operating_system_family = " LINUX"
1516 cpu_architecture = " ARM64"
1617 }
18+
1719 container_definitions = jsonencode ([
1820 {
1921 name = " worker"
You can’t perform that action at this time.
0 commit comments