Deleting a listener
To delete a listener for your network load balancer:
- In the management console
, select the folder to delete a load balancer listener from. - In the list of services, select Network Load Balancer.
- Select the network load balancer for deleting the listener.
- Under Listeners, click
in the line of the listener to delete. - In the menu that opens, click Remove listener.
If you do not have the Yandex Cloud command line interface yet, install and initialize it.
The folder specified in the CLI profile is used by default. You can specify a different folder using the --folder-name
or --folder-id
parameter.
To delete a listener for your network load balancer, run this command:
yc load-balancer network-load-balancer remove-listener <load_balancer_name_or_ID> \
--listener-name=<listener_name>
You can get the load balancer ID and name with a list of network load balancers in the folder and the listener name with network load balancer details.
Terraform
For more information about the provider resources, see the documentation on the Terraform
If you change the configuration files, Terraform automatically detects 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 a listener of a network load balancer created with Terraform:
-
Open the Terraform configuration file and delete the fragment with the listener description.
resource "yandex_lb_network_load_balancer" "foo" { ... listener { name = "<listener_name>" port = <port_number> external_address_spec { ip_version = "<IP_version>" } } ... }
-
Make sure the settings are correct.
-
Using the command line, navigate to the folder that contains the up-to-date Terraform configuration files with an infrastructure plan.
-
Run the command:
terraform validate
If there are errors in the configuration files, Terraform will point to them.
-
-
Delete the network load balancer.
-
Run the command to view planned changes:
terraform plan
If the resource configuration descriptions are correct, the terminal will display a list of the resources to modify and their parameters. This is a test step. No resources are updated.
-
If you are happy with the planned changes, apply them:
-
Run the command:
terraform apply
-
Confirm the update of resources.
-
Wait for the operation to complete.
-
-
To remove a network load balancer's listener, use the removeListener REST API method for the NetworkLoadBalancer resource or the NetworkLoadBalancerService/RemoveListener gRPC API call, and provide the following in the request:
- Load balancer ID in the
networkLoadBalancerId
parameter. - Listener name in the
listenerName
parameter.
You can get the load balancer ID with a list of network load balancers in the folder and the listener name with network load balancer details.