> For the complete documentation index, see [llms.txt](https://bluebricks.co/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://bluebricks.co/docs/orchestration/runs/state-management-and-history.md).

# State Management and History

Bluebricks supports two state management models. You choose who owns and operates the infrastructure state: **Bluebricks-managed** state or **Customer-managed** state.

Your choice determines where state is stored, how access is controlled, and how executions interact with it.

### Bluebricks-managed state

When Bluebricks manages state, it becomes part of the deployment execution lifecycle.\
\
State is stored securely and accessed only through authorized Bluebricks executions. You do not define or maintain a Terraform backend in your code.\
\
**How it works**

* State storage is provisioned and managed by Bluebricks.
* For each execution, Bluebricks injects a temporary backend configuration at runtime.
* Short-lived credentials are generated per execution.
* State access is allowed only while the execution is active.

If your code defines a backend, execution will fail until it is removed.

**Benefits**

* Zero setup: Enable managed state during environment creation. No backend configuration required.
* Execution-scoped access: Only active, authorized executions can read or modify state.
* Encrypted storage: State is encrypted at rest in managed object storage.
* Automatic locking: State locking is handled as part of plan and apply operations.

{% hint style="info" %}
Although the state is managed by Bluebricks, you are the owner and you can export it anytime.
{% endhint %}

#### How to view states in Bluebricks

To view state history:

1. Log-in to Bluebricks
2. Go to **Environments**
3. Hover over the environment you want to view, and click **Review** to open the environment's overview page
4. Go to **States** in the left panel

<details>

<summary>How to view or download a state's config</summary>

From the **environment's state** pag&#x65;**:**

1. Click **the three-dot menu** on the state you want to view
2. Click **Download state** to down a JSON of that state

Or, you can click **View Config** to see the JSON config of the state from the Bluebricks app.

{% hint style="info" %}
Only admins can download states.
{% endhint %}

</details>

### Customer-managed state

With customer-managed state, you retain full control over state storage and access.

You define and operate the Terraform backend in your code. Bluebricks interacts with state using the configuration you provide.\
\
**How it works**

* State backend is defined in your Terraform configuration.
* Credentials and access policies are owned and managed by you.
* Bluebricks executions use the backend as-is.

This model is useful when state must remain in an existing system or comply with strict organizational constraints.

**Considerations**

* You are responsible for backend availability and security.
* State access is not scoped or mediated by Bluebricks.
* Locking behavior depends on your backend configuration.
