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

Add support for multiple ports on container #37

Open
dragonfleas opened this issue Feb 27, 2024 · 0 comments
Open

Add support for multiple ports on container #37

dragonfleas opened this issue Feb 27, 2024 · 0 comments
Assignees
Labels
terraform Pull requests that update Terraform code

Comments

@dragonfleas
Copy link
Contributor

Add support for multiple ports on container

Description:

We probably want to enable a range of ports to be exposed from the container. By changing

variable "container_port" {
type = number
description = "Port exposed by the container"
}

to container_ports respectively, as an array of ports.
This would introduce breaking changes so we'd need another major version release if we decide to do this.

We can omit host_ports and should actually refactor the module to not use host_ports after this due to this information from the ECS Task Definition docs in AWS

If you specify a containerPortRange, leave this field empty and the value of the hostPort is set as follows:

For containers in a task with the awsvpc network mode, the hostPort is set to the same value as the containerPort. This is a static mapping strategy.

For containers in a task with the bridge network mode, the Amazon ECS agent finds open ports on the host and automatically binds them to the container ports. This is a dynamic mapping strategy.

If you use containers in a task with the awsvpc or host network mode, the hostPort can either be left blank or set to the same value as the containerPort.

We have the network mode hardcoded to awsvpc

Acceptance Criteria:

  • Refactor use of ports to omit host_port/s
  • Introduce container_ports variable as array of ports
  • Write unit tests to validate container_ports types and port number validity for fast failures using a combination of variable input validation and new tf unit tests
@dragonfleas dragonfleas added the terraform Pull requests that update Terraform code label Feb 27, 2024
@dragonfleas dragonfleas self-assigned this Feb 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
terraform Pull requests that update Terraform code
Projects
None yet
Development

No branches or pull requests

1 participant