Terraform-provider-google: log_config can't be disabled

Created on 1 May 2020  路  6Comments  路  Source: hashicorp/terraform-provider-google

(based on https://github.com/terraform-google-modules/terraform-google-lb-http/issues/92)

I'm tryng to create a load balancer and set:

log_config {
enable = false
sample_rate = null
}
The configuration doesn't work correctly as it is always set to enable->true sample_rate->1

I can see this in the logs

2020-03-18T12:45:50.787+0100 [DEBUG] plugin.terraform-provider-google-beta_v3.13.0_x5: },
2020-03-18T12:45:50.787+0100 [DEBUG] plugin.terraform-provider-google-beta_v3.13.0_x5: "logConfig": {
2020-03-18T12:45:50.787+0100 [DEBUG] plugin.terraform-provider-google-beta_v3.13.0_x5: "enable": true,
2020-03-18T12:45:50.787+0100 [DEBUG] plugin.terraform-provider-google-beta_v3.13.0_x5: "sampleRate": 1
2020-03-18T12:45:50.787+0100 [DEBUG] plugin.terraform-provider-google-beta_v3.13.0_x5: },
2020/03/18 12:45:50 [WARN] Provider "registry.terraform.io/-/google-beta" produced an unexpected new value for module.app_lb.google_compute_backend_service.default["default"], but we are tolerating it because it is using the legacy plugin SDK.
The following problems may be the cause of any confusing errors from downstream operations:
- .log_config[0].enable: was cty.False, but now cty.True
- .log_config[0].sample_rate: was null, but now cty.NumberIntVal(1)

same results with 3.18.0 and 4.xx

bug

All 6 comments

Can your share your config or full debug log to see what's going on ?

I am having the same issue. I always get suggested changes like:

      + log_config {
          + enable      = false
          + sample_rate = 0
        }

or:

      + log_config {}

In my TF code I used:

      log_config = {
        enable      = false
        sample_rate = 0
      }

the same here, I cannot disable logging on existing google_compute_backend_service

Don't want to file a new issue, as the cause seems to be the same.
Provider version 3.38.0.
When I have log_config section as follows:

log_config
  enable      = false
  sample_rate = null
}

for backend_service resource and

logging             = false

for health checks, terraform always suggests adding these to resources, while it finds it empty querying API:

  # module.global-loadbalancer.google_compute_health_check.default["sb2integration"] will be updated in-place
  ~ resource "google_compute_health_check" "default" {
        check_interval_sec  = 5
        ...
        http_health_check {
            port         = 8080
            proxy_header = "NONE"
            request_path = "/hc"
        }

      + log_config {
          + enable = false
        }
    }

and inside terraform provider log:

2020-09-15T10:37:53.323+0700 [DEBUG] plugin.terraform-provider-google-beta_v3.38.0_x5: {
2020-09-15T10:37:53.323+0700 [DEBUG] plugin.terraform-provider-google-beta_v3.38.0_x5:   "id": "6970670192020790769",
2020-09-15T10:37:53.323+0700 [DEBUG] plugin.terraform-provider-google-beta_v3.38.0_x5:   "creationTimestamp": "2020-09-14T19:12:46.246-07:00",
2020-09-15T10:37:53.323+0700 [DEBUG] plugin.terraform-provider-google-beta_v3.38.0_x5:   "name": "global-loadbalancer-hc-sb2integration",
2020-09-15T10:37:53.324+0700 [DEBUG] plugin.terraform-provider-google-beta_v3.38.0_x5:   "checkIntervalSec": 5,
2020-09-15T10:37:53.324+0700 [DEBUG] plugin.terraform-provider-google-beta_v3.38.0_x5:   "timeoutSec": 5,
2020-09-15T10:37:53.324+0700 [DEBUG] plugin.terraform-provider-google-beta_v3.38.0_x5:   "unhealthyThreshold": 2,
2020-09-15T10:37:53.324+0700 [DEBUG] plugin.terraform-provider-google-beta_v3.38.0_x5:   "healthyThreshold": 2,
2020-09-15T10:37:53.324+0700 [DEBUG] plugin.terraform-provider-google-beta_v3.38.0_x5:   "type": "HTTP",
2020-09-15T10:37:53.324+0700 [DEBUG] plugin.terraform-provider-google-beta_v3.38.0_x5:   "httpHealthCheck": {
2020-09-15T10:37:53.324+0700 [DEBUG] plugin.terraform-provider-google-beta_v3.38.0_x5:     "port": 8080,
2020-09-15T10:37:53.324+0700 [DEBUG] plugin.terraform-provider-google-beta_v3.38.0_x5:     "requestPath": "/hc",
2020-09-15T10:37:53.324+0700 [DEBUG] plugin.terraform-provider-google-beta_v3.38.0_x5:     "proxyHeader": "NONE"
2020-09-15T10:37:53.324+0700 [DEBUG] plugin.terraform-provider-google-beta_v3.38.0_x5:   },
...
2020-09-15T10:37:53.324+0700 [DEBUG] plugin.terraform-provider-google-beta_v3.38.0_x5:   "logConfig": {},
2020-09-15T10:37:53.324+0700 [DEBUG] plugin.terraform-provider-google-beta_v3.38.0_x5:   "kind": "compute#healthCheck"
2020-09-15T10:37:53.324+0700 [DEBUG] plugin.terraform-provider-google-beta_v3.38.0_x5: }

we can see

"logConfig": {},

which is not treated well.

Same problem with 3.43.0. I would even ask, why do I have to define logging in the first place instead of using the default values.

Still have the same problem with 3.51.0

Was this page helpful?
0 / 5 - 0 ratings