-
Notifications
You must be signed in to change notification settings - Fork 1
feat: v4 to v5 migrations - logpush_job #16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ssicard
wants to merge
8
commits into
main
Choose a base branch
from
ssicard/logpush-job
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
5a63bd9
initial code changes after Claude ran
ssicard 0351723
account for kind changes and v4 defaults after running provider tests
ssicard 480212b
ensure http_requests (zone level) and audit_logs (account level) are …
ssicard 0080891
remove 0 deletion from max_upload_* values
ssicard bcffa5b
remove references to 0 deletion
ssicard 8aa058c
first pass on e2e tests
ssicard 893a7a8
update logpush to delete instant-logs for kind
ssicard 9c317a4
update logpush with new function signatures
ssicard File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
96 changes: 96 additions & 0 deletions
96
integration/v4_to_v5/testdata/logpush_job/expected/logpush_job.tf
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,96 @@ | ||
| # Minimal logpush job | ||
| resource "cloudflare_logpush_job" "minimal" { | ||
| account_id = var.cloudflare_account_id | ||
| dataset = "audit_logs" | ||
| destination_conf = "https://logpush-receiver.sd.cfplat.com" | ||
| } | ||
|
|
||
| # Job with logpull_options only (no output_options) | ||
| resource "cloudflare_logpush_job" "with_logpull_options" { | ||
| account_id = var.cloudflare_account_id | ||
| dataset = "audit_logs" | ||
| destination_conf = "https://logpush-receiver.sd.cfplat.com" | ||
| logpull_options = "fields=ClientIP,EdgeStartTimestamp×tamps=unixnano" | ||
| } | ||
|
|
||
| # Job with output_options block | ||
| resource "cloudflare_logpush_job" "with_output_options" { | ||
| account_id = var.cloudflare_account_id | ||
| dataset = "audit_logs" | ||
| destination_conf = "https://logpush-receiver.sd.cfplat.com" | ||
|
|
||
| output_options = { | ||
| batch_prefix = "{" | ||
| batch_suffix = "}" | ||
| field_names = ["ClientIP", "EdgeStartTimestamp"] | ||
| output_type = "ndjson" | ||
| field_delimiter = "," | ||
| record_prefix = "{" | ||
| record_suffix = "}\n" | ||
| timestamp_format = "unixnano" | ||
| sample_rate = 1 | ||
| } | ||
| } | ||
|
|
||
| # Job with cve20214428 field (should be renamed) | ||
| resource "cloudflare_logpush_job" "with_cve_field" { | ||
| account_id = var.cloudflare_account_id | ||
| dataset = "audit_logs" | ||
| destination_conf = "https://logpush-receiver.sd.cfplat.com" | ||
|
|
||
| output_options = { | ||
| output_type = "ndjson" | ||
| cve_2021_44228 = true | ||
| field_delimiter = "," | ||
| record_prefix = "{" | ||
| record_suffix = "}\n" | ||
| timestamp_format = "unixnano" | ||
| sample_rate = 1 | ||
| } | ||
| } | ||
|
|
||
| # Job with instant-logs kind (should be removed) | ||
| resource "cloudflare_logpush_job" "instant_logs" { | ||
| zone_id = var.cloudflare_zone_id | ||
| dataset = "http_requests" | ||
| destination_conf = "https://logpush-receiver.sd.cfplat.com" | ||
| } | ||
|
|
||
| # Job with edge kind (should be preserved) | ||
| resource "cloudflare_logpush_job" "edge_logs" { | ||
| zone_id = var.cloudflare_zone_id | ||
| dataset = "http_requests" | ||
| destination_conf = "https://logpush-receiver.sd.cfplat.com" | ||
| kind = "edge" | ||
| } | ||
|
|
||
| # Job with "" kind (should be preserved) | ||
| resource "cloudflare_logpush_job" "edge_logs" { | ||
| zone_id = var.cloudflare_zone_id | ||
| dataset = "http_requests" | ||
| destination_conf = "https://logpush-receiver.sd.cfplat.com" | ||
| kind = "" | ||
| } | ||
|
|
||
| # Full featured job with all transformations | ||
| resource "cloudflare_logpush_job" "full" { | ||
| zone_id = var.cloudflare_zone_id | ||
| dataset = "http_requests" | ||
| destination_conf = "https://logpush-receiver.sd.cfplat.com" | ||
| enabled = true | ||
| name = "my-logpush-job" | ||
| frequency = "high" | ||
|
|
||
| output_options = { | ||
| batch_prefix = "{" | ||
| batch_suffix = "}" | ||
| field_names = ["ClientIP", "EdgeStartTimestamp", "RayID"] | ||
| output_type = "ndjson" | ||
| sample_rate = 1.0 | ||
| timestamp_format = "unixnano" | ||
| cve_2021_44228 = true | ||
| field_delimiter = "," | ||
| record_prefix = "{" | ||
| record_suffix = "}\n" | ||
| } | ||
| } | ||
174 changes: 174 additions & 0 deletions
174
integration/v4_to_v5/testdata/logpush_job/expected/terraform.tfstate
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,174 @@ | ||
| { | ||
| "version": 4, | ||
| "terraform_version": "1.5.0", | ||
| "serial": 1, | ||
| "lineage": "test-logpush-job-lineage", | ||
| "outputs": {}, | ||
| "resources": [ | ||
| { | ||
| "mode": "managed", | ||
| "type": "cloudflare_logpush_job", | ||
| "name": "minimal", | ||
| "provider": "provider[\"registry.terraform.io/cloudflare/cloudflare\"]", | ||
| "instances": [ | ||
| { | ||
| "schema_version": 0, | ||
| "attributes": { | ||
| "id": "1", | ||
| "account_id": "f037e56e89293a057740de681ac9abbe", | ||
| "dataset": "http_requests", | ||
| "destination_conf": "https://logpush-receiver.sd.cfplat.com", | ||
| "enabled": true | ||
| } | ||
| } | ||
| ] | ||
| }, | ||
| { | ||
| "mode": "managed", | ||
| "type": "cloudflare_logpush_job", | ||
| "name": "with_logpull_options", | ||
| "provider": "provider[\"registry.terraform.io/cloudflare/cloudflare\"]", | ||
| "instances": [ | ||
| { | ||
| "schema_version": 0, | ||
| "attributes": { | ||
| "id": "2", | ||
| "account_id": "f037e56e89293a057740de681ac9abbe", | ||
| "dataset": "http_requests", | ||
| "destination_conf": "https://logpush-receiver.sd.cfplat.com", | ||
| "enabled": true, | ||
| "logpull_options": "fields=ClientIP,EdgeStartTimestamp×tamps=unixnano" | ||
| } | ||
| } | ||
| ] | ||
| }, | ||
| { | ||
| "mode": "managed", | ||
| "type": "cloudflare_logpush_job", | ||
| "name": "with_output_options", | ||
| "provider": "provider[\"registry.terraform.io/cloudflare/cloudflare\"]", | ||
| "instances": [ | ||
| { | ||
| "schema_version": 0, | ||
| "attributes": { | ||
| "id": "3", | ||
| "account_id": "f037e56e89293a057740de681ac9abbe", | ||
| "dataset": "http_requests", | ||
| "destination_conf": "https://logpush-receiver.sd.cfplat.com", | ||
| "enabled": true, | ||
| "output_options": { | ||
| "batch_prefix": "{", | ||
| "batch_suffix": "}", | ||
| "field_names": ["ClientIP", "EdgeStartTimestamp"], | ||
| "output_type": "ndjson", | ||
| "field_delimiter": ",", | ||
| "record_prefix": "{", | ||
| "record_suffix": "}\n", | ||
| "timestamp_format": "unixnano", | ||
| "sample_rate": 1.0 | ||
| } | ||
| } | ||
| } | ||
| ] | ||
| }, | ||
| { | ||
| "mode": "managed", | ||
| "type": "cloudflare_logpush_job", | ||
| "name": "with_cve_field", | ||
| "provider": "provider[\"registry.terraform.io/cloudflare/cloudflare\"]", | ||
| "instances": [ | ||
| { | ||
| "schema_version": 0, | ||
| "attributes": { | ||
| "id": "4", | ||
| "account_id": "f037e56e89293a057740de681ac9abbe", | ||
| "dataset": "http_requests", | ||
| "destination_conf": "https://logpush-receiver.sd.cfplat.com", | ||
| "enabled": true, | ||
| "output_options": { | ||
| "cve_2021_44228": true, | ||
| "output_type": "ndjson", | ||
| "field_delimiter": ",", | ||
| "record_prefix": "{", | ||
| "record_suffix": "}\n", | ||
| "timestamp_format": "unixnano", | ||
| "sample_rate": 1.0 | ||
| } | ||
| } | ||
| } | ||
| ] | ||
| }, | ||
| { | ||
| "mode": "managed", | ||
| "type": "cloudflare_logpush_job", | ||
| "name": "instant_logs", | ||
| "provider": "provider[\"registry.terraform.io/cloudflare/cloudflare\"]", | ||
| "instances": [ | ||
| { | ||
| "schema_version": 0, | ||
| "attributes": { | ||
| "id": "5", | ||
| "account_id": "f037e56e89293a057740de681ac9abbe", | ||
| "dataset": "http_requests", | ||
| "destination_conf": "https://logpush-receiver.sd.cfplat.com", | ||
| "enabled": true | ||
| } | ||
| } | ||
| ] | ||
| }, | ||
| { | ||
| "mode": "managed", | ||
| "type": "cloudflare_logpush_job", | ||
| "name": "edge_logs", | ||
| "provider": "provider[\"registry.terraform.io/cloudflare/cloudflare\"]", | ||
| "instances": [ | ||
| { | ||
| "schema_version": 0, | ||
| "attributes": { | ||
| "id": "6", | ||
| "account_id": "f037e56e89293a057740de681ac9abbe", | ||
| "dataset": "http_requests", | ||
| "destination_conf": "https://logpush-receiver.sd.cfplat.com", | ||
| "enabled": true, | ||
| "kind": "edge" | ||
| } | ||
| } | ||
| ] | ||
| }, | ||
| { | ||
| "mode": "managed", | ||
| "type": "cloudflare_logpush_job", | ||
| "name": "full", | ||
| "provider": "provider[\"registry.terraform.io/cloudflare/cloudflare\"]", | ||
| "instances": [ | ||
| { | ||
| "schema_version": 0, | ||
| "attributes": { | ||
| "id": "7", | ||
| "account_id": "f037e56e89293a057740de681ac9abbe", | ||
| "dataset": "http_requests", | ||
| "destination_conf": "https://logpush-receiver.sd.cfplat.com", | ||
| "enabled": true, | ||
| "name": "my-logpush-job", | ||
| "frequency": "high", | ||
| "max_upload_bytes": 5000000.0, | ||
| "max_upload_records": 1000.0, | ||
| "max_upload_interval_seconds": 30.0, | ||
| "output_options": { | ||
| "cve_2021_44228": true, | ||
| "batch_prefix": "{", | ||
| "batch_suffix": "}", | ||
| "field_names": ["ClientIP", "EdgeStartTimestamp", "RayID"], | ||
| "output_type": "ndjson", | ||
| "sample_rate": 1.0, | ||
| "timestamp_format": "unixnano", | ||
| "field_delimiter": ",", | ||
| "record_prefix": "{", | ||
| "record_suffix": "}\n" | ||
| } | ||
| } | ||
| } | ||
| ] | ||
| } | ||
| ] | ||
| } |
85 changes: 85 additions & 0 deletions
85
integration/v4_to_v5/testdata/logpush_job/input/logpush_job.tf
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,85 @@ | ||
| # Minimal logpush job | ||
| resource "cloudflare_logpush_job" "minimal" { | ||
| account_id = var.cloudflare_account_id | ||
| dataset = "audit_logs" | ||
| destination_conf = "https://logpush-receiver.sd.cfplat.com" | ||
| } | ||
|
|
||
| # Job with logpull_options only (no output_options) | ||
| resource "cloudflare_logpush_job" "with_logpull_options" { | ||
| account_id = var.cloudflare_account_id | ||
| dataset = "audit_logs" | ||
| destination_conf = "https://logpush-receiver.sd.cfplat.com" | ||
| logpull_options = "fields=ClientIP,EdgeStartTimestamp×tamps=unixnano" | ||
| } | ||
|
|
||
| # Job with output_options block | ||
| resource "cloudflare_logpush_job" "with_output_options" { | ||
| account_id = var.cloudflare_account_id | ||
| dataset = "audit_logs" | ||
| destination_conf = "https://logpush-receiver.sd.cfplat.com" | ||
|
|
||
| output_options { | ||
| batch_prefix = "{" | ||
| batch_suffix = "}" | ||
| field_names = ["ClientIP", "EdgeStartTimestamp"] | ||
| output_type = "ndjson" | ||
| } | ||
| } | ||
|
|
||
| # Job with cve20214428 field (should be renamed) | ||
| resource "cloudflare_logpush_job" "with_cve_field" { | ||
| account_id = var.cloudflare_account_id | ||
| dataset = "audit_logs" | ||
| destination_conf = "https://logpush-receiver.sd.cfplat.com" | ||
|
|
||
| output_options { | ||
| cve20214428 = true | ||
| output_type = "ndjson" | ||
| } | ||
| } | ||
|
|
||
| # Job with instant-logs kind (should be removed) | ||
| resource "cloudflare_logpush_job" "instant_logs" { | ||
| zone_id = var.cloudflare_zone_id | ||
| dataset = "http_requests" | ||
| destination_conf = "https://logpush-receiver.sd.cfplat.com" | ||
| kind = "instant-logs" | ||
| } | ||
|
|
||
| # Job with edge kind (should be preserved) | ||
| resource "cloudflare_logpush_job" "edge_logs" { | ||
| zone_id = var.cloudflare_zone_id | ||
| dataset = "http_requests" | ||
| destination_conf = "https://logpush-receiver.sd.cfplat.com" | ||
| kind = "edge" | ||
| } | ||
|
|
||
| # Job with "" kind (should be preserved) | ||
| resource "cloudflare_logpush_job" "edge_logs" { | ||
| zone_id = var.cloudflare_zone_id | ||
| dataset = "http_requests" | ||
| destination_conf = "https://logpush-receiver.sd.cfplat.com" | ||
| kind = "" | ||
| } | ||
|
|
||
| # Full featured job with all transformations | ||
| resource "cloudflare_logpush_job" "full" { | ||
| zone_id = var.cloudflare_zone_id | ||
| dataset = "http_requests" | ||
| destination_conf = "https://logpush-receiver.sd.cfplat.com" | ||
| kind = "instant-logs" | ||
| enabled = true | ||
| name = "my-logpush-job" | ||
| frequency = "high" | ||
|
|
||
| output_options { | ||
| cve20214428 = true | ||
| batch_prefix = "{" | ||
| batch_suffix = "}" | ||
| field_names = ["ClientIP", "EdgeStartTimestamp", "RayID"] | ||
| output_type = "ndjson" | ||
| sample_rate = 1.0 | ||
| timestamp_format = "unixnano" | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.