Deleting a DNS zone
To delete a DNS zone:
- In the management console
, select the folder containing your DNS zone. - Select 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 installed yet, install and initialize it.
By default, the CLI uses the folder specified when creating the profile. To change the default folder, use the yc config set folder-id <folder_ID> command. You can also set a different folder for any specific command using the --folder-name or --folder-id parameter.
-
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 selected 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 correct, you will get this message:
Success! The configuration is valid. -
Run this command:
terraform planYou will see a detailed list of resources. No changes will be made at this step. If the configuration contains errors, Terraform will show them.
-
Apply the 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.