-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbigip_ltm_virtual_server.tf
58 lines (47 loc) · 1.27 KB
/
bigip_ltm_virtual_server.tf
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
48
49
50
51
52
53
54
55
56
57
58
variable "pool" {
default = "dummy-pool"
}
variable "destination" {
default = "218.108.149.373"
}
variable "nodes" {
type = "map"
default = {
# node0 = "10.10.10.10",
}
}
variable port {
default = "80"
}
resource "bigip_ltm_virtual_server" "http" {
pool = "${var.pool}"
name = "/Common/terraform_vs_http"
destination = "${var.destination}"
port = "${var.port}"
source_address_translation = "automap"
}
resource "bigip_ltm_pool" "pool" {
name = "${var.pool}"
load_balancing_mode = "round-robin"
monitors = ["/Common/tcp"]
allow_snat = "yes"
allow_nat = "yes"
}
resource "bigip_ltm_pool_attachment" "attach_node" {
count = "${length(keys(var.nodes))}"
pool = "${var.pool}"
node = "/Common/${element(values(var.nodes), count.index)}:${var.port}"
depends_on = ["bigip_ltm_pool.pool"]
}
output "pool_name" {
value = "${bigip_ltm_pool.pool.name}"
}
output "vs_source" {
value = "${bigip_ltm_virtual_server.http.source}"
}
output "vs_destination" {
value = "${bigip_ltm_virtual_server.http.destination}"
}
output "pool_attachment_nodes" {
value = ["${bigip_ltm_pool_attachment.attach_node.*.node}"]
}