{"id":18834467,"url":"https://github.com/fgouteroux/mimir2tf","last_synced_at":"2026-01-26T11:30:17.435Z","repository":{"id":61627071,"uuid":"545495150","full_name":"fgouteroux/mimir2tf","owner":"fgouteroux","description":"Mimir YAML Prometheus Rules to Terraform HCL converter ","archived":false,"fork":false,"pushed_at":"2024-08-26T14:32:34.000Z","size":199,"stargazers_count":8,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-12-30T07:42:18.382Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://github.com/fgouteroux/terraform-provider-mimir","language":"HCL","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fgouteroux.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-10-04T13:23:55.000Z","updated_at":"2024-08-26T14:32:37.000Z","dependencies_parsed_at":"2024-06-20T04:42:32.737Z","dependency_job_id":"16adc339-c045-44f4-a522-12b28dea96b4","html_url":"https://github.com/fgouteroux/mimir2tf","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fgouteroux%2Fmimir2tf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fgouteroux%2Fmimir2tf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fgouteroux%2Fmimir2tf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fgouteroux%2Fmimir2tf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fgouteroux","download_url":"https://codeload.github.com/fgouteroux/mimir2tf/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239768923,"owners_count":19693764,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-08T02:12:34.498Z","updated_at":"2026-01-26T11:30:17.382Z","avatar_url":"https://github.com/fgouteroux.png","language":"HCL","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mimir2tf - Mimir YAML Prometheus Rules to Terraform HCL converter\n\nA tool for converting Mimir Prometheus Rules (in YAML format) into HashiCorp's Terraform configuration language.\n\nThe converted `.tf` files are suitable for use with the [Terraform Mimir Provider](https://registry.terraform.io/providers/fgouteroux/mimir/latest/docs)\n\n\n## Installation\n\n**Pre-built Binaries**\n\nDownload Binary from GitHub [releases](https://github.com/fgouteroux/mimir2tf/releases/latest) page.\n\n## Usage\n\n```\nUsage of mimir2tf:\n  -d, --debug                enable debug output\n  -f, --filepath string      file or directory that contains the YAML configuration to convert. Use \"-\" to read from stdin (default \"-\")\n  -o, --output string        file or directory where Terraform config will be written (default \"-\")\n  -x, --overwrite-existing   allow overwriting existing output file(s)\n  -r, --reverse              Reverse mode (hcl to yaml)\n  -F, --tf12format           Use Terraform 0.12 formatter\n  -v, --version              Print mimir2tf version\n```\n\n## YAML to HCL\n\n**Convert a single YAML file and write generated Terraform config to Stdout**\n\n```\n$ mimir2tf -f test-fixtures/rules.yaml\n\nresource \"mimir_rule_group_alerting\" \"example\" {\n  name      = \"example\"\n  namespace = \"default\"\n\n  rule {\n    alert = \"HighRequestLatency\"\n    expr  = \"sum by (job) (http_inprogress_requests)\"\n    for   = \"5m\"\n\n    labels = {\n      severity = \"critical\"\n    }\n\n    annotations = {\n      test = \"annotation value\"\n    }\n  }\n}\n\nresource \"mimir_rule_group_recording\" \"mimir_ingester_rules\" {\n  name      = \"mimir_ingester_rules\"\n  namespace = \"default\"\n\n  rule {\n    record = \"cluster_namespace_pod:cortex_ingester_ingested_samples_total:rate1m\"\n    expr   = \"sum by(cluster, namespace, pod) (rate(cortex_ingester_ingested_samples_total[1m]))\"\n  }\n}\n```\n\n**Convert a single YAML file and write output to file**\n\n```\n$ mimir2tf -f test-fixtures/rules.yaml -o rules.tf\n```\n\n**Convert a directory of Mimir YAML files and write output to stdout**\n\n```\n$ mimir2tf -f test-fixtures/\n```\n\n**Convert a directory of Mimir YAML files and write output to file**\n\n```\n$ mimir2tf -f test-fixtures/ -o /tmp/mimir-alerts-rules.tf\n```\n\n## HCL to YAML\n\n**Convert a single HCL file and write yaml output to file**\n\n```\n$ mimir2tf -r -f test-fixtures/mimir-rules.tf -o /tmp/mimir-rules.yaml\n```\n\n**Convert a directory of Mimir HCL files to YAML file**\n\n```\n$ mimir2tf -r -f test-fixtures -o /tmp/mimir-alert-rules.yaml\n\n```\n\nThen validate with [promtool](https://prometheus.io/docs/prometheus/latest/configuration/recording_rules/#syntax-checking-rules)\n```\n$ promtool check rules /tmp/mimir-alert-rules.yaml\nChecking /tmp/mimir-alert-rules.yaml\n2 duplicate rule(s) found.\nMetric: MimirCompactorHasNotUploadedBlocks\nLabel(s):\n  severity: critical\nMetric: MimirRolloutStuck\nLabel(s):\n  severity: warning\nMight cause inconsistency while recording expressions.\n  SUCCESS: 194 rules found\n```\n\n## Building\n\n\u003e **NOTE** Requires a working Golang build environment.\n\nThis project uses Golang modules for dependency management, so it can be cloned outside of the `$GOPATH`.\n\n**Clone the repository**\n\n```\n$ git clone https://github.com/fgouteroux/mimir2tf.git\n```\n\n**Build**\n\n```\n$ cd mimir2tf\n$ make build\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffgouteroux%2Fmimir2tf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffgouteroux%2Fmimir2tf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffgouteroux%2Fmimir2tf/lists"}