Adding a lot of stuff.
This commit is contained in:
3
modules/eks-kube-prometheus-stack/data.tf
Normal file
3
modules/eks-kube-prometheus-stack/data.tf
Normal file
@ -0,0 +1,3 @@
|
||||
data "aws_eks_cluster_auth" "self" {
|
||||
name = var.cluster_id
|
||||
}
|
41
modules/eks-kube-prometheus-stack/main.tf
Normal file
41
modules/eks-kube-prometheus-stack/main.tf
Normal file
@ -0,0 +1,41 @@
|
||||
resource "helm_release" "kube_prometheus_stack" {
|
||||
name = var.prom_operator_release_name
|
||||
repository = "https://prometheus-community.github.io/helm-charts"
|
||||
chart = "kube-prometheus-stack"
|
||||
version = "34.9.0"
|
||||
namespace = var.namespace
|
||||
create_namespace = var.create_namespace
|
||||
|
||||
set {
|
||||
name = "prometheus.ingress.enabled"
|
||||
value = true
|
||||
}
|
||||
set {
|
||||
name = "prometheus.ingress.hosts"
|
||||
value = "{prometheus-operator.${var.domain}}"
|
||||
}
|
||||
set {
|
||||
name = "alertmanager.enabled"
|
||||
value = var.enable_alertmanager
|
||||
}
|
||||
set {
|
||||
name = "alertmanager.ingress.enabled"
|
||||
value = var.enable_alertmanager
|
||||
}
|
||||
set {
|
||||
name = "alertmanager.ingress.hosts"
|
||||
value = "{alertmanager.${var.domain}}"
|
||||
}
|
||||
set {
|
||||
name = "grafana.enabled"
|
||||
value = var.enable_grafana
|
||||
}
|
||||
set {
|
||||
name = "grafana.ingress.enabled"
|
||||
value = var.enable_grafana
|
||||
}
|
||||
set {
|
||||
name = "grafana.ingress.hosts"
|
||||
value = "{grafana.${var.domain}}"
|
||||
}
|
||||
}
|
7
modules/eks-kube-prometheus-stack/provider.tf
Normal file
7
modules/eks-kube-prometheus-stack/provider.tf
Normal file
@ -0,0 +1,7 @@
|
||||
provider "helm" {
|
||||
kubernetes {
|
||||
host = var.cluster_endpoint
|
||||
cluster_ca_certificate = base64decode(var.cluster_certificate_authority_data)
|
||||
token = data.aws_eks_cluster_auth.self.token
|
||||
}
|
||||
}
|
61
modules/eks-kube-prometheus-stack/variables.tf
Normal file
61
modules/eks-kube-prometheus-stack/variables.tf
Normal file
@ -0,0 +1,61 @@
|
||||
variable "cluster_id" {
|
||||
type = string
|
||||
description = "The name/id of the EKS cluster. Will block on cluster creation until the cluster is really ready"
|
||||
}
|
||||
|
||||
variable "cluster_endpoint" {
|
||||
type = string
|
||||
description = "Endpoint for your Kubernetes API server"
|
||||
}
|
||||
|
||||
variable "cluster_certificate_authority_data" {
|
||||
type = string
|
||||
description = "Base64 encoded certificate data required to communicate with the cluster"
|
||||
}
|
||||
|
||||
variable "namespace" {
|
||||
type = string
|
||||
description = "The namespace where the kube-prometheus-stack is deployed"
|
||||
default = "monitoring"
|
||||
}
|
||||
|
||||
variable "create_namespace" {
|
||||
type = bool
|
||||
description = "Flag allowing to create the namespace if it does not exists"
|
||||
default = true
|
||||
}
|
||||
|
||||
variable "domain" {
|
||||
type = string
|
||||
description = "Domain name used to setup ingress for kube-prometheus-stack"
|
||||
}
|
||||
|
||||
variable "prom_operator_release_name" {
|
||||
type = string
|
||||
description = "The name of the Helm release deploying the prometheus stack chart"
|
||||
default = "prometheus-community"
|
||||
}
|
||||
|
||||
variable "pushgateway_release_name" {
|
||||
type = string
|
||||
description = "The name of the Helm release deploying the pushgateway chart"
|
||||
default = "pushgateway"
|
||||
}
|
||||
|
||||
variable "enable_alertmanager" {
|
||||
type = bool
|
||||
default = true
|
||||
description = "Enable alertmanager in the Prometheus Operator"
|
||||
}
|
||||
|
||||
variable "enable_grafana" {
|
||||
type = bool
|
||||
default = true
|
||||
description = "Enable grafana in the Prometheus Operator"
|
||||
}
|
||||
|
||||
variable "enable_pushgateway" {
|
||||
type = bool
|
||||
default = true
|
||||
description = "Enable pushgateway in the Prometheus Operator"
|
||||
}
|
12
modules/eks-kube-prometheus-stack/versions.tf
Normal file
12
modules/eks-kube-prometheus-stack/versions.tf
Normal file
@ -0,0 +1,12 @@
|
||||
terraform {
|
||||
required_providers {
|
||||
helm = {
|
||||
source = "hashicorp/helm"
|
||||
version = "2.4.1"
|
||||
}
|
||||
aws = {
|
||||
source = "hashicorp/aws"
|
||||
version = "~> 4.4.0"
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user