From 65c50e603067537a8e7175b40ebab4fdb50ec9eb Mon Sep 17 00:00:00 2001 From: Antone Aguiar Date: Tue, 20 Feb 2024 11:15:13 -0800 Subject: [PATCH] Nginx config options (#265) * Nginx config options * Fix variable type mismatch for nginx pattern module * Allow partial declaration of config variables with defaults * Add telemetry log level configuration * remove coalesce function * Formatting --- modules/eks-monitoring/README.md | 19 +- modules/eks-monitoring/locals.tf | 7 +- modules/eks-monitoring/main.tf | 10 +- .../templates/opentelemetrycollector.yaml | 8 +- .../eks-monitoring/otel-config/values.yaml | 1 + modules/eks-monitoring/variables.tf | 180 +++++++----------- modules/eks-monitoring/versions.tf | 2 +- 7 files changed, 99 insertions(+), 128 deletions(-) diff --git a/modules/eks-monitoring/README.md b/modules/eks-monitoring/README.md index 2899667e..1c984667 100644 --- a/modules/eks-monitoring/README.md +++ b/modules/eks-monitoring/README.md @@ -19,7 +19,7 @@ See examples using this Terraform modules in the **Amazon EKS** section of [this | Name | Version | |------|---------| -| [terraform](#requirement\_terraform) | >= 1.1.0 | +| [terraform](#requirement\_terraform) | >= 1.3.0 | | [aws](#requirement\_aws) | >= 5.0.0 | | [helm](#requirement\_helm) | >= 2.4.1 | | [kubectl](#requirement\_kubectl) | >= 2.0.3 | @@ -71,7 +71,8 @@ See examples using this Terraform modules in the **Amazon EKS** section of [this | Name | Description | Type | Default | Required | |------|-------------|------|---------|:--------:| -| [adot\_loglevel](#input\_adot\_loglevel) | Verbosity level for ADOT collector logs. This accepts (detailed\|normal\|basic), see https://aws-otel.github.io/docs/components/misc-exporters for mor infos. | `string` | `"normal"` | no | +| [adot\_loglevel](#input\_adot\_loglevel) | Verbosity level for ADOT collector logs. This accepts (detailed\|normal\|basic), see https://aws-otel.github.io/docs/components/misc-exporters for more info. | `string` | `"normal"` | no | +| [adot\_service\_telemetry\_loglevel](#input\_adot\_service\_telemetry\_loglevel) | Verbosity level for ADOT service telemetry logs. See https://opentelemetry.io/docs/collector/configuration/#telemetry for more info. | `string` | `"INFO"` | no | | [adothealth\_monitoring\_config](#input\_adothealth\_monitoring\_config) | Config object for ADOT health monitoring |
object({
flux_gitrepository_name = string
flux_gitrepository_url = string
flux_gitrepository_branch = string
flux_kustomization_name = string
flux_kustomization_path = string

dashboards = object({
health = string
})
})
| `null` | no | | [apiserver\_monitoring\_config](#input\_apiserver\_monitoring\_config) | Config object for API server monitoring |
object({
flux_gitrepository_name = string
flux_gitrepository_url = string
flux_gitrepository_branch = string
flux_kustomization_name = string
flux_kustomization_path = string

dashboards = object({
basic = string
advanced = string
troubleshooting = string
})
})
| `null` | no | | [custom\_metrics\_config](#input\_custom\_metrics\_config) | Configuration object to enable custom metrics collection |
map(object({
enableBasicAuth = bool
path = string
basicAuthUsername = string
basicAuthPassword = string
ports = string
droppedSeriesPrefixes = string
}))
| `null` | no | @@ -97,13 +98,13 @@ See examples using this Terraform modules in the **Amazon EKS** section of [this | [enable\_nvidia\_monitoring](#input\_enable\_nvidia\_monitoring) | Enables monitoring of nvidia metrics | `bool` | `true` | no | | [enable\_recording\_rules](#input\_enable\_recording\_rules) | Enables or disables Managed Prometheus recording rules | `bool` | `true` | no | | [enable\_tracing](#input\_enable\_tracing) | Enables tracing with OTLP traces receiver to X-Ray | `bool` | `true` | no | -| [flux\_config](#input\_flux\_config) | FluxCD configuration |
object({
create_namespace = bool
k8s_namespace = string
helm_chart_name = string
helm_chart_version = string
helm_release_name = string
helm_repo_url = string
helm_settings = map(string)
helm_values = map(any)
})
|
{
"create_namespace": true,
"helm_chart_name": "flux2",
"helm_chart_version": "2.12.2",
"helm_release_name": "observability-fluxcd-addon",
"helm_repo_url": "https://fluxcd-community.github.io/helm-charts",
"helm_settings": {},
"helm_values": {},
"k8s_namespace": "flux-system"
}
| no | +| [flux\_config](#input\_flux\_config) | FluxCD configuration |
object({
create_namespace = optional(bool, true)
k8s_namespace = optional(string, "flux-system")
helm_chart_name = optional(string, "flux2")
helm_chart_version = optional(string, "2.12.2")
helm_release_name = optional(string, "observability-fluxcd-addon")
helm_repo_url = optional(string, "https://fluxcd-community.github.io/helm-charts")
helm_settings = optional(map(string), {})
helm_values = optional(map(any), {})
})
| `{}` | no | | [flux\_gitrepository\_branch](#input\_flux\_gitrepository\_branch) | Flux GitRepository Branch | `string` | `"v0.3.2"` | no | | [flux\_gitrepository\_name](#input\_flux\_gitrepository\_name) | Flux GitRepository name | `string` | `"aws-observability-accelerator"` | no | | [flux\_gitrepository\_url](#input\_flux\_gitrepository\_url) | Flux GitRepository URL | `string` | `"https://github.com/aws-observability/aws-observability-accelerator"` | no | | [flux\_kustomization\_name](#input\_flux\_kustomization\_name) | Flux Kustomization name | `string` | `"grafana-dashboards-infrastructure"` | no | | [flux\_kustomization\_path](#input\_flux\_kustomization\_path) | Flux Kustomization Path | `string` | `"./artifacts/grafana-operator-manifests/eks/infrastructure"` | no | -| [go\_config](#input\_go\_config) | Grafana Operator configuration |
object({
create_namespace = bool
helm_chart = string
helm_name = string
k8s_namespace = string
helm_release_name = string
helm_chart_version = string
})
|
{
"create_namespace": true,
"helm_chart": "oci://ghcr.io/grafana-operator/helm-charts/grafana-operator",
"helm_chart_version": "v5.5.2",
"helm_name": "grafana-operator",
"helm_release_name": "grafana-operator",
"k8s_namespace": "grafana-operator"
}
| no | +| [go\_config](#input\_go\_config) | Grafana Operator configuration |
object({
create_namespace = optional(bool, true)
helm_chart = optional(string, "oci://ghcr.io/grafana-operator/helm-charts/grafana-operator")
helm_name = optional(string, "grafana-operator")
k8s_namespace = optional(string, "grafana-operator")
helm_release_name = optional(string, "grafana-operator")
helm_chart_version = optional(string, "v5.5.2")
})
| `{}` | no | | [grafana\_api\_key](#input\_grafana\_api\_key) | Grafana API key for the Amazon Managed Grafana workspace. Required if `enable_external_secrets = true` | `string` | `""` | no | | [grafana\_cluster\_dashboard\_url](#input\_grafana\_cluster\_dashboard\_url) | Dashboard URL for Cluster Grafana Dashboard JSON | `string` | `"https://raw.githubusercontent.com/aws-observability/aws-observability-accelerator/v0.2.0/artifacts/grafana-dashboards/eks/infrastructure/cluster.json"` | no | | [grafana\_kubelet\_dashboard\_url](#input\_grafana\_kubelet\_dashboard\_url) | Dashboard URL for Kubelet Grafana Dashboard JSON | `string` | `"https://raw.githubusercontent.com/aws-observability/aws-observability-accelerator/v0.2.0/artifacts/grafana-dashboards/eks/infrastructure/kubelet.json"` | no | @@ -120,21 +121,21 @@ See examples using this Terraform modules in the **Amazon EKS** section of [this | [irsa\_iam\_role\_path](#input\_irsa\_iam\_role\_path) | IAM role path for IRSA roles | `string` | `"/"` | no | | [istio\_config](#input\_istio\_config) | Configuration object for ISTIO monitoring |
object({
enable_alerting_rules = bool
enable_recording_rules = bool
enable_dashboards = bool
scrape_sample_limit = number

flux_gitrepository_name = string
flux_gitrepository_url = string
flux_gitrepository_branch = string
flux_kustomization_name = string
flux_kustomization_path = string

managed_prometheus_workspace_id = string
prometheus_metrics_endpoint = string

dashboards = object({
cp = string
mesh = string
performance = string
service = string
})
})
| `null` | no | | [java\_config](#input\_java\_config) | Configuration object for Java/JMX monitoring |
object({
enable_alerting_rules = bool
enable_recording_rules = bool
enable_dashboards = bool
scrape_sample_limit = number


flux_gitrepository_name = string
flux_gitrepository_url = string
flux_gitrepository_branch = string
flux_kustomization_name = string
flux_kustomization_path = string

grafana_dashboard_url = string

prometheus_metrics_endpoint = string
})
| `null` | no | -| [ksm\_config](#input\_ksm\_config) | Kube State metrics configuration |
object({
create_namespace = bool
k8s_namespace = string
helm_chart_name = string
helm_chart_version = string
helm_release_name = string
helm_repo_url = string
helm_settings = map(string)
helm_values = map(any)

scrape_interval = string
scrape_timeout = string
})
|
{
"create_namespace": true,
"helm_chart_name": "kube-state-metrics",
"helm_chart_version": "5.15.2",
"helm_release_name": "kube-state-metrics",
"helm_repo_url": "https://prometheus-community.github.io/helm-charts",
"helm_settings": {},
"helm_values": {},
"k8s_namespace": "kube-system",
"scrape_interval": "60s",
"scrape_timeout": "15s"
}
| no | +| [ksm\_config](#input\_ksm\_config) | Kube State metrics configuration |
object({
create_namespace = optional(bool, true)
k8s_namespace = optional(string, "kube-system")
helm_chart_name = optional(string, "kube-state-metrics")
helm_chart_version = optional(string, "5.15.2")
helm_release_name = optional(string, "kube-state-metrics")
helm_repo_url = optional(string, "https://prometheus-community.github.io/helm-charts")
helm_settings = optional(map(string), {})
helm_values = optional(map(any), {})

scrape_interval = optional(string, "60s")
scrape_timeout = optional(string, "15s")
})
| `{}` | no | | [kubeproxy\_monitoring\_config](#input\_kubeproxy\_monitoring\_config) | Config object for kube-proxy monitoring |
object({
flux_gitrepository_name = string
flux_gitrepository_url = string
flux_gitrepository_branch = string
flux_kustomization_name = string
flux_kustomization_path = string

dashboards = object({
default = string
})
})
| `null` | no | | [logs\_config](#input\_logs\_config) | Configuration object for logs collection |
object({
cw_log_retention_days = number
})
|
{
"cw_log_retention_days": 90
}
| no | | [managed\_prometheus\_cross\_account\_role](#input\_managed\_prometheus\_cross\_account\_role) | Amazon Managed Prometheus Workspace's Account Role Arn | `string` | `""` | no | | [managed\_prometheus\_workspace\_endpoint](#input\_managed\_prometheus\_workspace\_endpoint) | Amazon Managed Prometheus Workspace Endpoint | `string` | `""` | no | | [managed\_prometheus\_workspace\_id](#input\_managed\_prometheus\_workspace\_id) | Amazon Managed Prometheus Workspace ID | `string` | `null` | no | | [managed\_prometheus\_workspace\_region](#input\_managed\_prometheus\_workspace\_region) | Amazon Managed Prometheus Workspace's Region | `string` | `null` | no | -| [ne\_config](#input\_ne\_config) | Node exporter configuration |
object({
create_namespace = bool
k8s_namespace = string
helm_chart_name = string
helm_chart_version = string
helm_release_name = string
helm_repo_url = string
helm_settings = map(string)
helm_values = map(any)

scrape_interval = string
scrape_timeout = string
})
|
{
"create_namespace": true,
"helm_chart_name": "prometheus-node-exporter",
"helm_chart_version": "4.24.0",
"helm_release_name": "prometheus-node-exporter",
"helm_repo_url": "https://prometheus-community.github.io/helm-charts",
"helm_settings": {},
"helm_values": {},
"k8s_namespace": "prometheus-node-exporter",
"scrape_interval": "60s",
"scrape_timeout": "60s"
}
| no | -| [nginx\_config](#input\_nginx\_config) | Configuration object for NGINX monitoring |
object({
enable_alerting_rules = bool
enable_recording_rules = bool
enable_dashboards = bool
scrape_sample_limit = number

flux_gitrepository_name = string
flux_gitrepository_url = string
flux_gitrepository_branch = string
flux_kustomization_name = string
flux_kustomization_path = string

grafana_dashboard_url = string

prometheus_metrics_endpoint = string
})
| `null` | no | +| [ne\_config](#input\_ne\_config) | Node exporter configuration |
object({
create_namespace = optional(bool, true)
k8s_namespace = optional(string, "prometheus-node-exporter")
helm_chart_name = optional(string, "prometheus-node-exporter")
helm_chart_version = optional(string, "4.24.0")
helm_release_name = optional(string, "prometheus-node-exporter")
helm_repo_url = optional(string, "https://prometheus-community.github.io/helm-charts")
helm_settings = optional(map(string), {})
helm_values = optional(map(any), {})

scrape_interval = optional(string, "60s")
scrape_timeout = optional(string, "60s")
})
| `{}` | no | +| [nginx\_config](#input\_nginx\_config) | Configuration object for NGINX monitoring |
object({
enable_alerting_rules = optional(bool)
enable_recording_rules = optional(bool)
enable_dashboards = optional(bool)
scrape_sample_limit = optional(number)

flux_gitrepository_name = optional(string)
flux_gitrepository_url = optional(string)
flux_gitrepository_branch = optional(string)
flux_kustomization_name = optional(string)
flux_kustomization_path = optional(string)

grafana_dashboard_url = optional(string)

prometheus_metrics_endpoint = optional(string)
})
| `{}` | no | | [nvidia\_monitoring\_config](#input\_nvidia\_monitoring\_config) | Config object for nvidia monitoring |
object({
flux_gitrepository_name = string
flux_gitrepository_url = string
flux_gitrepository_branch = string
flux_kustomization_name = string
flux_kustomization_path = string
})
| `null` | no | -| [prometheus\_config](#input\_prometheus\_config) | Controls default values such as scrape interval, timeouts and ports globally |
object({
global_scrape_interval = string
global_scrape_timeout = string
})
|
{
"global_scrape_interval": "120s",
"global_scrape_timeout": "15s"
}
| no | +| [prometheus\_config](#input\_prometheus\_config) | Controls default values such as scrape interval, timeouts and ports globally |
object({
global_scrape_interval = optional(string, "120s")
global_scrape_timeout = optional(string, "15s")
})
| `{}` | no | | [tags](#input\_tags) | Additional tags (e.g. `map('BusinessUnit`,`XYZ`) | `map(string)` | `{}` | no | | [target\_secret\_name](#input\_target\_secret\_name) | Target secret in Kubernetes to store the Grafana API Key Secret | `string` | `"grafana-admin-credentials"` | no | | [target\_secret\_namespace](#input\_target\_secret\_namespace) | Target namespace of secret in Kubernetes to store the Grafana API Key Secret | `string` | `"grafana-operator"` | no | -| [tracing\_config](#input\_tracing\_config) | Configuration object for traces collection to AWS X-Ray |
object({
otlp_grpc_endpoint = string
otlp_http_endpoint = string
send_batch_size = number
timeout = string
})
|
{
"otlp_grpc_endpoint": "0.0.0.0:4317",
"otlp_http_endpoint": "0.0.0.0:4318",
"send_batch_size": 50,
"timeout": "30s"
}
| no | +| [tracing\_config](#input\_tracing\_config) | Configuration object for traces collection to AWS X-Ray |
object({
otlp_grpc_endpoint = optional(string, "0.0.0.0:4317")
otlp_http_endpoint = optional(string, "0.0.0.0:4318")
send_batch_size = optional(number, 50)
timeout = optional(string, "30s")
})
| `{}` | no | ## Outputs diff --git a/modules/eks-monitoring/locals.tf b/modules/eks-monitoring/locals.tf index 8b942520..72cd3a9e 100644 --- a/modules/eks-monitoring/locals.tf +++ b/modules/eks-monitoring/locals.tf @@ -57,7 +57,7 @@ locals { grafana_dashboard_url = "https://raw.githubusercontent.com/aws-observability/aws-observability-accelerator/v0.2.0/artifacts/grafana-dashboards/eks/java/default.json" } - nginx_pattern_config = { + nginx_pattern_config_defaults = { # disabled if options from module are disabled, by default # can be overriden by providing a config enable_alerting_rules = var.enable_alerting_rules @@ -78,6 +78,11 @@ locals { grafana_dashboard_url = "https://raw.githubusercontent.com/aws-observability/aws-observability-accelerator/v0.2.0/artifacts/grafana-dashboards/eks/nginx/nginx.json" } + nginx_pattern_config = { + # Merge input variable with defaults and rebuild with non-null values + for k, v in merge(local.nginx_pattern_config_defaults, var.nginx_config) : k => v != null ? v : local.nginx_pattern_config_defaults[k] + } + istio_pattern_config = { # disabled if options from module are disabled, by default # can be overriden by providing a config diff --git a/modules/eks-monitoring/main.tf b/modules/eks-monitoring/main.tf index c96525ee..5b788b4a 100644 --- a/modules/eks-monitoring/main.tf +++ b/modules/eks-monitoring/main.tf @@ -120,6 +120,10 @@ module "helm_addon" { name = "adotLoglevel" value = var.adot_loglevel }, + { + name = "adotServiceTelemetryLoglevel" + value = var.adot_service_telemetry_loglevel + }, { name = "accountId" value = local.context.aws_caller_identity_account_id @@ -174,11 +178,11 @@ module "helm_addon" { }, { name = "nginxScrapeSampleLimit" - value = try(var.nginx_config.scrape_sample_limit, local.nginx_pattern_config.scrape_sample_limit) + value = local.nginx_pattern_config.scrape_sample_limit }, { name = "nginxPrometheusMetricsEndpoint" - value = try(var.nginx_config.prometheus_metrics_endpoint, local.nginx_pattern_config.prometheus_metrics_endpoint) + value = local.nginx_pattern_config.prometheus_metrics_endpoint }, { name = "enableIstio" @@ -239,7 +243,7 @@ module "nginx_monitoring" { source = "./patterns/nginx" count = var.enable_nginx ? 1 : 0 - pattern_config = coalesce(var.nginx_config, local.nginx_pattern_config) + pattern_config = local.nginx_pattern_config } module "istio_monitoring" { diff --git a/modules/eks-monitoring/otel-config/templates/opentelemetrycollector.yaml b/modules/eks-monitoring/otel-config/templates/opentelemetrycollector.yaml index a2aa43a6..5b0c153e 100644 --- a/modules/eks-monitoring/otel-config/templates/opentelemetrycollector.yaml +++ b/modules/eks-monitoring/otel-config/templates/opentelemetrycollector.yaml @@ -1536,9 +1536,9 @@ spec: exporters: [logging, prometheusremotewrite] {{ if .Values.enableAdotcollectorMetrics }} metrics/1: - receivers: [prometheus/1] - processors: [] - exporters: [prometheusremotewrite] + receivers: [prometheus/1] + processors: [] + exporters: [prometheusremotewrite] {{ end }} {{ if .Values.enableTracing }} traces: @@ -1551,4 +1551,6 @@ spec: metrics: address: 0.0.0.0:8888 level: basic + logging: + level: {{ .Values.adotServiceTelemetryLoglevel }} {{ end }} diff --git a/modules/eks-monitoring/otel-config/values.yaml b/modules/eks-monitoring/otel-config/values.yaml index d274557d..2cf1c984 100644 --- a/modules/eks-monitoring/otel-config/values.yaml +++ b/modules/eks-monitoring/otel-config/values.yaml @@ -32,6 +32,7 @@ istioScrapeSampleLimit: ${istio_scrape_sample_limit} istioPrometheusMetricsEndpoint: ${istio_prometheus_metrics_endpoint} adotLoglevel: ${adot_loglevel} +adotServiceTelemetryLoglevel: ${adot_service_telemetry_loglevel} enableAdotcollectorMetrics: ${enable_adotcollector_metrics} diff --git a/modules/eks-monitoring/variables.tf b/modules/eks-monitoring/variables.tf index 34e7532c..e1e58da1 100644 --- a/modules/eks-monitoring/variables.tf +++ b/modules/eks-monitoring/variables.tf @@ -58,11 +58,17 @@ variable "irsa_iam_additional_policies" { } variable "adot_loglevel" { - description = "Verbosity level for ADOT collector logs. This accepts (detailed|normal|basic), see https://aws-otel.github.io/docs/components/misc-exporters for mor infos." + description = "Verbosity level for ADOT collector logs. This accepts (detailed|normal|basic), see https://aws-otel.github.io/docs/components/misc-exporters for more info." type = string default = "normal" } +variable "adot_service_telemetry_loglevel" { + description = "Verbosity level for ADOT service telemetry logs. See https://opentelemetry.io/docs/collector/configuration/#telemetry for more info." + type = string + default = "INFO" +} + variable "managed_prometheus_workspace_endpoint" { description = "Amazon Managed Prometheus Workspace Endpoint" type = string @@ -144,32 +150,20 @@ variable "enable_kube_state_metrics" { variable "ksm_config" { description = "Kube State metrics configuration" type = object({ - create_namespace = bool - k8s_namespace = string - helm_chart_name = string - helm_chart_version = string - helm_release_name = string - helm_repo_url = string - helm_settings = map(string) - helm_values = map(any) - - scrape_interval = string - scrape_timeout = string + create_namespace = optional(bool, true) + k8s_namespace = optional(string, "kube-system") + helm_chart_name = optional(string, "kube-state-metrics") + helm_chart_version = optional(string, "5.15.2") + helm_release_name = optional(string, "kube-state-metrics") + helm_repo_url = optional(string, "https://prometheus-community.github.io/helm-charts") + helm_settings = optional(map(string), {}) + helm_values = optional(map(any), {}) + + scrape_interval = optional(string, "60s") + scrape_timeout = optional(string, "15s") }) - default = { - create_namespace = true - helm_chart_name = "kube-state-metrics" - helm_chart_version = "5.15.2" - helm_release_name = "kube-state-metrics" - helm_repo_url = "https://prometheus-community.github.io/helm-charts" - helm_settings = {} - helm_values = {} - k8s_namespace = "kube-system" - - scrape_interval = "60s" - scrape_timeout = "15s" - } + default = {} nullable = false } @@ -182,32 +176,20 @@ variable "enable_node_exporter" { variable "ne_config" { description = "Node exporter configuration" type = object({ - create_namespace = bool - k8s_namespace = string - helm_chart_name = string - helm_chart_version = string - helm_release_name = string - helm_repo_url = string - helm_settings = map(string) - helm_values = map(any) - - scrape_interval = string - scrape_timeout = string + create_namespace = optional(bool, true) + k8s_namespace = optional(string, "prometheus-node-exporter") + helm_chart_name = optional(string, "prometheus-node-exporter") + helm_chart_version = optional(string, "4.24.0") + helm_release_name = optional(string, "prometheus-node-exporter") + helm_repo_url = optional(string, "https://prometheus-community.github.io/helm-charts") + helm_settings = optional(map(string), {}) + helm_values = optional(map(any), {}) + + scrape_interval = optional(string, "60s") + scrape_timeout = optional(string, "60s") }) - default = { - create_namespace = true - helm_chart_name = "prometheus-node-exporter" - helm_chart_version = "4.24.0" - helm_release_name = "prometheus-node-exporter" - helm_repo_url = "https://prometheus-community.github.io/helm-charts" - helm_settings = {} - helm_values = {} - k8s_namespace = "prometheus-node-exporter" - - scrape_interval = "60s" - scrape_timeout = "60s" - } + default = {} nullable = false } @@ -220,14 +202,11 @@ variable "tags" { variable "prometheus_config" { description = "Controls default values such as scrape interval, timeouts and ports globally" type = object({ - global_scrape_interval = string - global_scrape_timeout = string + global_scrape_interval = optional(string, "120s") + global_scrape_timeout = optional(string, "15s") }) - default = { - global_scrape_interval = "120s" - global_scrape_timeout = "15s" - } + default = {} nullable = false } @@ -266,18 +245,14 @@ variable "enable_tracing" { variable "tracing_config" { description = "Configuration object for traces collection to AWS X-Ray" type = object({ - otlp_grpc_endpoint = string - otlp_http_endpoint = string - send_batch_size = number - timeout = string + otlp_grpc_endpoint = optional(string, "0.0.0.0:4317") + otlp_http_endpoint = optional(string, "0.0.0.0:4318") + send_batch_size = optional(number, 50) + timeout = optional(string, "30s") }) - default = { - otlp_grpc_endpoint = "0.0.0.0:4317" - otlp_http_endpoint = "0.0.0.0:4318" - send_batch_size = 50 - timeout = "30s" - } + default = {} + nullable = false } variable "enable_custom_metrics" { @@ -336,28 +311,27 @@ variable "enable_nginx" { default = false } - variable "nginx_config" { description = "Configuration object for NGINX monitoring" type = object({ - enable_alerting_rules = bool - enable_recording_rules = bool - enable_dashboards = bool - scrape_sample_limit = number + enable_alerting_rules = optional(bool) + enable_recording_rules = optional(bool) + enable_dashboards = optional(bool) + scrape_sample_limit = optional(number) - flux_gitrepository_name = string - flux_gitrepository_url = string - flux_gitrepository_branch = string - flux_kustomization_name = string - flux_kustomization_path = string + flux_gitrepository_name = optional(string) + flux_gitrepository_url = optional(string) + flux_gitrepository_branch = optional(string) + flux_kustomization_name = optional(string) + flux_kustomization_path = optional(string) - grafana_dashboard_url = string + grafana_dashboard_url = optional(string) - prometheus_metrics_endpoint = string + prometheus_metrics_endpoint = optional(string) }) - # defaults are pre-computed in locals.tf, provide a full definition to override - default = null + # defaults are pre-computed in locals.tf + default = {} } variable "enable_istio" { @@ -423,26 +397,17 @@ variable "enable_fluxcd" { variable "flux_config" { description = "FluxCD configuration" type = object({ - create_namespace = bool - k8s_namespace = string - helm_chart_name = string - helm_chart_version = string - helm_release_name = string - helm_repo_url = string - helm_settings = map(string) - helm_values = map(any) + create_namespace = optional(bool, true) + k8s_namespace = optional(string, "flux-system") + helm_chart_name = optional(string, "flux2") + helm_chart_version = optional(string, "2.12.2") + helm_release_name = optional(string, "observability-fluxcd-addon") + helm_repo_url = optional(string, "https://fluxcd-community.github.io/helm-charts") + helm_settings = optional(map(string), {}) + helm_values = optional(map(any), {}) }) - default = { - create_namespace = true - helm_chart_name = "flux2" - helm_chart_version = "2.12.2" - helm_release_name = "observability-fluxcd-addon" - helm_repo_url = "https://fluxcd-community.github.io/helm-charts" - helm_settings = {} - helm_values = {} - k8s_namespace = "flux-system" - } + default = {} nullable = false } @@ -455,22 +420,15 @@ variable "enable_grafana_operator" { variable "go_config" { description = "Grafana Operator configuration" type = object({ - create_namespace = bool - helm_chart = string - helm_name = string - k8s_namespace = string - helm_release_name = string - helm_chart_version = string + create_namespace = optional(bool, true) + helm_chart = optional(string, "oci://ghcr.io/grafana-operator/helm-charts/grafana-operator") + helm_name = optional(string, "grafana-operator") + k8s_namespace = optional(string, "grafana-operator") + helm_release_name = optional(string, "grafana-operator") + helm_chart_version = optional(string, "v5.5.2") }) - default = { - create_namespace = true - helm_chart = "oci://ghcr.io/grafana-operator/helm-charts/grafana-operator" - helm_name = "grafana-operator" - k8s_namespace = "grafana-operator" - helm_release_name = "grafana-operator" - helm_chart_version = "v5.5.2" - } + default = {} nullable = false } diff --git a/modules/eks-monitoring/versions.tf b/modules/eks-monitoring/versions.tf index ea7a421f..736ab9a5 100644 --- a/modules/eks-monitoring/versions.tf +++ b/modules/eks-monitoring/versions.tf @@ -1,5 +1,5 @@ terraform { - required_version = ">= 1.1.0" + required_version = ">= 1.3.0" required_providers { aws = {