Skip to content

Commit

Permalink
feat: INFRA-403 Apply Sebs Suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
Issam committed Nov 14, 2023
1 parent c6cc697 commit be9d762
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 15 deletions.
40 changes: 37 additions & 3 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ locals {
content = module.prometheus_node_exporter_configs.configuration
}
],
var.fluentbit.enabled ? [{
filename = "fluent_bit.cfg"
content_type = "text/cloud-config"
content = module.fluentbit_configs.configuration
}] : [],
var.chrony.enabled ? [{
filename = "chrony.cfg"
content_type = "text/cloud-config"
Expand All @@ -40,7 +45,7 @@ locals {
}

module "vault_configs" {
source = "git::https://github.com/Ferlab-Ste-Justine/terraform-cloudinit-templates.git//vault?ref=v0.8.0"
source = "git::https://github.com/Ferlab-Ste-Justine/terraform-cloudinit-templates.git//vault?ref=v0.15.0"
install_dependencies = var.install_dependencies
hostname = var.name
release_version = var.release_version
Expand All @@ -49,12 +54,12 @@ module "vault_configs" {
}

module "prometheus_node_exporter_configs" {
source = "git::https://github.com/Ferlab-Ste-Justine/terraform-cloudinit-templates.git//prometheus-node-exporter?ref=v0.8.0"
source = "git::https://github.com/Ferlab-Ste-Justine/terraform-cloudinit-templates.git//prometheus-node-exporter?ref=v0.15.0"
install_dependencies = var.install_dependencies
}

module "chrony_configs" {
source = "git::https://github.com/Ferlab-Ste-Justine/terraform-cloudinit-templates.git//chrony?ref=v0.8.0"
source = "git::https://github.com/Ferlab-Ste-Justine/terraform-cloudinit-templates.git//chrony?ref=v0.15.0"
install_dependencies = var.install_dependencies
chrony = {
servers = var.chrony.servers
Expand All @@ -63,6 +68,35 @@ module "chrony_configs" {
}
}

module "fluentbit_configs" {
source = "git::https://github.com/Ferlab-Ste-Justine/terraform-cloudinit-templates.git//fluent-bit?ref=v0.15.0"
install_dependencies = true
fluentbit = {
metrics = var.fluentbit.metrics
systemd_services = concat(
var.fluentbit.etcd_tag != "" ? [{
tag = var.fluentbit.etcd_tag
service = "etcd.service"
}] : [],
[
{
tag = var.fluentbit.containerd_tag
service = "containerd.service"
},
{
tag = var.fluentbit.kubelet_tag
service = "kubelet.service"
},
{
tag = var.fluentbit.node_exporter_tag
service = "node-exporter.service"
}
]
)
forward = var.fluentbit.forward
}
}

data "template_cloudinit_config" "user_data" {
gzip = true
base64_encode = true
Expand Down
53 changes: 41 additions & 12 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,6 @@ variable "flavor_id" {
type = string
}


variable "cloud_init_volume_pool" {
description = "Name of the volume pool that will contain the cloud init volume"
type = string
}

variable "cloud_init_volume_name" {
description = "Name of the cloud init volume"
type = string
default = ""
}

variable "ssh_admin_user" {
description = "Pre-existing ssh admin user of the image"
type = string
Expand Down Expand Up @@ -149,4 +137,45 @@ variable "etcd_backend" {
password = ""
}
}
}

variable "fluentbit" {
description = "Fluent-bit configuration"
sensitive = true
type = object({
enabled = bool
containerd_tag = string
kubelet_tag = string
etcd_tag = string
node_exporter_tag = string
metrics = object({
enabled = bool
port = number
})
forward = object({
domain = string
port = number
hostname = string
shared_key = string
ca_cert = string
})
})
default = {
enabled = false
containerd_tag = ""
kubelet_tag = ""
etcd_tag = ""
node_exporter_tag = ""
metrics = {
enabled = false
port = 0
}
forward = {
domain = ""
port = 0
hostname = ""
shared_key = ""
ca_cert = ""
}
}
}
4 changes: 4 additions & 0 deletions versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ terraform {
source = "terraform-provider-openstack/openstack"
version = "= 1.49.0"
}
template = {
source = "hashicorp/template"
version = "= 2.2.0"
}
}
required_version = ">= 1.0.0"
}

0 comments on commit be9d762

Please sign in to comment.