terraform-provider-bigip
terraform-provider-bigip copied to clipboard
BigIP LTM Pool - Update in place causing unnecessary destroy which fails as pool in use.
trafficstars
Environment
- TMOS/Bigip Version: 16.1.4.1
- Terraform Version: v1.8.1
- Terraform bigip provider Version: v1.22.0
Summary
When updating a bigip_ltm_pool, Terraform says in place update but an error is returned saying the pool can't be deleted as it is in use.
Steps To Reproduce
resource "bigip_ltm_monitor" "monitor" {
name = "/Common/test_http_monitor"
parent = "/Common/http"
}
resource "bigip_ltm_pool" "pool" {
name = "/Common/test_pool"
load_balancing_mode = "least-connections"
minimum_active_members = 1
monitors = [bigip_ltm_monitor.monitor.name]
depends_on = [
bigip_command.folder-command_create,
bigip_ltm_monitor.monitor
]
}
resource "bigip_ltm_virtual_server" "http" {
name = "/Common/test_http"
destination = "1.1.1.1"
port = 443
source_address_translation = "automap"
translate_address = "enabled"
translate_port = "enabled"
pool = bigip_ltm_pool.pool.name
profiles = [ "/Common/tcp", "/Common/http", "/Common/oneconnect" ]
irules = [ ]
depends_on = [
bigip_ltm_pool.pool,
]
}
Now updating the pool resource will cause the error as it is in use by the virtual server http
Expected Behavior
The pool is successfully modified with the changes.
Actual Behavior
An error is thrown in Terraform
Terraform plan
# module.production.module.netbox.bigip_ltm_pool.pool will be updated in-place
~ resource "bigip_ltm_pool" "pool" {
id = "/Common/test_pool"
~ load_balancing_mode = "round-robin" -> "least-connections"
name = "/Common/test_pool"
~ service_down_action = "none" -> "reselect"
# (7 unchanged attributes hidden)
}
Error
│ Error: 01070265:3: The Pool (/Common/test_pool) cannot be deleted because it is in use by a Virtual Server (/Common/test_http).
│
│ with module.production.module.test.bigip_ltm_pool.pool,
│ on modules/test_http/main.tf line 19, in resource "bigip_ltm_pool" "pool":
│ 19: resource "bigip_ltm_pool" "pool" {
Hi @scu-cmoore1,
I tested with version 1.22.1 the following with success.
resource "bigip_ltm_monitor" "monitor" {
name = "/Common/test_http_monitor"
parent = "/Common/http"
}
resource "bigip_ltm_pool" "pool" {
name = "/Common/test_pool"
load_balancing_mode = "least-connections-member"
minimum_active_members = 1
monitors = [bigip_ltm_monitor.monitor.name]
depends_on = [
bigip_ltm_monitor.monitor
]
}
resource "bigip_ltm_virtual_server" "http" {
name = "/Common/test_http"
destination = "1.1.1.1"
port = 443
source_address_translation = "automap"
translate_address = "enabled"
translate_port = "enabled"
pool = bigip_ltm_pool.pool.name
profiles = [ "/Common/tcp", "/Common/http", "/Common/oneconnect" ]
irules = [ ]
depends_on = [
bigip_ltm_pool.pool
]
}
Change LB mode:
resource "bigip_ltm_monitor" "monitor" {
name = "/Common/test_http_monitor"
parent = "/Common/http"
}
resource "bigip_ltm_pool" "pool" {
name = "/Common/test_pool"
load_balancing_mode = "ratio-member"
minimum_active_members = 1
monitors = [bigip_ltm_monitor.monitor.name]
depends_on = [
bigip_ltm_monitor.monitor
]
}
resource "bigip_ltm_virtual_server" "http" {
name = "/Common/test_http"
destination = "1.1.1.1"
port = 443
source_address_translation = "automap"
translate_address = "enabled"
translate_port = "enabled"
pool = bigip_ltm_pool.pool.name
profiles = [ "/Common/tcp", "/Common/http", "/Common/oneconnect" ]
irules = [ ]
depends_on = [
bigip_ltm_pool.pool
]
}
$ terraform plan -out pool
bigip_ltm_monitor.monitor: Refreshing state... [id=/Common/test_http_monitor]
bigip_ltm_pool.pool: Refreshing state... [id=/Common/test_pool]
bigip_ltm_virtual_server.http: Refreshing state... [id=/Common/test_http]
Terraform used the selected providers to generate the following execution plan.
Resource actions are indicated with the following symbols:
~ update in-place
Terraform will perform the following actions:
# bigip_ltm_pool.pool will be updated in-place
~ resource "bigip_ltm_pool" "pool" {
id = "/Common/test_pool"
~ load_balancing_mode = "least-connections-member" -> "ratio-member"
name = "/Common/test_pool"
# (7 unchanged attributes hidden)
}
Plan: 0 to add, 1 to change, 0 to destroy.
───────────────────────────────────────────────────────────────────────────────
Saved the plan to: pool
To perform exactly these actions, run the following command to apply:
terraform apply "pool"
$ terraform apply "pool"
bigip_ltm_pool.pool: Modifying... [id=/Common/test_pool]
bigip_ltm_pool.pool: Modifications complete after 0s [id=/Common/test_pool]
Can you test with version 1.22.1?