diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index c9a7b59..632685e 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -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 @@ -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 diff --git a/.github/workflows/pkg.yaml b/.github/workflows/pkg.yaml index c2f9af6..a3ca915 100644 --- a/.github/workflows/pkg.yaml +++ b/.github/workflows/pkg.yaml @@ -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 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3144060..7b7931d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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): diff --git a/README.md b/README.md index a51d8b7..9c9e586 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# 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) @@ -6,12 +6,12 @@ [![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 🙂 diff --git a/TerraformBackend.sln b/TerraformBackend.sln index 9dcf439..0b1d8c0 100644 --- a/TerraformBackend.sln +++ b/TerraformBackend.sln @@ -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 diff --git a/docs/index.md b/docs/index.md index b961ee3..2d0cd94 100644 --- a/docs/index.md +++ b/docs/index.md @@ -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 @@ -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