Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 27 additions & 4 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,36 @@ permissions:
pull-requests: write

jobs:
check:
runs-on: ubuntu-latest
steps:
- name: Checks-out the repository
uses: actions/checkout@v5
- name: Get changes files
id: changed-files
uses: tj-actions/changed-files@v47
with:
files_yaml: |
doc:
- docs/**
app:
- src/**
- test/**
- name: Lints Markdown files
uses: DavidAnson/markdownlint-cli2-action@v20
with:
globs: "**/*.md"
build:
runs-on: ubuntu-latest
needs: check
if: needs.check.outputs.app_any_changed == 'true'
steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Checkout workflow parts
uses: actions/checkout@v4
uses: actions/checkout@v5
with:
repository: devpro/github-workflow-parts
ref: main
Expand All @@ -57,11 +78,13 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
image-scan:
runs-on: ubuntu-latest
needs: check
if: needs.check.outputs.app_any_changed == 'true'
steps:
- name: Checkout source code
uses: actions/checkout@v3
uses: actions/checkout@v5
- name: Checkout workflow parts
uses: actions/checkout@v3
uses: actions/checkout@v5
with:
repository: devpro/github-workflow-parts
ref: main
Expand Down
15 changes: 15 additions & 0 deletions .github/workflows/pkg.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,23 @@ on:
workflow_dispatch: {}

jobs:
check:
runs-on: ubuntu-latest
steps:
- name: Checks-out the repository
uses: actions/checkout@v5
- name: Get changes files
id: changed-files
uses: tj-actions/changed-files@v47
with:
files_yaml: |
app:
- src/**
- test/**
publish:
runs-on: ubuntu-latest
needs: check
if: needs.check.outputs.app_any_changed == 'true'
steps:
- name: Checkout source code
uses: actions/checkout@v4
Expand Down
11 changes: 0 additions & 11 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,6 @@ The code was made by looking at Terraform specifications:
- [HTTP backend](https://developer.hashicorp.com/terraform/language/backend/http)
- [Remote state backend](https://github.com/hashicorp/terraform/tree/main/internal/backend/remote-state)

The may was partially inspired by looking at other implementations:

- [GitLab](https://gitlab.com/gitlab-org/manage/import/gitlab/-/blob/master/doc/user/infrastructure/terraform_state.md)
- [lib/api/terraform/state.rb](https://gitlab.com/gitlab-org/manage/import/gitlab/-/blob/master/lib/api/terraform/state.rb)
- HTTP
- [akshay/terraform-http-backend-pass](https://git.coop/akshay/terraform-http-backend-pass)
- [bhoriuchi/terraform-backend-http](https://github.com/bhoriuchi/terraform-backend-http)
- [nimbolus/terraform-backend](https://github.com/nimbolus/terraform-backend)
- git
- [plumber-cd/terraform-backend-git](https://github.com/plumber-cd/terraform-backend-git)

## Debug the application

A MongoDB must be running - the easiest way to do it is through a container (here with Docker CLI/engine):
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# MongoDB HTTP backend for Terraform/OpenTofu state
# MongoDB HTTP backend for Terraform / OpenTofu

[![CI](https://github.com/devpro/terraform-backend-mongodb/actions/workflows/ci.yaml/badge.svg?branch=main)](https://github.com/devpro/terraform-backend-mongodb/actions/workflows/ci.yaml)
[![Pages](https://github.com/devpro/terraform-backend-mongodb/actions/workflows/pages.yaml/badge.svg?branch=main)](https://github.com/devpro/terraform-backend-mongodb/actions/workflows/pages.yaml)
[![PKG](https://github.com/devpro/terraform-backend-mongodb/actions/workflows/pkg.yaml/badge.svg?branch=main)](https://github.com/devpro/terraform-backend-mongodb/actions/workflows/pkg.yaml)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=devpro_terraform-backend-mongodb&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=devpro_terraform-backend-mongodb)
[![Docker Image Version](https://img.shields.io/docker/v/devprofr/terraform-backend-mongodb?label=Image&logo=docker)](https://hub.docker.com/r/devprofr/terraform-backend-mongodb)

Manage Terraform/OpenTofu state through a secured REST API and take advatange of MongoDB greatness!
A robust HTTP backend to store Terraform or OpenTofu state in MongoDB, using its built-in replication for reliable, distributed management.

## Getting started
🚀 Get started at [tfbackend-mongodb.devpro.fr](http://tfbackend-mongodb.devpro.fr/).

Best place to start is the [documentation website](http://tfbackend-mongodb.devpro.fr/).
## Quick overview

## Going further
![High-level view](docs/assets/images/high-level.png)

Technical implementation is described in the [contribution guide](CONTRIBUTING.md).
For development details, see [CONTRIBUTING.md](CONTRIBUTING.md) - contributions are more than welcome 🙂
1 change: 1 addition & 0 deletions TerraformBackend.sln
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "local-files", "local-files"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "docs", "docs", "{FF437226-25A3-491B-B433-F4760EC45D25}"
ProjectSection(SolutionItems) = preProject
docs\architecture.md = docs\architecture.md
docs\CNAME = docs\CNAME
docs\index.md = docs\index.md
mkdocs.yml = mkdocs.yml
Expand Down
16 changes: 8 additions & 8 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Welcome

A simple, standards-compliant HTTP backend for [Terraform](https://www.terraform.io) (and [Terraform](https://www.terraform.io)) that stores state files in MongoDB.
A simple, standards-compliant HTTP backend for [Terraform](https://www.terraform.io) (and [OpenTofu](https://opentofu.org/)) that stores state files in MongoDB.

!!! tip

Instead of relying on vendor-specific storage or local files, this backend lets you use MongoDB - a mature, horizontally scalable document database - as the storage layer for your Terraform state.
Since Terraform state is already JSON, MongoDB is a natural and efficient fit.
Instead of relying on vendor-specific storage or local files, this backend lets you use MongoDB - a mature, horizontally scalable document database - as the storage layer for your Terraform state.
Since Terraform state is already JSON, MongoDB is a natural and efficient fit.

## Key features

Expand All @@ -23,7 +23,7 @@ A simple, standards-compliant HTTP backend for [Terraform](https://www.terraform

- You already run MongoDB in your organization
- You want a highly available, globally distributed state store without adding another vendor
- You need strong RBAC and encryption controls that MongoDB already provides
- You prefer running one binary in Kubernetes or as a Docker container instead of managing S3
- You want to use the valuable Terraform state information in your infrastructure management system
- You want to simplify the infrastructure automation with a single, highly available source of truth
- You need strong RBAC and encryption controls
- You prefer running one container instead of managing S3
- You wish to integrate Terraform with your infrastructure management system
- You want to a single, highly available source of truth