terraform-aws-ecs-container-definition icon indicating copy to clipboard operation
terraform-aws-ecs-container-definition copied to clipboard

Log Configuration Options should be options

Open fszymanski-blvd opened this issue 3 years ago • 2 comments

Found a bug? Maybe our Slack Community can help.

Slack Community

Describe the Bug

According to the log configuration documentation, the options section is not required. Our use case for this is a docker container with log configuration embedded in the dockerfile to allow for multiple outputs when using ECS Fargate.

If you try to create a container definition with the following setup

log_configuration = {
  logDriver = "json-file"
}

You will get the following error:

Error: Invalid function argument

  on .terraform/modules/fargate.container_definition/main.tf line 45, in locals:
  45:     options   = tomap(lookup(var.log_configuration, "options"))
    |----------------
    | var.log_configuration is object with 1 attribute "logDriver"

Invalid value for "inputMap" parameter: the given object has no attribute
"options"

Expected Behavior

The container definition should be created with empty options.

fszymanski-blvd avatar Jan 24 '22 20:01 fszymanski-blvd

Unfortunately every key needs to be defined

See this in our examples

https://github.com/cloudposse/terraform-aws-ecs-container-definition/blob/ec4c4a662fe3f5d9d8cf594a41d31e10e13bd8f9/examples/complete/fixtures.us-east-2.tfvars#L49-L56

For every key that is unneeded, try using null

nitrocode avatar Jan 28 '22 01:01 nitrocode

https://github.com/cloudposse/terraform-aws-ecs-container-definition/pull/154 should resolve

obataku avatar Aug 09 '22 04:08 obataku