I see that there are multiple options for Backends, however git isn’t one of them.
I believe git can be used as a backend for tfstate, in the below steps:
- Create a dedicated git repo
- Commit the tfstate files in a specified directory and branch. Only fetch the required files, rather than the whole repo, as this repo could be used to store multiple tfstate files on different directories.
- For locking and unlocking: Method 1 (git LFS): use ‘git lfs lock’
Method 2 (git - where lfs isn’t possible): Use another file suffixed with .lock, which should contain the lock state.
Is there any plan for Terraform to release git as a backend?
I've also thought of ways to use the HTTP backend to upload to a git, no luck yet.
Thoughts on how this can be achieved?
There's already a Github/Gitlab/Bitbucket provider.