Skip to content

Commit

Permalink
added prometheus and helm dependency with terraform
Browse files Browse the repository at this point in the history
  • Loading branch information
timam committed Oct 24, 2023
1 parent 56cb4e5 commit 733ed34
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 0 deletions.
6 changes: 6 additions & 0 deletions sandbox/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Terraform Files
.terraform
terraform.tfstate.d
.terraform.lock.hcl
terraform.tfstate
terraform.tfstate.backup
22 changes: 22 additions & 0 deletions sandbox/grafana.tf
Original file line number Diff line number Diff line change
@@ -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
]
}
5 changes: 5 additions & 0 deletions sandbox/namespace.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
resource "kubernetes_namespace_v1" "statuz" {
metadata {
name = "statuz"
}
}
35 changes: 35 additions & 0 deletions sandbox/prometheus.tf
Original file line number Diff line number Diff line change
@@ -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
]
}
11 changes: 11 additions & 0 deletions sandbox/providers.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
provider "kubernetes" {
config_path = "~/.kube/config"
config_context = "minikube"
}

provider "helm" {
kubernetes {
config_path = "~/.kube/config"
config_context = "minikube"
}
}

0 comments on commit 733ed34

Please sign in to comment.