---
title: "Managed resources"
description: "The resources an environment manages, what detaching means, and attaching, forgetting and deleting one."
---

> Documentation Index
> Fetch the complete documentation index at: https://docs.ezghcloud.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Managed resources

Each environment keeps a list of the resources it manages, by their key in the file
(`resources.db`, and a service's own resources as `services.<name>.<kind>`). `ezgh deploy status`
and the canvas show them with their status.

| Status | Means |
| --- | --- |
| `creating`, `changing` | A deployment is creating or changing it |
| `managed` | The environment manages it |
| `createFailed` | Creating it failed; the next deployment tries again |
| `detaching`, `detached` | It was removed from the file; Deploy no longer changes it |
| `missing` | Its product no longer has it |
| `deleting`, `deleted` | It's being deleted, or was, on request |
| `forgotten` | Deploy stopped tracking it; the resource itself is untouched |

## On product pages

Every product page for a managed resource says so: "Managed by Deploy stack `shop` / `production`.
Changes made here are reverted by its next deployment." It links to the stack. The file wins for
each field it sets, so change those in the file. Fields the file doesn't set can be changed on
the product's page and are kept.

Resources whose products take tags carry `ezgh-deploy-stack`, `ezgh-deploy-environment` and
`ezgh-deploy-entry`. The environment's list is what counts: bots, buckets, alert rules, listeners
and firewall rules carry no tags.

## Detached

Removing a resource from the file detaches it at the next deployment. Deploy stops managing it,
removes its tags, and leaves it and its data as they are. A detached resource shows on the canvas
until it's attached again or dismissed (forgotten).

## Missing

A database, cache, bucket, queue or secret that its product no longer has is `missing`, and is
never recreated by itself: plans that touch it are refused until you forget or attach it, so a
lost database is never replaced by an empty one without you knowing. A missing firewall, target
group, listener or alert rule is recreated by the next deployment, and shown in its plan.

## Attach

```sh
ezgh deploy resources attach db dbi_0123456789ab
```

has the environment manage an existing resource under a key in the file, instead of creating one.
You need the product's read and update rights on that resource, and it can't already be managed
by another environment. Its next deployment's plan shows what changes to match the file.

## Forget

```sh
ezgh deploy resources forget db
```

stops managing a resource and leaves it as it is. The CLI names the stack, environment, kind and
ID, and asks you to type `<environment>/<key>`; `--yes` skips the question. Forgetting a `missing`
resource lets the next plan create a new one.

## Delete

```sh
ezgh deploy resources delete db --confirm production/db
```

deletes a managed resource, as its own deployment. It's the only way Deploy deletes one. The CLI
names the stack, environment, kind and ID, and needs `<environment>/<key>` typed or passed with
`--confirm`. You need the product's own delete right on the resource, as well as
`deploy.resources.delete`.

| Action | Permission |
| --- | --- |
| List | `deploy.resources.list` |
| Attach | `deploy.resources.attach`, and the product's read and update rights on the resource |
| Forget | `deploy.resources.forget` |
| Delete | `deploy.resources.delete`, and the product's delete right on the resource |

Source: https://docs.ezghcloud.com/deploy/resources/index.mdx
