The lock backend takes care of locking a specific state file, so that only one Terraform entity can access and change it in a given time.
This is the simplest implementation by using a local Golang map and doesn't require any configuration. It works fine for a standalone, single-instance Terraform backend server, but doesn't scale. Also if the Terraform backend server crashes, the lock information will be lost.
Set LOCK_BACKEND
to local
.
This backend uses an external Redis server to lock the states. It's scalable and can be used also with multiple Terraform backend server instances.
Set LOCK_BACKEND
to redis
.
Make sure that the Redis client is set up properly.
This backend uses an external Postgres server to lock the states. It's scalable and can be used also with multiple Terraform backend server instances.
Set LOCK_BACKEND
to postgres
.
Environment Variable | Type | Default | Description |
---|---|---|---|
LOCK_POSTGRES_TABLE | string | locks |
The table name used for storing locks |
Make sure that the Postgres client is set up properly.