RavinderReddyF5 / terraform-provider-bigip-version0.12

Terraform resources that can configure F5 BIGIP products
Mozilla Public License 2.0
0 stars 0 forks source link

[CLOSED] bigip_ltm_virtual_server attribute name not updating on apply #209

Open RavinderReddyF5 opened 4 years ago

RavinderReddyF5 commented 4 years ago

Issue by howsTricks Wednesday Oct 30, 2019 at 11:57 GMT Originally opened as https://github.com/terraform-providers/terraform-provider-bigip/issues/178


Appears that the "name" attribute on tf does not get updated when edited, even through tf recognizes that it will change it. After "applying" the change, nothing is changed on the F5 and subsequently running apply will attempt to change the name again. Logs show success each time, but actual UI does not not show any changes.

Example tf script:

provider "bigip" {
    address = "xxxx"
    username = "xxx"
    password = "xxx"
}
resource "bigip_ltm_virtual_server" "http" {
  name = "/Common/terraform_testVIP"
  destination = "10.12.12.13"
  port = 80
  pool = "/Common/the-default-pool"
}

resource "bigip_ltm_pool" "mypool" {
    name = "/Common/the-default-pool"
    monitors = ["/Common/http"]
    allow_nat = "yes"
    allow_snat = "yes"
    load_balancing_mode = "round-robin"
}

Logs:

PS C:\Users\XXXX\Documents\network\F5\Terraform\XXXX prototyping\Example VIP> terraform plan
Refreshing Terraform state in-memory prior to plan...
The refreshed state will be used to calculate this plan, but will not be
persisted to local or remote state storage.

bigip_ltm_pool.mypool: Refreshing state... [id=/Common/the-default-pool]

------------------------------------------------------------------------

An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  # bigip_ltm_virtual_server.http will be created
  + resource "bigip_ltm_virtual_server" "http" {
      + client_profiles              = (known after apply)
      + destination                  = "10.12.12.13"
      + fallback_persistence_profile = (known after apply)
      + id                           = (known after apply)
      + ip_protocol                  = (known after apply)
      + mask                         = "255.255.255.255"
      + persistence_profiles         = (known after apply)
      + pool                         = "/Common/the-default-pool"
      + port                         = 80
      + profiles                     = (known after apply)
      + server_profiles              = (known after apply)
      + snatpool                     = (known after apply)
      + source                       = "0.0.0.0/0"
      + source_address_translation   = (known after apply)
      + state                        = "enabled"
      + translate_address            = (known after apply)
      + translate_port               = (known after apply)
      + vlans_enabled                = (known after apply)
    }

Plan: 1 to add, 0 to change, 0 to destroy.

------------------------------------------------------------------------

Note: You didn't specify an "-out" parameter to save this plan, so Terraform
can't guarantee that exactly these actions will be performed if
"terraform apply" is subsequently run.

PS C:\Users\XXXX\Documents\network\F5\Terraform\XXXX prototyping\Example VIP> terraform apply
bigip_ltm_pool.mypool: Refreshing state... [id=/Common/the-default-pool]

An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  # bigip_ltm_virtual_server.http will be created
  + resource "bigip_ltm_virtual_server" "http" {
      + client_profiles              = (known after apply)
      + destination                  = "10.12.12.13"
      + fallback_persistence_profile = (known after apply)
      + id                           = (known after apply)
      + ip_protocol                  = (known after apply)
      + mask                         = "255.255.255.255"
      + name                         = "/Common/terraform_testVIP"
      + persistence_profiles         = (known after apply)
      + pool                         = "/Common/the-default-pool"
      + port                         = 80
      + server_profiles              = (known after apply)
      + snatpool                     = (known after apply)
      + source                       = "0.0.0.0/0"
      + source_address_translation   = (known after apply)
      + state                        = "enabled"
      + translate_address            = (known after apply)
      + translate_port               = (known after apply)
      + vlans_enabled                = (known after apply)
    }

Plan: 1 to add, 0 to change, 0 to destroy.

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

bigip_ltm_virtual_server.http: Creating...
bigip_ltm_virtual_server.http: Creation complete after 3s [id=/Common/terraform_testVIP]

