Open RavinderReddyF5 opened 4 years ago
Comment by scshitole Monday May 20, 2019 at 19:47 GMT
/* nodes with port1 */
resource "bigip_ltm_node" "nodes_port1" {
count = "${var.nodes_port1_count}"
name = "${format("/%s/%s", var.partition_name, element(keys(var.nodes_port1), count.index))}"
address = "${lookup(var.nodes_port1, element(keys(var.nodes_port1), count.index))}"
monitor = "default"
rate_limit = "disabled"
dynamic_ratio = "1"
}
/* nodes with port2 */
resource "bigip_ltm_node" "nodes_port2" {
count = "${var.nodes_port2_count}"
name = "${format("/%s/%s", var.partition_name, element(keys(var.nodes_port2), count.index))}"
address = "${lookup(var.nodes_port2, element(keys(var.nodes_port2), count.index))}"
monitor = "default"
rate_limit = "disabled"
dynamic_ratio = "1"
}
/* pool */
resource "bigip_ltm_pool" "pool" {
name = "${format("/%s/pool", var.partition_name)}"
load_balancing_mode = "round-robin"
monitors = ["/Common/tcp"]
allow_snat = "yes"
allow_nat = "yes"
depends_on = ["bigip_ltm_node.nodes_port1", "bigip_ltm_node.nodes_port2"]
}
/* Pool attachment nodes port1*/
resource "bigip_ltm_pool_attachment" "nodes_port1" {
count = "${var.nodes_port1_count}"
pool = "${bigip_ltm_pool.pool.name}"
node = "${format("%s:443", bigip_ltm_node.nodes_port1.*.name[count.index])}"
depends_on = ["bigip_ltm_node.nodes_port1", "bigip_ltm_pool.pool"]
}
/* Pool attachment nodes port2*/
resource "bigip_ltm_pool_attachment" "nodes_port2" {
count = "${var.nodes_port2_count}"
pool = "${bigip_ltm_pool.pool.name}"
node = "${format("%s:80", bigip_ltm_node.nodes_port2.*.name[count.index])}"
depends_on = ["bigip_ltm_node.nodes_port2", "bigip_ltm_pool.pool"]
}
Comment by vjvalenti2 Wednesday Jun 26, 2019 at 12:38 GMT
@scshitole Would you be able to provide a version targeted for 0.12? It seems that the new for loop functionality would really come in handy here.
Comment by dannyk81 Wednesday Jun 26, 2019 at 13:13 GMT
release v0.12.3 is out (https://github.com/terraform-providers/terraform-provider-bigip/blob/v0.12.3/CHANGELOG.md#0123-june-06-2019) and includes support for 0.12
Comment by vjvalenti2 Friday Jun 28, 2019 at 13:12 GMT
Yes, I am aware. We are building an Big-IP configuration from scratch so it would be very helpful to take advantage of some of 0.12's new features like dynamic blocks and for loops. But I haven't yet seen any working examples of such with this provider.
How can we for example generate dynamic blocks of node resources from a list of node names?
Comment by vjvalenti2 Friday Jun 28, 2019 at 23:38 GMT
Nevermind - I now see that for/for_each does not (yet) apply at the resource level, so I went with the old count method.
Issue by spirrello Tuesday May 14, 2019 at 16:43 GMT Originally opened as https://github.com/terraform-providers/terraform-provider-bigip/issues/106
Hi,
Do you have an example of how to use this provider for creating multiple nodes, pools and VIPs?