Yandex Cloud
Поиск
Связаться с намиПодключиться
  • Истории успеха
  • Документация
  • Блог
  • Все сервисы
  • Статус работы сервисов
    • Доступны в регионе
    • Инфраструктура и сеть
    • Платформа данных
    • Контейнеры
    • Инструменты разработчика
    • Бессерверные вычисления
    • Безопасность
    • Мониторинг и управление ресурсами
    • ИИ для бизнеса
    • Бизнес-инструменты
  • Все решения
    • По отраслям
    • По типу задач
    • Экономика платформы
    • Безопасность
    • Техническая поддержка
    • Каталог партнёров
    • Обучение и сертификация
    • Облако для стартапов
    • Облако для крупного бизнеса
    • Центр технологий для общества
    • Партнёрская программа
    • Поддержка IT-бизнеса
    • Облако для фрилансеров
    • Обучение и сертификация
    • Блог
    • Документация
    • Мероприятия и вебинары
    • Контакты, чаты и сообщества
    • Идеи
    • Тарифы Yandex Cloud
    • Промоакции и free tier
    • Правила тарификации
  • Истории успеха
  • Документация
  • Блог
Проект Яндекса
© 2025 ТОО «Облачные Сервисы Казахстан»
Terraform в Yandex Cloud
  • Начало работы
  • Библиотека решений
    • Обзор
    • История изменений (англ.)
          • alb_backend_group
          • alb_http_router
          • alb_load_balancer
          • alb_target_group
          • alb_virtual_host

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

  • Example usage
  • Schema
  • Required
  • Optional
  • Read-Only
  • Nested Schema for allocation_policy
  • Nested Schema for allocation_policy.location
  • Nested Schema for auto_scale_policy
  • Nested Schema for listener
  • Nested Schema for listener.endpoint
  • Nested Schema for listener.endpoint.address
  • Nested Schema for listener.endpoint.address.external_ipv4_address
  • Nested Schema for listener.endpoint.address.external_ipv6_address
  • Nested Schema for listener.endpoint.address.internal_ipv4_address
  • Nested Schema for listener.http
  • Nested Schema for listener.http.handler
  • Nested Schema for listener.http.handler.http2_options
  • Nested Schema for listener.http.redirects
  • Nested Schema for listener.stream
  • Nested Schema for listener.stream.handler
  • Nested Schema for listener.tls
  • Nested Schema for listener.tls.default_handler
  • Nested Schema for listener.tls.default_handler.http_handler
  • Nested Schema for listener.tls.default_handler.http_handler.http2_options
  • Nested Schema for listener.tls.default_handler.stream_handler
  • Nested Schema for listener.tls.sni_handler
  • Nested Schema for listener.tls.sni_handler.handler
  • Nested Schema for listener.tls.sni_handler.handler.http_handler
  • Nested Schema for listener.tls.sni_handler.handler.http_handler.http2_options
  • Nested Schema for listener.tls.sni_handler.handler.stream_handler
  • Nested Schema for log_options
  • Nested Schema for log_options.discard_rule
  • Nested Schema for timeouts
  • Import
  1. Справочник Terraform
  2. Ресурсы (англ.)
  3. Application Load Balancer (ALB)
  4. Resources
  5. alb_load_balancer

yandex_alb_load_balancer (Resource)

