Skip to content

Commit

Permalink
added container_name variable
Browse files Browse the repository at this point in the history
  • Loading branch information
VladVolchkov committed Jun 23, 2020
1 parent 29976e2 commit 51c0ea3
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ EOF
| container\_cpu | Amount of cpu used by the task | string | `512` | no |
| container\_definitions | Fargate container definition | string | see default value bellow this table | no |
| container\_memory | Amount of memory used by the task | string | `1024` | no |
| container\_name | Defines container name which will be used as target in ALB target group. If not set ${var.project}-${var.service} value will be used. | string | `` | no |
| container\_port | exposed port in container | string | `80` | no |
| ecs\_cluster\_id | ID of existing ECS cluster (if want to attach service and etc to existing cluster) | string | `none` | no |
| environment | Environment name is used to identify resources | string | `env` | no |
Expand Down
2 changes: 1 addition & 1 deletion ecs-cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ resource "aws_ecs_service" "this" {

load_balancer {
target_group_arn = "${var.alb_target_group_arn}"
container_name = "${var.service}-${var.environment}"
container_name = "${var.container_name == "" ? var.service-var.environment : var.container_name}"
container_port = "${var.container_port}"
}

Expand Down
5 changes: 5 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ variable "container_memory" {
default = "1024"
}

variable "container_name" {
description = "Defines container name which will be used as target in ALB target group. If not set ${var.project}-${var.service} value will be used."
default = ""
}

variable "health_check_grace_period_seconds" {
description = "Seconds to ignore failing load balancer health checks on newly instantiated tasks to prevent premature shutdown"
default = "30"
Expand Down

0 comments on commit 51c0ea3

Please sign in to comment.