diff --git a/sandbox/.gitignore b/sandbox/.gitignore new file mode 100644 index 0000000..bf156ab --- /dev/null +++ b/sandbox/.gitignore @@ -0,0 +1,6 @@ +# Terraform Files +.terraform +terraform.tfstate.d +.terraform.lock.hcl +terraform.tfstate +terraform.tfstate.backup diff --git a/sandbox/grafana.tf b/sandbox/grafana.tf new file mode 100644 index 0000000..cca1818 --- /dev/null +++ b/sandbox/grafana.tf @@ -0,0 +1,22 @@ +resource "helm_release" "grafana" { + namespace = kubernetes_namespace_v1.statuz.id + repository = "https://grafana.github.io/helm-charts" + chart = "grafana" + name = "grafana" + version = "6.61.1" + values = [ + <<-EOT + grafana.ini: + auth.anonymous: + enabled: true + org_role: Admin + datasources: + datasources.yaml: + apiVersion: 1 + datasources: + - name: Prometheus + type: prometheus + url: http://prometheus-server:80 + EOT + ] +} \ No newline at end of file diff --git a/sandbox/namespace.tf b/sandbox/namespace.tf new file mode 100644 index 0000000..569b017 --- /dev/null +++ b/sandbox/namespace.tf @@ -0,0 +1,5 @@ +resource "kubernetes_namespace_v1" "statuz" { + metadata { + name = "statuz" + } +} \ No newline at end of file diff --git a/sandbox/prometheus.tf b/sandbox/prometheus.tf new file mode 100644 index 0000000..dd3f6bd --- /dev/null +++ b/sandbox/prometheus.tf @@ -0,0 +1,35 @@ +resource "helm_release" "prometheus" { + namespace = kubernetes_namespace_v1.statuz.id + repository = "https://prometheus-community.github.io/helm-charts" + chart = "prometheus" + name = "prometheus" + version = "25.2.0" + values = [ + <<-EOT + serverFiles: + rule_files: + - /etc/config/recording_rules.yml + - /etc/config/alerting_rules.yml + prometheus.yml: + scrape_configs: + - job_name: prometheus + honor_timestamps: true + scrape_interval: 15s + scrape_timeout: 10s + metrics_path: /metrics + scheme: http + static_configs: + - targets: + - localhost:9090 + - job_name: watcher + honor_timestamps: true + scrape_interval: 15s + scrape_timeout: 10s + metrics_path: /metrics + scheme: http + static_configs: + - targets: + - watcher:8080 + EOT + ] +} \ No newline at end of file diff --git a/sandbox/providers.tf b/sandbox/providers.tf new file mode 100644 index 0000000..689d1ff --- /dev/null +++ b/sandbox/providers.tf @@ -0,0 +1,11 @@ +provider "kubernetes" { + config_path = "~/.kube/config" + config_context = "minikube" +} + +provider "helm" { + kubernetes { + config_path = "~/.kube/config" + config_context = "minikube" + } +} \ No newline at end of file