cloudposse / terraform-aws-ecs-container-definition

Terraform module to generate well-formed JSON documents (container definitions) that are passed to the aws_ecs_task_definition Terraform resource
https://cloudposse.com/accelerate
Apache License 2.0
339 stars 244 forks source link

Cleaner multiple definition example using json_map #131

Closed nitrocode closed 3 years ago

nitrocode commented 3 years ago

what

why

references

N/A

nitrocode commented 3 years ago

/test all

Gowiem commented 3 years ago

@nitrocode if validate-codeowners doesn't complete then you might need to push an empty commit:

git commit --allow-empty -m "feat: trigger CI"
nitrocode commented 3 years ago

I think I messed it up...

nitrocode commented 3 years ago

/test all

nitrocode commented 3 years ago

Is something broken with this ?

https://github.com/cloudposse/terraform-aws-ecs-container-definition/blob/549d7a09ea946e889e78904d0a136107b4a2c49c/examples/multiple_definitions/main.tf#L49-L55

CaseyLabs commented 3 years ago

That's what I'm trying to figure out at the moment. This block:

resource "aws_ecs_task_definition" "main" {
  family = local.unique_name
  container_definitions = jsonencode([
    module.first_container.json_map,
    module.second_container.json_map
  ])
}

Results in This object does not have an attribute named "json_map" for both objects.

This works however:

resource "aws_ecs_task_definition" "main" {
  family = local.unique_name
  container_definitions = jsonencode([
    module.first_container.json_map_encoded,
    module.second_container.json_map_encoded
  ])
}

I'm on my first coffee this morning, so may be missing something on my side ;-)

nitrocode commented 3 years ago

Ah you're right. Thank you. https://github.com/cloudposse/terraform-aws-ecs-container-definition/pull/132