55
66 log_group_name = try (coalesce (var. cloudwatch_log_group_name , " /aws/ecs/${ var . service } /${ var . name } " ), " " )
77
8- log_configuration = merge (
8+ logConfiguration = merge (
99 { for k , v in {
1010 logDriver = " awslogs" ,
1111 options = {
@@ -14,58 +14,52 @@ locals {
1414 awslogs-stream-prefix = " ecs"
1515 },
1616 } : k => v if var . enable_cloudwatch_logging },
17- var. log_configuration
17+ var. logConfiguration
1818 )
1919
20- linux_parameters = var. enable_execute_command ? merge ({ " initProcessEnabled" : true }, var. linux_parameters ) : merge ({ " initProcessEnabled" : false }, var. linux_parameters )
21-
22- health_check = length (var. health_check ) > 0 ? merge ({
23- interval = 30 ,
24- retries = 3 ,
25- timeout = 5
26- }, var. health_check ) : null
20+ linuxParameters = var. enable_execute_command ? merge (var. linuxParameters , { " initProcessEnabled" : true }) : var. linuxParameters
2721
2822 definition = {
29- command = length ( var. command ) > 0 ? var.command : null
23+ command = var.command
3024 cpu = var.cpu
31- dependsOn = length ( var. dependencies ) > 0 ? var.dependencies : null # depends_on is a reserved word
32- disableNetworking = local.is_not_windows ? var.disable_networking : null
33- dnsSearchDomains = local.is_not_windows && length (var . dns_search_domains ) > 0 ? var.dns_search_domains : null
34- dnsServers = local.is_not_windows && length (var . dns_servers ) > 0 ? var.dns_servers : null
35- dockerLabels = length ( var. docker_labels ) > 0 ? var.docker_labels : null
36- dockerSecurityOptions = length ( var. docker_security_options ) > 0 ? var.docker_security_options : null
37- entrypoint = length ( var. entrypoint ) > 0 ? var.entrypoint : null
25+ dependsOn = var.dependsOn
26+ disableNetworking = local.is_not_windows ? var.disableNetworking : null
27+ dnsSearchDomains = local.is_not_windows ? var.dnsSearchDomains : null
28+ dnsServers = local.is_not_windows ? var.dnsServers : null
29+ dockerLabels = var.dockerLabels
30+ dockerSecurityOptions = var.dockerSecurityOptions
31+ entrypoint = var.entrypoint
3832 environment = var.environment
39- environmentFiles = length ( var. environment_files ) > 0 ? var.environment_files : null
33+ environmentFiles = var.environmentFiles
4034 essential = var.essential
41- extraHosts = local.is_not_windows && length (var . extra_hosts ) > 0 ? var.extra_hosts : null
42- firelensConfiguration = length ( var. firelens_configuration ) > 0 ? var.firelens_configuration : null
43- healthCheck = local.health_check
35+ extraHosts = local.is_not_windows ? var.extraHosts : null
36+ firelensConfiguration = var.firelensConfiguration
37+ healthCheck = var.healthCheck
4438 hostname = var.hostname
4539 image = var.image
4640 interactive = var.interactive
47- links = local.is_not_windows && length (var . links ) > 0 ? var.links : null
48- linuxParameters = local.is_not_windows && length (local . linux_parameters ) > 0 ? local.linux_parameters : null
49- logConfiguration = length (local. log_configuration ) > 0 ? local.log_configuration : null
41+ links = local.is_not_windows ? var.links : null
42+ linuxParameters = local.is_not_windows ? local.linuxParameters : null
43+ logConfiguration = length (local. logConfiguration ) > 0 ? local.logConfiguration : null
5044 memory = var.memory
51- memoryReservation = var.memory_reservation
52- mountPoints = var.mount_points
45+ memoryReservation = var.memoryReservation
46+ mountPoints = var.mountPoints
5347 name = var.name
54- portMappings = var.port_mappings
48+ portMappings = var.portMappings
5549 privileged = local.is_not_windows ? var.privileged : null
56- pseudoTerminal = var.pseudo_terminal
57- restartPolicy = var.restart_policy
58- readonlyRootFilesystem = local.is_not_windows ? var.readonly_root_filesystem : null
59- repositoryCredentials = length ( var. repository_credentials ) > 0 ? var.repository_credentials : null
60- resourceRequirements = length ( var. resource_requirements ) > 0 ? var.resource_requirements : null
61- secrets = length ( var. secrets ) > 0 ? var.secrets : null
62- startTimeout = var.start_timeout
63- stopTimeout = var.stop_timeout
64- systemControls = length ( var. system_controls ) > 0 ? var.system_controls : []
65- ulimits = local.is_not_windows && length (var . ulimits ) > 0 ? var.ulimits : null
50+ pseudoTerminal = var.pseudoTerminal
51+ restartPolicy = var.restartPolicy
52+ readonlyRootFilesystem = local.is_not_windows ? var.readonlyRootFilesystem : null
53+ repositoryCredentials = var.repositoryCredentials
54+ resourceRequirements = var.resourceRequirements
55+ secrets = var.secrets
56+ startTimeout = var.startTimeout
57+ stopTimeout = var.stopTimeout
58+ systemControls = var.systemControls
59+ ulimits = local.is_not_windows ? var.ulimits : null
6660 user = local.is_not_windows ? var.user : null
67- volumesFrom = var.volumes_from
68- workingDirectory = var.working_directory
61+ volumesFrom = var.volumesFrom
62+ workingDirectory = var.workingDirectory
6963 }
7064
7165 # Strip out all null values, ECS API will provide defaults in place of null/empty values
@@ -77,6 +71,7 @@ resource "aws_cloudwatch_log_group" "this" {
7771
7872 name = var. cloudwatch_log_group_use_name_prefix ? null : local. log_group_name
7973 name_prefix = var. cloudwatch_log_group_use_name_prefix ? " ${ local . log_group_name } -" : null
74+ log_group_class = var. cloudwatch_log_group_class
8075 retention_in_days = var. cloudwatch_log_group_retention_in_days
8176 kms_key_id = var. cloudwatch_log_group_kms_key_id
8277
0 commit comments