From 6ce0a755bca6dd6ca741f1da01dd257beeea2a6b Mon Sep 17 00:00:00 2001 From: James Golovich Date: Wed, 29 May 2024 22:30:04 -0700 Subject: [PATCH 1/3] Mirror API record_delimiter defaults According to https://developers.cloudflare.com/logs/reference/log-output-options/ the default options for record_suffix are "}\n" and not "}" The defaults cause malformed JSON when there is more than a single record in a time interval. Perhaps a better default would be to set record_delimiter to "\n" and keep field_delimiter "}" but this change is intended to mirror the published documentation --- internal/sdkv2provider/schema_cloudflare_logpush_job.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/sdkv2provider/schema_cloudflare_logpush_job.go b/internal/sdkv2provider/schema_cloudflare_logpush_job.go index c0ff60b8a8..358377e133 100644 --- a/internal/sdkv2provider/schema_cloudflare_logpush_job.go +++ b/internal/sdkv2provider/schema_cloudflare_logpush_job.go @@ -175,7 +175,7 @@ func resourceCloudflareLogpushJobSchema() map[string]*schema.Schema { "record_suffix": { Type: schema.TypeString, Optional: true, - Default: "}", + Default: "}\n", Description: "String to be appended after each record", }, "record_template": { From 8f9777bc5c71156c38b498f55b578d534f8fb1de Mon Sep 17 00:00:00 2001 From: James Golovich Date: Wed, 29 May 2024 22:44:47 -0700 Subject: [PATCH 2/3] Add changelog for cloudflare_logpush_job record_suffix --- .changelog/3334.txt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .changelog/3334.txt diff --git a/.changelog/3334.txt b/.changelog/3334.txt new file mode 100644 index 0000000000..29a2fdfbef --- /dev/null +++ b/.changelog/3334.txt @@ -0,0 +1,3 @@ +```release-note:bug +resource/cloudflare_logpush_job: Mirror API defaults for record_delimiter to include newline +``` From 91b1fdc9a256eb07802e35060b489918a191c8bf Mon Sep 17 00:00:00 2001 From: Jacob Bednarz Date: Fri, 31 May 2024 11:30:08 +1000 Subject: [PATCH 3/3] `make docs` --- docs/resources/logpush_job.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/resources/logpush_job.md b/docs/resources/logpush_job.md index a34d82d602..9269dd4bd2 100644 --- a/docs/resources/logpush_job.md +++ b/docs/resources/logpush_job.md @@ -147,7 +147,8 @@ Optional: - `output_type` (String) Specifies the output type. Available values: `ndjson`, `csv`. Defaults to `ndjson`. - `record_delimiter` (String) String to be inserted in-between the records as separator. - `record_prefix` (String) String to be prepended before each record. Defaults to `{`. -- `record_suffix` (String) String to be appended after each record. Defaults to `}`. +- `record_suffix` (String) String to be appended after each record. Defaults to `} +`. - `record_template` (String) String to use as template for each record instead of the default comma-separated list. - `sample_rate` (Number) Specifies the sampling rate. Defaults to `1`. - `timestamp_format` (String) Specifies the format for timestamps. Available values: `unixnano`, `unix`, `rfc3339`. Defaults to `unixnano`.