telia-oss / terraform-aws-ecs-fargate

Terraform module which creates Fargate ECS resources on AWS.
https://registry.terraform.io/modules/telia-oss/ecs-fargate/aws
MIT License
82 stars 75 forks source link

add Log Configurations #76

Open yuvalberk opened 1 year ago

yuvalberk commented 1 year ago

Feature request

please add the option to add Log Configuration to the Container definitions in the task Definition

container_definitions = <<DEFINITION [ { "name": "${var.repository_name}", "image": "${var.repository_uri}", "essential": true, "portMappings": [ { "containerPort": 5000, "hostPort": 5000 } ], "logConfiguration": { "logDriver": "awslogs", "options": { "awslogs-group": "${var.cloudwatch_group}", "awslogs-region": "eu-central-1", "awslogs-stream-prefix": "ecs" } } } ] DEFINITION

larstobi commented 1 year ago

@yuvalberk Thanks for opening this issue!

Would you like to only specify the log group and stream, or also other parameters?

yuvalberk commented 1 year ago

Actually, I added the future locally on my repo.

  I just added this to the variables.tf:

variable "awslogs-stream-prefix" {

  type = string

  default = "container"

}

  And changed the - awslogs-stream-prefix  in the main.tf:

  log_configuration_options = merge({

    "awslogs-group"         = var.log_group_name != "" ? var.log_group_name : aws_cloudwatch_log_group.main.0.name,

    "awslogs-region"        = data.aws_region.current.name

    "awslogs-stream-prefix" = var.awslogs-stream-prefix

  }, local.log_multiline_pattern)

Maybe the awslogs-group parameter can also be given to the user as a choice to specify and if not this will be the default value

There is another problem with the new version, it gives an error message which is this

“Could not retrieve the list of available versions for provider hashicorp/aws: no available releases match the given constraints >= 3.27.0, >= 3.29.0, >= 3.67.0, >= 3.69.0, ~> 3.69.0, >= 3.73.0, >= 4.6.0, >=     

│ 4.9.0”

  I couldn’t find out why it is happening so I had to use version "6.2.0"

  Please fix this issue first,

Thanks !!

From: Lars Tobias Skjong-Børsting @.> Sent: Wednesday, October 26, 2022 16:06 To: telia-oss/terraform-aws-ecs-fargate @.> Cc: Yuval Berkman @.>; Mention @.> Subject: Re: [telia-oss/terraform-aws-ecs-fargate] add Log Configurations (Issue #76)

  @yuvalberk https://github.com/yuvalberk Thanks for opening this issue!

Would you like to only specify the log group and stream, or also other parameters?

— Reply to this email directly, view it on GitHub https://github.com/telia-oss/terraform-aws-ecs-fargate/issues/76#issuecomment-1292005098 , or unsubscribe https://github.com/notifications/unsubscribe-auth/A2KLD7FMN7ZQXQQSN2RE6JTWFEUBZANCNFSM6AAAAAARO64N7M . You are receiving this because you were mentioned.Message ID: @. @.> >

k1rd3rf commented 1 year ago

Would it be possible to add the ability to override the whole logConfiguration object?

I.e. I would like to use awsfirelens as log driver, and set some options, per: https://docs.datadoghq.com/integrations/ecs_fargate/?tab=webui#fluent-bit-and-firelens