Deleting API gateways
To delete an API gateway:
- In the management console
, select the folder where you wish to delete an API gateway. - In the list of services, select API Gateway.
- In the API gateway row, click
- In the window that opens, click Delete.
To delete an API gateway, run the command below:
yc serverless api-gateway delete --id <API gateway ID>
Where id
is the ID of the API gateway.
Result:
done (18s)
With Terraform
For more information about the provider resources, see the documentation on the Terraform
If you change the configuration files, Terraform automatically determines which part of your configuration is already deployed and what should be added or removed.
If you don't have Terraform, install it and configure the Yandex Cloud provider.
To delete an API gateway created using Terraform:
-
Open the Terraform configuration file and delete the fragment with the API gateway description.
Example API gateway description in the Terraform configuration:
... resource "yandex_api_gateway" "test-api-gateway" { name = "some_name" description = "any description" labels = { label = "label" empty-label = "" } spec = <<-EOT openapi: "3.0.0" info: version: 1.0.0 title: Test API paths: /hello: get: summary: Say hello operationId: hello parameters: - name: user in: query description: User name to appear in greetings required: false schema: type: string default: 'world' responses: '200': description: Greeting content: 'text/plain': schema: type: "string" x-yc-apigateway-integration: type: dummy http_code: 200 http_headers: 'Content-Type': "text/plain" content: 'text/plain': "Hello again, {user}!\n" EOT } ...
-
In the command line, go to the directory with the Terraform configuration file.
-
Check the configuration using this command:
terraform validate
If the configuration is correct, you will get this message:
Success! The configuration is valid.
-
Run this command:
terraform plan
The terminal will display a list of resources with parameters. No changes will be made at this step. If the configuration contains any errors, Terraform will point them out.
-
Apply the configuration changes:
terraform apply
-
Confirm the changes: type
yes
into the terminal and press Enter.You can verify the changes using the management console
or the CLI command below:yc serverless api-gateway list
You can delete an API gateway using the Yandex Cloud Toolkit plugin
To delete an API gateway, use the delete REST API method for the ApiGateway resource or the ApiGatewayService/Delete gRPC API call.