File tree Expand file tree Collapse file tree 6 files changed +33
-11
lines changed
examples/multiple-target-groups Expand file tree Collapse file tree 6 files changed +33
-11
lines changed Original file line number Diff line number Diff line change 11repos :
22- repo : https://github.com/pre-commit/pre-commit-hooks
3- rev : v4.1 .0
3+ rev : v4.2 .0
44 hooks :
55 - id : check-added-large-files
66 args : ['--maxkb=500']
1717 - id : detect-aws-credentials
1818 args : ['--allow-missing-credentials']
1919 - id : trailing-whitespace
20- - repo : git ://github.com/antonbabenko/pre-commit-terraform
21- rev : v1.64 .0
20+ - repo : https ://github.com/antonbabenko/pre-commit-terraform
21+ rev : v1.71 .0
2222 hooks :
2323 - id : terraform_fmt
2424 - id : terraform_docs
25- - id : terraform_tflint
25+ - id : terraform_tflint
Original file line number Diff line number Diff line change @@ -5,6 +5,17 @@ All notable changes to this project will be documented in this file.
55<a name =" unreleased " ></a >
66## [ Unreleased]
77
8+ - removed whitespace
9+ - added distinct function to prevent a port being used multiple times
10+ - Added checks to ensure that errors are not generated when target_group ports mapping is used
11+ - Updated variable name
12+ - Updated file to prefer target_group ports if provided, else use task_container_port
13+
14+
15+ <a name =" 6.4.2 " ></a >
16+ ## [ 6.4.2] - 2022-03-11
17+
18+ - Refactor examples to work with provider 4.0.0+ ([ #53 ] ( https://github.com/umotif-public/terraform-aws-ecs-fargate/issues/53 ) )
819- fix: setting ` task_health_command ` to null ([ #49 ] ( https://github.com/umotif-public/terraform-aws-ecs-fargate/issues/49 ) )
920
1021
@@ -224,7 +235,8 @@ All notable changes to this project will be documented in this file.
224235- Initial commit
225236
226237
227- [ Unreleased ] : https://github.com/umotif-public/terraform-aws-ecs-fargate/compare/6.4.1...HEAD
238+ [ Unreleased ] : https://github.com/umotif-public/terraform-aws-ecs-fargate/compare/6.4.2...HEAD
239+ [ 6.4.2 ] : https://github.com/umotif-public/terraform-aws-ecs-fargate/compare/6.4.1...6.4.2
228240[ 6.4.1 ] : https://github.com/umotif-public/terraform-aws-ecs-fargate/compare/6.4.0...6.4.1
229241[ 6.4.0 ] : https://github.com/umotif-public/terraform-aws-ecs-fargate/compare/6.3.0...6.4.0
230242[ 6.3.0 ] : https://github.com/umotif-public/terraform-aws-ecs-fargate/compare/6.2.2...6.3.0
Original file line number Diff line number Diff line change @@ -77,21 +77,21 @@ module "ecs-fargate" {
7777
7878## Authors
7979
80- Module managed by [ Marcin Cuber ] ( https://github.com/marcincuber ) [ LinkedIn] ( https://www.linkedin.com/in/marcincuber / ) .
80+ Module managed by [ Abdul Wahid ] ( https://github.com/Ohid25 ) [ LinkedIn] ( https://www.linkedin.com/in/abdulwahid / ) .
8181
8282<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
8383## Requirements
8484
8585| Name | Version |
8686| ------| ---------|
8787| <a name =" requirement_terraform " ></a > [ terraform] ( #requirement\_ terraform ) | >= 0.13.7 |
88- | <a name =" requirement_aws " ></a > [ aws] ( #requirement\_ aws ) | >= 3.34 |
88+ | <a name =" requirement_aws " ></a > [ aws] ( #requirement\_ aws ) | >= 4.0.0 |
8989
9090## Providers
9191
9292| Name | Version |
9393| ------| ---------|
94- | <a name =" provider_aws " ></a > [ aws] ( #provider\_ aws ) | >= 3.34 |
94+ | <a name =" provider_aws " ></a > [ aws] ( #provider\_ aws ) | >= 4.0.0 |
9595
9696## Modules
9797
Original file line number Diff line number Diff line change @@ -136,7 +136,7 @@ module "fargate" {
136136 target_groups = [
137137 {
138138 target_group_name = " external-alb"
139- container_port = 80
139+ container_port = 443
140140 },
141141 {
142142 target_group_name = " internal-alb"
@@ -186,4 +186,3 @@ resource "aws_security_group_rule" "test_sg_ingress" {
186186 to_port = 3022
187187 source_security_group_id = module. fargate . service_sg_id
188188}
189-
Original file line number Diff line number Diff line change @@ -140,6 +140,13 @@ locals {
140140 value = v
141141 }
142142 ]
143+
144+ target_group_portMaps = length (var. target_groups ) > 0 ? distinct ([
145+ for tg in var . target_groups : {
146+ containerPort = contains (keys (tg), " container_port" ) ? tg . container_port : var . task_container_port
147+ protocol = contains (keys (tg), " protocol" ) ? lower (tg. protocol ) : " tcp"
148+ }
149+ ]) : []
143150}
144151
145152resource "aws_ecs_task_definition" "task" {
@@ -168,6 +175,9 @@ resource "aws_ecs_task_definition" "task" {
168175 },
169176 %{ ~endif }
170177 "essential": true,
178+ %{ if length (local. target_group_portMaps ) > 0 }
179+ "portMappings": ${ jsonencode (local. target_group_portMaps )} ,
180+ %{ else }
171181 %{ if var . task_container_port != 0 || var . task_host_port != 0 ~}
172182 "portMappings": [
173183 {
@@ -181,6 +191,7 @@ resource "aws_ecs_task_definition" "task" {
181191 }
182192 ],
183193 %{ ~endif }
194+ %{ ~endif }
184195 "logConfiguration": {
185196 "logDriver": "awslogs",
186197 "options": {
Original file line number Diff line number Diff line change @@ -2,6 +2,6 @@ terraform {
22 required_version = " >= 0.13.7"
33
44 required_providers {
5- aws = " >= 3.34 "
5+ aws = " >= 4.0.0 "
66 }
77}
You can’t perform that action at this time.
0 commit comments