[Yandex Cloud documentation](../../index.md) > [Yandex Virtual Private Cloud](../index.md) > [Step-by-step guides](index.md) > Security groups > Changing the name and description

# Changing the name and description

After creating a [security group](../concepts/security-groups.md), you can change its name and description, and [add](security-group-add-rule.md) or [remove](security-group-delete-rule.md) rules.

{% list tabs group=instructions %}

- Management console {#console}

  To change the name or description of a group:

  1. In the [management console](https://console.yandex.cloud), select the folder containing the security group you want to update.
  1. Navigate to **Virtual Private Cloud**.
  1. In the left-hand panel, select ![image](../../_assets/console-icons/shield.svg) **Security groups**.
  1. Click ![image](../../_assets/console-icons/ellipsis.svg) in the row of the group you need to update.
  1. In the menu that opens, click **Edit**.
  1. Edit the group name and description and click **Save**.

- CLI {#cli}
  
  To update the security group, run this command:

  ```
  yc vpc security-group update <group_ID> --new-name test-sg-renamed
  ```

- Terraform {#tf}

  If you do not have Terraform yet, [install it and configure the Yandex Cloud provider](../../tutorials/infrastructure-management/terraform-quickstart.md#install-terraform).
  
  
  To manage infrastructure using Terraform under a service account or user accounts (a Yandex account, a federated account, or a local user), [authenticate](../../terraform/authentication.md) using the appropriate method.
 
  With [Terraform](https://www.terraform.io/), you can quickly create a cloud infrastructure in Yandex Cloud and manage it using configuration files. These files store the infrastructure description written in HashiCorp Configuration Language (HCL). If you change the configuration files, Terraform automatically detects which part of your configuration is already deployed, and what should be added or removed.
  
  Terraform is distributed under the [Business Source License](https://github.com/hashicorp/terraform/blob/main/LICENSE). The [Yandex Cloud provider for Terraform](https://github.com/yandex-cloud/terraform-provider-yandex) is distributed under the [MPL-2.0](https://www.mozilla.org/en-US/MPL/2.0/) license.
  
  For more information about the provider resources, see the relevant documentation on the [Terraform](https://www.terraform.io/docs/providers/yandex/index.html) website or [its mirror](../../terraform/index.md).

  1. Open the Terraform configuration file and edit the `name` and `description` parameters in the security group description:

     ```hcl
     ...
     resource "yandex_vpc_security_group" "test-sg" {
       name        = "Test security group"
       description = "Description for security group"
       network_id  = "${yandex_vpc_network.lab-net.id}"
     }
     ...
     ```

     For more information about `yandex_vpc_security_group` properties in Terraform, see [this provider guide](../../terraform/resources/vpc_security_group.md).

     {% note info %}

     To manage the [default security group](../concepts/security-groups.md#default-security-group), use the [vpc_default_security_group](../../terraform/resources/vpc_default_security_group.md) resource.

     {% endnote %}

  1. Check the configuration using this command:

     ```
     terraform validate
     ```
     
     If the configuration is valid, you will get this message:
     
     ```
     Success! The configuration is valid.
     ```

  1. Run this command:

     ```
     terraform plan
     ```
  
     You will see a list of resources and their properties. No changes will be made at this step. Terraform will show any errors in the configuration.

  1. Apply the configuration changes:

     ```
     terraform apply
     ```
     
  1. Confirm the changes: type `yes` into the terminal and press **Enter**.

     You can check the security group update using the [management console](https://console.yandex.cloud) or this [CLI](../../cli/quickstart.md) command:

     ```
     yc vpc security-group get <security_group_name>
     ```

- API {#api}

  To change the security group name or description, use the [update](../api-ref/SecurityGroup/update.md) REST API method for the [SecurityGroup](../api-ref/SecurityGroup/index.md) resource or the [SecurityGroupService/Update](../api-ref/grpc/SecurityGroup/update.md) gRPC API call, and provide the following in the request:

  * ID of the security group you want to update, in the `securityGroupId` parameter.

    To get the security group ID, use the [list](../api-ref/SecurityGroup/list.md) REST API method for the [SecurityGroup](../api-ref/SecurityGroup/index.md) resource or the [SecurityGroupService/List](../api-ref/grpc/SecurityGroup/list.md) gRPC API call and provide the folder ID in the `folderId` request parameter.

    To learn how to find out the folder ID, see [Getting the folder ID](../../resource-manager/operations/folder/get-id.md).

  * New name for the security group in the `name` parameter.
  * New description for the security group in the `description` parameter.
  * List of settings to update in the `updateMask` parameter.

  {% note warning %}
  
  The API method will assign default values to all the parameters of the object you are modifying unless you explicitly provide them in your request. To avoid this, list the settings you want to change in the `updateMask` parameter as a single comma-separated string.
  
  {% endnote %}

{% endlist %}