Skip to content

Commit

Permalink
Code review
Browse files Browse the repository at this point in the history
  • Loading branch information
jana-opszero committed Jan 17, 2024
1 parent 9955b3b commit 2b00fbb
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
10 changes: 5 additions & 5 deletions cloudwatch_eks_pod_logs.tf
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
resource "kubernetes_namespace" "amazon_cloudwatch" {
count = var.eks_pod_logs_cloudwatch ? 1 : 0
count = var.enable_pods_logs_to_cloudwatch ? 1 : 0

metadata {
name = "amazon-cloudwatch"
}
}

resource "kubernetes_config_map" "fluent_bit_cluster_info" {
count = var.eks_pod_logs_cloudwatch ? 1 : 0
count = var.enable_pods_logs_to_cloudwatch ? 1 : 0

metadata {
name = "fluent-bit-cluster-info"
Expand All @@ -25,19 +25,19 @@ resource "kubernetes_config_map" "fluent_bit_cluster_info" {
}

data "http" "fluent_bit_yaml" {
url = "https://raw.githubusercontent.com/aws-samples/amazon-cloudwatch-container-insights/k8s/${var.eks_pod_logs_cloudwatch_fluent_bit_version}/k8s-deployment-manifest-templates/deployment-mode/daemonset/container-insights-monitoring/fluent-bit/fluent-bit.yaml"
url = "https://raw.githubusercontent.com/aws-samples/amazon-cloudwatch-container-insights/k8s/${local.eks_pod_logs_cloudwatch_fluent_bit_version}/k8s-deployment-manifest-templates/deployment-mode/daemonset/container-insights-monitoring/fluent-bit/fluent-bit.yaml"
}


resource "null_resource" "eks_pod_cloudwatch" {
count = var.eks_pod_logs_cloudwatch ? 1 : 0
count = var.enable_pods_logs_to_cloudwatch ? 1 : 0

triggers = {
manifest_sha1 = sha1(data.http.fluent_bit_yaml.body)
}

provisioner "local-exec" {
command = "kubectl replace -f https://raw.githubusercontent.com/aws-samples/amazon-cloudwatch-container-insights/k8s/${var.eks_pod_logs_cloudwatch_fluent_bit_version}/k8s-deployment-manifest-templates/deployment-mode/daemonset/container-insights-monitoring/fluent-bit/fluent-bit.yaml"
command = "kubectl replace -f https://raw.githubusercontent.com/aws-samples/amazon-cloudwatch-container-insights/k8s/${local.eks_pod_logs_cloudwatch_fluent_bit_version}/k8s-deployment-manifest-templates/deployment-mode/daemonset/container-insights-monitoring/fluent-bit/fluent-bit.yaml"
}

depends_on = [
Expand Down
2 changes: 2 additions & 0 deletions locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ locals {
alb_name = "aws-load-balancer-controller"
partition = data.aws_partition.current.partition
account_id = data.aws_caller_identity.current.account_id
# https://github.com/aws-samples/amazon-cloudwatch-container-insights/releases
eks_pod_logs_cloudwatch_fluent_bit_version = "1.3.19"

tags = merge(var.tags, {
"KubespotEnvironment" = var.environment_name
Expand Down
14 changes: 7 additions & 7 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -403,15 +403,15 @@ variable "calico_version" {
description = "The version of the calico helm chart"
}

variable "eks_pod_logs_cloudwatch" {
variable "enable_pods_logs_to_cloudwatch" {
default = false
type = bool
description = "Stream EKS pod logs to cloudwatch"
}

variable "eks_pod_logs_cloudwatch_fluent_bit_version" {
default = "1.3.19"
type = string
# https://github.com/aws-samples/amazon-cloudwatch-container-insights/releases
description = "Fluent bit version released by cloudwatch"
}
#variable "eks_pod_logs_cloudwatch_fluent_bit_version" {
# default = "1.3.19"
# type = string
# # https://github.com/aws-samples/amazon-cloudwatch-container-insights/releases
# description = "Fluent bit version released by cloudwatch"
#}

0 comments on commit 2b00fbb

Please sign in to comment.