> For the complete documentation index, see [llms.txt](https://docs.stackmate.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.stackmate.io/configuration/configuration-file/state.md).

# state

{% hint style="info" %}
You can deploy the state bucket and lock table by using [these instructions](https://docs.stackmate.io/configuration/configuration-file/pages/JJcujEOUgnUnP5wehd2B#2.-create-the-state-bucket-and-dynamodb-lock-table).
{% endhint %}

The `state` configuration option, is an `Object` which defines where the [Terraform State](https://www.terraform.io/language/state) should be stored after each deployment.&#x20;

### Accepted values

#### AWS S3 Bucket

For storing the state on an AWS S3 bucket, you need to specify an object containing the following attributes:

* `bucket` - The name for the bucket to use. It should comply with the guidelines that AWS provides for naming a bucket.
* `lockTable` - The DynamoDB table to use for state locking. If you don't want to use state locking, feel free to leave this option out.
* `statePath` - *Optional* - The name of the Terraform state file to use. By default it's `stackmate.tfstate` and it should always end in `.tfstate`
* `provider` - *Optional* - It should be set to `aws`. *You don't have to specify this value if the root configuration option for `provider` is set to `aws`.*

### Examples

#### Storing your state on a private, encrypted AWS S3 bucket with state locking

```yaml
...
state:
  bucket: my-awesome-project-state-bucket
  lockTable: stackmate-state-lock
  # 👇 this is optional, by default it will be set to eg. production/stackmate.tfstate
  statePath: my-cool-project.tfstate
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.stackmate.io/configuration/configuration-file/state.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
