diff --git a/container_definition.tf b/container_definition.tf index afa757a..f9da8f2 100644 --- a/container_definition.tf +++ b/container_definition.tf @@ -35,13 +35,14 @@ locals { } } : null) - portMappings = [ + # concat with var.extra_port_mappings + portMappings = concat([ { hostPort = var.container_port, containerPort = var.container_port, protocol = "tcp" } - ] + ], var.extra_port_mappings) ulimits = startswith(upper(var.operating_system_family), "WINDOWS") ? [] : [ { diff --git a/variables.tf b/variables.tf index d348ce5..20cbb93 100644 --- a/variables.tf +++ b/variables.tf @@ -324,6 +324,16 @@ variable "efs_volumes" { type = any } +variable "extra_port_mappings" { + default = [] + description = "Additional ports to be exposed from the container." + type = list(object({ + hostPort = number + containerPort = number + protocol = optional(string, "tcp") + })) +} + variable "firelens" { description = "Configuration for optional custom log routing using FireLens over fluentbit sidecar. Enable `attach_init_config_s3_policy` to attach an IAM policy granting access to the init config files on S3." default = {}