opentelekomcloud / terraform-provider-opentelekomcloud

Terraform OpenTelekomCloud provider
https://registry.terraform.io/providers/opentelekomcloud/opentelekomcloud/latest
Mozilla Public License 2.0
88 stars 77 forks source link

ELBv3 Listener replacing default_pool_id with null #1692

Closed CHS-OTC closed 2 years ago

CHS-OTC commented 2 years ago

Hi,

there is a difference in behaviour between ELBv2 and ELBv3 in regards to backend groups in the listeners.

If a listener is created via TF without backend server group and assigning an backend server group afterwards via GUI, there is no issue with ELBv2. But with ELBv3 it tries to replace the value "default_pool_id" with null.

This can also be replicated by first assigning a default_pool_id with a pool created via TF and then to remove the parameter default_pool_id from the TF listener configuation.

Terraform provider version

Terraform v1.1.0 on windows_amd64

Affected Resource(s)

opentelekomcloud_lb_listener_v3

# Terraform Configuration Files
ELBv3
resource "opentelekomcloud_lb_listener_v3" "lb_listener_http_2" {
  name            = "http"
  protocol        = "TCP"
  protocol_port   = 80
  loadbalancer_id = "70fadc88-fb19-4361-81d8-a59653161888" 
  tags = {
    env = "evv"
  }
}
ELBv2
resource "opentelekomcloud_lb_listener_v2" "listener_1" {
  name            = "a"
  protocol        = "TCP"
  protocol_port   = 8080
  loadbalancer_id = "fb44cb9f-e55d-44af-9c3d-bb65b13a72bb"

  tags = {
    muh = "kuh"
  }
}

Debug Output/Panic Output

Steps to Reproduce

  1. Create ELBv3
  2. terraform apply with ELBv3 Listener
  3. Adding Backend Server Group via GUI
  4. terraform apply again without any changes

Expected Behavior

no changes should be detected. For ELBv2 that is the case.

Actual Behavior

# opentelekomcloud_lb_listener_v3.lb_listener_http_2 will be updated in-place
  ~ resource "opentelekomcloud_lb_listener_v3" "lb_listener_http_2" {
      - default_pool_id    = "22b667f7-b3c4-461f-a347-ece10aab6002" -> null
        id                 = "17c28988-990c-43dc-8d6c-05ca200bccab"
        name               = "http"
        tags               = {
            "env" = "evv"
        }
        # (11 unchanged attributes hidden)

        # (1 unchanged block hidden)
    }

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

opentelekomcloud_lb_listener_v3.lb_listener_http_2: Modifying... [id=17c28988-990c-43dc-8d6c-05ca200bccab]
╷
│ Error: unable to update ListenerV3 17c28988-990c-43dc-8d6c-05ca200bccab: Bad request with: [PUT https://elb.eu-de.otc.t-systems.com/v3/c87a0390a7f242a8b32b104b4e899793/elb/listeners/17c28988-990c-43dc-8d6c-05ca200bccab], error message: {"error_msg":"Invalid request body: Empty body '{}' is meaningless.","error_code":"SYS.0400","request_id":"aafaa14abc7dcc6197e2f70e745e0d00"}
│
│   with opentelekomcloud_lb_listener_v3.lb_listener_http_2,
│   on delb.tf line 48, in resource "opentelekomcloud_lb_listener_v3" "lb_listener_http_2":
│   48: resource "opentelekomcloud_lb_listener_v3" "lb_listener_http_2" {
│
╵
outcatcher commented 2 years ago

@CHS-OTC for some reason I wasn't able to reproduce the issue, can you please try it again?

outcatcher commented 2 years ago

@CHS-OTC please comment if it still reproduces, closing for now

sfhl commented 2 years ago

Hi there, i still get this with versions as follows

Terraform v1.1.3
on linux_amd64
+ provider registry.terraform.io/terraform-providers/opentelekomcloud v1.29.2
Terraform will perform the following actions:
...
  # opentelekomcloud_lb_listener_v3.on will be updated in-place
  ~ resource "opentelekomcloud_lb_listener_v3" "one" {
      - default_pool_id    = "4d3bcc1b-be2e-4231-a004-46f468c34c67" -> null
        id                 = "dcb0f031-e434-4bdf-8b74-e68b5ba926f5"
        name               = "one"
        tags               = {}
        # (11 unchanged attributes hidden)

        # (1 unchanged block hidden)
    }
...
Plan: 0 to add, 1 to change, 0 to destroy.