[Yandex Cloud documentation](../../index.md) > [Yandex Application Load Balancer](../index.md) > [Step-by-step guides](index.md) > Target groups > Deleting a target group

# Deleting an Application Load Balancer target group

{% note warning %}

You cannot delete a target group used in a backend group. First, you need to [remove](backend-group-update.md#update-group) it from all backend groups.

{% endnote %}

To delete a [target group](../concepts/target-group.md):

{% list tabs group=instructions %}

- Management console {#console}

  1. In the [management console](https://console.yandex.cloud), select your target group [folder](../../resource-manager/concepts/resources-hierarchy.md#folder).
  1. Navigate to **Application Load Balancer**.
  1. In the left-hand panel, select ![image](../../_assets/console-icons/target.svg) **Target groups**.
  1. Select your target group and click ![image](../../_assets/console-icons/ellipsis.svg).
  1. In the menu that opens, select **Delete**.

     To do this with multiple groups, select the groups to delete from the list and click **Delete** at the bottom of the screen.
  1. In the window that opens, click **Delete**.

- CLI {#cli}

  If you do not have the Yandex Cloud CLI yet, [install and initialize it](../../cli/quickstart.md#install).

  The folder used by default is the one specified when [creating](../../cli/operations/profile/profile-create.md) the CLI profile. To change the default folder, use the `yc config set folder-id <folder_ID>` command. You can also specify a different folder for any command using `--folder-name` or `--folder-id`. If you access a resource by its name, the search will be limited to the default folder. If you access a resource by its ID, the search will be global, i.e., through all folders based on access permissions.

  1. See the description of the [CLI](../../cli/index.md) command for deleting a target group:

     ```bash
     yc alb target-group delete --help
     ```

  1. Run this command:

     ```bash
     yc alb target-group delete <target_group_name_or_ID>
     ```

     To check whether the group has been deleted, get a list of target groups by running the command:

     ```bash
     yc alb target-group list
     ```

- Terraform {#tf}

  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).

  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.

  1. Open the Terraform configuration file and delete the part describing your target group.

     Sample target group description in the Terraform configuration:

     ```hcl
     resource "yandex_alb_target_group" "foo" {
       name           = "<target_group_name>"

       target {
         subnet_id    = "<subnet_ID>"
         ip_address   = "<VM_1_internal_IP_address>"
       }

       target {
         subnet_id    = "<subnet_ID>"
         ip_address   = "<VM_2_internal_IP_address>"
       }

       target {
         subnet_id    = "<subnet_ID>"
         ip_address   = "<VM_3_internal_IP_address>"
       }
     }
     ```

     For more information about `yandex_alb_target_group` properties, see [this Terraform provider guide](../../terraform/resources/alb_target_group.md).
  1. Apply the changes:

     1. In the terminal, navigate to the configuration file directory.
     1. Make sure the configuration is correct using this command:
     
        ```bash
        terraform validate
        ```
     
        If the configuration is valid, you will get this message:
     
        ```bash
        Success! The configuration is valid.
        ```
     
     1. Run this command:
     
        ```bash
        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:
     
        ```bash
        terraform apply
        ```
     
     1. Type `yes` and press **Enter** to confirm the changes.

     You can check target group updates in the [management console](https://console.yandex.cloud) or using this [CLI](../../cli/index.md) command:

     ```bash
     yc alb target-group list
     ```

     {% note warning "Timeouts" %}
     
     The Terraform provider limits operations with Application Load Balancer target groups to 10 minutes.
     
     Operations in excess of this time will be interrupted.
     
     {% cut "How do I modify these limits?" %}
     
     Add the `timeouts` section to the target group description, e.g.:
     
     ```hcl
     resource "yandex_alb_target_group" "<target_group_name>" {
       ...
       timeouts {
         create = "60m"
         update = "60m"
         delete = "60m"
       }
     }
     ```
     
     {% endcut %}
     
     {% endnote %}

- API {#api}

  Use the [delete](../api-ref/TargetGroup/delete.md) REST API method for the [TargetGroup](../api-ref/TargetGroup/index.md) resource or the [TargetGroupService/Delete](../api-ref/grpc/TargetGroup/delete.md) gRPC API call.

{% endlist %}