Skip to content

Commit 9a645ee

Browse files
committed
Adding overrides for AB2D contracts.
1 parent 77868ee commit 9a645ee

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

terraform/modules/service/main.tf

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
locals {
2+
awslogs_group = var.awslogs_group_override != null ? var.awslogs_group_override : local.service_name
3+
container_name = var.container_name_override != null ? var.container_name_override : local.service_name
24
service_name = var.service_name_override != null ? var.service_name_override : var.platform.service
35
service_name_full = "${var.platform.app}-${var.platform.env}-${local.service_name}"
46
}
@@ -13,7 +15,7 @@ resource "aws_ecs_task_definition" "this" {
1315
memory = var.memory
1416
container_definitions = nonsensitive(jsonencode([
1517
{
16-
name = local.service_name
18+
name = local.container_name
1719
image = var.image
1820
readonlyRootFilesystem = true
1921
portMappings = var.port_mappings
@@ -23,7 +25,7 @@ resource "aws_ecs_task_definition" "this" {
2325
logConfiguration = {
2426
logDriver = "awslogs"
2527
options = {
26-
awslogs-group = "/aws/ecs/fargate/${var.platform.app}-${var.platform.env}/${local.service_name}"
28+
awslogs-group = "/aws/ecs/fargate/${var.platform.app}-${var.platform.env}/${local.awslogs_group}"
2729
awslogs-create-group = "true"
2830
awslogs-region = var.platform.primary_region.name
2931
awslogs-stream-prefix = "${var.platform.app}-${var.platform.env}"

terraform/modules/service/variables.tf

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
variable "awslogs_group_override" {
2+
default = null
3+
description = "Override to allow to non-standard log group names that do not match the service name."
4+
type = string
5+
}
6+
17
variable "cluster_arn" {
28
description = "The ecs cluster ARN hosting the service and task."
39
type = string
@@ -12,6 +18,12 @@ variable "container_environment" {
1218
default = null
1319
}
1420

21+
variable "container_name_override" {
22+
default = null
23+
description = "Override to allow for non-standard container names that do not match the service name."
24+
type = string
25+
}
26+
1527
variable "container_secrets" {
1628
description = "The secrets to pass to the container. For more information, see [Specifying Sensitive Data](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/specifying-sensitive-data.html) in the Amazon Elastic Container Service Developer Guide"
1729
type = list(object({

0 commit comments

Comments
 (0)