-
Notifications
You must be signed in to change notification settings - Fork 2
feat(logpush_job): v4 to v5 migrations #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
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
07d45c3
initial code changes after Claude ran
ssicard 5e15a52
account for kind changes and v4 defaults after running provider tests
ssicard d615ca4
ensure http_requests (zone level) and audit_logs (account level) are …
ssicard 06ef942
remove 0 deletion from max_upload_* values
ssicard a3827e0
remove references to 0 deletion
ssicard cb89364
first pass on e2e tests
ssicard 125a319
update logpush to delete instant-logs for kind
ssicard eeb7497
update logpush with new function signatures
ssicard e64cde4
v4 empty string and zero val to null defaults
ssicard 2b364c0
add false default for cve option
ssicard e3c8a2f
remove logpush_job e2e test for instant-logs
ssicard 78ffdc3
update zone level resource to use appropriate dataset
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
101 changes: 101 additions & 0 deletions
101
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,101 @@ | ||
| variable "cloudflare_account_id" { | ||
| description = "Cloudflare account ID" | ||
| type = string | ||
| } | ||
|
|
||
| variable "cloudflare_zone_id" { | ||
| description = "Cloudflare zone ID" | ||
| type = string | ||
| } | ||
|
|
||
| # 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" | ||
| cve_2021_44228 = false | ||
| 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 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" "empty_kind" { | ||
| 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 = "edge" | ||
| 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" | ||
| } | ||
| } | ||
177 changes: 177 additions & 0 deletions
177
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,177 @@ | ||
| { | ||
| "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": "audit_logs", | ||
| "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", | ||
| "cve_2021_44228": false, | ||
| "field_delimiter": ",", | ||
| "record_prefix": "{", | ||
| "record_suffix": "}\n", | ||
| "timestamp_format": "unixnano", | ||
| "sample_rate": 1 | ||
| } | ||
| } | ||
| } | ||
| ] | ||
| }, | ||
| { | ||
| "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 | ||
| } | ||
| } | ||
| } | ||
| ] | ||
| }, | ||
| { | ||
| "mode": "managed", | ||
| "type": "cloudflare_logpush_job", | ||
| "name": "empty_kind", | ||
| "provider": "provider[\"registry.terraform.io/cloudflare/cloudflare\"]", | ||
| "instances": [ | ||
| { | ||
| "schema_version": 0, | ||
| "attributes": { | ||
| "id": "5", | ||
| "zone_id": "0da42c8d2132a9ddaf714f9e7c920711", | ||
| "dataset": "http_requests", | ||
| "destination_conf": "https://logpush-receiver.sd.cfplat.com", | ||
| "enabled": true, | ||
| "kind": "" | ||
| } | ||
| } | ||
| ] | ||
| }, | ||
| { | ||
| "mode": "managed", | ||
| "type": "cloudflare_logpush_job", | ||
| "name": "edge_logs", | ||
| "provider": "provider[\"registry.terraform.io/cloudflare/cloudflare\"]", | ||
| "instances": [ | ||
| { | ||
| "schema_version": 0, | ||
| "attributes": { | ||
| "id": "6", | ||
| "zone_id": "0da42c8d2132a9ddaf714f9e7c920711", | ||
| "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", | ||
| "zone_id": "0da42c8d2132a9ddaf714f9e7c920711", | ||
| "dataset": "http_requests", | ||
| "destination_conf": "https://logpush-receiver.sd.cfplat.com", | ||
| "enabled": true, | ||
| "kind": "edge", | ||
| "name": "my-logpush-job", | ||
| "frequency": "high", | ||
| "max_upload_bytes": 5000000, | ||
| "max_upload_records": 1000, | ||
| "max_upload_interval_seconds": 30, | ||
| "output_options": { | ||
| "cve_2021_44228": true, | ||
| "batch_prefix": "{", | ||
| "batch_suffix": "}", | ||
| "field_names": ["ClientIP", "EdgeStartTimestamp", "RayID"], | ||
| "output_type": "ndjson", | ||
| "sample_rate": 1, | ||
| "timestamp_format": "unixnano", | ||
| "field_delimiter": ",", | ||
| "record_prefix": "{", | ||
| "record_suffix": "}\n" | ||
| } | ||
| } | ||
| } | ||
| ] | ||
| } | ||
| ] | ||
| } |
87 changes: 87 additions & 0 deletions
87
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,87 @@ | ||
| variable "cloudflare_account_id" { | ||
| description = "Cloudflare account ID" | ||
| type = string | ||
| } | ||
|
|
||
| variable "cloudflare_zone_id" { | ||
| description = "Cloudflare zone ID" | ||
| type = string | ||
| } | ||
|
|
||
| # 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 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" "empty_kind" { | ||
| 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 = "edge" | ||
| 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.
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.