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.
-
On the management console home page
, select the folder. This page displays folders for the selected cloud. You can switch to another cloud, if required. -
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 display the details of an operation in progress before it 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
yandex_resourcemanager_folder
resource parameters in Terraform, see the relevant provider documentation . -
In the command line, go to the folder 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.
Once the waiting timeout expires, the folder status will change to DELETING
. This means it is being permanently deleted, which may take up to 72 hours; after that, the folder will be deleted along with all its resources.
Alert
While a folder is PENDING_DELETION
, your disks, reserved IPs, and other data are still stored and billed.
While a folder is PENDING_DELETION
, you are still charged for paid resources if metrics detect their consumption.
The cost of such storage is charged at the previous rate. Track your resource costs in Yandex Cloud Billing