Skip to content

Commit

Permalink
feat: add appProtocol and name to var.port_mappings
Browse files Browse the repository at this point in the history
  • Loading branch information
jtribble committed Sep 26, 2023
1 parent 19bc586 commit 2c03cfa
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 13 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ No resources.
|------|-------------|------|---------|:--------:|
| <a name="input_command"></a> [command](#input\_command) | The command that is passed to the container | `list(string)` | `null` | no |
| <a name="input_container_cpu"></a> [container\_cpu](#input\_container\_cpu) | The number of cpu units to reserve for the container. This is optional for tasks using Fargate launch type and the total amount of container\_cpu of all containers in a task will need to be lower than the task-level cpu value | `number` | `0` | no |
| <a name="input_container_definition"></a> [container\_definition](#input\_container\_definition) | Container definition overrides which allows for extra keys or overriding existing keys. | <pre>object({<br> command = optional(list(string))<br> cpu = optional(number)<br> dependsOn = optional(list(object({<br> condition = string<br> containerName = string<br> })))<br> disableNetworking = optional(bool)<br> dnsSearchDomains = optional(list(string))<br> dnsServers = optional(list(string))<br> dockerLabels = optional(map(string))<br> dockerSecurityOptions = optional(list(string))<br> entryPoint = optional(list(string))<br> environment = optional(list(object({<br> name = string<br> value = string<br> })))<br> environmentFiles = optional(list(object({<br> type = string<br> value = string<br> })))<br> essential = optional(bool)<br> extraHosts = optional(list(object({<br> hostname = string<br> ipAddress = string<br> })))<br> firelensConfiguration = optional(object({<br> options = optional(map(string))<br> type = string<br> }))<br> healthCheck = optional(object({<br> command = list(string)<br> interval = optional(number)<br> retries = optional(number)<br> startPeriod = optional(number)<br> timeout = optional(number)<br> }))<br> hostname = optional(string)<br> image = optional(string)<br> interactive = optional(bool)<br> links = optional(list(string))<br> linuxParameters = optional(object({<br> capabilities = optional(object({<br> add = optional(list(string))<br> drop = optional(list(string))<br> }))<br> devices = optional(list(object({<br> containerPath = string<br> hostPath = string<br> permissions = optional(list(string))<br> })))<br> initProcessEnabled = optional(bool)<br> maxSwap = optional(number)<br> sharedMemorySize = optional(number)<br> swappiness = optional(number)<br> tmpfs = optional(list(object({<br> containerPath = string<br> mountOptions = optional(list(string))<br> size = number<br> })))<br> }))<br> logConfiguration = optional(object({<br> logDriver = string<br> options = optional(map(string))<br> secretOptions = optional(list(object({<br> name = string<br> valueFrom = string<br> })))<br> }))<br> memory = optional(number)<br> memoryReservation = optional(number)<br> mountPoints = optional(list(object({<br> containerPath = optional(string)<br> readOnly = optional(bool)<br> sourceVolume = optional(string)<br> })))<br> name = optional(string)<br> portMappings = optional(list(object({<br> name = optional(string)<br> containerPort = number<br> hostPort = optional(number)<br> protocol = optional(string)<br> })))<br> privileged = optional(bool)<br> pseudoTerminal = optional(bool)<br> readonlyRootFilesystem = optional(bool)<br> repositoryCredentials = optional(object({<br> credentialsParameter = string<br> }))<br> resourceRequirements = optional(list(object({<br> type = string<br> value = string<br> })))<br> secrets = optional(list(object({<br> name = string<br> valueFrom = string<br> })))<br> startTimeout = optional(number)<br> stopTimeout = optional(number)<br> systemControls = optional(list(object({<br> namespace = string<br> value = string<br> })))<br> ulimits = optional(list(object({<br> hardLimit = number<br> name = string<br> softLimit = number<br> })))<br> user = optional(string)<br> volumesFrom = optional(list(object({<br> readOnly = optional(bool)<br> sourceContainer = string<br> })))<br> workingDirectory = optional(string)<br> })</pre> | `{}` | no |
| <a name="input_container_definition"></a> [container\_definition](#input\_container\_definition) | Container definition overrides which allows for extra keys or overriding existing keys. | <pre>object({<br> command = optional(list(string))<br> cpu = optional(number)<br> dependsOn = optional(list(object({<br> condition = string<br> containerName = string<br> })))<br> disableNetworking = optional(bool)<br> dnsSearchDomains = optional(list(string))<br> dnsServers = optional(list(string))<br> dockerLabels = optional(map(string))<br> dockerSecurityOptions = optional(list(string))<br> entryPoint = optional(list(string))<br> environment = optional(list(object({<br> name = string<br> value = string<br> })))<br> environmentFiles = optional(list(object({<br> type = string<br> value = string<br> })))<br> essential = optional(bool)<br> extraHosts = optional(list(object({<br> hostname = string<br> ipAddress = string<br> })))<br> firelensConfiguration = optional(object({<br> options = optional(map(string))<br> type = string<br> }))<br> healthCheck = optional(object({<br> command = list(string)<br> interval = optional(number)<br> retries = optional(number)<br> startPeriod = optional(number)<br> timeout = optional(number)<br> }))<br> hostname = optional(string)<br> image = optional(string)<br> interactive = optional(bool)<br> links = optional(list(string))<br> linuxParameters = optional(object({<br> capabilities = optional(object({<br> add = optional(list(string))<br> drop = optional(list(string))<br> }))<br> devices = optional(list(object({<br> containerPath = string<br> hostPath = string<br> permissions = optional(list(string))<br> })))<br> initProcessEnabled = optional(bool)<br> maxSwap = optional(number)<br> sharedMemorySize = optional(number)<br> swappiness = optional(number)<br> tmpfs = optional(list(object({<br> containerPath = string<br> mountOptions = optional(list(string))<br> size = number<br> })))<br> }))<br> logConfiguration = optional(object({<br> logDriver = string<br> options = optional(map(string))<br> secretOptions = optional(list(object({<br> name = string<br> valueFrom = string<br> })))<br> }))<br> memory = optional(number)<br> memoryReservation = optional(number)<br> mountPoints = optional(list(object({<br> containerPath = optional(string)<br> readOnly = optional(bool)<br> sourceVolume = optional(string)<br> })))<br> name = optional(string)<br> portMappings = optional(list(object({<br> appProtocol = optional(string) # http, http2, grpc (defaults to tcp)<br> containerPort = optional(number)<br> containerPortRange = optional(string)<br> hostPort = optional(number)<br> name = optional(string)<br> protocol = optional(string) # tcp (default), udp<br> })))<br> privileged = optional(bool)<br> pseudoTerminal = optional(bool)<br> readonlyRootFilesystem = optional(bool)<br> repositoryCredentials = optional(object({<br> credentialsParameter = string<br> }))<br> resourceRequirements = optional(list(object({<br> type = string<br> value = string<br> })))<br> secrets = optional(list(object({<br> name = string<br> valueFrom = string<br> })))<br> startTimeout = optional(number)<br> stopTimeout = optional(number)<br> systemControls = optional(list(object({<br> namespace = string<br> value = string<br> })))<br> ulimits = optional(list(object({<br> hardLimit = number<br> name = string<br> softLimit = number<br> })))<br> user = optional(string)<br> volumesFrom = optional(list(object({<br> readOnly = optional(bool)<br> sourceContainer = string<br> })))<br> workingDirectory = optional(string)<br>})</pre> | `{}` | no |
| <a name="input_container_depends_on"></a> [container\_depends\_on](#input\_container\_depends\_on) | The dependencies defined for container startup and shutdown. A container can contain multiple dependencies. When a dependency is defined for container startup, for container shutdown it is reversed. The condition can be one of START, COMPLETE, SUCCESS or HEALTHY | <pre>list(object({<br> condition = string<br> containerName = string<br> }))</pre> | `null` | no |
| <a name="input_container_image"></a> [container\_image](#input\_container\_image) | The image used to start the container. Images in the Docker Hub registry available by default | `string` | n/a | yes |
| <a name="input_container_memory"></a> [container\_memory](#input\_container\_memory) | The amount of memory (in MiB) to allow the container to use. This is a hard limit, if the container attempts to exceed the container\_memory, the container is killed. This field is optional for Fargate launch type and the total amount of container\_memory of all containers in a task will need to be lower than the task memory value | `number` | `null` | no |
Expand Down
11 changes: 7 additions & 4 deletions examples/complete/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,14 @@ variable "container_memory_reservation" {
# https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_PortMapping.html
variable "port_mappings" {
type = list(object({
containerPort = number
hostPort = optional(number)
protocol = optional(string)
appProtocol = optional(string) # http, http2, grpc (defaults to tcp)
containerPort = optional(number)
containerPortRange = optional(string)
hostPort = optional(number)
name = optional(string)
protocol = optional(string) # tcp (default), udp
}))
description = "The port mappings to configure for the container. This is a list of maps. Each map should contain \"containerPort\", \"hostPort\", and \"protocol\", where \"protocol\" is one of \"tcp\" or \"udp\". If using 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"
description = "The port mappings to configure for the container. This is a list of maps. Each map should contain `containerPort`, `hostPort`, and `protocol`, where `protocol` is one of `tcp` or `udp`. If using 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`"
default = null
}

Expand Down
21 changes: 13 additions & 8 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,12 @@ variable "container_definition" {
})))
name = optional(string)
portMappings = optional(list(object({
name = optional(string)
containerPort = number
hostPort = optional(number)
protocol = optional(string)
appProtocol = optional(string) # http, http2, grpc (defaults to tcp)
containerPort = optional(number)
containerPortRange = optional(string)
hostPort = optional(number)
name = optional(string)
protocol = optional(string) # tcp (default), udp
})))
privileged = optional(bool)
pseudoTerminal = optional(bool)
Expand Down Expand Up @@ -144,11 +146,14 @@ variable "container_definition" {
# https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_PortMapping.html
variable "port_mappings" {
type = list(object({
containerPort = number
hostPort = optional(number)
protocol = optional(string)
appProtocol = optional(string) # http, http2, grpc (defaults to tcp)
containerPort = optional(number)
containerPortRange = optional(string)
hostPort = optional(number)
name = optional(string)
protocol = optional(string) # tcp (default), udp
}))
description = "The port mappings to configure for the container. This is a list of maps. Each map should contain \"containerPort\", \"hostPort\", and \"protocol\", where \"protocol\" is one of \"tcp\" or \"udp\". If using 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"
description = "The port mappings to configure for the container. This is a list of maps. Each map should contain `containerPort`, `hostPort`, and `protocol`, where `protocol` is one of `tcp` or `udp`. If using 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`"
default = null
}

Expand Down

0 comments on commit 2c03cfa

Please sign in to comment.