terraform-provider-bigip icon indicating copy to clipboard operation
terraform-provider-bigip copied to clipboard

persistence_profiles changes are not handled correctly on import

Open marsu-p opened this issue 1 year ago • 0 comments
trafficstars

Environment

  • TMOS/Bigip Version: BIG-IP 15.1.8.1
  • Terraform Version: v1.5.6
  • Terraform bigip provider Version: v1.22.1

Summary

When importing a bigip_ltm_virtual_server resource, persistence_profiles are not handled correctly.

Steps To Reproduce

Steps to reproduce the behavior:

  1. Create a virtual server in the UI, with a persistence profile set Screenshot 2024-06-14 at 11 00 17

  2. Create terraform config for above virtual server (with a change, BUT without persistence_profiles set)

# bigip_ltm_virtual_server.virtual_server:
resource "bigip_ltm_virtual_server" "virtual_server" {
    id                         = "/my-partition/vip-major-admin-443"
    name                       = "/my-partition/vip-major-admin-443"
    description                = "VIP MAJOR admin-443 (managed by terraform)"
    destination                = "1.1.1.1%1000"
    mask                       = "255.255.255.255"
    ip_protocol                = "tcp"
    port                       = 443
    pool                       = "/my-partition/pool-major-admin-2443"
    profiles                   = [
        "/Common/tcp",
    ]
    snatpool                   = "/my-partition/sn-112"
    source_address_translation = "snat"
}
  1. import the resource
$ terraform import 'bigip_ltm_virtual_server.virtual_server' /my-partition/vip-major-admin-443
bigip_ltm_virtual_server.virtual_server: Importing from ID "/my-partition/vip-major-admin-443"...
bigip_ltm_virtual_server.virtual_server: Import prepared!
  Prepared bigip_ltm_virtual_server for import
bigip_ltm_virtual_server.virtual_server: Refreshing state... [id=/my-partition/vip-major-admin-443]

Import successful!

The resources that were imported are shown above. These resources are now in
your Terraform state and will henceforth be managed by Terraform.
  1. check terraform plan output
$ terraform plan
bigip_ltm_virtual_server.virtual_server: Refreshing state... [id=/my-partition/vip-major-admin-443]

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_virtual_server.virtual_server will be updated in-place
  ~ resource "bigip_ltm_virtual_server" "virtual_server" {
      ~ description                = "some description" -> "VIP MAJOR admin-443 (managed by terraform)"
        id                         = "/my-partition/vip-demo-admin-443"
        name                       = "/my-partition/vip-demo-admin-443"
        # (18 unchanged attributes hidden)
    }

Plan: 0 to add, 1 to change, 0 to destroy.
  1. terraform apply removes the persistence profile Screenshot 2024-06-14 at 11 04 06

Expected Behavior

persistence_profiles should show in the changes

Actual Behavior

persistence_profiles is not shown in the changes

marsu-p avatar Jun 14 '24 09:06 marsu-p