Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
T
Terraform Http Backend Pass
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Akshay Mankar
Terraform Http Backend Pass
Commits
a9d29498
Commit
a9d29498
authored
4 years ago
by
Akshay Mankar
Browse files
Options
Downloads
Patches
Plain Diff
Add README.md
parent
caedf89b
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
README.md
+69
-0
69 additions, 0 deletions
README.md
terraform-http-backend-pass.cabal
+1
-0
1 addition, 0 deletions
terraform-http-backend-pass.cabal
with
70 additions
and
0 deletions
README.md
0 → 100644
+
69
−
0
View file @
a9d29498
# 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-env
-f
https://git.coop/akshay/terraform-http-backend-pass/-/archive/main/terraform-http-backend-pass-main.tar.gz
-i
```
2.
Create a pass repository:
```
bash
export
PASSWORD_STORE_DIR
=
/desired/path/to/store
pass init <gpg-keys>
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 <remote-url>
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 cacn can also be specified dynamically using the
`-backend-config`
option while running
`terraform init`
6.
Use terraform as usual:
```
bash
terraform init
terraform apply
```
This diff is collapsed.
Click to expand it.
terraform-http-backend-pass.cabal
+
1
−
0
View file @
a9d29498
...
...
@@ -6,6 +6,7 @@ author: Akshay Mankar
maintainer: itsakshaymankar@gmail.com
build-type: Simple
extra-source-files: CHANGELOG.md
, README.md
executable terraform-http-backend-pass
main-is: Main.hs
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment