Skip to content

feat(logpush_job): v4 to v5 migrations #16

Merged
ssicard merged 12 commits intomainfrom
ssicard/logpush-job
Nov 26, 2025
Merged

feat(logpush_job): v4 to v5 migrations #16
ssicard merged 12 commits intomainfrom
ssicard/logpush-job

Conversation

@ssicard
Copy link
Collaborator

@ssicard ssicard commented Nov 5, 2025

  1. Supports migrations of the logpush_job resource from v4 to v5. Will migrate the following:
  • rename attribute in output_options of cve20214428 to cve_2021_44228
  • any kind of "instant-logs" is no longer supported. It now transforms into ""
  • max_upload_bytes, max_upload_records, and max_upload_interval_seconds all convert from an int to Float64
  • convert output_options from block to attribute
  1. Moves the function for nulling out empty values from zero_trust_device_posture_rule to a helper for use across various resources.

Assertions Made

The following assertions were made within this implementation:

  • max_upload_bytes, max_upload_records, and max_upload_interval_seconds had default values of 0 in v4. This is not a valid value for any of these fields, so the tool will delete these fields to null them out to match v5 state.
  • The defaults for output_options in v4 are retained as the tool migrates to v5. They will now be explicitly set in customer's config and state after migration.
  • empty string defaults are nulled out to match v5 state and avoid drift

End to End Tests

The output of the end to end tests are seen below. There are two drifts, which are expected, as they are a result of kind allowing less values in v5 than in v4 for instant-logs.

Running terraform plan in v5/...
⚠ Terraform plan shows changes
  Plan: 0 to add, 2 to change, 0 to destroy.

Detailed changes:

  # module.logpush_job.cloudflare_logpush_job.full will be updated in-place
  ~ resource "cloudflare_logpush_job" "full" {
      + error_message    = (known after apply)
        id               = 1300622
      ~ kind             = "instant-logs" -> ""
      + last_complete    = (known after apply)
      + last_error       = (known after apply)
        name             = "my-logpush-job"
        # (6 unchanged attributes hidden)

  # module.logpush_job.cloudflare_logpush_job.instant_logs will be updated in-place
  ~ resource "cloudflare_logpush_job" "instant_logs" {
      + error_message    = (known after apply)
        id               = 1300615
      ~ kind             = "instant-logs" -> ""
      + last_complete    = (known after apply)
      + last_error       = (known after apply)
        # (5 unchanged attributes hidden)

vaishakdinesh
vaishakdinesh previously approved these changes Nov 7, 2025
@ssicard ssicard marked this pull request as draft November 11, 2025 20:26
@ssicard ssicard marked this pull request as ready for review November 12, 2025 16:58
SirCortly
SirCortly previously approved these changes Nov 12, 2025
@ssicard ssicard dismissed vaishakdinesh’s stale review November 12, 2025 17:13

This is a stale review, and substantial changes have been added since regarding:

  • explicitly setting v4 defaults in the v5 config and state
  • removing any kind set to "instant-logs" as the v5 default will set it to ""
@tamas-jozsa
Copy link
Collaborator

Could you rebase + improve the comprehensiveness of the integration testdata using prompt:subtask_08?

@SirCortly SirCortly self-requested a review November 17, 2025 18:26
@ssicard ssicard force-pushed the ssicard/logpush-job branch from 9c1a2db to 893a7a8 Compare November 21, 2025 15:27
@ssicard ssicard dismissed SirCortly’s stale review November 24, 2025 16:53

This review is stale.

SirCortly
SirCortly previously approved these changes Nov 24, 2025
@ssicard ssicard changed the title feat: v4 to v5 migrations - logpush_job feat(logpush_job): v4 to v5 migrations Nov 25, 2025
@ssicard ssicard force-pushed the ssicard/logpush-job branch from 52ac48f to debc9a0 Compare November 25, 2025 20:05
@ssicard
Copy link
Collaborator Author

ssicard commented Nov 26, 2025

Note: the integration/e2e tests that tested instant-logs being removed from the config/state were removed after testing. A change was made in the resource.go in the provider to ignore any updates to this value, but as that is not available until a new version of the provider comes out, this test has been removed.

@ssicard ssicard force-pushed the ssicard/logpush-job branch from 6850f3c to f228a54 Compare November 26, 2025 16:02
@ssicard ssicard force-pushed the ssicard/logpush-job branch from 42a7e07 to 78ffdc3 Compare November 26, 2025 19:37
@ssicard ssicard dismissed SirCortly’s stale review November 26, 2025 20:26

Some changes have been made to tests since last review

@ssicard ssicard merged commit 2c44d36 into main Nov 26, 2025
13 of 15 checks passed
@ssicard ssicard deleted the ssicard/logpush-job branch November 26, 2025 21:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants