Deleting a folder
To delete a folder, you must have the editor
role or higher for that folder. If you cannot perform this operation, contact an administrator or the folder owner.
-
Select the folder on the management console home page
. This page displays folders for the selected cloud. If necessary, switch to another cloud. -
Click
next to the folder and select Delete. -
Specify folder deletion delay: the time period after which the folder will be deleted. Select one of the suggested periods or
Delete now
. The default folder deletion delay is 7 days. -
Click Delete.
The resources will be stopped, and the folder status will change to PENDING_DELETION
. You can cancel the deletion of a folder that is PENDING_DELETION
. To cancel, click
If you do not have the Yandex Cloud command line interface yet, install and initialize it.
-
View a description of the folder delete command:
yc resource-manager folder delete --help
-
If you know the folder ID or name, proceed to the next step. Otherwise, use one of these methods to get them:
-
Get a list of folders:
yc resource-manager folder list
Result:
+----------------------+--------------------+--------+--------+-------------+ | ID | NAME | LABELS | STATUS | DESCRIPTION | +----------------------+--------------------+--------+--------+-------------+ | b1gppulhhm2a******** | yet-another-folder | | ACTIVE | | | b1gvmob95yys******** | default | | ACTIVE | | +----------------------+--------------------+--------+--------+-------------+
- If you know the ID of the resource that belongs to the required folder, you can get the folder ID from the information about that resource:
yc <service_name> <service_category> get <resource_ID>
Where:
<service_name>
: Service name, e.g.,compute
<service_category>
: Resource category, e.g.,instance
<resource_ID>
: Resource ID
For example, the
fhmp74bfis2a********
VM belongs to theb1gpvjd9ir42********
folder:yc compute instance get fhmp74bfis2a********
Result:
id: fhmp74bfis2a******** folder_id: b1gpvjd9ia42******** ...
-
-
Delete the folder:
yc resource-manager folder delete <folder_ID>
To have the operation progress details shown before the operation is completed, set the
--async
flag.
If you don't have Terraform, install it and configure the Yandex Cloud provider.
To delete a folder created with Terraform:
-
Open the Terraform configuration file and delete the fragment describing the folder.
Example folder description in a Terraform configuration... resource "yandex_resourcemanager_folder" "folder1" { cloud_id = "b1gia12......fvsleds" name = "new-folder" description = "this is my default-folder" } ...
For more information about the parameters of the
yandex_resourcemanager_folder
resource in Terraform, see the provider documentation . -
In the command line, go to the directory with the Terraform configuration file.
-
Check the configuration using this command:
terraform validate
If the configuration is correct, you will get this message:
Success! The configuration is valid.
-
Run this command:
terraform plan
The terminal will display a list of resources with parameters. No changes will be made at this step. If the configuration contains any errors, Terraform will point them out.
-
Apply the configuration changes:
terraform apply
-
Confirm the changes: type
yes
into the terminal and press Enter.You can check the folder deletion using the management console
or this CLI command:yc resource-manager folder list
To delete a folder, use the delete REST API method for the Folder resource or the FolderService/Delete gRPC API call.
Alert
While a folder's status is PENDING_DELETION
, your disks, reserved IPs, and other data are preserved. The cost of such storage is charged at the previous rate. Track your resource costs in Yandex Cloud Billing
Once the delay ends, the folder's status will change to DELETING
. This status indicates that permanent deletion is underway and may take up to 72 hours resulting in the folder being deleted together with all its resources.