File tree Expand file tree Collapse file tree 4 files changed +12
-1
lines changed Expand file tree Collapse file tree 4 files changed +12
-1
lines changed Original file line number Diff line number Diff line change 20
20
"readOnly": false
21
21
}],
22
22
"logConfiguration": {
23
+ %{ if cloudwatch >= 1 }
23
24
"logDriver": "awslogs",
24
25
"options": {
25
26
"awslogs-group": "${logs_group}",
26
27
"awslogs-stream-prefix": "${logs_stream_prefix}",
27
28
"awslogs-region": "${logs_region}"
28
29
}
30
+ %{ endif }
29
31
}
30
32
}]
Original file line number Diff line number Diff line change 1
1
resource "aws_cloudwatch_log_group" "this" {
2
- name = var. name
2
+ count = var. cloudwatch >= 1 ? 1 : 0
3
+
4
+ name = var. name
5
+ retention_in_days = var. cloudwatch
3
6
}
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ data "template_file" "container_definitions" {
10
10
volume_name = var.name
11
11
volume_path = " /data/db"
12
12
environment = jsonencode (var. environment )
13
+ cloudwatch = var.cloudwatch
13
14
logs_group = var.name
14
15
logs_stream_prefix = var.name
15
16
logs_region = data.aws_region.this.name
Original file line number Diff line number Diff line change @@ -39,6 +39,11 @@ variable "volume_size" {
39
39
default = 0
40
40
}
41
41
42
+ variable "cloudwatch" {
43
+ type = number
44
+ default = 0
45
+ }
46
+
42
47
variable "environment" {
43
48
type = list (object ({ name = string , value = string }))
44
49
default = []
You can’t perform that action at this time.
0 commit comments