Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
101 changes: 101 additions & 0 deletions integration/v4_to_v5/testdata/logpush_job/expected/logpush_job.tf
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&timestamps=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 integration/v4_to_v5/testdata/logpush_job/expected/terraform.tfstate
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&timestamps=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 integration/v4_to_v5/testdata/logpush_job/input/logpush_job.tf
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&timestamps=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"
}
}
Loading