Статья создана
Yandex Cloud
Обновлена 7 августа 2025 г.
  • Example usage
  • Schema
    • Required
    • Optional
    • Read-Only
    • Nested Schema for allocation_policy
    • Nested Schema for allocation_policy.location
    • Nested Schema for auto_scale_policy
    • Nested Schema for listener
    • Nested Schema for listener.endpoint
    • Nested Schema for listener.endpoint.address
    • Nested Schema for listener.endpoint.address.external_ipv4_address
    • Nested Schema for listener.endpoint.address.external_ipv6_address
    • Nested Schema for listener.endpoint.address.internal_ipv4_address
    • Nested Schema for listener.http
    • Nested Schema for listener.http.handler
    • Nested Schema for listener.http.handler.http2_options
    • Nested Schema for listener.http.redirects
    • Nested Schema for listener.stream
    • Nested Schema for listener.stream.handler
    • Nested Schema for listener.tls
    • Nested Schema for listener.tls.default_handler
    • Nested Schema for listener.tls.default_handler.http_handler
    • Nested Schema for listener.tls.default_handler.http_handler.http2_options
    • Nested Schema for listener.tls.default_handler.stream_handler
    • Nested Schema for listener.tls.sni_handler
    • Nested Schema for listener.tls.sni_handler.handler
    • Nested Schema for listener.tls.sni_handler.handler.http_handler
    • Nested Schema for listener.tls.sni_handler.handler.http_handler.http2_options
    • Nested Schema for listener.tls.sni_handler.handler.stream_handler
    • Nested Schema for log_options
    • Nested Schema for log_options.discard_rule
    • Nested Schema for timeouts
  • Import

Creates an Application Load Balancer in the specified folder. For more information, see the official documentation.

Example usageExample usage

//
// Create a new Application Load Balancer (ALB)
//
resource "yandex_alb_load_balancer" "my_alb" {
  name = "my-load-balancer"

  network_id = yandex_vpc_network.test-network.id

  allocation_policy {
    location {
      zone_id   = "ru-central1-a"
      subnet_id = yandex_vpc_subnet.test-subnet.id
    }
  }

  listener {
    name = "my-listener"
    endpoint {
      address {
        external_ipv4_address {
        }
      }
      ports = [8080]
    }
    http {
      handler {
        http_router_id = yandex_alb_http_router.test-router.id
      }
    }
  }

  log_options {
    discard_rule {
      http_code_intervals = ["2XX"]
      discard_percent     = 75
    }
  }
}

SchemaSchema

RequiredRequired

  • allocation_policy (Block List, Min: 1, Max: 1) Allocation zones for the Load Balancer instance. (see below for nested schema)
  • network_id (String) The VPC Network ID of subnets which resource attached to.

OptionalOptional

  • allow_zonal_shift (Boolean) Specifies whether application load balancer is available to zonal shift
  • auto_scale_policy (Block List, Max: 1) Scaling settings of the application load balancer. (see below for nested schema)
  • 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.
  • labels (Map of String) A set of key/value label pairs which assigned to resource.
  • listener (Block List) List of listeners for the Load Balancer. (see below for nested schema)
  • log_options (Block List, Max: 1) Cloud Logging settings. (see below for nested schema)
  • name (String) The resource name.
  • region_id (String) The region ID where Load Balancer is located at.
  • security_group_ids (Set of String) The list of security groups applied to resource or their components.
  • timeouts (Block, Optional) (see below for nested schema)

Read-OnlyRead-Only

  • created_at (String) The creation timestamp of the resource.
  • id (String) The ID of this resource.
  • log_group_id (String) Cloud Logging group ID to send logs to. Leave empty to use the balancer folder default log group.
  • status (String) Status of the Load Balancer.

Nested Schema for Nested Schema for allocation_policy

Required:

  • location (Block Set, Min: 1) Unique set of locations. (see below for nested schema)

Nested Schema for Nested Schema for allocation_policy.location

Required:

  • subnet_id (String) ID of the subnet that location is located at.
  • zone_id (String) The availability zone where resource is located. If it is not provided, the default provider zone will be used.

Optional:

  • disable_traffic (Boolean) If set, will disable all L7 instances in the zone for request handling.

Nested Schema for Nested Schema for auto_scale_policy

Optional:

  • max_size (Number) Upper limit for total instance count (across all zones)
  • min_zone_size (Number) Lower limit for instance count in each zone.

Nested Schema for Nested Schema for listener

Required:

  • name (String) Name of the listener.

