Skip to content

Commit 5673b58

Browse files
Allow custom log group template input for fluent-bit (#253)
* Allow custom log group template input for fluent-bit * terraform-docs: automated action --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent 78dd048 commit 5673b58

3 files changed

Lines changed: 13 additions & 1 deletion

File tree

aws/platform/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ You can then use it to manually edit the aws-auth ConfigMap:
187187
| <a name="input_istio_ingress_values"></a> [istio\_ingress\_values](#input\_istio\_ingress\_values) | Overrides to pass to the Helm chart | `list(string)` | `[]` | no |
188188
| <a name="input_istiod_values"></a> [istiod\_values](#input\_istiod\_values) | Overrides to pass to the Helm chart | `list(string)` | `[]` | no |
189189
| <a name="input_k8s_namespace"></a> [k8s\_namespace](#input\_k8s\_namespace) | Kubernetes namespace in which resources should be created | `string` | `"flightdeck"` | no |
190+
| <a name="input_log_group_template_override"></a> [log\_group\_template\_override](#input\_log\_group\_template\_override) | Optional override for Fluent Bit log group template | `string` | `null` | no |
190191
| <a name="input_logs_prefix"></a> [logs\_prefix](#input\_logs\_prefix) | Prefix for CloudWatch log groups | `string` | `"/flightdeck"` | no |
191192
| <a name="input_logs_retention_in_days"></a> [logs\_retention\_in\_days](#input\_logs\_retention\_in\_days) | Number of days for which logs should be retained | `number` | `30` | no |
192193
| <a name="input_logs_skip_destroy"></a> [logs\_skip\_destroy](#input\_logs\_skip\_destroy) | Set to false to destroy the log group with the platform | `bool` | `true` | no |

aws/platform/main.tf

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ locals {
380380
auto_create_group true
381381
region ${data.aws_region.current.name}
382382
log_group_name ${module.cloudwatch_logs.log_group_name}
383-
log_group_template ${var.logs_prefix}/$kubernetes['namespace_name']
383+
log_group_template ${local.log_group_template_value}
384384
log_stream_prefix $${HOST_NAME}-
385385
log_stream_template $kubernetes['pod_name'].$kubernetes['container_name']
386386
log_retention_days ${var.logs_retention_in_days}
@@ -420,6 +420,11 @@ locals {
420420
})
421421
]
422422

423+
log_group_template_value = coalesce(
424+
var.log_group_template_override,
425+
"${var.logs_prefix}/$kubernetes['namespace_name']"
426+
)
427+
423428
istio_ingress_values = [
424429
yamlencode({
425430
service = {

aws/platform/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,12 @@ variable "k8s_namespace" {
152152
description = "Kubernetes namespace in which resources should be created"
153153
}
154154

155+
variable "log_group_template_override" {
156+
type = string
157+
default = null
158+
description = "Optional override for Fluent Bit log group template"
159+
}
160+
155161
variable "logs_retention_in_days" {
156162
type = number
157163
default = 30

0 commit comments

Comments
 (0)