
spawn
or kill
command. Those commands cause the CLI to fetch layer definitions and the necessary pieces of state. The CLI will also update the state in the back-end when it changes.
Types of back-ends
There are two types of back-ends:local
and s3
.
The local
back-end means you will store state and layer definitions on disk.
The problem with using the local
back-end is that other members of the team won’t have access to your layer definitions and their state.
The s3
back-end specifies the S3 bucket into which Layerform will store layer definitions and state.
By using an s3
back-end you enable your whole team to fetch the definitions you provisioned. Additionally, your team can share core pieces of infrastructure because they will have access to shared state in the cloud.
Provisioning (Configuration Step)
To provision a back-end, you must first specify the desired back-end in yourconfig.yml
file in the ~/.layerform
folder.
layers.json
file. This file has definitions for each layer, as shown below.
layerform configure
to provision these layers to your S3 bucket.

Please create a bucket exclusively for Layerform when using an S3 bucket as a back-end.Layerform should always have its own bucket for storing layer states and definitions. Otherwise, it may overwrite existing files.
Using (Usage Step)
Users directly interface with the back-end when they runlayerform spawn
and layerform kill
.
Those commands cause the Layerform CLI to fetch state and layer definitions from the back-end so it knows which Terraform files to run.

Configuration
To configure your CLI to use a particular back-end, you must remember to update theconfig.yaml
file within ~/.layerform
so it pulls and writes data to the correct place.
To use an S3 bucket, you must add a context
entry whose type
is s3
. That entry must specify the bucket’s name under the bucket
key.
Then, you should set currentContext
to the name of your S3 context, as shown below.
Please create a bucket exclusively for Layerform when using an S3 bucket as a back-end.Layerform should always have its own bucket for storing layer states and definitions. Otherwise, it may overwrite existing files.
Using the local filesystem
To use the local filesystem back-end yourcontext
entry must use the type local
and specify the directory containing your layer definitions and state.