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] Can't change virtual server name? #217

Open RavinderReddyF5 opened 4 years ago

RavinderReddyF5 commented 4 years ago

Issue by stobias123 Wednesday Nov 06, 2019 at 19:19 GMT Originally opened as https://github.com/terraform-providers/terraform-provider-bigip/issues/186


Using a resource like below...

resource "bigip_ltm_virtual_server" "https" {
  name                       = "/Common/vs_foo"
  destination                = "1.2.3.4"
  ...
}

Applying, then changing as shown below.

resource "bigip_ltm_virtual_server" "https" {
  name                       = "/Common/vs_bar"
  destination                = "1.2.3.4"
  ...
}

Results in a successful apply, but the name is not changed.

RavinderReddyF5 commented 4 years ago

Comment by dannyk81 Wednesday Nov 06, 2019 at 20:11 GMT


I'd say this is a happy accident :sweat_smile: since the name of an existing VS (or Pool, or Node, etc...) cannot be modified, at least not through the API.

In fact, the resource should have a ForceNew: true set on the name attribute.

I found this hack: https://indepthtechnology.org/2019/03/04/f5-bigip-rename-virtual-server-and-pool-names/

either that, or modifying the config files and reloading the config from there.

I can't recommend any of these, haven't tried them myself.

RavinderReddyF5 commented 4 years ago

Comment by stobias123 Wednesday Nov 06, 2019 at 20:28 GMT


I'd say the opposite actually, looks like a bug..

If we've got ForceNew on the attribute, then why is it saying it can update in place? https://github.com/terraform-providers/terraform-provider-bigip/blob/master/bigip/resource_bigip_ltm_virtual_server.go#L35

RavinderReddyF5 commented 4 years ago

Comment by dannyk81 Wednesday Nov 06, 2019 at 20:38 GMT


haa, indeed the ForceNew: true is already there...

I just did a quick test and in my case the VS resource is indeed being recreated when changing the name:

 resource "bigip_ltm_virtual_server" "https" {
-  name        = "/Common/vs_bar"
+  name        = "/Common/vs_foo"
   destination = "1.2.3.4"
   ip_protocol = "tcp"
   port        = 8080
   pool        = bigip_ltm_pool.test_pool1.name
 }
  # bigip_ltm_virtual_server.https must be replaced
-/+ resource "bigip_ltm_virtual_server" "https" {
      ~ client_profiles              = [] -> (known after apply)
        destination                  = "1.2.3.4"
      + fallback_persistence_profile = (known after apply)
      ~ id                           = "/Common/vs_bar" -> (known after apply)
        ip_protocol                  = "tcp"
      - irules                       = [] -> null
        mask                         = "255.255.255.255"
      ~ name                         = "/Common/vs_bar" -> "/Common/vs_foo" # forces replacement
      ~ persistence_profiles         = [] -> (known after apply)
      - policies                     = [] -> null
        pool                         = "/Common/test_pool1"
        port                         = 8080
      ~ profiles                     = [
          - "/Common/fastL4",
        ] -> (known after apply)
      ~ server_profiles              = [] -> (known after apply)
      + snatpool                     = (known after apply)
        source                       = "0.0.0.0/0"
      ~ source_address_translation   = "none" -> (known after apply)
        state                        = "enabled"
      ~ translate_address            = "enabled" -> (known after apply)
      ~ translate_port               = "enabled" -> (known after apply)
      - vlans                        = [] -> null
      ~ vlans_enabled                = false -> (known after apply)
    }

and here's the apply itself:

bigip_ltm_virtual_server.https: Destroying... [id=/Common/vs_bar]
bigip_ltm_virtual_server.https: Destruction complete after 0s
bigip_ltm_virtual_server.https: Creating...
bigip_ltm_virtual_server.https: Creation complete after 2s [id=/Common/vs_foo]

Apply complete! Resources: 1 added, 0 changed, 1 destroyed.

just curious, which version of terraform are you using?

RavinderReddyF5 commented 4 years ago

Comment by dannyk81 Wednesday Nov 06, 2019 at 20:39 GMT


@stobias123 notice the

~ name                         = "/Common/vs_bar" -> "/Common/vs_foo" # forces replacement
RavinderReddyF5 commented 4 years ago

Comment by stobias123 Wednesday Nov 06, 2019 at 20:59 GMT


I get different behavior.

Terraform v0.12.12
+ provider.bigip v1.0.0
+ provider.vault v2.5.0
  # bigip_ltm_virtual_server.http will be updated in-place
  ~ resource "bigip_ltm_virtual_server" "http" {
        client_profiles            = []
        destination                = "1.2.3.4"
        id                         = "/Common/vs_stage-foo_http"
        ip_protocol                = "tcp"
        irules                     = [
            "/Common/irule_proxy_pass",
        ]
        mask                       = "255.255.255.255"
      ~ name                       = "/Common/vs_stage-foo_http" -> "/Common/vs_stage-test-foo_http"
RavinderReddyF5 commented 4 years ago

Comment by dannyk81 Wednesday Nov 06, 2019 at 21:05 GMT


welp... the ForceNew: true is in master, but not part of v1.0.0 release :smile:

https://github.com/terraform-providers/terraform-provider-bigip/blob/dc9e923a89de5ff0303159a20fa5eafb3e97a61b/bigip/resource_bigip_ltm_virtual_server.go#L31-L36

so that explains things, I'm using a build from master (testing recent fixes) so not hitting this of course.

RavinderReddyF5 commented 4 years ago

Comment by stobias123 Wednesday Nov 06, 2019 at 21:08 GMT


What's the release schedule look like? Trying to get this functionality, as well as a couple new modules (client ssl profiles) asap

RavinderReddyF5 commented 4 years ago

Comment by dannyk81 Wednesday Nov 06, 2019 at 21:18 GMT


no idea...

if urgent, you can always build the plugin from master and put the binary in ~/.terraform.d/plugins/linux_amd64/ (and probably cleanup the modules cache)

/cc @papineni87 @RavinderReddyF5 @scshitole @GaddamSaketha maybe you can help with the release...

RavinderReddyF5 commented 4 years ago

Comment by papineni87 Thursday Nov 07, 2019 at 08:49 GMT


Release cadence will be on monthly, however any urgent requirements/fixes needed by anyone we can patch release for those

we faced some test related issues with client ssl profiles and we are working on it. If anything else needed, please raise a new issue and we can track it and fix it

RavinderReddyF5 commented 4 years ago

Comment by RavinderReddyF5 Wednesday Nov 27, 2019 at 01:33 GMT


@stobias123 Fix Available in v1.1.0, please open new issue for any other issues you see.