f5devcentral / terraform-provider-bigip-old

This Repo is Deprecated please refer to https://github.com/terraform-providers/terraform-provider-bigip Provider is Published !
Mozilla Public License 2.0
32 stars 15 forks source link

resource_bigip_ltm_pool_attachment not working #128

Closed vikram-chandrakanth closed 1 year ago

vikram-chandrakanth commented 5 years ago

Hi Team,

resource_bigip_ltm_pool_attachment, is not updating the last state, on the first run it attaches the member to the pool,

But on re-run, it try to add it again. and fails on saying, there are already a member of the pool.

First Run:

bigip_ltm_pool_attachment.nodes_attach[2]: Creating... node: "" => "test_node01:80" pool: "" => "/Common/node" bigip_ltm_pool_attachment.nodes_attach[1]: Creating... node: "" => "web_node02:80" pool: "" => "/Common/server" bigip_ltm_pool_attachment.nodes_attach[0]: Creating... node: "" => "web_node01:80" pool: "" => "/Common/server" bigip_ltm_pool_attachment.nodes_attach[3]: Creating... node: "" => "test_node02:80" pool: "" => "/Common/node" bigip_ltm_pool_attachment.nodes_attach[3]: Creation complete after 0s (ID: /Common/node-test_node02:80) bigip_ltm_pool_attachment.nodes_attach[2]: Creation complete after 0s (ID: /Common/node-test_node01:80) bigip_ltm_pool_attachment.nodes_attach[1]: Creation complete after 0s (ID: /Common/server-web_node02:80) bigip_ltm_pool_attachment.nodes_attach[0]: Creation complete after 0s (ID: /Common/server-web_node01:80)

Second Run:

bigip_ltm_pool_attachment.nodes_attach[1]: Refreshing state... (ID: /Common/server-web_node02:80) bigip_ltm_pool_attachment.nodes_attach[0]: Refreshing state... (ID: /Common/server-web_node01:80) bigip_ltm_pool_attachment.nodes_attach[3]: Refreshing state... (ID: /Common/node-test_node02:80) bigip_ltm_pool_attachment.nodes_attach[2]: Refreshing state... (ID: /Common/node-test_node01:80) bigip_ltm_pool_attachment.nodes_attach[0]: Creating... node: "" => "web_node01:80" pool: "" => "/Common/server" bigip_ltm_pool_attachment.nodes_attach[3]: Creating... node: "" => "test_node02:80" pool: "" => "/Common/node" bigip_ltm_pool_attachment.nodes_attach[1]: Creating... node: "" => "web_node02:80" pool: "" => "/Common/server" bigip_ltm_pool_attachment.nodes_attach[2]: Creating... node: "" => "test_node01:80" pool: "" => "/Common/node"

Error: Error applying plan:

4 error(s) occurred:

Terraform does not automatically rollback in the face of errors. Instead, your Terraform state file has been partially updated with any resources that successfully completed. Please address the error above and apply again to incrementally change your infrastructure.

main.tf

provider "bigip" { address = "${var.url}" username = "${var.username}" password = "${var.password}" }

resource "bigip_ltm_pool_attachment" "nodes_attach" { count = "${length(var.pool_nodes)}" pool = "/Common/${lookup(var.pool_nodes[count.index], "pool")}" node = "${lookup(var.pool_nodes[count.index], "name")}" }

Regards, Vikram

dannyk81 commented 5 years ago

Hi @vikram-chandrakanth

You should not be using the provider from this repo (in case you are), since active development moved to https://github.com/terraform-providers/terraform-provider-bigip

On a high level look here, I think the problem is in how the node name is declared:

bigip_ltm_pool_attachment.nodes_attach[0]: Creating...
node: "" => "web_node01:80"
pool: "" => "/Common/server"

^^ above is wrong, since the node name should be a fullPath so you are missing the partition bit:

node: "" => "/Common/web_node01:80"

Can you please retry with above and using the latest release from https://github.com/terraform-providers/terraform-provider-bigip

adam-f5 commented 1 year ago

Repository Archived