Skip to content

Commit 90e9635

Browse files
authored
Add cloudwatch grafana datasource (#1050)
* Fix rabbit prometheus scrape config on master Related issue(s): * #1048 * [Grafana] Add cloudwatch datasource This lets us build dashboards using cloudwatch metrics (aws managed resources like RDS or MQ store their prometheus-like metrics there) Related issue(s): * #1048 * Hardcode grafana cloudwatch datasource uid This lets us reuse the same dashboard json without adjusting its uid per deployment. This is how it works with current architecture design * Disable cloudwatch datasource for non aws
1 parent 3b55f18 commit 90e9635

File tree

3 files changed

+43
-1
lines changed

3 files changed

+43
-1
lines changed

services/monitoring/grafana/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ terraform/plan.cache:
2727
@exit 1
2828

2929
.PHONY: terraform-plan
30-
terraform-plan: $(REPO_CONFIG_LOCATION) $(TF_STATE_FILE) ensure-grafana-online ## terraform plan
30+
terraform-plan: $(REPO_CONFIG_LOCATION) $(TF_STATE_FILE) ensure-grafana-online assets ## terraform plan
3131
# terraform plan
3232
@set -a; source $<; set +a; \
3333
terraform -chdir=./terraform plan -out=plan.cache

services/monitoring/grafana/terraform/datasources.tf

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,22 @@ resource "grafana_data_source" "tempo" {
2323
basic_auth_enabled = false
2424
is_default = false
2525
}
26+
27+
resource "grafana_data_source" "cloudwatch" {
28+
# This resource is only created if the AWS Deployments
29+
count = var.IS_AWS_DEPLOYMENT ? 1 : 0
30+
31+
type = "cloudwatch"
32+
name = "cloudwatch"
33+
uid = "fem2inr5v64n4c"
34+
35+
json_data_encoded = jsonencode({
36+
defaultRegion = var.AWS_DEFAULT_REGION
37+
authType = "keys"
38+
})
39+
40+
secure_json_data_encoded = jsonencode({
41+
accessKey = var.GRAFANA_CLOUDWATCH_DATASOURCE_USER_ACCESS_KEY
42+
secretKey = var.GRAFANA_CLOUDWATCH_DATASOURCE_USER_SECRET_KEY
43+
})
44+
}

services/monitoring/grafana/terraform/variables.tf

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,26 @@ variable "PROMETHEUS_CATCHALL_URL" {
1818
description = "Prometheus Catchall URL"
1919
sensitive = false
2020
}
21+
22+
# to be used to create resource only for AWS / non AWS Deployments
23+
# this is not syncronised / validated with dashboards imported from folders
24+
variable "IS_AWS_DEPLOYMENT" {
25+
description = "Is AWS Deployment"
26+
type = bool
27+
default = false
28+
}
29+
30+
variable "AWS_DEFAULT_REGION" {
31+
description = "AWS Region"
32+
sensitive = false
33+
}
34+
35+
variable "GRAFANA_CLOUDWATCH_DATASOURCE_USER_ACCESS_KEY" {
36+
description = "AWS Grafana Cloudwatch User Access Key"
37+
sensitive = true
38+
}
39+
40+
variable "GRAFANA_CLOUDWATCH_DATASOURCE_USER_SECRET_KEY" {
41+
description = "AWS Grafana Cloudwatch User Secret Key"
42+
sensitive = true
43+
}

0 commit comments

Comments
 (0)