mimir2tf

command module
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 4, 2022 License: MPL-2.0 Imports: 14 Imported by: 0

README

mimir2tf - Mimir YAML Prometheus Rules to Terraform HCL converter

A tool for converting Mimir Prometheus Rules (in YAML format) into HashiCorp's Terraform configuration language.

The converted .tf files are suitable for use with the Terraform Mimir Provider

Installation

Pre-built Binaries

Download Binary from GitHub releases page.

Example Usage

Convert a single YAML file and write generated Terraform config to Stdout

$ mimir2tf -f test-fixtures/rules.yaml

resource "mimir_rule_group_alerting" "example" {
  name      = "example"
  namespace = "my_namespace"

  rule {
    alert = "HighRequestLatency"
    expr  = "sum by (job) (http_inprogress_requests)"
    for   = "5m"

    labels = {
      severity = "critical"
    }

    annotations = {
      test = "annotation value"
    }
  }
}

resource "mimir_rule_group_recording" "mimir_ingester_rules" {
  name      = "mimir_ingester_rules"
  namespace = "my_namespace"

  rule {
    record = "cluster_namespace_pod:cortex_ingester_ingested_samples_total:rate1m"
    expr   = "sum by(cluster, namespace, pod) (rate(cortex_ingester_ingested_samples_total[1m]))"
  }
}

Convert a single YAML file and write output to file

$ mimir2tf -f test-fixtures/rules.yaml -o rules.tf

Convert a directory of Mimir YAML files

$ mimir2tf -f test-fixtures/

Building

NOTE Requires a working Golang build environment.

This project uses Golang modules for dependency management, so it can be cloned outside of the $GOPATH.

Clone the repository

$ git clone https://github.com/fgouteroux/mimir2tf.git

Build

$ cd mimir2tf
$ make build

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL