diff --git a/docs/contributors.md b/docs/contributors.md index 0c893128..82aeb522 100644 --- a/docs/contributors.md +++ b/docs/contributors.md @@ -16,6 +16,7 @@ The core team include the following people: * Michael Hausenblas * Rodrigue Koffi * Toshal Dudhwala +* Vikram Venkataraman We welcome the wider open source community and thank [those who contribute](https://github.com/aws-observability/terraform-aws-observability-accelerator/graphs/contributors) to this project. diff --git a/docs/ecs/ecs-monitoring-on-ec2.md b/docs/ecs/ecs-monitoring-on-ec2.md index 11e50a85..7a65f467 100644 --- a/docs/ecs/ecs-monitoring-on-ec2.md +++ b/docs/ecs/ecs-monitoring-on-ec2.md @@ -4,6 +4,7 @@ This example demonstrates how to monitor your Amazon Elastic Container Service o (Amazon ECS) cluster with the Observability Accelerator's ECS monitoring module The module collects Prometheus metrics from tasks running on ECS and sends it to Prometheus using AWS Distro for OpenTelemetry Collector (ADOT). + You can either run the collector as a sidecar or deploy the collector as its own ECS service for entire cluster. ECS tasks with Prometheus endpoints are discovered using extension [ecsobserver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/extension/observer/ecsobserver/README.md). @@ -26,7 +27,7 @@ Make sure to update your exisitng Application Task Definitions based on the work ## Setup -#### 1. Add the ECS Monitoring Module to your exisitng ECS CLuster +#### 1. Add the ECS Monitoring Module to your exisitng ECS Cluster ``` module "ecs_monitoring" { diff --git a/modules/eks-monitoring/README.md b/modules/eks-monitoring/README.md index 5d9b1ff2..2b5e6055 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 | @@ -75,7 +75,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 | @@ -101,13 +102,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 | @@ -123,20 +124,20 @@ 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\_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 c87bb6c3..96c689cc 100644 --- a/modules/eks-monitoring/locals.tf +++ b/modules/eks-monitoring/locals.tf @@ -62,7 +62,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 @@ -83,6 +83,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 084ecf30..a9b14e53 100644 --- a/modules/eks-monitoring/main.tf +++ b/modules/eks-monitoring/main.tf @@ -138,6 +138,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 @@ -192,11 +196,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" @@ -257,7 +261,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 bf08361b..07149842 100644 --- a/modules/eks-monitoring/otel-config/templates/opentelemetrycollector.yaml +++ b/modules/eks-monitoring/otel-config/templates/opentelemetrycollector.yaml @@ -261,9 +261,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: @@ -276,4 +276,6 @@ spec: metrics: address: 0.0.0.0:8888 level: basic + logs: + 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 e0378618..d3f8bcdc 100644 --- a/modules/eks-monitoring/variables.tf +++ b/modules/eks-monitoring/variables.tf @@ -58,11 +58,23 @@ 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 + default = "" +} + variable "managed_prometheus_workspace_id" { description = "Amazon Managed Prometheus Workspace ID" type = string @@ -138,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 } @@ -176,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 } @@ -214,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 } @@ -260,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" { @@ -330,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" { @@ -417,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 } @@ -449,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 = {