Skip to content

Terraform modules for creating Prometheus Operator Custom Resource Definitions

License

Notifications You must be signed in to change notification settings

mongodb-devprod-infrastructure/terraform-kubernetes-prometheus-operator

Repository files navigation

terraform-kubernetes-prometheus-operator

Terraform modules for creating Prometheus Operator Custom Resource Definitions

Purpose

The purpose of this repository is to provide a means of creating Prometheus Operator custom resources using Terraform.

What is Prometheus Operator?

Prometheus Operator provides Kubernetes native deployment and management of Prometheus and related monitoring components. Notably, Prometheus Operator includes custom resources to deploy and manage Prometheus, Alertmanager, and related components.

Why not Jsonnet?

The Prometheus community wrote a design document to present a technique for packaging and deploying extensible and customizable configurations of dashboards, alert definitions, and exporters. The design, known as "Monitoring Mixins", uses Jsonnet to package together said resources.

While Jsonnet is an incredibly powerful data templating language, it comes with a steep learning curve. For example, The kube-prometheus project uses Jsonnet to create dashboards and alerts used to monitor Kubernetes clusters. Understanding how to customize or create new resources using these libraries is not very straightforward and becomes problematic when using the kube-prometheus-stack Helm chart.

Moreover, Terraform offers numerous providers to add resources that it can manage. For example, the AWS provider can be used to interact with the many resources supported by AWS.

Usage

This repository comes with the following Terraform modules:

Instructions for using each module is described in their respective README files. Each module also contains an examples directory that contains valid and tested Terraform configurations.

Contributing

Please refer to the CONTRIBUTING document for more information.

License

Apache License 2.0

Requirements

Name Version
terraform >= 1.0
helm >= 2.6.0
kubernetes >= 2.12.1

Providers

Name Version
kubernetes >= 2.12.1

Modules

Name Source Version
grafana ./modules/grafana n/a
prometheus ./modules/prometheus n/a

Resources

Name Type
kubernetes_config_map.this resource

Inputs

Name Description Type Default Required
namespace Namespace defines the space within which each name must be unique. string "default" no

Outputs

No outputs.