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

cloudflare_logpush_job plan always suggests changes

Open joshuamsager opened this issue 7 months ago • 6 comments

Confirmation

  • [x] This is a bug with an existing resource and is not a feature request or enhancement. Feature requests should be submitted with Cloudflare Support or your account team.
  • [x] I have searched the issue tracker and my issue isn't already found.
  • [x] I have replicated my issue using the latest version of the provider and it is still present.

Terraform and Cloudflare provider version

Terraform v1.10.3 cloudflare/cloudflare v5.3.0

Affected resource(s)

  • cloudflare_logpush_job

Terraform configuration files

resource "cloudflare_logpush_job" "kitchensink" {
  name             = "HTTP-requests-kitchensink"
  zone_id          = var.zone_id
  kind             = var.kind
  dataset          = "http_requests"
  destination_conf = "https://${var.destination}?header_Authorization=Basic%20${var.auth_token}"

  # Used only for "Core" logging (kind is null)
  max_upload_interval_seconds = 30
  max_upload_records          = 1000

  output_options = {
    field_names      = local.fields
    timestamp_format = "unixnano"
    sample_rate      = var.sample
    output_type      = "ndjson"
    record_prefix    = "{"
    record_suffix    = "}\n"
    field_delimiter  = ","
  }

  enabled = var.enabled
}

Link to debug output

Shared in Cloudflare Support ticket

Panic output

No response

Expected output

Plan after apply should not propose changes

Actual output

module.observe_apps.cloudflare_logpush_job.kitchensink will be updated in-place

~ resource "cloudflare_logpush_job" "kitchensink" { + error_message = (known after apply) id = 677037 - kind = "" -> null ~ last_complete = "2025-04-15T14:03:29Z" -> (known after apply) + last_error = (known after apply) name = "HTTP-requests-kitchensink" ~ output_options = { + cve_2021_44228 = false # (7 unchanged attributes hidden) } # (7 unchanged attributes hidden) }

Steps to reproduce

  1. Provision a logpush job without a kind attribute
  2. Configure output_options
  3. Apply configuration
  4. terraform plan

Additional factoids

No response

References

No response

joshuamsager avatar May 13 '25 14:05 joshuamsager

I've opened an internal issue to track the investigation on this.

jhutchings1 avatar May 13 '25 17:05 jhutchings1

I have this issue also. Please keep us posted @jhutchings1

anordby avatar May 19 '25 13:05 anordby

Still broken in v5.5.0

joshuamsager avatar May 20 '25 15:05 joshuamsager

Still an issue with v5.6.0 for info (ref. https://github.com/jenkins-infra/cloudflare/pull/60)

dduportal avatar Jun 18 '25 15:06 dduportal

The team believed this was fixed in v5.5.0. I have reactivated the internal issue and pinged engineering to take another look.

jhutchings1 avatar Jun 19 '25 00:06 jhutchings1

The team believed this was fixed in v5.5.0. I have reactivated the internal issue and pinged engineering to take another look.

Thanks! If you need any tests we are happy to try (since most of the Jenkins infrastructure code is public and Cloudflare sponsors us).

dduportal avatar Jun 19 '25 06:06 dduportal

This is still happening in v5.7.0

kmbzdyk avatar Jul 15 '25 07:07 kmbzdyk

this issue https://github.com/cloudflare/terraform-provider-cloudflare/issues/5766 now is blocking us from reproducing this issue on v5.7.0

mojanjz avatar Jul 17 '25 15:07 mojanjz

Update: I found out that the workaround for this is to remove the resource from UI and let terraform recreate it. I do use deprecated 'logpull_options' property instead of 'output_options' tho

kmbzdyk avatar Jul 18 '25 08:07 kmbzdyk

This is still a problem in provider version 5.7.1. I am using output_options and don't want to use deprecated logpull_options.

Tried tainting and removing logpush in Cloudflare UI to recreate logpush resources. That works ok but the freshly created logpush resources still gives a recurring change

Image

anordby avatar Jul 21 '25 13:07 anordby

Same issue with v5.7.1 Terraform v1.12.2

MG-Nix avatar Jul 31 '25 12:07 MG-Nix

This has been release in 5.8.2

rupalims avatar Aug 01 '25 23:08 rupalims

Just tested this with 5.8.2 and there is still drift with error_message, last_complete, last_error, output_options.sample_rate

jamie-oconnell avatar Aug 02 '25 02:08 jamie-oconnell

This was solved in 5.8.2 for me

anordby avatar Aug 05 '25 13:08 anordby

Just tested this with 5.8.2 and there is still drift with error_message, last_complete, last_error, output_options.sample_rate

@jamie-oconnell do you mind opening a new issue with your repro? We're not able to reproduce what you're mentioning, so this will help us get to the bottom of it. Thanks!

jhutchings1 avatar Aug 05 '25 23:08 jhutchings1

@jamie-oconnell, It happened to me that I had explicitly added output_options.sample_rate = 0 in an attempt to solve the perpetual issue. After upgrading the version and removing this line, the issue is now gone. Check if this is the case for you

egarbi avatar Aug 28 '25 10:08 egarbi