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

# Act on unmanaged resources

> Mark unmanaged resources as managed by another tool with management rules, or generate the CLI commands to delete the ones nobody needs.

Once you know which resources are unmanaged, you can mark the ones another tool already manages, or delete the ones nobody needs.

Both actions start from a list of unmanaged resources: an environment's **Unmanaged** tab, an unmanaged resource collection, or the **Orphaned**, **Unattributed** and **Unmanaged** rows of the [project tree](https://docs.envzero.com/guides/ez-control-center/explore-cloud-resources.md#read-the-project-tree). Select resources with their checkboxes to open the action bar.

![Unmanaged tab with two resources selected and an action bar with Mark as managed and Generate delete commands highlighted](https://mintcdn.com/envzero-b61043c8/7R9pjxUjbkYFPf24/images/guides/ez-control-center/unmanaged-bulk-actions.png?fit=max\&auto=format\&n=7R9pjxUjbkYFPf24\&q=85\&s=5ebba74efd331cdbb1b4d2525f75646d)

1. **Mark as managed** assigns the selected resources to another tool.
2. **Generate delete commands** builds the commands to delete them.

## Mark resources as managed by another tool

Use this for resources that a tool other than env zero already manages, such as Crossplane, Pulumi or a team's own scripts. They stop counting as unmanaged and show as **Externally managed**, and EZ Control Center stops suggesting to codify or delete them.

> [!WARNING]
>
> Marking resources as managed, and adding, editing or deleting rules, needs the **Edit Organization Settings** permission.

**1. Select the resources**

Select one or more unmanaged resources and click **Mark as managed**.

**2. Name the tool**

In **Managed by**, pick a suggested tool or type your own. The name becomes the rule's name and shows on every matching resource. In **Where (optional)**, add where they are managed, such as a repository URL or a console name.

![Mark as managed dialog with Managed by set to Crossplane, Where set to github.com/acme/platform-crossplane, and Apply to set to the 2 selected resources](https://mintcdn.com/envzero-b61043c8/7R9pjxUjbkYFPf24/images/guides/ez-control-center/mark-as-managed-dialog.png?fit=max\&auto=format\&n=7R9pjxUjbkYFPf24\&q=85\&s=96000a809dfbdd9c32fc8275190e6cd7)

**3. Choose what the rule covers**

Under **Apply to**, pick one:

* **Only the selected resources**: the rule covers these resources and no others. New resources are not included.
* **Every resource that matches these conditions**: the rule covers every resource that matches, including resources found later. Conditions can use **Tag**, **Resource Type**, **Account Name**, **Region**, **Name ends with**, **Unmanaged resource collection** and **Owner**.

The dialog shows how many unmanaged resources the rule will mark. Click **Show them** to check the list.

**4. Save**

Click **Mark as managed**. The confirmation offers **Undo** and **View rule**.

Resources that env zero manages are never affected by a rule.

### Manage rules

All rules are listed in **Organization Settings** > **IaC Management**.

![IaC Management settings listing the built-in CloudFormation rule and a Spacelift rule, with Add rule and the Built in tag highlighted](https://mintcdn.com/envzero-b61043c8/7R9pjxUjbkYFPf24/images/guides/ez-control-center/iac-management-rules.png?fit=max\&auto=format\&n=7R9pjxUjbkYFPf24\&q=85\&s=4fd60a27c59af6fdfd25f4fd12045564)

1. **Add rule** creates a rule from conditions, without selecting resources first.
2. The **Built in** CloudFormation rule marks every AWS resource tagged `aws:cloudformation:stack-name` as managed by CloudFormation. You can turn it off, but not edit or delete it.

Edit or delete your own rules from their row. An organization can have up to 25 rules, and up to 100 resources selected one by one across all rules. For larger sets, use conditions instead of selecting resources.

> [!NOTE]
>
> A resource in a CloudFormation stack cannot be selected for either action. Change or delete it through its stack.

## Delete unmanaged resources

EZ Control Center builds the CLI commands that delete the selected resources. You review the commands and run them yourself. env zero never runs them.

**1. Select the resources**

Select one or more unmanaged resources and click **Generate delete commands**. For one resource, you can also click **Generate delete command** in its details.

**2. Review the commands**

![Delete 2 resources dialog confirming none are managed, with aws s3 rb and aws ec2 terminate-instances commands and a Copy commands button](https://mintcdn.com/envzero-b61043c8/7R9pjxUjbkYFPf24/images/guides/ez-control-center/delete-commands.png?fit=max\&auto=format\&n=7R9pjxUjbkYFPf24\&q=85\&s=2c56c65eacb1efc4329954fc7fd91111)

1. Before showing any command, EZ Control Center checks again which resources are managed, by env zero or by a rule. Managed resources are left out, and the dialog says how many.
2. One command per resource, using the `aws`, `gcloud` or `az` CLI. A resource type with no delete command gets a `# No delete command exists for` comment instead.
3. **Copy commands** copies them all.

**3. Run them**

Run the commands in a shell signed in to the right cloud account. Commands for resources whose names are only unique inside an account, such as IAM roles, run only when your AWS CLI is signed in to that account.

> [!WARNING]
>
> Deleting a cloud resource cannot be undone. Check each command before you run it. If the managed-state check fails, the dialog shows no commands.

After the next sync, deleted resources disappear from EZ Control Center.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.