Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/akshaymankar/terraform-http-backend-pass
Mirror of https://git.coop/akshay/terraform-http-backend-pass
https://github.com/akshaymankar/terraform-http-backend-pass
Last synced: 24 days ago
JSON representation
Mirror of https://git.coop/akshay/terraform-http-backend-pass
- Host: GitHub
- URL: https://github.com/akshaymankar/terraform-http-backend-pass
- Owner: akshaymankar
- License: agpl-3.0
- Created: 2021-02-28T14:28:29.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-05-29T19:38:26.000Z (over 1 year ago)
- Last Synced: 2024-09-23T03:15:10.567Z (about 2 months ago)
- Language: Haskell
- Homepage:
- Size: 33.2 KB
- Stars: 1
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Terraform HTTP Backend Pass
**Catchy name! What does it do?**
According to [terraform
docs](https://www.terraform.io/docs/language/settings/backends/index.html):> Each Terraform configuration can specify a backend, which defines where and
> how operations are performed, where state snapshots are stored, etc.There are a few backends which terraform provides, none of which are very
customizable. The [http
backend](https://www.terraform.io/docs/language/settings/backends/http.html),
however, provides a way to define where (and how) state snapshots are stored. It
additionally allows for a locking the state while some operation is being
perfomed.This project aims to provide a backend to store the terraform state in a git
repository. As the state can contain sensitive information, it should be
encrypted before storing, for which [`pass`](https://www.passwordstore.org/) is
used.## How to use
1. Install the backend in one of these ways:
- Using [Stack](https://docs.haskellstack.org/en/stable/README/):
```bash
stack install terraform-http-backend-pass
```
- Using [Cabal](https://www.haskell.org/cabal/):
```bash
cabal install terraform-http-backend-pass
```
- Using [nix](https://nixos.org/):
```bash
nix registry add terraform-http-backend-pass git+https://git.coop/akshay/terraform-http-backend-pass
nix build 'terraform-http-backend-pass#' --profile $HOME/.nix-profile
```
2. Create a pass repository:
```bash
export PASSWORD_STORE_DIR=/desired/path/to/store
pass init
pass git init
```
3. Push the repository somewhere, set push upstream:
```bash
export PASSWORD_STORE_DIR=/desired/path/to/store
pass git remote add origin
pass git push -u origin master
```
4. Start the backend:
```bash
terraform-http-backend-pass --repositoryPath /desired/path/to/store --port 8888
```
5. Setup terraform with backend information:
```tf
terraform {
backend "http" {
# Or, something else if the server is not running on localhost
address = "http://localhost:8888"
}
}
```
The address can also be specified dynamically using the `-backend-config`
option while running `terraform init`
6. Use terraform as usual:
```bash
terraform init
terraform apply
```