Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support multiple container ports #54

Closed
networkprogrammer opened this issue Mar 17, 2022 · 4 comments
Closed

Support multiple container ports #54

networkprogrammer opened this issue Mar 17, 2022 · 4 comments
Labels
bug Something isn't working

Comments

@networkprogrammer
Copy link
Contributor

What is the current behavior?
The portMapping list of the task definition only lists 1 port as defined in task_container_port. Since target-group lists container_port, that value should be used to populate portMapping

Terraform fails when trying to map TG container port to a non-existent portMapping

 Error: failed creating ECS service (ecs-fargate-example): InvalidParameterException: The container ecs-fargate-example did not have a container port 5672 defined.
│ 
│   with module.fargate.aws_ecs_service.service,
│   on .terraform/modules/fargate/main.tf line 295, in resource "aws_ecs_service" "service":
│  295: resource "aws_ecs_service" "service" {

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem.
Example code
https://gist.github.com/networkprogrammer/3c64d16d379098260309fea2e8aa7af4

What is the expected behavior?
Ideally, the container port should be picked from the tg's container port. That way AWS does not complain about port mapping not existing

Details
I have an nginx container listening on multiple ports. With task_container_port being used to populate port-mapping, I have to run multiple instances of the same container with task_container_port set to different ports, although they do the same thing.

Software versions?
Terraform v1.1.6
on linux_amd64

  • provider registry.terraform.io/hashicorp/aws v4.5.0
  • provider registry.terraform.io/hashicorp/random v3.1.1

umotif-public/ecs-fargate/aws: 6.4.2
umotif-public/alb/aws: 2.X

@Ohid25
Copy link
Contributor

Ohid25 commented Mar 17, 2022

Thank you for raising this issue - we've managed to identify the bug in the module that prevents multiple port mappings.

We've added this to our backlog and will work on this when we are able to.

@Ohid25 Ohid25 added the bug Something isn't working label Mar 17, 2022
@Ohid25 Ohid25 closed this as completed Apr 15, 2022
@networkprogrammer
Copy link
Contributor Author

I created PR #59 for this. Please review and merge as needed

@networkprogrammer
Copy link
Contributor Author

This issue still exists and should not have been closed. I submitted a PR #59 to help facilitate the functionality that this issue mentions

@Ohid25 Ohid25 reopened this May 12, 2022
@Ohid25
Copy link
Contributor

Ohid25 commented May 12, 2022

This is now solved as a part of @networkprogrammer's PR in 6.5.0.

Thanks again @networkprogrammer for the contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

No branches or pull requests

2 participants