Deleting a DNS zone
To delete a DNS zone:
- In the management console
, select the folder containing your DNS zone. - Go to Cloud DNS.
- Find the zone you want to delete and click
in its row. - In the menu that opens, click Delete.
- In the window that opens, click Delete.
If you do not have the Yandex Cloud CLI yet, install and initialize it.
The folder used by default is the one specified when creating 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.
-
See the description of the CLI command for deleting a DNS zone:
yc dns zone delete --help -
Get a list of all DNS zones in the default folder:
yc dns zone list -
Select the zone
IDorNAME. -
Delete the zone from the default folder:
yc dns zone delete <zone_name_or_ID>
If you do not have Terraform yet, install it and configure the Yandex Cloud provider.
To delete a DNS zone created with Terraform:
-
Open the Terraform configuration file and delete the fragment describing your DNS zone.
Terraform DNS zone description example
resource "yandex_vpc_network" "foo" {} resource "yandex_dns_zone" "zone1" { name = "my-public-zone" description = "Test public zone" labels = { label1 = "test-public" } zone = "test.example-public2.com." } -
In the command line, navigate to the directory with the Terraform configuration file.
-
Check the configuration using this command:
terraform validateIf the configuration is valid, you will get this message:
Success! The configuration is valid. -
Run this command:
terraform planYou 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.
-
Apply the configuration changes:
terraform apply -
Type
yesand press Enter to confirm changes.You can check whether the DNS zone was successfully deleted in the management console
or using this CLI command:yc dns zone list
To delete a DNS zone, use the delete REST API method for the DnsZone resource or the DnsZoneService/Delete gRPC API call.