diff --git a/container/main.tf b/container/main.tf index 5563fba..7e356d5 100644 --- a/container/main.tf +++ b/container/main.tf @@ -10,7 +10,19 @@ locals { logConfiguration = var.log_configuration, secrets = var.secrets, environment = var.environment + healthCheck = var.health_check + systemControls = var.system_controls + command = var.command + startTimeout = var.start_timeout + stopTimeout = var.stop_timeout + entryPoint = var.entry_point + linuxParameters = var.linux_parameters } - container_definition_json = jsonencode(local.container_definition) - container_definition_list = jsonencode([local.container_definition]) + + filtered_container_definition = { + for key, value in local.container_definition : key => value if value != null + } + + container_definition_json = jsonencode(local.filtered_container_definition) + container_definition_list = jsonencode([local.filtered_container_definition]) } diff --git a/container/variables.tf b/container/variables.tf index 613bfc2..bfed4a4 100644 --- a/container/variables.tf +++ b/container/variables.tf @@ -20,11 +20,13 @@ variable "port_mappings" { variable "cpu" { description = "The number of cpu units to reserve for the container" type = number + default = null } variable "memory" { description = "The amount of memory (in MiB) to reserve for the container" type = number + default = null } variable "essential" { @@ -69,3 +71,60 @@ variable "mount_points" { readOnly = bool })) } + +variable "health_check" { + description = "The health check for the container" + type = object({ + command = list(string) + interval = number + timeout = number + retries = number + startPeriod = number + }) + default = null +} + +variable "system_controls" { + description = "The system controls for the container" + type = list(object({ + namespace = string + value = string + })) + default = null +} + +variable "command" { + description = "The command for the container" + type = list(string) + default = null +} + +variable "start_timeout" { + description = "The start timeout for the container" + type = number + default = null +} + +variable "stop_timeout" { + description = "The stop timeout for the container" + type = number + default = null +} + +variable "entry_point" { + description = "The entry point for the container" + type = list(string) + default = null +} + +variable "linux_parameters" { + description = "The linux parameters for the container" + type = object({ + capabilities = object({ + add = list(string) + drop = list(string) + }) + initProcessEnabled = bool + }) + default = null +} \ No newline at end of file