Yandex Cloud
Поиск
Связаться с экспертомПопробовать бесплатно
  • Кейсы
  • Документация
  • Блог
  • Все сервисы
  • Статус работы сервисов
  • Marketplace
    • Популярные
    • Инфраструктура и сеть
    • Платформа данных
    • Искусственный интеллект
    • Безопасность
    • Инструменты DevOps
    • Бессерверные вычисления
    • Управление ресурсами
  • Все решения
    • По отраслям
    • По типу задач
    • Экономика платформы
    • Безопасность
    • Техническая поддержка
    • Каталог партнёров
    • Обучение и сертификация
    • Облако для стартапов
    • Облако для крупного бизнеса
    • Центр технологий для общества
    • Облако для интеграторов
    • Поддержка IT-бизнеса
    • Облако для фрилансеров
    • Обучение и сертификация
    • Блог
    • Документация
    • Контент-программа
    • Мероприятия и вебинары
    • Контакты, чаты и сообщества
    • Идеи
    • Калькулятор цен
    • Тарифы
    • Акции и free tier
  • Кейсы
  • Документация
  • Блог
Создавайте контент и получайте гранты!Готовы написать своё руководство? Участвуйте в контент-программе и получайте гранты на работу с облачными сервисами!
Подробнее о программе
Проект Яндекса
© 2026 ООО «Яндекс.Облако»
Terraform в Yandex Cloud
  • Начало работы
  • Библиотека решений
    • Обзор
    • История изменений (англ.)
          • lb_network_load_balancer
          • lb_target_group

В этой статье:

  • Example usage
  • Arguments & Attributes Reference
  • Import
  1. Справочник Terraform
  2. Ресурсы (англ.)
  3. Network Load Balancer
  4. Resources
  5. lb_network_load_balancer

yandex_lb_network_load_balancer (Resource)

Статья создана
Yandex Cloud
Обновлена 9 апреля 2026 г.
  • Example usage
  • Arguments & Attributes Reference
  • Import

Creates a network load balancer in the specified folder using the data specified in the config. For more information, see the official documentation.

Example usageExample usage

//
// Create a new Network Load Balancer (NLB).
//
resource "yandex_lb_network_load_balancer" "my_nlb" {
  name = "my-network-load-balancer"

  listener {
    name = "my-listener"
    port = 8080
    external_address_spec {
      ip_version = "ipv4"
    }
  }

  attached_target_group {
    target_group_id = yandex_lb_target_group.my-target-group.id

    healthcheck {
      name = "http"
      http_options {
        port = 8080
        path = "/ping"
      }
    }
  }
}

Arguments & Attributes ReferenceArguments & Attributes Reference

  • allow_zonal_shift (Bool). Flag that marks the network load balancer as available to zonal shift.
  • created_at (Read-Only) (String). The creation timestamp of the resource.
  • deletion_protection (Bool). The true value means that resource is protected from accidental deletion.
  • description (String). The resource description.
  • folder_id (String). The folder identifier that resource belongs to. If it is not provided, the default provider folder-id is used.
  • id (String).
  • labels (Map Of String). A set of key/value label pairs which assigned to resource.
  • name (String). The resource name.
  • region_id (String). ID of the availability zone where the network load balancer resides. If omitted, default region is being used.
  • type (String). Type of the network load balancer. Must be one of 'external' or 'internal'. The default is 'external'.
  • attached_target_group [Block]. An AttachedTargetGroup resource.
    • target_group_id (Required)(String). ID of the target group.
    • healthcheck [Block]. A HealthCheck resource.

Важно

One of http_options or tcp_options should be specified.

- `healthy_threshold` (Number). Number of successful health checks required in order to set the `HEALTHY` status for the target.
- `interval` (Number). The interval between health checks. The default is 2 seconds.
- `name` (**Required**)(String). Name of the health check. The name must be unique for each target group that attached to a single load balancer.
- `timeout` (Number). Timeout for a target to return a response for the health check. The default is 1 second.
- `unhealthy_threshold` (Number). Number of failed health checks before changing the status to `UNHEALTHY`. The default is 2.
- `http_options` [Block]. Options for HTTP health check.
  - `path` (String). URL path to set for health checking requests for every target in the target group. For example `/ping`. The default path is `/`.
  - `port` (**Required**)(Number). Port to use for HTTP health checks.
- `tcp_options` [Block]. Options for TCP health check.
  - `port` (**Required**)(Number). Port to use for TCP health checks.
  • listener [Block]. Listener specification that will be used by a network load balancer.

Важно

One of external_address_spec or internal_address_spec should be specified.

  • name (Required)(String). Name of the listener. The name must be unique for each listener on a single load balancer.
  • port (Required)(Number). Port for incoming traffic.
  • protocol (String). Protocol for incoming traffic. TCP or UDP and the default is TCP.
  • target_port (Number). Port of a target. The default is the same as listener's port.
  • external_address_spec [Block]. External IP address specification.
    • address (String). External IP address for a listener. IP address will be allocated if it wasn't been set.
    • ip_version (String). IP version of the external addresses that the load balancer works with. Must be one of ipv4 or ipv6. The default is ipv4.
  • internal_address_spec [Block]. Internal IP address specification.
    • address (String). Internal IP address for a listener. Must belong to the subnet that is referenced in subnet_id. IP address will be allocated if it wasn't been set.
    • ip_version (String). IP version of the external addresses that the load balancer works with. Must be one of ipv4 or ipv6. The default is ipv4.
    • subnet_id (Required)(String). ID of the subnet to which the internal IP address belongs.
  • timeouts [Block].
    • create (String).
    • delete (String).
    • update (String).

ImportImport

The resource can be imported by using their resource ID. For getting it you can use Yandex Cloud Web Console or Yandex Cloud CLI.

# terraform import yandex_lb_network_load_balancer.<resource Name> <resource Id>
terraform import yandex_lb_network_load_balancer.my_nlb ...

Была ли статья полезна?

Предыдущая
lb_target_group
Следующая
lb_target_group
Создавайте контент и получайте гранты!Готовы написать своё руководство? Участвуйте в контент-программе и получайте гранты на работу с облачными сервисами!
Подробнее о программе
Проект Яндекса
© 2026 ООО «Яндекс.Облако»