Skip to content
Open
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
96 changes: 96 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,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&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"
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 integration/v4_to_v5/testdata/logpush_job/expected/terraform.tfstate
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&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",
"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 integration/v4_to_v5/testdata/logpush_job/input/logpush_job.tf
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&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 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"
}
}
Loading
Loading