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

`requestlog_template` is added to the state as `responselog_template`

Open marcsauter opened this issue 10 months ago • 4 comments

https://github.com/F5Networks/terraform-provider-bigip/blob/1014351a85dec1abf9ea69545cac0a2e89ddb9e0/bigip/resource_bigip_ltm_profile_request_log.go#L265

marcsauter avatar Mar 28 '24 14:03 marcsauter

Hi @marcsauter

Can you give more information about your request?

pgouband avatar Mar 28 '24 14:03 pgouband

hello @pgouband Marc is working at my customer. They observed the following issue in the module bigip_ltm_request_log_profile:

  1. TF config is
resource "bigip_ltm_request_log_profile" "tf_access_log_sec" {
  name                = "/Common/tf-access-log-sec"
  defaults_from       = bigip_ltm_request_log_profile.tf_request_log_pf.name
  request_logging     = "enabled"
  requestlog_template = "<134> $${TIME_MSECS} $${TIME_OFFSET} bigip_host=$${BIGIP_HOSTNAME} type=request"
  response_logging    = "enabled"
  responselog_template = "<134> $${TIME_MSECS} $${TIME_OFFSET} bigip_host=$${BIGIP_HOSTNAME} type=response"
}
  1. After TF apply, the configuration is correct on the BIG-IP:
ltm profile request-log tf-access-log-sec {
    app-service none
    defaults-from tf-request-log-pf
    request-log-template "<134> ${TIME_MSECS} ${TIME_OFFSET} bigip_host=${BIGIP_HOSTNAME} type=request"
    request-logging enabled
    response-log-template "<134> ${TIME_MSECS} ${TIME_OFFSET} bigip_host=${BIGIP_HOSTNAME} type=response"
    response-logging enabled
}
  1. however, in the TF state (because of the error in provider code mentioned above by Marc), we do see:
$ terraform state show bigip_ltm_request_log_profile.tf_access_log_sec
2024-04-11T13:38:28.958+0200 [INFO]  provider: configuring client automatic mTLS
2024-04-11T13:38:28.998+0200 [INFO]  provider.terraform-provider-bigip_v1.22.0: configuring server automatic mTLS: timestamp=2024-04-11T13:38:28.998+0200
# bigip_ltm_request_log_profile.tf_access_log_sec:
resource "bigip_ltm_request_log_profile" "tf_access_log_sec" {
    defaults_from        = "/Common/tf-request-log-pf"
    id                   = "/Common/tf-access-log-sec"
    name                 = "/Common/tf-access-log-sec"
    request_logging      = "enabled"
    requestlog_template  = "<134> ${TIME_MSECS} ${TIME_OFFSET} bigip_host=${BIGIP_HOSTNAME} type=request"
    response_logging     = "enabled"
    responselog_template = "<134> ${TIME_MSECS} ${TIME_OFFSET} bigip_host=${BIGIP_HOSTNAME} type=request"
}

==> responselog_template = requestlo_template

  1. Result: TF sees a config drift and re-applied the config everytime:
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_request_log_profile.tf_access_log_sec will be updated in-place
  ~ resource "bigip_ltm_request_log_profile" "tf_access_log_sec" {
        id                   = "/Common/tf-access-log-sec"
        name                 = "/Common/tf-access-log-sec"
      ~ responselog_template = "<134> ${TIME_MSECS} ${TIME_OFFSET} bigip_host=${BIGIP_HOSTNAME} type=request" -> "<134> ${TIME_MSECS} ${TIME_OFFSET} bigip_host=${BIGIP_HOSTNAME} type=response"
        # (4 unchanged attributes hidden)
    }

Please fix this issue, thank you.

amolari avatar Apr 11 '24 11:04 amolari

I guess this issue is the same as this one #950

amolari avatar Apr 11 '24 11:04 amolari

Hi,

Thanks for reporting. Added to the backlog and internal tracking ID for this request is: INFRAANO-1539.

pgouband avatar Apr 12 '24 07:04 pgouband