Terraform AWS EKS Namespace Metrics
Budget: ₹600 – ₹1,500 INR
I keep all my EKS observability code in Terraform and I am using the AWS Distro for OpenTelemetry together with Prometheus and CloudWatch.
Inside the module I have already declared
```
variable "namespace_variables_map" {
type = map(object({
metrics = list(string)
labels = list(string)
}))
default = {
"aws-otel-eks" = {
metrics = [
"scrape_duration_seconds",
"up",
"scrape_series_added"
]
labels = []
}
}
}
```
The goal is simple:
• Only the three metrics above must be scraped when the namespace is **aws-otel-eks**.
• No metrics at all should be exposed, scraped, or routed to CloudWatch for any other namespace in the cluster.
I need a clean, reusable Terraform solution (using the ADOT Helm chart or operator—whichever you find cleaner) that enforces this rule and keeps the configuration self-contained in the module. Prometheus is the scraper, CloudWatch is the sink, and Terraform drives everything, so the code you deliver has to fit naturally into that stack.
What I expect from you
1. Updated Terraform resources (or a new module) that apply the filter logic.
2. Any ADOT/Prometheus configuration snippets required (serviceMonitors, relabels, etc.).
3. A short README explaining where to put variables and how to test that non-aws-otel-eks namespaces stay silent.
If you can solve it elegantly and keep the configuration minimal, let’s get started.
Inside the module I have already declared
```
variable "namespace_variables_map" {
type = map(object({
metrics = list(string)
labels = list(string)
}))
default = {
"aws-otel-eks" = {
metrics = [
"scrape_duration_seconds",
"up",
"scrape_series_added"
]
labels = []
}
}
}
```
The goal is simple:
• Only the three metrics above must be scraped when the namespace is **aws-otel-eks**.
• No metrics at all should be exposed, scraped, or routed to CloudWatch for any other namespace in the cluster.
I need a clean, reusable Terraform solution (using the ADOT Helm chart or operator—whichever you find cleaner) that enforces this rule and keeps the configuration self-contained in the module. Prometheus is the scraper, CloudWatch is the sink, and Terraform drives everything, so the code you deliver has to fit naturally into that stack.
What I expect from you
1. Updated Terraform resources (or a new module) that apply the filter logic.
2. Any ADOT/Prometheus configuration snippets required (serviceMonitors, relabels, etc.).
3. A short README explaining where to put variables and how to test that non-aws-otel-eks namespaces stay silent.
If you can solve it elegantly and keep the configuration minimal, let’s get started.