Apply complete! Resources: 1 added, 0 changed, 0 destroyed.
PS C:\Users\XXXX\Documents\network\F5\Terraform\XXXX prototyping\Example VIP> terraform apply
bigip_ltm_pool.mypool: Refreshing state... [id=/Common/the-default-pool]
bigip_ltm_virtual_server.http: Refreshing state... [id=/Common/terraform_testVIP]

An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
  ~ update in-place

Terraform will perform the following actions:

  # bigip_ltm_virtual_server.http will be updated in-place
  ~ resource "bigip_ltm_virtual_server" "http" {
        client_profiles            = []
        destination                = "10.12.12.13"
        id                         = "/Common/terraform_testVIP"
        ip_protocol                = "any"
        irules                     = []
        mask                       = "255.255.255.255"
      ~ name                       = "/Common/terraform_testVIP" -> "/Common/terraform_testVIP_RENAMED"
        persistence_profiles       = []
        policies                   = []
        pool                       = "/Common/the-default-pool"
        port                       = 80
        profiles                   = [
            "/Common/fastL4",
        server_profiles            = []
        source                     = "0.0.0.0/0"
        source_address_translation = "none"
        state                      = "enabled"
        translate_address          = "enabled"
        translate_port             = "enabled"
        vlans                      = []
        vlans_enabled              = false
    }

Plan: 0 to add, 1 to change, 0 to destroy.

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

bigip_ltm_virtual_server.http: Modifying... [id=/Common/terraform_testVIP]
bigip_ltm_virtual_server.http: Modifications complete after 1s [id=/Common/terraform_testVIP]

Apply complete! Resources: 0 added, 1 changed, 0 destroyed.
PS C:\Users\XXXX\Documents\network\F5\Terraform\XXXX prototyping\Example VIP> terraform plan
Refreshing Terraform state in-memory prior to plan...
The refreshed state will be used to calculate this plan, but will not be
persisted to local or remote state storage.

bigip_ltm_pool.mypool: Refreshing state... [id=/Common/the-default-pool]
bigip_ltm_virtual_server.http: Refreshing state... [id=/Common/terraform_testVIP]

------------------------------------------------------------------------
        pool                       = "/Common/the-default-pool"
        port                       = 80
        profiles                   = [
            "/Common/fastL4",
        ]
        server_profiles            = []
        source                     = "0.0.0.0/0"
        source_address_translation = "none"
        state                      = "enabled"
        translate_address          = "enabled"
        translate_port             = "enabled"
        vlans                      = []
        vlans_enabled              = false
    }

Plan: 0 to add, 1 to change, 0 to destroy.

------------------------------------------------------------------------

Note: You didn't specify an "-out" parameter to save this plan, so Terraform
can't guarantee that exactly these actions will be performed if
"terraform apply" is subsequently run.

PS C:\Users\XXXX\Documents\network\F5\Terraform\XXXX prototyping\Example VIP>
PS C:\Users\XXXX\Documents\network\F5\Terraform\XXXX prototyping\Example VIP> terraform apply
bigip_ltm_pool.mypool: Refreshing state... [id=/Common/the-default-pool]
bigip_ltm_virtual_server.http: Refreshing state... [id=/Common/terraform_testVIP]

An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
  ~ update in-place

