mirror of
https://github.com/storytold/terraform-aws-observability-accelerator.git
synced 2026-10-09 00:09:43 +00:00
Make creation of Grafana Data Source and Folder configurable (#145)
* Made the cluster variable visible in dashboards * Made the repo reusable with multiple EKS clusters * Relabled the input variable from create_grafana_data_source to create_prometheus_data_source
This commit is contained in:
committed by
GitHub
parent
cd28d9975a
commit
caeebe0e1a
@@ -75,11 +75,12 @@ This module makes use of the open source [kube-prometheus-stack](https://github.
|
||||
| <a name="input_enable_logs"></a> [enable\_logs](#input\_enable\_logs) | Using AWS For FluentBit to collect cluster and application logs to Amazon CloudWatch | `bool` | `true` | no |
|
||||
| <a name="input_enable_nginx"></a> [enable\_nginx](#input\_enable\_nginx) | Enable NGINX workloads monitoring, alerting and default dashboards | `bool` | `false` | no |
|
||||
| <a name="input_enable_node_exporter"></a> [enable\_node\_exporter](#input\_enable\_node\_exporter) | Enables or disables Node exporter. Disabling this might affect some data in the dashboards | `bool` | `true` | no |
|
||||
| <a name="input_enable_recording_rules"></a> [enable\_recording\_rules](#input\_enable\_recording\_rules) | Enables or disables Managed Prometheus recording rules | `bool` | `true` | no |
|
||||
| <a name="input_enable_tracing"></a> [enable\_tracing](#input\_enable\_tracing) | (Experimental) Enables tracing with AWS X-Ray. This changes the deploy mode of the collector to daemon set. Requirement: adot add-on <= 0.58-build.0 | `bool` | `false` | no |
|
||||
| <a name="input_helm_config"></a> [helm\_config](#input\_helm\_config) | Helm Config for Prometheus | `any` | `{}` | no |
|
||||
| <a name="input_irsa_iam_permissions_boundary"></a> [irsa\_iam\_permissions\_boundary](#input\_irsa\_iam\_permissions\_boundary) | IAM permissions boundary for IRSA roles | `string` | `null` | no |
|
||||
| <a name="input_irsa_iam_role_path"></a> [irsa\_iam\_role\_path](#input\_irsa\_iam\_role\_path) | IAM role path for IRSA roles | `string` | `"/"` | no |
|
||||
| <a name="input_java_config"></a> [java\_config](#input\_java\_config) | Configuration object for Java/JMX monitoring | <pre>object({<br> enable_alerting_rules = bool<br> scrape_sample_limit = number<br> })</pre> | <pre>{<br> "enable_alerting_rules": true,<br> "scrape_sample_limit": 1000<br>}</pre> | no |
|
||||
| <a name="input_java_config"></a> [java\_config](#input\_java\_config) | Configuration object for Java/JMX monitoring | <pre>object({<br> enable_alerting_rules = bool<br> enable_recording_rules = bool<br> scrape_sample_limit = number<br> })</pre> | <pre>{<br> "enable_alerting_rules": true,<br> "enable_recording_rules": true,<br> "scrape_sample_limit": 1000<br>}</pre> | no |
|
||||
| <a name="input_ksm_config"></a> [ksm\_config](#input\_ksm\_config) | Kube State metrics configuration | <pre>object({<br> create_namespace = bool<br> k8s_namespace = string<br> helm_chart_name = string<br> helm_chart_version = string<br> helm_release_name = string<br> helm_repo_url = string<br> helm_settings = map(string)<br> helm_values = map(any)<br><br> scrape_interval = string<br> scrape_timeout = string<br> })</pre> | <pre>{<br> "create_namespace": true,<br> "helm_chart_name": "kube-state-metrics",<br> "helm_chart_version": "4.24.0",<br> "helm_release_name": "kube-state-metrics",<br> "helm_repo_url": "https://prometheus-community.github.io/helm-charts",<br> "helm_settings": {},<br> "helm_values": {},<br> "k8s_namespace": "kube-system",<br> "scrape_interval": "60s",<br> "scrape_timeout": "15s"<br>}</pre> | no |
|
||||
| <a name="input_logs_config"></a> [logs\_config](#input\_logs\_config) | Configuration object for logs collection | <pre>object({<br> cw_log_retention_days = number<br> })</pre> | <pre>{<br> "cw_log_retention_days": 90<br>}</pre> | no |
|
||||
| <a name="input_managed_prometheus_workspace_endpoint"></a> [managed\_prometheus\_workspace\_endpoint](#input\_managed\_prometheus\_workspace\_endpoint) | Amazon Managed Prometheus Workspace Endpoint | `string` | `""` | no |
|
||||
|
||||
@@ -2945,7 +2945,7 @@
|
||||
"uid": "$datasource"
|
||||
},
|
||||
"definition": "",
|
||||
"hide": 2,
|
||||
"hide": 0,
|
||||
"includeAll": false,
|
||||
"multi": false,
|
||||
"name": "cluster",
|
||||
|
||||
@@ -2148,7 +2148,7 @@
|
||||
"uid": "$datasource"
|
||||
},
|
||||
"definition": "",
|
||||
"hide": 2,
|
||||
"hide": 0,
|
||||
"includeAll": false,
|
||||
"label": "cluster",
|
||||
"multi": false,
|
||||
|
||||
@@ -2542,7 +2542,7 @@
|
||||
"uid": "$datasource"
|
||||
},
|
||||
"definition": "",
|
||||
"hide": 2,
|
||||
"hide": 0,
|
||||
"includeAll": false,
|
||||
"multi": false,
|
||||
"name": "cluster",
|
||||
|
||||
@@ -1402,7 +1402,7 @@
|
||||
"uid": "$datasource"
|
||||
},
|
||||
"definition": "",
|
||||
"hide": 2,
|
||||
"hide": 0,
|
||||
"includeAll": false,
|
||||
"multi": false,
|
||||
"name": "cluster",
|
||||
|
||||
@@ -2139,7 +2139,7 @@
|
||||
"uid": "$datasource"
|
||||
},
|
||||
"definition": "",
|
||||
"hide": 2,
|
||||
"hide": 0,
|
||||
"includeAll": false,
|
||||
"multi": false,
|
||||
"name": "cluster",
|
||||
|
||||
@@ -153,11 +153,13 @@ module "helm_addon" {
|
||||
}
|
||||
|
||||
module "java_monitoring" {
|
||||
source = "./patterns/java"
|
||||
count = var.enable_java ? 1 : 0
|
||||
source = "./patterns/java"
|
||||
count = var.enable_java ? 1 : 0
|
||||
enable_dashboards = var.enable_dashboards
|
||||
|
||||
managed_prometheus_workspace_id = var.managed_prometheus_workspace_id
|
||||
enable_alerting_rules = var.java_config.enable_alerting_rules
|
||||
enable_recording_rules = var.java_config.enable_recording_rules
|
||||
dashboards_folder_id = var.dashboards_folder_id
|
||||
}
|
||||
|
||||
|
||||
@@ -42,6 +42,8 @@ No modules.
|
||||
|------|-------------|------|---------|:--------:|
|
||||
| <a name="input_dashboards_folder_id"></a> [dashboards\_folder\_id](#input\_dashboards\_folder\_id) | Grafana folder ID for automatic dashboards | `string` | n/a | yes |
|
||||
| <a name="input_enable_alerting_rules"></a> [enable\_alerting\_rules](#input\_enable\_alerting\_rules) | Enables or disables Managed Prometheus alerting rules | `bool` | `true` | no |
|
||||
| <a name="input_enable_dashboards"></a> [enable\_dashboards](#input\_enable\_dashboards) | Enables or disables curated dashboards | `bool` | `true` | no |
|
||||
| <a name="input_enable_recording_rules"></a> [enable\_recording\_rules](#input\_enable\_recording\_rules) | Enables or disables Managed Prometheus recording rules | `bool` | `true` | no |
|
||||
| <a name="input_managed_prometheus_workspace_id"></a> [managed\_prometheus\_workspace\_id](#input\_managed\_prometheus\_workspace\_id) | Amazon Managed Prometheus Workspace ID | `string` | `null` | no |
|
||||
|
||||
## Outputs
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
resource "aws_prometheus_rule_group_namespace" "recording_rules" {
|
||||
count = var.enable_recording_rules ? 1 : 0
|
||||
name = "accelerator-java-rules"
|
||||
workspace_id = var.managed_prometheus_workspace_id
|
||||
data = <<EOF
|
||||
@@ -31,6 +32,7 @@ EOF
|
||||
}
|
||||
|
||||
resource "grafana_dashboard" "this" {
|
||||
count = var.enable_dashboards ? 1 : 0
|
||||
folder = var.dashboards_folder_id
|
||||
config_json = file("${path.module}/dashboards/default.json")
|
||||
}
|
||||
|
||||
@@ -4,6 +4,12 @@ variable "enable_alerting_rules" {
|
||||
default = true
|
||||
}
|
||||
|
||||
variable "enable_recording_rules" {
|
||||
description = "Enables or disables Managed Prometheus recording rules"
|
||||
type = bool
|
||||
default = true
|
||||
}
|
||||
|
||||
variable "managed_prometheus_workspace_id" {
|
||||
description = "Amazon Managed Prometheus Workspace ID"
|
||||
type = string
|
||||
@@ -14,3 +20,9 @@ variable "dashboards_folder_id" {
|
||||
description = "Grafana folder ID for automatic dashboards"
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "enable_dashboards" {
|
||||
description = "Enables or disables curated dashboards"
|
||||
type = bool
|
||||
default = true
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
################################################################################################################################################
|
||||
|
||||
resource "aws_prometheus_rule_group_namespace" "recording_rules" {
|
||||
count = var.enable_recording_rules ? 1 : 0
|
||||
name = "accelerator-infra-rules"
|
||||
workspace_id = var.managed_prometheus_workspace_id
|
||||
data = <<EOF
|
||||
|
||||
@@ -62,6 +62,12 @@ variable "enable_alerting_rules" {
|
||||
default = true
|
||||
}
|
||||
|
||||
variable "enable_recording_rules" {
|
||||
description = "Enables or disables Managed Prometheus recording rules"
|
||||
type = bool
|
||||
default = true
|
||||
}
|
||||
|
||||
variable "enable_dashboards" {
|
||||
description = "Enables or disables curated dashboards"
|
||||
type = bool
|
||||
@@ -217,13 +223,15 @@ variable "enable_java" {
|
||||
variable "java_config" {
|
||||
description = "Configuration object for Java/JMX monitoring"
|
||||
type = object({
|
||||
enable_alerting_rules = bool
|
||||
scrape_sample_limit = number
|
||||
enable_alerting_rules = bool
|
||||
enable_recording_rules = bool
|
||||
scrape_sample_limit = number
|
||||
})
|
||||
|
||||
default = {
|
||||
enable_alerting_rules = true
|
||||
scrape_sample_limit = 1000
|
||||
enable_alerting_rules = true
|
||||
enable_recording_rules = true
|
||||
scrape_sample_limit = 1000
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user