|
| 1 | +--- |
| 2 | +title: Deletion protection |
| 3 | +title_tag: Deletion protection | Pulumi ESC |
| 4 | +h1: Deletion protection |
| 5 | +meta_desc: Prevent accidental deletion of critical environments with deletion protection. |
| 6 | +menu: |
| 7 | + esc: |
| 8 | + identifier: deletion-protection |
| 9 | + parent: pulumi-esc-admin |
| 10 | + weight: 5 |
| 11 | +--- |
| 12 | + |
| 13 | +Deletion protection prevents accidental deletion of environments containing sensitive configuration. When enabled for an environment, deletion attempts are blocked until protection is explicitly disabled. |
| 14 | + |
| 15 | +## Enabling deletion protection |
| 16 | + |
| 17 | +### In the Pulumi Cloud console |
| 18 | + |
| 19 | +Navigate to your environment's settings page and find the deletion protection tab. Toggle the setting to enable protection. |
| 20 | + |
| 21 | +When protection is enabled, the environment delete button is disabled and displays instructions for removing protection. |
| 22 | + |
| 23 | +### Using the ESC CLI |
| 24 | + |
| 25 | +Enable deletion protection using the `esc env settings set` command: |
| 26 | + |
| 27 | +```bash |
| 28 | +esc env settings set myorg/myproject/prod deletion-protected true |
| 29 | +``` |
| 30 | + |
| 31 | +View the current protection status: |
| 32 | + |
| 33 | +```bash |
| 34 | +esc env settings get myorg/myproject/prod deletion-protected |
| 35 | +``` |
| 36 | + |
| 37 | +View all environment settings: |
| 38 | + |
| 39 | +```bash |
| 40 | +esc env settings get myorg/myproject/prod |
| 41 | +``` |
| 42 | + |
| 43 | +## Deleting protected environments |
| 44 | + |
| 45 | +Attempting to delete a protected environment returns an error: |
| 46 | + |
| 47 | +```bash |
| 48 | +$ esc env rm myorg/myproject/prod --yes |
| 49 | +error: deletion protection is enabled for this environment |
| 50 | +``` |
| 51 | + |
| 52 | +To delete a protected environment, first disable protection: |
| 53 | + |
| 54 | +```bash |
| 55 | +esc env settings set myorg/myproject/prod deletion-protected false |
| 56 | +esc env rm myorg/myproject/prod |
| 57 | +``` |
| 58 | + |
| 59 | +## Visual indicators |
| 60 | + |
| 61 | +Protected environments display an orange shield icon in the environment list and in stack overview pages where the environment is imported. The shield icon links to the deletion protection settings. |
| 62 | + |
| 63 | +## Permissions |
| 64 | + |
| 65 | +Only environment admins can modify deletion protection settings. This requires the `EnvironmentSettingsUpdate` permission. |
| 66 | + |
| 67 | +## Use cases |
| 68 | + |
| 69 | +Deletion protection helps prevent: |
| 70 | + |
| 71 | +- Accidental deletion of production environments |
| 72 | +- Removal of environments shared across multiple stacks |
| 73 | +- Loss of critical configuration during team transitions |
| 74 | + |
| 75 | +Enable deletion protection for environments that contain production secrets, are imported by multiple stacks, or represent stable configuration that should persist. |
0 commit comments