Move all dashboards to GitOps (#175)

* Typo

* Remove Grafana provider

* Temp: move dashbaords to gitOps

* Move external labels to resource attributes

* Avoid DDoS with using 0.0.0.0

* Pre-commit

* Transition in two steps

Will need to remove provider in a separate version to provide a transition path as removing this will break terraform and leave orphans in the state

* Move patterns' dashboards creation to gitOps

Standardize config objects for patterns as well

* Pre-commit

* Create AMP dashboard from external source with Grafana provider

* Fix deprecated option

* Fix Flux requirements

* Run pre-commit

* Update example with operator

* Cleanup examples

* Update multicluster example

* Update multicluster example

* Drop dead variable

* Update docs

* Change GitOps branch name

* Update docs

* Replacing Secrets Manager to SSM to store Grafana API Key (#178)

* Fixing SSM

* Fixing SSM

* Replacing Secrets Manager with SSM

* Replacing Secrets Manager with SSM

* Update architecture diagram

* Update architecture diagram

* Update README.md

* Update index.md

* Fixing Grafana Operator Version

* Fix multicluster example

* Update docs

---------

Co-authored-by: Ela AWS <51791117+elamaran11@users.noreply.github.com>
Co-authored-by: Elamaran Shanmugam <elamaran.shan@gmail.com>
This commit is contained in:
Rodrigue Koffi
2023-06-12 18:00:42 +02:00
committed by GitHub
parent c5e4c0c718
commit fa38a90efc
46 changed files with 363 additions and 4462 deletions
+28 -8
View File
@@ -1,7 +1,8 @@
resource "aws_prometheus_rule_group_namespace" "recording_rules" {
count = var.enable_recording_rules ? 1 : 0
count = var.pattern_config.enable_recording_rules ? 1 : 0
name = "accelerator-java-rules"
workspace_id = var.managed_prometheus_workspace_id
workspace_id = var.pattern_config.managed_prometheus_workspace_id
data = <<EOF
groups:
- name: default-metric
@@ -12,10 +13,10 @@ EOF
}
resource "aws_prometheus_rule_group_namespace" "alerting_rules" {
count = var.enable_alerting_rules ? 1 : 0
count = var.pattern_config.enable_alerting_rules ? 1 : 0
name = "accelerator-java-alerting"
workspace_id = var.managed_prometheus_workspace_id
workspace_id = var.pattern_config.managed_prometheus_workspace_id
data = <<EOF
groups:
- name: default-alert
@@ -31,8 +32,27 @@ groups:
EOF
}
resource "grafana_dashboard" "this" {
count = var.enable_dashboards ? 1 : 0
folder = var.dashboards_folder_id
config_json = file("${path.module}/dashboards/default.json")
resource "kubectl_manifest" "flux_kustomization" {
count = var.pattern_config.enable_dashboards ? 1 : 0
yaml_body = <<YAML
apiVersion: kustomize.toolkit.fluxcd.io/v1beta2
kind: Kustomization
metadata:
name: ${var.pattern_config.flux_kustomization_name}
namespace: flux-system
spec:
interval: 1m0s
path: ${var.pattern_config.flux_kustomization_path}
prune: true
sourceRef:
kind: GitRepository
name: ${var.pattern_config.flux_gitrepository_name}
postBuild:
substitute:
AMG_AWS_REGION: ${var.pattern_config.managed_prometheus_workspace_region}
AMP_ENDPOINT_URL: ${var.pattern_config.managed_prometheus_workspace_endpoint}
AMG_ENDPOINT_URL: ${var.pattern_config.grafana_url}
GRAFANA_JAVA_JMX_DASH_URL: ${var.pattern_config.grafana_dashboard_url}
YAML
}