Terraform will perform the following actions:

  # bigip_ltm_virtual_server.http will be updated in-place
  ~ resource "bigip_ltm_virtual_server" "http" {
        client_profiles            = []
        destination                = "10.12.12.13"
        id                         = "/Common/terraform_testVIP"
        ip_protocol                = "any"
        irules                     = []
        mask                       = "255.255.255.255"
      ~ name                       = "/Common/terraform_testVIP" -> "/Common/terraform_testVIP_RENAMED"
        persistence_profiles       = []
        policies                   = []
        pool                       = "/Common/the-default-pool"
        port                       = 80
        profiles                   = [
            "/Common/fastL4",
        server_profiles            = []
        source                     = "0.0.0.0/0"
        source_address_translation = "none"
        state                      = "enabled"
        translate_address          = "enabled"
        translate_port             = "enabled"
        vlans                      = []
        vlans_enabled              = false
    }

Plan: 0 to add, 1 to change, 0 to destroy.

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

bigip_ltm_virtual_server.http: Modifying... [id=/Common/terraform_testVIP]
bigip_ltm_virtual_server.http: Modifications complete after 1s [id=/Common/terraform_testVIP]

Note: You didn't specify an "-out" parameter to save this plan, so Terraform
can't guarantee that exactly these actions will be performed if
"terraform apply" is subsequently run.

PS C:\Users\XXXX\Documents\network\F5\Terraform\XXXX prototyping\Example VIP> terraform apply
bigip_ltm_pool.mypool: Refreshing state... [id=/Common/the-default-pool]
bigip_ltm_virtual_server.http: Refreshing state... [id=/Common/terraform_testVIP]

An execution plan has been generated and is shown below.  
Resource actions are indicated with the following symbols:
  ~ update in-place

Terraform will perform the following actions:

  # bigip_ltm_virtual_server.http will be updated in-place  
  ~ resource "bigip_ltm_virtual_server" "http" {
        client_profiles            = []
        destination                = "10.12.12.13"
        id                         = "/Common/terraform_testVIP"
        ip_protocol                = "any"
        irules                     = []
        mask                       = "255.255.255.255"
      ~ name                       = "/Common/terraform_testVIP" -> "/Common/terraform_testVIP_RENAMED"
        persistence_profiles       = []
        policies                   = []
        pool                       = "/Common/the-default-pool"
        port                       = 80
        profiles                   = [
            "/Common/fastL4",
        ]
        server_profiles            = []
        source                     = "0.0.0.0/0"
        source_address_translation = "none"
        state                      = "enabled"
        translate_address          = "enabled"
        translate_port             = "enabled"
        vlans                      = []
        vlans_enabled              = false
    }

Plan: 0 to add, 1 to change, 0 to destroy.

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

bigip_ltm_virtual_server.http: Modifying... [id=/Common/terraform_testVIP]
bigip_ltm_virtual_server.http: Modifications complete after 2s [id=/Common/terraform_testVIP]

Apply complete! Resources: 0 added, 1 changed, 0 destroyed.
PS C:\Users\XXXX\Documents\network\F5\Terraform\XXXX prototyping\Example VIP>
RavinderReddyF5 commented 4 years ago

Comment by papineni87 Friday Nov 01, 2019 at 06:33 GMT


Generally virtual server name shouldn't be edited, we should add "ForceNew" field for name argument, so that any change in name will create a new resource.

I will add above change in code, so that it won't be misleading

From ( https://devcentral.f5.com/s/question/0D51T00006i7k5A/how-do-i-to-rename-a-virtual-serverpool-name-on-a-f5-ltm- ) virtual server name can be changed by editing bigip.conf file but you may encounter issues while loading bigip.conf file.Best way is create one new virtual server with dummy IP and then you just switch over the IP's in off business hours.

RavinderReddyF5 commented 4 years ago

Comment by howsTricks Friday Nov 01, 2019 at 06:40 GMT


Sounds good. Thanks for the update!

On Fri, Nov 1, 2019 at 7:33 AM papineni87 notifications@github.com wrote:

Generally virtual server name shouldn't be edited, we should add "ForceNew" field for name argument, so that any change in name will create a new resource.

I will add above change in code, so that it won't be misleading

From ( https://devcentral.f5.com/s/question/0D51T00006i7k5A/how-do-i-to-rename-a-virtual-serverpool-name-on-a-f5-ltm- ) virtual server name can be changed by editing bigip.conf file but you may encounter issues while loading bigip.conf file.Best way is create one new virtual server with dummy IP and then you just switch over the IP's in off business hours.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/terraform-providers/terraform-provider-bigip/issues/178?email_source=notifications&email_token=AA22ZPISX3HZJDAJWYFDOODQRPEVHA5CNFSM4JGYBMU2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEC2DZOA#issuecomment-548682936, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA22ZPPVNFV5EKNXGT2VGLTQRPEVHANCNFSM4JGYBMUQ .

-- -Chris