Skip to content

Instantly share code, notes, and snippets.

@parshyn-dima
Created January 5, 2021 19:49
Show Gist options
  • Save parshyn-dima/0e3b797018a1a2e857113f6bbaf78e7d to your computer and use it in GitHub Desktop.
Save parshyn-dima/0e3b797018a1a2e857113f6bbaf78e7d to your computer and use it in GitHub Desktop.
resource "yandex_lb_target_group" "reddit_app_tg" {
name = "reddit-app-tg"
region_id = "ru-central1"
target {
subnet_id = var.subnet_id
address = yandex_compute_instance.app.network_interface.0.ip_address
}
target {
subnet_id = var.subnet_id
address = yandex_compute_instance.app2.network_interface.0.ip_address
}
}
resource "yandex_lb_network_load_balancer" "reddit_app_lb" {
name = "reddit-app-lb"
listener {
name = "reddit-app-listener"
port = 80
target_port = 9292
external_address_spec {
ip_version = "ipv4"
}
}
attached_target_group {
target_group_id = yandex_lb_target_group.reddit_app_tg.id
healthcheck {
name = "app-http-hc"
http_options {
port = 9292
path = "/"
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment