File tree Expand file tree Collapse file tree 5 files changed +15
-6
lines changed Expand file tree Collapse file tree 5 files changed +15
-6
lines changed Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ data "aws_iam_policy_document" "fluent_bit" {
41
41
42
42
data "aws_iam_policy_document" "fluent_bit_cw_and_s3" {
43
43
44
- for_each = var. fluent_bit_s3_bucket_enable ? { " enabled" = 1 } : {}
44
+ for_each = var. fluent_bit_enable_s3_output ? { " enabled" = 1 } : {}
45
45
46
46
statement {
47
47
sid = " PutLogEvents"
Original file line number Diff line number Diff line change @@ -38,7 +38,8 @@ locals {
38
38
tolerations = jsonencode (var. fluent_bit_tolerations ),
39
39
affinity = jsonencode (local. affinity ),
40
40
excluded_namespaces = var.fluent_bit_excluded_namespaces,
41
- s3_bucket_name = var.fluent_bit_s3_bucket_enable ? module.fluentbit_s3_bucket[0 ].s3_bucket_id : null ,
41
+ s3_bucket_name = var.fluent_bit_enable_s3_output ? module.fluentbit_s3_bucket[0 ].s3_bucket_id : null ,
42
+ cw_enable = var.fluent_bit_enable_cw_output
42
43
})
43
44
44
45
fluent_bit_helm_config = merge (
@@ -93,7 +94,7 @@ resource "aws_iam_policy" "fluent_bit_irsa" {
93
94
94
95
name = " ${ var . cluster_name } -fluentbit"
95
96
description = " IAM Policy for AWS for FluentBit IRSA"
96
- policy = var. fluent_bit_s3_bucket_enable ? data. aws_iam_policy_document . fluent_bit_cw_and_s3 [" enabled" ]. json : data. aws_iam_policy_document . fluent_bit . json
97
+ policy = var. fluent_bit_enable_s3_output ? data. aws_iam_policy_document . fluent_bit_cw_and_s3 [" enabled" ]. json : data. aws_iam_policy_document . fluent_bit . json
97
98
}
98
99
99
100
moved {
Original file line number Diff line number Diff line change 1
1
module "fluentbit_s3_bucket" {
2
- count = var. fluent_bit_s3_bucket_enable ? 1 : 0
2
+ count = var. fluent_bit_enable_s3_output ? 1 : 0
3
3
4
4
source = " terraform-aws-modules/s3-bucket/aws"
5
5
version = " ~> 4.6.1"
Original file line number Diff line number Diff line change @@ -135,6 +135,7 @@ config:
135
135
136
136
# # https://docs.fluentbit.io/manual/pipeline/outputs
137
137
outputs : |
138
+ %{if cw_enable == true}
138
139
[OUTPUT]
139
140
Name cloudwatch_logs
140
141
Match kube.*
@@ -143,6 +144,7 @@ config:
143
144
log_stream_template $kubernetes['namespace_name'].$kubernetes['pod_name'].$kubernetes['container_name']
144
145
log_stream_prefix fluentbit-
145
146
auto_create_group false
147
+ %{ endif }
146
148
147
149
%{if s3_bucket_name != null}
148
150
[OUTPUT]
Original file line number Diff line number Diff line change @@ -1565,8 +1565,14 @@ variable "fluent_bit_excluded_namespaces" {
1565
1565
default = []
1566
1566
}
1567
1567
1568
- variable "fluent_bit_s3_bucket_enable " {
1569
- description = " S3 bucket name to store fluentbit logs "
1568
+ variable "fluent_bit_enable_s3_output " {
1569
+ description = " Enable S3 output logging "
1570
1570
type = bool
1571
1571
default = false
1572
1572
}
1573
+
1574
+ variable "fluent_bit_enable_cw_output" {
1575
+ description = " Enable cloudwatch logging"
1576
+ type = bool
1577
+ default = true
1578
+ }
You can’t perform that action at this time.
0 commit comments