Skip to content
No description or website provided.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore - Terraform State in Git

2019 Ondrej Sika <>


Download scripts to your repository & commit them.

curl -o && \
  curl -o && \
  chmod +x && \
  chmod +x

Ignore .state in .gitignore.

echo .state >> .gitignore

Create config form example

Commit those changes into repository.

Setup Git Repository for State (and Move Actual State There)

Doesn't matter If you have some state or if you start from scratch.

You can set up remote repository in or use it as param of ./ script.

This script clone repository for your state to .state folder, move there actual state files (terraform.tfstate and terraform.tfstate.backup) if exist. Then creates links for those state files into state repository.

You have to remove terraform.tfstate and terraform.tfstate.backup from .gitignore, you want to commit those links.


Instead of terraform, you have to use ./ with same argument you use with standart command.

For example:

./ init
./ apply
You can’t perform that action at this time.