@@ -25,8 +25,8 @@ data "aws_region" "current" {
25
25
26
26
locals {
27
27
enable_http_on_alb = var. alb_http_enabled && var. alb_https_enabled && var. alb_http_to_https_redirect_enabled ? false : var. alb_http_enabled
28
- redirect_resources_count = local. enable_http_on_alb ? 1 : 0
29
- redirect_code = var. alb_http_to_https_redirect_permanent ? 302 : 301
28
+ redirect_resources_count = local. enable_http_on_alb == false ? 1 : 0
29
+ redirect_code = var. alb_http_to_https_redirect_permanent ? " 302" : " 301"
30
30
31
31
ec2_asg_resources_count = var. ec2_asg_enabled ? 1 : 0
32
32
ec2_nat_setup = var. vpc_nat_gateway_enabled || var. vpc_nat_instance_enabled
@@ -111,22 +111,16 @@ echo 'ECS_CLUSTER=${module.ecs.this_ecs_cluster_name}' >> /etc/ecs/ecs.config
111
111
echo 'ECS_DISABLE_PRIVILEGED=${ var . ecs_disable_privilegged_mode } ' >> /etc/ecs/ecs.config
112
112
echo 'ECS_AVAILABLE_LOGGING_DRIVERS=["awslogs","fluentd"]' >> /etc/ecs/ecs.config
113
113
USERDATA
114
-
115
- # https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-networking.html
116
- vpc_subnets_ids = {
117
- private = module.dynamic_subnets.private_subnet_ids
118
- public = module.dynamic_subnets.public_subnet_ids
119
- }
120
114
}
121
115
122
116
module "ecs_instance_label" {
123
117
source = " git::https://github.com/cloudposse/terraform-null-label.git?ref=tags/0.16.0"
124
- attributes = [ compact (concat (var. attributes , [" ecs" , " instance" ]))]
118
+ attributes = compact (concat (var. attributes , [" ecs" , " instance" ]))
125
119
delimiter = var. delimiter
126
120
name = var. name
127
121
namespace = var. namespace
128
122
stage = var. stage
129
- tags = merge ({
123
+ tags = merge ({
130
124
" Cluster" = module.ecs.this_ecs_cluster_name
131
125
}, var. tags )
132
126
}
@@ -200,7 +194,7 @@ module "autoscaling_group" {
200
194
stage = var. stage
201
195
tags = module. ecs_instance_label . tags
202
196
203
- security_group_ids = [ var . ec2_asg_security_group_ids , aws_security_group . ecs_instance [0 ]. id ]
197
+ security_group_ids = compact ( concat ( var. ec2_asg_security_group_ids , [ aws_security_group . ecs_instance [0 ]. id ]))
204
198
subnet_ids = local. ec2_nat_setup ? module. dynamic_subnets . private_subnet_ids : module. dynamic_subnets . public_subnet_ids
205
199
206
200
image_id = data. aws_ami . amazon_linux_ecs [0 ]. id
@@ -353,9 +347,7 @@ module "alb_target_group_alarms" {
353
347
stage = var. stage
354
348
tags = var. tags
355
349
356
- alb_name = module. alb . alb_name
357
350
alb_arn_suffix = module. alb . alb_arn_suffix
358
- target_group_name = data. aws_alb_target_group . default . name
359
351
target_group_arn_suffix = data. aws_alb_target_group . default . arn_suffix
360
352
target_3xx_count_threshold = var. alb_target_group_alarms_3xx_threshold
361
353
target_4xx_count_threshold = var. alb_target_group_alarms_4xx_threshold
@@ -364,9 +356,15 @@ module "alb_target_group_alarms" {
364
356
period = var. alb_target_group_alarms_period
365
357
evaluation_periods = var. alb_target_group_alarms_evaluation_periods
366
358
367
- ok_actions = var. alb_target_group_alarms_ok_actions
368
- alarm_actions = var. alb_target_group_alarms_alarm_actions
369
- insufficient_data_actions = var. alb_target_group_alarms_insufficient_data_actions
359
+ # https://github.com/cloudposse/terraform-aws-alb-target-group-cloudwatch-sns-alarms/pull/18
360
+ ok_actions = [aws_sns_topic . default . arn ]
361
+ alarm_actions = [aws_sns_topic . default . arn ]
362
+ insufficient_data_actions = [aws_sns_topic . default . arn ]
363
+ notify_arns = [aws_sns_topic . default . arn ]
364
+ }
365
+
366
+ resource "aws_sns_topic" "default" {
367
+ name = " test"
370
368
}
371
369
372
370
# ############################################################
@@ -375,7 +373,7 @@ module "alb_target_group_alarms" {
375
373
376
374
module "traefik" {
377
375
source = " git::https://github.com/aleks-fofanov/terraform-aws-ecs-traefik-service.git?ref=terraform012_migration"
378
- attributes = [ compact (concat (var. attributes , [" traefik" ]))]
376
+ attributes = compact (concat (var. attributes , [" traefik" ]))
379
377
delimiter = var. delimiter
380
378
name = var. name
381
379
namespace = var. namespace
0 commit comments