Skip to content

Commit 792e967

Browse files
committed
Fixing issues with new dependencies
1 parent 20e6261 commit 792e967

File tree

3 files changed

+53
-25
lines changed

3 files changed

+53
-25
lines changed

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Check versions for this module on:
1717

1818
module "td" {
1919
source = "cn-terraform/ecs-fargate-task-definition/aws"
20-
version = "1.0.4"
20+
version = "1.0.5"
2121
name_preffix = var.name_preffix
2222
profile = var.profile
2323
region = var.region
@@ -54,6 +54,9 @@ Check versions for this module on:
5454
* working_directory: (Optional) The working directory to run commands inside the container.
5555
* placement_constraints: (Optional) A set of placement constraints rules that are taken into consideration during task placement. Maximum number of placement_constraints is 10. This is a list of maps, where each map should contain "type" and "expression".
5656
* proxy_configuration: (Optional) The proxy configuration details for the App Mesh proxy. This is a list of maps, where each map should contain "container_name", "properties" and "type"
57+
* system_controls: A list of namespaced kernel parameters to set in the container, mapping to the --sysctl option to docker run. This is a list of maps: { namespace = \"\", value = \"\"}"
58+
* firelens_configuration: The FireLens configuration for the container. This is used to specify and configure a log router for container logs. For more details, see https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_FirelensConfiguration.html
59+
* log_configuration: Log configuration options to send to a custom log driver for the container. For more details, see https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_LogConfiguration.html
5760

5861
## Output values
5962

main.tf

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,6 @@ provider "aws" {
66
region = var.region
77
}
88

9-
# ---------------------------------------------------------------------------------------------------------------------
10-
# AWS Cloudwatch Logs
11-
# ---------------------------------------------------------------------------------------------------------------------
12-
module "aws_cw_logs" {
13-
source = "cn-terraform/cloudwatch-logs/aws"
14-
version = "1.0.3"
15-
logs_path = local.log_options["awslogs-group"]
16-
profile = var.profile
17-
region = var.region
18-
}
19-
209
# ---------------------------------------------------------------------------------------------------------------------
2110
# AWS ECS Task Execution Role
2211
# ---------------------------------------------------------------------------------------------------------------------
@@ -52,18 +41,20 @@ module "container_definition" {
5241
environment = var.environment
5342
secrets = var.secrets
5443
readonly_root_filesystem = var.readonly_root_filesystem
55-
log_driver = local.log_driver
56-
log_options = local.log_options
5744
mount_points = var.mount_points
5845
dns_servers = var.dns_servers
5946
ulimits = var.ulimits
47+
docker_labels = var.docker_labels
6048
repository_credentials = var.repository_credentials
6149
volumes_from = var.volumes_from
6250
links = var.links
6351
user = var.user
6452
container_depends_on = var.container_depends_on
6553
start_timeout = var.start_timeout
6654
stop_timeout = var.stop_timeout
55+
system_controls = var.system_controls
56+
firelens_configuration = var.firelens_configuration
57+
log_configuration = var.log_configuration
6758
}
6859

6960
# Task Definition

variables.tf

Lines changed: 45 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,12 @@ variable "dns_servers" {
6767
default = []
6868
}
6969

70+
variable "docker_labels" {
71+
type = map(string)
72+
description = "The configuration options to send to the `docker_labels`"
73+
default = null
74+
}
75+
7076
variable "entrypoint" {
7177
type = list
7278
description = "(Optional) The entry point that is passed to the container"
@@ -85,10 +91,27 @@ variable "essential" {
8591
default = "true"
8692
}
8793

94+
# https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_FirelensConfiguration.html
95+
variable "firelens_configuration" {
96+
type = object({
97+
type = string
98+
options = map(string)
99+
})
100+
description = "The FireLens configuration for the container. This is used to specify and configure a log router for container logs. For more details, see https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_FirelensConfiguration.html"
101+
default = null
102+
}
103+
104+
# https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_HealthCheck.html
88105
variable "healthcheck" {
89-
type = map
90-
description = "(Optional) A map containing command (string), interval (duration in seconds), retries (1-10, number of times to retry before marking container unhealthy, and startPeriod (0-300, optional grace period to wait, in seconds, before failed healthchecks count toward retries)"
91-
default = {}
106+
type = object({
107+
command = list(string)
108+
retries = number
109+
timeout = number
110+
interval = number
111+
startPeriod = number
112+
})
113+
description = "A map containing command (string), timeout, interval (duration in seconds), retries (1-10, number of times to retry before marking container unhealthy), and startPeriod (0-300, optional grace period to wait, in seconds, before failed healthchecks count toward retries)"
114+
default = null
92115
}
93116

94117
variable "links" {
@@ -97,13 +120,18 @@ variable "links" {
97120
default = []
98121
}
99122

100-
locals {
101-
log_driver = "awslogs"
102-
log_options = {
103-
"awslogs-region" = var.region
104-
"awslogs-group" = "/ecs/service/${var.name_preffix}"
105-
"awslogs-stream-prefix" = "ecs"
106-
}
123+
# https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_LogConfiguration.html
124+
variable "log_configuration" {
125+
type = object({
126+
logDriver = string
127+
options = map(string)
128+
secretOptions = list(object({
129+
name = string
130+
valueFrom = string
131+
}))
132+
})
133+
description = "Log configuration options to send to a custom log driver for the container. For more details, see https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_LogConfiguration.html"
134+
default = null
107135
}
108136

109137
variable "mount_points" {
@@ -121,7 +149,7 @@ locals {
121149
},
122150
]
123151
}
124-
152+
125153
variable "readonly_root_filesystem" {
126154
type = string
127155
description = "(Optional) Determines whether a container is given read-only access to its root filesystem. Due to how Terraform type casts booleans in json it is required to double quote this value"
@@ -145,6 +173,12 @@ variable "start_timeout" {
145173
default = 30
146174
}
147175

176+
variable "system_controls" {
177+
type = list(map(string))
178+
description = "A list of namespaced kernel parameters to set in the container, mapping to the --sysctl option to docker run. This is a list of maps: { namespace = \"\", value = \"\"}"
179+
default = null
180+
}
181+
148182
variable "stop_timeout" {
149183
description = "(Optional) Timeout in seconds between sending SIGTERM and SIGKILL to container"
150184
default = 30

0 commit comments

Comments
 (0)