Optional:

  • endpoint (Block List) Network endpoint (addresses and ports) of the listener. (see below for nested schema)
  • http (Block List, Max: 1) HTTP handler that sets plain text HTTP router. (see below for nested schema)
  • stream (Block List, Max: 1) Stream configuration (see below for nested schema)
  • tls (Block List, Max: 1) TLS configuration (see below for nested schema)

Nested Schema for Nested Schema for listener.endpoint

Required:

  • address (Block List, Min: 1) One or more addresses to listen on. (see below for nested schema)
  • ports (List of Number) One or more ports to listen on.

Nested Schema for Nested Schema for listener.endpoint.address

Optional:

  • external_ipv4_address (Block List, Max: 1) External IPv4 address. (see below for nested schema)
  • external_ipv6_address (Block List, Max: 1) External IPv6 address. (see below for nested schema)
  • internal_ipv4_address (Block List, Max: 1) Internal IPv4 address. (see below for nested schema)

Nested Schema for Nested Schema for listener.endpoint.address.external_ipv4_address

Optional:

  • address (String) Provided by the client or computed automatically.

Nested Schema for Nested Schema for listener.endpoint.address.external_ipv6_address

Optional:

  • address (String) Provided by the client or computed automatically.

Nested Schema for Nested Schema for listener.endpoint.address.internal_ipv4_address

Optional:

  • address (String) Provided by the client or computed automatically.
  • subnet_id (String) ID of the subnet that the address belongs to.

Nested Schema for Nested Schema for listener.http

Optional:

  • handler (Block List, Max: 1) HTTP handler. (see below for nested schema)
  • redirects (Block List, Max: 1) Shortcut for adding http -> https redirects. (see below for nested schema)

Nested Schema for Nested Schema for listener.http.handler

Optional:

  • allow_http10 (Boolean) If set, will enable only HTTP1 protocol with HTTP1.0 support.
  • http2_options (Block List, Max: 1) If set, will enable HTTP2 protocol for the handler. (see below for nested schema)
  • http_router_id (String) HTTP router id.
  • rewrite_request_id (Boolean) When unset, will preserve the incoming x-request-id header, otherwise would rewrite it with a new value.

Nested Schema for Nested Schema for listener.http.handler.http2_options

Optional:

  • max_concurrent_streams (Number) Maximum number of concurrent streams.

Nested Schema for Nested Schema for listener.http.redirects

Optional:

  • http_to_https (Boolean) If set redirects all unencrypted HTTP requests to the same URI with scheme changed to https.

Nested Schema for Nested Schema for listener.stream

Optional:

  • handler (Block List, Max: 1) Stream handler resource. (see below for nested schema)

Nested Schema for Nested Schema for listener.stream.handler

Optional:

  • backend_group_id (String) Backend Group ID.
  • idle_timeout (String) The idle timeout is the interval after which the connection will be forcibly closed if no data has been transmitted or received on either the upstream or downstream connection. If not configured, the default idle timeout is 1 hour. Setting it to 0 disables the timeout.

Nested Schema for Nested Schema for listener.tls

Required:

  • default_handler (Block List, Min: 1, Max: 1) TLS handler resource. (see below for nested schema)

Optional:

  • sni_handler (Block List) Settings for handling requests with Server Name Indication (SNI) (see below for nested schema)

Nested Schema for Nested Schema for listener.tls.default_handler

Required:

  • certificate_ids (Set of String) Certificate IDs in the Certificate Manager. Multiple TLS certificates can be associated with the same context to allow both RSA and ECDSA certificates. Only the first certificate of each type will be used.

Optional:

  • http_handler (Block List, Max: 1) HTTP handler. (see below for nested schema)
  • stream_handler (Block List, Max: 1) Stream handler resource. (see below for nested schema)

Nested Schema for Nested Schema for listener.tls.default_handler.http_handler

