Skip to main content
Terraform users: add DESTROY_ENVIRONMENT to the permissions of each env0_custom_role resource that keeps destroy. When your organization first opts in, env zero adds it to your custom roles that have RUN_PLAN or RUN_APPLY, so otherwise your next terraform apply removes it and those users can no longer destroy.

Destroy Environment permission

Custom roles have a new permission, Destroy Environment (DESTROY_ENVIRONMENT). When your organization opts in, a user needs it to destroy an environment, approve a destroy or destroy a workflow sub-environment, from the UI, the API or the CLI. The default roles that can plan or apply include it.

Opt in to the permission

A new organization policy, Destroy Environment Permission in Organization Settings > Policies, lets your organization opt in to the permission. The first time your organization opts in, env zero adds the permission to every custom role with Run Plans or Run Applies, so no user loses access. Remove it from the roles that should not destroy. New organizations are opted in from the start, and so are existing organizations where no custom role can run plans or applies without the permission. In an opted-in organization, a custom role you create through the API or Terraform can destroy only if it lists DESTROY_ENVIRONMENT. To set the policy with Terraform, use require_destroy_environment_permission in env0_organization_policy. Learn more: Destroy Environment permission