Skip to content

Commit a12e9b1

Browse files
authored
PRMP-763: Weekly ODS update ecs task (#194)
1 parent 0dbd36b commit a12e9b1

19 files changed

Lines changed: 288 additions & 65 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ terraform.rc
3131
node_modules/
3232
tfplan
3333
*.zip
34+
*tf.plan
3435

3536
.idea/
3637
.vscode/

infrastructure/README.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
| Name | Version |
1010
|------|---------|
11-
| <a name="provider_aws"></a> [aws](#provider\_aws) | 5.62.0 |
11+
| <a name="provider_aws"></a> [aws](#provider\_aws) | 5.66.0 |
1212

1313
## Modules
1414

@@ -84,9 +84,11 @@
8484
| <a name="module_ndr-app-config"></a> [ndr-app-config](#module\_ndr-app-config) | ./modules/app_config | n/a |
8585
| <a name="module_ndr-bulk-staging-store"></a> [ndr-bulk-staging-store](#module\_ndr-bulk-staging-store) | ./modules/s3/ | n/a |
8686
| <a name="module_ndr-docker-ecr-ui"></a> [ndr-docker-ecr-ui](#module\_ndr-docker-ecr-ui) | ./modules/ecr/ | n/a |
87+
| <a name="module_ndr-docker-ecr-weekly-ods-update"></a> [ndr-docker-ecr-weekly-ods-update](#module\_ndr-docker-ecr-weekly-ods-update) | ./modules/ecr/ | n/a |
8788
| <a name="module_ndr-document-store"></a> [ndr-document-store](#module\_ndr-document-store) | ./modules/s3/ | n/a |
8889
| <a name="module_ndr-ecs-container-port-ssm-parameter"></a> [ndr-ecs-container-port-ssm-parameter](#module\_ndr-ecs-container-port-ssm-parameter) | ./modules/ssm_parameter | n/a |
89-
| <a name="module_ndr-ecs-fargate"></a> [ndr-ecs-fargate](#module\_ndr-ecs-fargate) | ./modules/ecs | n/a |
90+
| <a name="module_ndr-ecs-fargate-app"></a> [ndr-ecs-fargate-app](#module\_ndr-ecs-fargate-app) | ./modules/ecs | n/a |
91+
| <a name="module_ndr-ecs-fargate-ods-update"></a> [ndr-ecs-fargate-ods-update](#module\_ndr-ecs-fargate-ods-update) | ./modules/ecs | n/a |
9092
| <a name="module_ndr-feedback-mailbox"></a> [ndr-feedback-mailbox](#module\_ndr-feedback-mailbox) | ./modules/ses | n/a |
9193
| <a name="module_ndr-lloyd-george-store"></a> [ndr-lloyd-george-store](#module\_ndr-lloyd-george-store) | ./modules/s3/ | n/a |
9294
| <a name="module_ndr-vpc-ui"></a> [ndr-vpc-ui](#module\_ndr-vpc-ui) | ./modules/vpc/ | n/a |
@@ -188,6 +190,8 @@
188190
| [aws_iam_role.ecs_execution](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role) | resource |
189191
| [aws_iam_role.manifest_presign_url_role](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role) | resource |
190192
| [aws_iam_role.mesh_forwarder](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role) | resource |
193+
| [aws_iam_role.ods_weekly_update_ecs_execution](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role) | resource |
194+
| [aws_iam_role.ods_weekly_update_task_role](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role) | resource |
191195
| [aws_iam_role.s3_backup_iam_role](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role) | resource |
192196
| [aws_iam_role.sns_failure_feedback_role](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role) | resource |
193197
| [aws_iam_role.splunk_sqs_forwarder](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role) | resource |
@@ -218,6 +222,7 @@
218222
| [aws_s3_bucket_lifecycle_configuration.lg-lifecycle-rules](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_lifecycle_configuration) | resource |
219223
| [aws_s3_bucket_lifecycle_configuration.staging-store-lifecycle-rules](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_lifecycle_configuration) | resource |
220224
| [aws_s3_bucket_policy.logs_bucket_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_policy) | resource |
225+
| [aws_scheduler_schedule.ods_weekly_update_ecs](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/scheduler_schedule) | resource |
221226
| [aws_security_group.ndr_mesh_sg](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/security_group) | resource |
222227
| [aws_sns_topic.alarm_notifications_topic](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/sns_topic) | resource |
223228
| [aws_sns_topic_subscription.alarm_notifications_sns_topic_subscription](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/sns_topic_subscription) | resource |

infrastructure/api.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ resource "aws_api_gateway_rest_api" "ndr_doc_store_api" {
1313

1414
resource "aws_api_gateway_domain_name" "custom_api_domain" {
1515
domain_name = local.api_gateway_full_domain_name
16-
regional_certificate_arn = module.ndr-ecs-fargate.certificate_arn
16+
regional_certificate_arn = module.ndr-ecs-fargate-app.certificate_arn
1717

1818
endpoint_configuration {
1919
types = ["REGIONAL"]

infrastructure/ecr.tf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,11 @@ module "ndr-docker-ecr-ui" {
55
environment = var.environment
66
owner = var.owner
77
}
8+
module "ndr-docker-ecr-weekly-ods-update" {
9+
count = local.is_sandbox ? 0 : 1
10+
source = "./modules/ecr/"
11+
app_name = "${terraform.workspace}-weekly-ods-update"
12+
13+
environment = var.environment
14+
owner = var.owner
15+
}

infrastructure/ecs.tf

Lines changed: 68 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
module "ndr-ecs-fargate" {
1+
module "ndr-ecs-fargate-app" {
22
source = "./modules/ecs"
33
ecs_cluster_name = "app-cluster"
4+
is_lb_needed = true
5+
is_autoscaling_needed = true
6+
is_service_needed = true
47
vpc_id = module.ndr-vpc-ui.vpc_id
58
public_subnets = module.ndr-vpc-ui.public_subnets
69
private_subnets = module.ndr-vpc-ui.private_subnets
@@ -22,9 +25,71 @@ module "ndr-ecs-container-port-ssm-parameter" {
2225
source = "./modules/ssm_parameter"
2326
name = "container_port"
2427
description = "Docker container port number for ${var.environment}"
25-
resource_depends_on = module.ndr-ecs-fargate
26-
value = module.ndr-ecs-fargate.container_port
28+
resource_depends_on = module.ndr-ecs-fargate-app
29+
value = module.ndr-ecs-fargate-app.container_port
2730
type = "SecureString"
2831
owner = var.owner
2932
environment = var.environment
33+
}
34+
35+
module "ndr-ecs-fargate-ods-update" {
36+
count = local.is_sandbox ? 0 : 1
37+
source = "./modules/ecs"
38+
ecs_cluster_name = "ods-weekly-update"
39+
vpc_id = module.ndr-vpc-ui.vpc_id
40+
public_subnets = module.ndr-vpc-ui.public_subnets
41+
private_subnets = module.ndr-vpc-ui.private_subnets
42+
sg_name = "${terraform.workspace}-ods-weekly-update-sg"
43+
ecs_launch_type = "FARGATE"
44+
ecs_cluster_service_name = "${terraform.workspace}-ods-weekly-update"
45+
ecr_repository_url = module.ndr-docker-ecr-weekly-ods-update[0].ecr_repository_url
46+
environment = var.environment
47+
owner = var.owner
48+
container_port = 80
49+
is_autoscaling_needed = false
50+
is_lb_needed = false
51+
is_service_needed = false
52+
alarm_actions_arn_list = []
53+
logs_bucket = aws_s3_bucket.logs_bucket.bucket
54+
task_role = aws_iam_role.ods_weekly_update_task_role[0].arn
55+
environment_vars = [
56+
{
57+
"name" : "table_name",
58+
"value" : module.lloyd_george_reference_dynamodb_table.table_name
59+
},
60+
{
61+
"name" : "PDS_FHIR_IS_STUBBED",
62+
"value" : tostring(local.is_sandbox)
63+
}
64+
]
65+
ecs_container_definition_memory = 512
66+
ecs_container_definition_cpu = 256
67+
ecs_task_definition_memory = 512
68+
ecs_task_definition_cpu = 256
69+
}
70+
71+
resource "aws_iam_role" "ods_weekly_update_task_role" {
72+
count = local.is_sandbox ? 0 : 1
73+
name = "${terraform.workspace}_ods_weekly_update_task_role"
74+
managed_policy_arns = [
75+
module.lloyd_george_reference_dynamodb_table.dynamodb_policy,
76+
aws_iam_policy.ssm_access_policy.arn,
77+
]
78+
assume_role_policy = jsonencode(
79+
{
80+
"Version" : "2012-10-17",
81+
"Statement" : [
82+
{
83+
"Sid" : "",
84+
"Effect" : "Allow",
85+
"Principal" : {
86+
"Service" : [
87+
"ecs-tasks.amazonaws.com"
88+
]
89+
},
90+
"Action" : "sts:AssumeRole"
91+
}
92+
]
93+
}
94+
)
3095
}

infrastructure/firewall.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ module "firewall_waf_v2" {
1010
}
1111

1212
resource "aws_wafv2_web_acl_association" "web_acl_association" {
13-
resource_arn = module.ndr-ecs-fargate.load_balancer_arn
13+
resource_arn = module.ndr-ecs-fargate-app.load_balancer_arn
1414
web_acl_arn = module.firewall_waf_v2[0].arn
1515

1616
count = (terraform.workspace == "ndra" ||
1717
terraform.workspace == "ndrb" ||
1818
terraform.workspace == "ndrc" ||
1919
terraform.workspace == "ndrd") ? 0 : 1
2020
depends_on = [
21-
module.ndr-ecs-fargate,
21+
module.ndr-ecs-fargate-app,
2222
module.firewall_waf_v2[0]
2323
]
2424
}

infrastructure/modules/ecs/README.md

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,20 +47,32 @@ No modules.
4747
| Name | Description | Type | Default | Required |
4848
|------|-------------|------|---------|:--------:|
4949
| <a name="input_alarm_actions_arn_list"></a> [alarm\_actions\_arn\_list](#input\_alarm\_actions\_arn\_list) | n/a | `list(string)` | n/a | yes |
50+
| <a name="input_autoscaling_max_capacity"></a> [autoscaling\_max\_capacity](#input\_autoscaling\_max\_capacity) | n/a | `number` | `6` | no |
51+
| <a name="input_autoscaling_min_capacity"></a> [autoscaling\_min\_capacity](#input\_autoscaling\_min\_capacity) | n/a | `number` | `3` | no |
5052
| <a name="input_aws_region"></a> [aws\_region](#input\_aws\_region) | n/a | `string` | `"eu-west-2"` | no |
51-
| <a name="input_certificate_domain"></a> [certificate\_domain](#input\_certificate\_domain) | n/a | `string` | n/a | yes |
53+
| <a name="input_certificate_domain"></a> [certificate\_domain](#input\_certificate\_domain) | n/a | `string` | `""` | no |
5254
| <a name="input_container_port"></a> [container\_port](#input\_container\_port) | n/a | `number` | `8080` | no |
53-
| <a name="input_domain"></a> [domain](#input\_domain) | n/a | `string` | n/a | yes |
55+
| <a name="input_desired_count"></a> [desired\_count](#input\_desired\_count) | n/a | `number` | `3` | no |
56+
| <a name="input_domain"></a> [domain](#input\_domain) | n/a | `string` | `""` | no |
5457
| <a name="input_ecr_repository_url"></a> [ecr\_repository\_url](#input\_ecr\_repository\_url) | n/a | `any` | n/a | yes |
5558
| <a name="input_ecs_cluster_name"></a> [ecs\_cluster\_name](#input\_ecs\_cluster\_name) | n/a | `string` | n/a | yes |
5659
| <a name="input_ecs_cluster_service_name"></a> [ecs\_cluster\_service\_name](#input\_ecs\_cluster\_service\_name) | n/a | `string` | n/a | yes |
60+
| <a name="input_ecs_container_definition_cpu"></a> [ecs\_container\_definition\_cpu](#input\_ecs\_container\_definition\_cpu) | n/a | `number` | `512` | no |
61+
| <a name="input_ecs_container_definition_memory"></a> [ecs\_container\_definition\_memory](#input\_ecs\_container\_definition\_memory) | n/a | `number` | `1024` | no |
5762
| <a name="input_ecs_launch_type"></a> [ecs\_launch\_type](#input\_ecs\_launch\_type) | n/a | `string` | `"FARGATE"` | no |
63+
| <a name="input_ecs_task_definition_cpu"></a> [ecs\_task\_definition\_cpu](#input\_ecs\_task\_definition\_cpu) | n/a | `number` | `1024` | no |
64+
| <a name="input_ecs_task_definition_memory"></a> [ecs\_task\_definition\_memory](#input\_ecs\_task\_definition\_memory) | n/a | `number` | `2048` | no |
5865
| <a name="input_environment"></a> [environment](#input\_environment) | n/a | `string` | n/a | yes |
66+
| <a name="input_environment_vars"></a> [environment\_vars](#input\_environment\_vars) | n/a | `list` | <pre>[<br> null<br>]</pre> | no |
67+
| <a name="input_is_autoscaling_needed"></a> [is\_autoscaling\_needed](#input\_is\_autoscaling\_needed) | n/a | `bool` | `true` | no |
68+
| <a name="input_is_lb_needed"></a> [is\_lb\_needed](#input\_is\_lb\_needed) | n/a | `bool` | `false` | no |
69+
| <a name="input_is_service_needed"></a> [is\_service\_needed](#input\_is\_service\_needed) | n/a | `bool` | `true` | no |
5970
| <a name="input_logs_bucket"></a> [logs\_bucket](#input\_logs\_bucket) | n/a | `any` | n/a | yes |
6071
| <a name="input_owner"></a> [owner](#input\_owner) | n/a | `string` | n/a | yes |
6172
| <a name="input_private_subnets"></a> [private\_subnets](#input\_private\_subnets) | n/a | `any` | n/a | yes |
6273
| <a name="input_public_subnets"></a> [public\_subnets](#input\_public\_subnets) | n/a | `any` | n/a | yes |
6374
| <a name="input_sg_name"></a> [sg\_name](#input\_sg\_name) | n/a | `string` | n/a | yes |
75+
| <a name="input_task_role"></a> [task\_role](#input\_task\_role) | n/a | `any` | `null` | no |
6476
| <a name="input_vpc_id"></a> [vpc\_id](#input\_vpc\_id) | n/a | `string` | n/a | yes |
6577

6678
## Outputs
@@ -70,5 +82,7 @@ No modules.
7082
| <a name="output_certificate_arn"></a> [certificate\_arn](#output\_certificate\_arn) | The arn of certificate that load balancer is using |
7183
| <a name="output_container_port"></a> [container\_port](#output\_container\_port) | The container port number of docker image, which was provided as input variable of this module |
7284
| <a name="output_dns_name"></a> [dns\_name](#output\_dns\_name) | n/a |
85+
| <a name="output_ecs_cluster_arn"></a> [ecs\_cluster\_arn](#output\_ecs\_cluster\_arn) | n/a |
7386
| <a name="output_load_balancer_arn"></a> [load\_balancer\_arn](#output\_load\_balancer\_arn) | The arn of the load balancer |
7487
| <a name="output_security_group_id"></a> [security\_group\_id](#output\_security\_group\_id) | n/a |
88+
| <a name="output_task_definition_arn"></a> [task\_definition\_arn](#output\_task\_definition\_arn) | n/a |

infrastructure/modules/ecs/alarms.tf

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
resource "aws_cloudwatch_metric_alarm" "alb_alarm_4XX" {
2-
alarm_name = "4XX-status-${aws_lb.ecs_lb.name}"
2+
count = !local.is_sandbox && var.is_lb_needed ? 1 : 0
3+
alarm_name = "4XX-status-${aws_lb.ecs_lb[0].name}"
34
comparison_operator = "GreaterThanOrEqualToThreshold"
45
evaluation_periods = "1"
56
namespace = "AWS/ApplicationELB"
@@ -9,22 +10,21 @@ resource "aws_cloudwatch_metric_alarm" "alb_alarm_4XX" {
910
threshold = 20
1011
treat_missing_data = "notBreaching"
1112
dimensions = {
12-
LoadBalancer = aws_lb.ecs_lb.arn_suffix
13+
LoadBalancer = aws_lb.ecs_lb[0].arn_suffix
1314
}
14-
alarm_description = "This alarm indicates that at least 20 4XX statuses have occurred on ${aws_lb.ecs_lb.name} in a minute."
15+
alarm_description = "This alarm indicates that at least 20 4XX statuses have occurred on ${aws_lb.ecs_lb[0].name} in a minute."
1516
alarm_actions = var.alarm_actions_arn_list
1617

1718
tags = {
18-
Name = "4XX-status-${aws_lb.ecs_lb.name}"
19+
Name = "4XX-status-${aws_lb.ecs_lb[0].name}"
1920
Owner = var.owner
2021
Environment = var.environment
2122
Workspace = terraform.workspace
2223
}
23-
count = local.is_sandbox ? 0 : 1
2424
}
2525

2626
resource "aws_cloudwatch_metric_alarm" "alb_alarm_5XX" {
27-
alarm_name = "5XX-status-${aws_lb.ecs_lb.name}"
27+
alarm_name = "5XX-status-${aws_lb.ecs_lb[0].name}"
2828
comparison_operator = "GreaterThanOrEqualToThreshold"
2929
evaluation_periods = "1"
3030
namespace = "AWS/ApplicationELB"
@@ -34,18 +34,18 @@ resource "aws_cloudwatch_metric_alarm" "alb_alarm_5XX" {
3434
threshold = 5
3535
treat_missing_data = "notBreaching"
3636
dimensions = {
37-
LoadBalancer = aws_lb.ecs_lb.arn_suffix
37+
LoadBalancer = aws_lb.ecs_lb[0].arn_suffix
3838
}
39-
alarm_description = "This alarm indicates that at least 5 5XX statuses have occurred on ${aws_lb.ecs_lb.name} within 5 minutes."
39+
alarm_description = "This alarm indicates that at least 5 5XX statuses have occurred on ${aws_lb.ecs_lb[0].name} within 5 minutes."
4040
alarm_actions = var.alarm_actions_arn_list
4141

4242
tags = {
43-
Name = "5XX-status-${aws_lb.ecs_lb.name}"
43+
Name = "5XX-status-${aws_lb.ecs_lb[0].name}"
4444
Owner = var.owner
4545
Environment = var.environment
4646
Workspace = terraform.workspace
4747
}
48-
count = local.is_sandbox ? 0 : 1
48+
count = !local.is_sandbox && var.is_lb_needed ? 1 : 0
4949
}
5050

5151
resource "aws_cloudwatch_metric_alarm" "ndr_ecs_service_cpu_high_alarm" {
@@ -60,7 +60,7 @@ resource "aws_cloudwatch_metric_alarm" "ndr_ecs_service_cpu_high_alarm" {
6060

6161
dimensions = {
6262
ClusterName = aws_ecs_cluster.ndr_ecs_cluster.name
63-
ServiceName = aws_ecs_service.ndr_ecs_service.name
63+
ServiceName = aws_ecs_service.ndr_ecs_service[0].name
6464
}
6565

6666
alarm_description = "The CPU usage for ${var.ecs_cluster_service_name} is currently above 85%, the autoscaling will begin scaling up."
@@ -72,7 +72,7 @@ resource "aws_cloudwatch_metric_alarm" "ndr_ecs_service_cpu_high_alarm" {
7272
Environment = var.environment
7373
Workspace = terraform.workspace
7474
}
75-
count = local.is_sandbox ? 0 : 1
75+
count = local.is_sandbox || !var.is_service_needed ? 0 : 1
7676
}
7777

7878
resource "aws_cloudwatch_metric_alarm" "ndr_ecs_service_cpu_low_alarm" {
@@ -87,7 +87,7 @@ resource "aws_cloudwatch_metric_alarm" "ndr_ecs_service_cpu_low_alarm" {
8787

8888
dimensions = {
8989
ClusterName = aws_ecs_cluster.ndr_ecs_cluster.name
90-
ServiceName = aws_ecs_service.ndr_ecs_service.name
90+
ServiceName = aws_ecs_service.ndr_ecs_service[0].name
9191
}
9292

9393
alarm_description = "The CPU usage for ${var.ecs_cluster_service_name} is currently belowe 15%, the autoscaling will begin scaling down."
@@ -99,5 +99,5 @@ resource "aws_cloudwatch_metric_alarm" "ndr_ecs_service_cpu_low_alarm" {
9999
Environment = var.environment
100100
Workspace = terraform.workspace
101101
}
102-
count = local.is_sandbox ? 0 : 1
102+
count = local.is_sandbox || !var.is_service_needed ? 0 : 1
103103
}

infrastructure/modules/ecs/lb.tf

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
resource "aws_lb" "ecs_lb" {
2+
count = var.is_lb_needed ? 1 : 0
23
name = "${terraform.workspace}-lb"
34
internal = false
45
load_balancer_type = "application"
@@ -21,6 +22,8 @@ resource "aws_lb" "ecs_lb" {
2122
}
2223

2324
resource "aws_lb_target_group" "ecs_lb_tg" {
25+
count = var.is_lb_needed ? 1 : 0
26+
2427
name = "${terraform.workspace}-ecs"
2528
port = 80
2629
protocol = "HTTP"
@@ -46,32 +49,37 @@ resource "aws_lb_target_group" "ecs_lb_tg" {
4649
}
4750

4851
resource "aws_lb_listener" "https" {
49-
load_balancer_arn = aws_lb.ecs_lb.arn
52+
count = var.is_lb_needed ? 1 : 0
53+
load_balancer_arn = aws_lb.ecs_lb[0].arn
5054
port = "443"
5155
protocol = "HTTPS"
5256
ssl_policy = "ELBSecurityPolicy-TLS13-1-2-2021-06"
53-
certificate_arn = data.aws_acm_certificate.amazon_issued.arn
57+
certificate_arn = data.aws_acm_certificate.amazon_issued[0].arn
5458

5559
default_action {
5660
type = "forward"
57-
target_group_arn = aws_lb_target_group.ecs_lb_tg.arn
61+
target_group_arn = aws_lb_target_group.ecs_lb_tg[0].arn
5862
}
5963
}
6064

6165
data "aws_acm_certificate" "amazon_issued" {
66+
count = var.is_lb_needed ? 1 : 0
67+
6268
domain = var.certificate_domain
6369
types = ["AMAZON_ISSUED"]
6470
most_recent = true
6571
}
6672

6773
resource "aws_lb_listener" "http" {
68-
load_balancer_arn = aws_lb.ecs_lb.arn
74+
count = var.is_lb_needed ? 1 : 0
75+
76+
load_balancer_arn = aws_lb.ecs_lb[0].arn
6977
port = "80"
7078
protocol = "HTTP"
7179

7280
default_action {
7381
type = "redirect"
74-
target_group_arn = aws_lb_target_group.ecs_lb_tg.arn
82+
target_group_arn = aws_lb_target_group.ecs_lb_tg[0].arn
7583
redirect {
7684
port = "443"
7785
protocol = "HTTPS"

0 commit comments

Comments
 (0)