Optional:

  • allow_http10 (Boolean) If set, will enable only HTTP1 protocol with HTTP1.0 support.
  • http2_options (Block List, Max: 1) If set, will enable HTTP2 protocol for the handler. (see below for nested schema)
  • http_router_id (String) HTTP router id.
  • rewrite_request_id (Boolean) When unset, will preserve the incoming x-request-id header, otherwise would rewrite it with a new value.

Nested Schema for Nested Schema for listener.tls.default_handler.http_handler.http2_options

Optional:

  • max_concurrent_streams (Number) Maximum number of concurrent streams.

Nested Schema for Nested Schema for listener.tls.default_handler.stream_handler

Optional:

  • backend_group_id (String) Backend Group ID.
  • idle_timeout (String) The idle timeout is the interval after which the connection will be forcibly closed if no data has been transmitted or received on either the upstream or downstream connection. If not configured, the default idle timeout is 1 hour. Setting it to 0 disables the timeout.

Nested Schema for Nested Schema for listener.tls.sni_handler

Required:

  • handler (Block List, Min: 1, Max: 1) TLS handler resource. (see below for nested schema)
  • name (String) Name of the SNI handler
  • server_names (Set of String) Server names that are matched by the SNI handler

Nested Schema for Nested Schema for listener.tls.sni_handler.handler

Required:

  • certificate_ids (Set of String) Certificate IDs in the Certificate Manager. Multiple TLS certificates can be associated with the same context to allow both RSA and ECDSA certificates. Only the first certificate of each type will be used.

Optional:

  • http_handler (Block List, Max: 1) HTTP handler. (see below for nested schema)
  • stream_handler (Block List, Max: 1) Stream handler resource. (see below for nested schema)

Nested Schema for Nested Schema for listener.tls.sni_handler.handler.http_handler

Optional:

  • allow_http10 (Boolean) If set, will enable only HTTP1 protocol with HTTP1.0 support.
  • http2_options (Block List, Max: 1) If set, will enable HTTP2 protocol for the handler. (see below for nested schema)
  • http_router_id (String) HTTP router id.
  • rewrite_request_id (Boolean) When unset, will preserve the incoming x-request-id header, otherwise would rewrite it with a new value.

Nested Schema for Nested Schema for listener.tls.sni_handler.handler.http_handler.http2_options

Optional:

  • max_concurrent_streams (Number) Maximum number of concurrent streams.

Nested Schema for Nested Schema for listener.tls.sni_handler.handler.stream_handler

Optional:

  • backend_group_id (String) Backend Group ID.
  • idle_timeout (String) The idle timeout is the interval after which the connection will be forcibly closed if no data has been transmitted or received on either the upstream or downstream connection. If not configured, the default idle timeout is 1 hour. Setting it to 0 disables the timeout.

Nested Schema for Nested Schema for log_options

Optional:

  • disable (Boolean) Set to true to disable Cloud Logging for the balancer.
  • discard_rule (Block List) List of rules to discard a fraction of logs. (see below for nested schema)
  • log_group_id (String) Cloud Logging group ID to send logs to. Leave empty to use the balancer folder default log group.

Nested Schema for Nested Schema for log_options.discard_rule

Optional:

  • discard_percent (Number) The percent of logs which will be discarded.
  • grpc_codes (List of String) list of grpc codes by name, e.g, [NOT_FOUND, RESOURCE_EXHAUSTED].
  • http_code_intervals (List of String) List of http code intervals 1XX-5XX or ALL
  • http_codes (List of Number) List of http codes 100-599.

Nested Schema for Nested Schema for timeouts

Optional:

  • create (String) A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours).
  • delete (String) A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours). Setting a timeout for a Delete operation is only applicable if changes are saved into state before the destroy operation occurs.
  • update (String) A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours).

ImportImport

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

# terraform import yandex_alb_load_balancer.<resource Name> <resource Id>
terraform import yandex_alb_load_balancer.my_alb ds705**********q7qvl

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

Предыдущая
alb_http_router
Следующая
alb_target_group
Проект Яндекса
© 2025 ТОО «Облачные Сервисы Казахстан»