Updating a folder
To update a folder name or description, use the management console, CLI, API, or Terraform.
- 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 Edit. - Enter a new name and description for the folder.
- Click Save.
If you do not have the Yandex Cloud command line interface yet, install and initialize it.
-
View the description of the update folder command:
yc resource-manager folder update --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******** ...
-
-
Change the folder parameters, e.g., name and description. You can specify the folder to update by its name or ID.
yc resource-manager folder update default \ --new-name myfolder \ --description "this is my default-folder"
The command will rename the
default
foulder tomyfolder
and update its description. The folder naming requirements are as follows:- The name must be from 3 to 63 characters long.
- It may contain lowercase Latin letters, numbers, and hyphens.
- The first character must be a letter and the last character cannot be a hyphen.
If you don't have Terraform, install it and configure the Yandex Cloud provider.
To edit the settings of a folder created with Terraform:
-
Open the Terraform configuration file and edit the fragment with the folder description.
Example folder description in a Terraform configuration
... resource "yandex_resourcemanager_folder" "folder1" { cloud_id = "b1gia12lt1tp********" name = "myfolder" description = "this is my default-folder" } ...
For more information about the
yandex_resourcemanager_folder
resource parameters in Terraform, see the relevant provider documentation . -
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 update using the management console
or this CLI command:yc resource-manager folder list-operations <folder_name_or_ID>
To update a folder, use the update REST API method for the Folder resource or the FolderService/Update gRPC API call.