-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.tf
More file actions
47 lines (40 loc) · 1.27 KB
/
Copy pathmain.tf
File metadata and controls
47 lines (40 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
locals {
# Key members by address:port so reordering the input list does not churn the
# plan.
members = {
for m in var.members : "${m.address}:${m.protocol_port}" => m
}
}
resource "openstack_lb_loadbalancer_v2" "this" {
name = var.name
vip_subnet_id = var.vip_subnet_id
tags = var.tags
}
resource "openstack_lb_listener_v2" "this" {
name = "${var.name}-listener"
loadbalancer_id = openstack_lb_loadbalancer_v2.this.id
protocol = var.listener_protocol
protocol_port = var.listener_port
}
resource "openstack_lb_pool_v2" "this" {
name = "${var.name}-pool"
listener_id = openstack_lb_listener_v2.this.id
protocol = var.listener_protocol
lb_method = var.pool_method
}
resource "openstack_lb_member_v2" "this" {
for_each = local.members
pool_id = openstack_lb_pool_v2.this.id
address = each.value.address
protocol_port = each.value.protocol_port
subnet_id = each.value.subnet_id
}
resource "openstack_lb_monitor_v2" "this" {
count = var.monitor != null ? 1 : 0
pool_id = openstack_lb_pool_v2.this.id
type = var.monitor.type
delay = var.monitor.delay
timeout = var.monitor.timeout
max_retries = var.monitor.max_retries
url_path = var.monitor.url_path
}