I’m receiving a cryptic error in terraform when trying to apply using this config. The logpush job was created via the UI and has been imported, but when trying to apply I get the following error:
Error: error parsing logpush job from resource: Key is missing
with module.cf_dns_zones.cloudflare_logpush_job.datadog_http_requests
on …/…/modules/cf_dns_zones/logpush.tf line 1, in resource “cloudflare_logpush_job” “datadog_http_requests”:
This doesn’t make much sense to me, the dd_api_key variable is definitely set since it’s not nullable AND has a default value.
resource "cloudflare_logpush_job" "datadog_http_requests" {
enabled = true
zone_id = var.zone_id
name = "168446"
dataset = "http_requests"
filter = "{\"key\":\"ClientCountry\",\"operator\":\"!eq\",\"value\":\"us\"}"
destination_conf = "datadog://http-intake.logs.us5.datadoghq.com/api/v2/logs?ddsource=cloudflare&ddtags=env:prod,source:cloudflare&service=cloudflare&header_DD-API-KEY=${var.dd_api_key}"
logpull_options = "fields=ClientIP,ClientRequestHost,ClientRequestMethod,ClientRequestURI,EdgeEndTimestamp,EdgeResponseBytes,EdgeResponseStatus,EdgeStartTimestamp,RayID,BotScore,CacheCacheStatus,ClientCountry,ClientDeviceType,ClientRegionCode,ClientRequestPath,EdgeColoCode,EdgeTimeToFirstByteMs,OriginResponseDurationMs,OriginResponseStatus×tamps=rfc3339"
}
This is something that I would raise on the [terraform repo ](GitHub - cloudflare/terraform-provider-cloudflare: Cloudflare Terraform Provider ) and make sure to include the debug logs for it.
Never mind it seems you already have here though the debug log very light
opened 07:33PM - 24 Jan 23 UTC
kind/bug
triage/needs-information
### Confirmation
- [X] My issue isn't already found on the issue tracker.
- [X]… I have replicated my issue using the latest version of the provider and it is still present.
### Terraform and Cloudflare provider version
Terraform v1.3.2
on darwin_amd64
+ provider registry.terraform.io/cloudflare/cloudflare v3.31.0
### Affected resource(s)
cloudflare_logpush_job
### Terraform configuration files
```hcl
resource "cloudflare_logpush_job" "datadog_http_requests" {
enabled = true
zone_id = var.zone_id
name = "datadog-http-requests"
logpull_options = "fields=BotScore,CacheCacheStatus,ClientCountry,ClientDeviceType,ClientIP,ClientRegionCode,ClientRequestHost,ClientRequestMethod,ClientRequestPath,ClientRequestURI,ClientRequestUserAgent,EdgeResponseStatus,EdgeStartTimestamp×tamps=rfc3339,EdgeTimeToFirstByteMs,OriginResponseDurationMs,OriginResponseStatus,ZoneName"
destination_conf = "datadog://http-intake.logs.us5.datadoghq.com/api/v2/logs?header_DD-API-KEY=${var.dd_api_key}&ddsource=cloudflare&service=cloudflare&ddtags=env:prod"
dataset = "http_requests"
filter = "{\"key\":\"ClientCountry\",\"operator\":\"!eq\",\"value\":\"us\"}"
}
```
### Link to debug output
https://gist.github.com/samvanryssegem-qz/961e442c6907096595fe8af5df41a877
### Panic output
_No response_
### Expected output
The logpush job to be created
### Actual output
My terraform cloud run ended with the following error.
`Error: error parsing logpush job from resource: Key is missing
`
### Steps to reproduce
1.) Create terraform and run in tf cloud
### Additional factoids
I've double-checked and my api key variable is set. Maybe I'm setting up the destination incorrectly?
### References
_No response_