Log driver awslogs requires options
Closed this issue · 3 comments
Description
I have set cloudwatch_log_group_name. However, I am getting "Error: creating ECS Task Definition (ddagent-p): ClientException: Log driver awslogs requires options: awslogs-group". The example does not set awslogs-group.
⚠️ Note
Before you submit an issue, please perform the following first:
- Remove the local
.terraform
directory (! ONLY if state is stored remotely, which hopefully you are following that best practice!):rm -rf .terraform/
- Re-initialize the project root to pull down modules:
terraform init
- Re-attempt your terraform plan or apply and check if the issue still persists
Versions
-
Module version [Required]: 5.9.1
-
Terraform version: 1.7.3
- Provider version(s): aws v5.37.0
Reproduction Code [Required]
Steps to reproduce the behavior:
My terraform configuration file is pretty similar to the EC2 example:
enable_cloudwatch_logging = true
create_cloudwatch_log_group = true
cloudwatch_log_group_name = "/aws/ecs/X-p"
cloudwatch_log_group_retention_in_days = 7
log_configuration = {
logDriver = "awslogs"
options = {
awslogs-region = "X-X-2"
}
}
Expected behavior
ECS service is created with related cloudwatch log group.
Actual behavior
Error: creating ECS Task Definition (X-p): ClientException: Log driver awslogs requires options: awslogs-group
Terminal Output Screenshot(s)
Additional context
@monelgordillo @bryantbiggs yes, the current example is not fully correct because Terraform doesn't support deep map merge. My apologies that I didn't pay attention to Terraform's shallow merge behavior while making it 😕.
I've prepared a fix for the EC2 example - #170
Based on that, to define a custom log_configuration
, it's required to define all params at the log_configuration.options
map or use defaults defined at the appropriate local.
terraform-aws-ecs/modules/container-definition/main.tf
Lines 8 to 18 in 45f532c
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.