[Yandex Cloud documentation](../../../index.md) > [Yandex Cloud CDN](../../index.md) > [Step-by-step guides](../index.md) > Resources > Deleting a resource

# Deleting a resource

{% list tabs group=instructions %}

- Management console {#console}

  1. In the [management console](https://console.yandex.cloud), select the folder where your resource is located.
  1. Navigate to **Cloud CDN**.
  1. Click the resource name.
  1. In the top-right corner, click ![image](../../../_assets/console-icons/trash-bin.svg) **Delete** and then click **Delete** in the window that opens.

- 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. View the description of the CLI command to delete a resource:

     ```bash
     yc cdn resource delete --help
     ```

  1. Get a list of all resources in the default folder:

     ```bash
     yc cdn resource list --format yaml
     ```

     Result:

     ```text
     id: s0me1dkfjq********
     folder_id: s0mef01der7p********
     cname: testexample.com
     ...
     ssl_certificate:
       type: DONT_USE
       status: READY
     ```

  1. Delete the resource:

     ```bash
     yc cdn resource delete <resource_ID>
     ```

     For more information about the `yc cdn resource delete` command, see the [CLI reference](../../../cli/cli-ref/cdn/cli-ref/resource/delete.md).
  1. Make sure that the delete operation was successful. To do this, view the folder's resource list again:

     ```bash
     yc cdn resource list
     ```

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

  To delete a CDN resource created with Terraform:
  1. Open the Terraform configuration file and delete the resource description fragment.

     {% cut "An example of a CDN resource description in the Terraform configuration" %}

     ```hcl
     resource "yandex_cdn_resource" "my_resource" {
         cname               = "cdn1.yandex-example.ru"
         active              = false
         origin_protocol     = "https"
         secondary_hostnames = ["cdn-example-1.yandex.ru", "cdn-example-2.yandex.ru"]
         origin_group_id     = yandex_cdn_origin_group.my_group.id
         ...
         options {
           edge_cache_settings = "345600"
           ignore_cookie       = true
           ...
         }
     }
     ```

     {% endcut %}

  1. In the command line, navigate to the directory with the Terraform configuration file.
  1. Check the configuration using this command:

     ```bash
     terraform validate
     ```

     If the configuration is valid, you will get this message:

     ```text
     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 whether the CDN resource has been deleted using the [management console](https://console.yandex.cloud) or this [CLI](../../../cli/quickstart.md) command:

     ```bash
     yc cdn resource list
     ```

- API {#api}

  To delete a resource, use the [delete](../../api-ref/Resource/delete.md) REST API method for the [Resource](../../api-ref/Resource/index.md) resource or the [ResourceService/Delete](../../api-ref/grpc/Resource/delete.md) gRPC API call.

{% endlist %}