terraform-provider-bigip: Provider fails to create a node

I am trying to upgrade our terraform-provider-bigip from 0.3b to 0.12.0. I’m using:

Terraform v0.11.8
 provider.bigip v0.12.0

The bigip version I’m running against has this version: BIG-IP 11.6.3 Build 0.0.3 Final, which I understand is not the official version that you’ve tested with.

I have the following code in a module (I tried to simplify from the real code a bit). Also note that I tried with the interval field being "5" as well as the int value of 5

locals {
  pool_name = "/Common/${var.env_type}_${var.application}_${var.component}"
}

resource "bigip_ltm_monitor" "monitor" {
  name     = "/Common/${var.env_type}_${var.application}_${var.component}"
  parent   = "/Common/http"
  send     = "GET ${var.healthcheck_uri} HTTP/1.0\r\n"
  receive  = "${var.healthcheck_return}"
  timeout  = "16"
  interval = 5
}

resource "bigip_ltm_node" "node" {
  count   = "5"
  name    = "/Common/${element(var.instances_dns, count.index)}"
  address = "${element(var.instance_private_ips, count.index)}"
}

resource "bigip_ltm_pool" "pool" {
  count               = "1"
  name                = "${local.pool_name}"
  load_balancing_mode = "least-connections-member"
  monitors            = ["${var.tcp_monitor ? "/Common/tcp" : bigip_ltm_monitor.monitor.name}"]
  allow_snat          = "yes"
  allow_nat           = "yes"
}

resource "bigip_ltm_pool_attachment" "pool_node_attachment" {
  count = "5"
  pool  = "${local.pool_name}"
  node  = "${element(bigip_ltm_node.node.*.name, count.index)}"
}

It appears the monitor, pool and nodes get created ok, as evidenced below, but it looks like right when it is about to perform the pool attachment, the apply fails.

module.test_f5_pool.bigip_ltm_node.node[4]: Creating...
  address:          "" => "8.8.8.5"
  connection_limit: "" => "0"
  dynamic_ratio:    "" => "0"
  name:             "" => "/Common/test_instance_5"
  state:            "" => "user-up"
module.test_f5_pool.bigip_ltm_monitor.monitor: Creating...
  destination:   "" => "*:*"
  interval:      "" => "5"
  ip_dscp:       "" => "0"
  manual_resume: "" => "disabled"
  name:          "" => "/Common/QA_tf_test-f5-pool-v2-with-nodes"
  parent:        "" => "/Common/http"
  receive:       "" => "HTTP/1.1 200"
  reverse:       "" => "disabled"
  send:          "" => "GET /health HTTP/1.0\\r\\n"
  time_until_up: "" => "0"
  timeout:       "" => "16"
  transparent:   "" => "disabled"
module.test_f5_pool.bigip_ltm_node.node[3]: Creating...
  address:          "" => "8.8.8.4"
  connection_limit: "" => "0"
  dynamic_ratio:    "" => "0"
  name:             "" => "/Common/test_instance_4"
  state:            "" => "user-up"
module.test_f5_pool.bigip_ltm_node.node[1]: Creating...
  address:          "" => "8.8.8.2"
  connection_limit: "" => "0"
  dynamic_ratio:    "" => "0"
  name:             "" => "/Common/test_instance_2"
  state:            "" => "user-up"
module.test_f5_pool.bigip_ltm_node.node[0]: Creating...
  address:          "" => "8.8.8.1"
  connection_limit: "" => "0"
  dynamic_ratio:    "" => "0"
  name:             "" => "/Common/test_instance_1"
  state:            "" => "user-up"
module.test_f5_pool.bigip_ltm_node.node[2]: Creating...
  address:          "" => "8.8.8.3"
  connection_limit: "" => "0"
  dynamic_ratio:    "" => "0"
  name:             "" => "/Common/test_instance_3"
  state:            "" => "user-up"
module.test_f5_pool.bigip_ltm_monitor.monitor: Creation complete after 3s (ID: /Common/QA_tf_test-f5-pool-v2-with-nodes)
module.test_f5_pool.bigip_ltm_pool.pool: Creating...
  allow_nat:           "" => "yes"
  allow_snat:          "" => "yes"
  load_balancing_mode: "" => "least-connections-member"
  monitors.#:          "" => "1"
  monitors.2320741212: "" => "/Common/QA_tf_test-f5-pool-v2-with-nodes"
  name:                "" => "/Common/QA_tf_test-f5-pool-v2-with-nodes"
  reselect_tries:      "" => "0"
  service_down_action: "" => "none"
  slow_ramp_time:      "" => "10"
module.test_f5_pool.bigip_ltm_pool.pool: Creation complete after 0s (ID: /Common/QA_tf_test-f5-pool-v2-with-nodes)

Error: Error applying plan:

5 error(s) occurred:

* module.test_f5_pool.bigip_ltm_node.node[3]: 1 error(s) occurred:

* bigip_ltm_node.node.3: json: cannot unmarshal number into Go struct field .interval of type string
* module.test_f5_pool.bigip_ltm_node.node[2]: 1 error(s) occurred:

* bigip_ltm_node.node.2: json: cannot unmarshal number into Go struct field .interval of type string
* module.test_f5_pool.bigip_ltm_node.node[1]: 1 error(s) occurred:

* bigip_ltm_node.node.1: json: cannot unmarshal number into Go struct field .interval of type string
* module.test_f5_pool.bigip_ltm_node.node[4]: 1 error(s) occurred:

* bigip_ltm_node.node.4: json: cannot unmarshal number into Go struct field .interval of type string
* module.test_f5_pool.bigip_ltm_node.node[0]: 1 error(s) occurred:

* bigip_ltm_node.node.0: json: cannot unmarshal number into Go struct field .interval of type string

It appears as if the provider is allowing me to create the monitor objects with either an integer or a string value type, but then doesn’t like it when it attempts a pool attachment. This used to not be a problem when we used 0.3b. Can you recommend a workaround or a solution of any kind for this problem?

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 1
  • Comments: 31 (20 by maintainers)

Commits related to this issue

Most upvoted comments

@dannyk81 please reviwe 4f257d7

@scshitole looks like I missed this, but looking at https://github.com/terraform-providers/terraform-provider-bigip/commit/4f257d7d0c7fae5f81bcea0b5b3b158f5fa690bd I just see formatting changes.

The relevant fix is probably in the go-bigip library, is it not? or was this already merged there? I don’t see any PR over there so not sure what has changed…

Can you submit a PR for go-bigip?

@antoniotamer can you please add depends on as well

resource “bigip_ltm_pool_attachment” “attach_node2” { pool = “/Common/terraform-pool” node = “/Common/11.1.1.102:80” depends_on = [“bigip_ltm_pool.pool”]

}

That didn’t work, unfortunately