Skip to content
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

Automated Logpush challenge not working #1019

Closed
simpsora opened this issue Apr 9, 2021 · 12 comments · Fixed by #1024
Closed

Automated Logpush challenge not working #1019

simpsora opened this issue Apr 9, 2021 · 12 comments · Fixed by #1024
Labels
kind/documentation Categorizes issue or PR as related to documentation. triage/accepted Indicates an issue or PR is ready to be actively worked on.

Comments

@simpsora
Copy link
Contributor

simpsora commented Apr 9, 2021

Confirmation

My issue isn't already found on the issue tracker.
I have replicated my issue using the latest version of the provider and it is still present.

Terraform version

Terraform version: 0.14.9
Cloudflare provider version: 2.19.2

Affected resource(s)

cloudflare_logpush_ownership_challenge
cloudflare_logpush_job
aws_s3_bucket_object

Terraform configuration files

resource "cloudflare_logpush_ownership_challenge" "challenge" {
  zone_id          = var.cloudflare_zone_id
  destination_conf = "s3://${var.logpush_bucket_name}/${local.zone_name}?region=${var.logpush_bucket_region}"
}

data "aws_s3_bucket_object" "challenge_file" {
  bucket = var.logpush_bucket_name
  key    = cloudflare_logpush_ownership_challenge.challenge.ownership_challenge_filename
}

resource "cloudflare_logpush_job" "http_requests_job" {
  enabled             = true
  zone_id             = var.cloudflare_zone_id
  name                = local.zone_name
  logpull_options     = "fields=${join(",", var.logpush_fields)}&timestamps=rfc3339"
  destination_conf    = "s3://${var.logpush_bucket_name}/${local.zone_name}/{DATE}?region=${var.logpush_bucket_region}"
  ownership_challenge = data.aws_s3_bucket_object.challenge_file.body
  dataset             = "http_requests"
}

Debug output

$ TF_LOG=DEBUG terraform apply
2021/04/09 15:14:34 [WARN] Log levels other than TRACE are currently unreliable, and are supported only for backward compatibility.
  Use TF_LOG=TRACE to see Terraform's internal logs.
  ----
2021/04/09 15:14:34 [INFO] Terraform version: 0.14.9
2021/04/09 15:14:34 [INFO] Go runtime version: go1.15.6
2021/04/09 15:14:34 [INFO] CLI args: []string{"/usr/local/Cellar/tfenv/2.2.0/versions/0.14.9/terraform", "apply"}
2021/04/09 15:14:34 [DEBUG] Attempting to open CLI config file: /Users/rosssimpson/.terraformrc
2021/04/09 15:14:34 Loading CLI configuration from /Users/rosssimpson/.terraformrc
2021/04/09 15:14:34 [DEBUG] ignoring non-existing provider search directory terraform.d/plugins
2021/04/09 15:14:34 [DEBUG] ignoring non-existing provider search directory /Users/rosssimpson/.terraform.d/plugins
2021/04/09 15:14:34 [DEBUG] ignoring non-existing provider search directory /Users/rosssimpson/Library/Application Support/io.terraform/plugins
2021/04/09 15:14:34 [DEBUG] ignoring non-existing provider search directory /Library/Application Support/io.terraform/plugins
2021/04/09 15:14:34 [INFO] CLI command args: []string{"apply"}
2021/04/09 15:14:34 [WARN] Log levels other than TRACE are currently unreliable, and are supported only for backward compatibility.
  Use TF_LOG=TRACE to see Terraform's internal logs.
  ----
2021/04/09 15:14:34 [WARN] Log levels other than TRACE are currently unreliable, and are supported only for backward compatibility.
  Use TF_LOG=TRACE to see Terraform's internal logs.
  ----
2021/04/09 15:14:34 [INFO] AWS Auth provider used: "EnvProvider"
2021/04/09 15:14:34 [DEBUG] Trying to get account information via sts:GetCallerIdentity
2021/04/09 15:14:34 [DEBUG] [aws-sdk-go] DEBUG: Request sts/GetCallerIdentity Details:
---[ REQUEST POST-SIGN ]-----------------------------
POST / HTTP/1.1
Host: sts.amazonaws.com
User-Agent: aws-sdk-go/1.37.0 (go1.15.6; darwin; amd64) APN/1.0 HashiCorp/1.0 Terraform/0.14.9
Content-Length: 43
Authorization: AWS4-HMAC-SHA256 Credential=[REDACTED]/20210409/us-east-1/sts/aws4_request, SignedHeaders=content-length;content-type;host;x-amz-date;x-amz-security-token, Signature=[REDACTED]
Content-Type: application/x-www-form-urlencoded; charset=utf-8
X-Amz-Date: 20210409T031434Z
X-Amz-Security-Token: [REDACTED]
Accept-Encoding: gzip

Action=GetCallerIdentity&Version=2011-06-15
-----------------------------------------------------
2021/04/09 15:14:40 [DEBUG] [aws-sdk-go] DEBUG: Response sts/GetCallerIdentity Details:
---[ RESPONSE ]--------------------------------------
HTTP/1.1 200 OK
Connection: close
Content-Length: 459
Content-Type: text/xml
Date: Fri, 09 Apr 2021 03:14:39 GMT
X-Amzn-Requestid: bae8bab4-f1e6-4601-b473-c5d37883b8f7


-----------------------------------------------------
2021/04/09 15:14:40 [DEBUG] [aws-sdk-go] <GetCallerIdentityResponse xmlns="https://sts.amazonaws.com/doc/2011-06-15/">
  <GetCallerIdentityResult>
    <Arn>arn:aws:sts::[ACCOUNT_ID]:assumed-role/cloudformation/1617937947818477000</Arn>
    <UserId>[USER_ID]:1617937947818477000</UserId>
    <Account>[ACCOUNT_ID]</Account>
  </GetCallerIdentityResult>
  <ResponseMetadata>
    <RequestId>bae8bab4-f1e6-4601-b473-c5d37883b8f7</RequestId>
  </ResponseMetadata>
</GetCallerIdentityResponse>
2021/04/09 15:14:40 [DEBUG] checking for provisioner in "."
2021/04/09 15:14:40 [DEBUG] checking for provisioner in "/usr/local/Cellar/tfenv/2.2.0/versions/0.14.9"
2021/04/09 15:14:40 [INFO] Failed to read plugin lock file .terraform/plugins/darwin_amd64/lock.json: open .terraform/plugins/darwin_amd64/lock.json: no such file or directory
2021/04/09 15:14:40 [INFO] backend/local: starting Apply operation
2021/04/09 15:14:40 [DEBUG] [aws-sdk-go] DEBUG: Request s3/ListObjects Details:
---[ REQUEST POST-SIGN ]-----------------------------
GET /?max-keys=1000&prefix=env%3A%2F HTTP/1.1
Host: [STATE_BUCKET].s3.amazonaws.com
User-Agent: aws-sdk-go/1.37.0 (go1.15.6; darwin; amd64) APN/1.0 HashiCorp/1.0 Terraform/0.14.9
Authorization: AWS4-HMAC-SHA256 Credential=[REDACTED]/20210409/us-east-1/s3/aws4_request, SignedHeaders=host;x-amz-content-sha256;x-amz-date;x-amz-security-token, Signature=[REDACTED]
X-Amz-Content-Sha256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
X-Amz-Date: 20210409T031440Z
X-Amz-Security-Token: [REDACTED]
Accept-Encoding: gzip


-----------------------------------------------------
2021/04/09 15:14:41 [DEBUG] [aws-sdk-go] DEBUG: Response s3/ListObjects Details:
---[ RESPONSE ]--------------------------------------
HTTP/1.1 200 OK
Connection: close
Transfer-Encoding: chunked
Content-Type: application/xml
Date: Fri, 09 Apr 2021 03:14:42 GMT
Server: AmazonS3
X-Amz-Bucket-Region: us-east-1
X-Amz-Id-2: vegU0bFywBFD2kKvdCKBObBxwVk70C/h311IL9pkqvQm+XvriVBp/4yN5AidS/zv4IR+nNOwaBc=
X-Amz-Request-Id: E110FHDC84C4EDJJ


-----------------------------------------------------
2021/04/09 15:14:41 [DEBUG] [aws-sdk-go] <?xml version="1.0" encoding="UTF-8"?>
<ListBucketResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/"><Name>[STATE_BUCKET]</Name><Prefix>env:/</Prefix><Marker></Marker><MaxKeys>1000</MaxKeys><IsTruncated>false</IsTruncated></ListBucketResult>
2021/04/09 15:14:41 [DEBUG] [aws-sdk-go] DEBUG: Request s3/GetObject Details:
---[ REQUEST POST-SIGN ]-----------------------------
GET /logpush/[ZONE_NAME].tfstate HTTP/1.1
Host: [STATE_BUCKET].s3.amazonaws.com
User-Agent: aws-sdk-go/1.37.0 (go1.15.6; darwin; amd64) APN/1.0 HashiCorp/1.0 Terraform/0.14.9
Authorization: AWS4-HMAC-SHA256 Credential=[REDACTED]/20210409/us-east-1/s3/aws4_request, SignedHeaders=host;x-amz-content-sha256;x-amz-date;x-amz-security-token, Signature=[REDACTED]
X-Amz-Content-Sha256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
X-Amz-Date: 20210409T031441Z
X-Amz-Security-Token: [REDACTED]
Accept-Encoding: gzip


-----------------------------------------------------
2021/04/09 15:14:42 [DEBUG] [aws-sdk-go] DEBUG: Response s3/GetObject Details:
---[ RESPONSE ]--------------------------------------
HTTP/1.1 200 OK
Connection: close
Content-Length: 157
Accept-Ranges: bytes
Content-Type: application/json
Date: Fri, 09 Apr 2021 03:14:43 GMT
Etag: "eeb97af2c389baf769253ee90cc7f65c"
Last-Modified: Fri, 09 Apr 2021 03:13:44 GMT
Server: AmazonS3
X-Amz-Id-2: HAQjAE1CEL5rJH9XXGCrVb/oJVOkcdZzIDeyf8xougOVwioR69veodSzgMuXI4DD5ApFBzregEE=
X-Amz-Request-Id: 67A5NAD1BHMGKYX1
X-Amz-Version-Id: NYejswgIlmgep.gm5IzzZohCN4Vdpzqx


-----------------------------------------------------
2021/04/09 15:14:42 [DEBUG] [aws-sdk-go]
2021-04-09T15:14:42.469+1200 [INFO]  plugin: configuring client automatic mTLS
2021-04-09T15:14:42.493+1200 [DEBUG] plugin: starting plugin: path=.terraform/providers/registry.terraform.io/cloudflare/cloudflare/2.19.2/darwin_amd64/terraform-provider-cloudflare_v2.19.2 args=[.terraform/providers/registry.terraform.io/cloudflare/cloudflare/2.19.2/darwin_amd64/terraform-provider-cloudflare_v2.19.2]
2021-04-09T15:14:42.655+1200 [DEBUG] plugin: plugin started: path=.terraform/providers/registry.terraform.io/cloudflare/cloudflare/2.19.2/darwin_amd64/terraform-provider-cloudflare_v2.19.2 pid=33068
2021-04-09T15:14:42.655+1200 [DEBUG] plugin: waiting for RPC address: path=.terraform/providers/registry.terraform.io/cloudflare/cloudflare/2.19.2/darwin_amd64/terraform-provider-cloudflare_v2.19.2
2021-04-09T15:14:42.674+1200 [INFO]  plugin.terraform-provider-cloudflare_v2.19.2: configuring server automatic mTLS: timestamp=2021-04-09T15:14:42.674+1200
2021-04-09T15:14:42.709+1200 [DEBUG] plugin: using plugin: version=5
2021-04-09T15:14:42.709+1200 [DEBUG] plugin.terraform-provider-cloudflare_v2.19.2: plugin address: address=/var/folders/hd/_1jqks_53ddd3j41f___mxw40000gn/T/plugin542705651 network=unix timestamp=2021-04-09T15:14:42.709+1200
2021-04-09T15:14:42.766+1200 [WARN]  plugin.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = transport is closing"
2021-04-09T15:14:42.769+1200 [DEBUG] plugin: plugin process exited: path=.terraform/providers/registry.terraform.io/cloudflare/cloudflare/2.19.2/darwin_amd64/terraform-provider-cloudflare_v2.19.2 pid=33068
2021-04-09T15:14:42.769+1200 [DEBUG] plugin: plugin exited
2021-04-09T15:14:42.769+1200 [INFO]  plugin: configuring client automatic mTLS
2021-04-09T15:14:42.798+1200 [DEBUG] plugin: starting plugin: path=.terraform/providers/registry.terraform.io/hashicorp/aws/3.35.0/darwin_amd64/terraform-provider-aws_v3.35.0_x5 args=[.terraform/providers/registry.terraform.io/hashicorp/aws/3.35.0/darwin_amd64/terraform-provider-aws_v3.35.0_x5]
2021-04-09T15:14:44.065+1200 [DEBUG] plugin: plugin started: path=.terraform/providers/registry.terraform.io/hashicorp/aws/3.35.0/darwin_amd64/terraform-provider-aws_v3.35.0_x5 pid=33069
2021-04-09T15:14:44.065+1200 [DEBUG] plugin: waiting for RPC address: path=.terraform/providers/registry.terraform.io/hashicorp/aws/3.35.0/darwin_amd64/terraform-provider-aws_v3.35.0_x5
2021-04-09T15:14:44.102+1200 [INFO]  plugin.terraform-provider-aws_v3.35.0_x5: configuring server automatic mTLS: timestamp=2021-04-09T15:14:44.101+1200
2021-04-09T15:14:44.138+1200 [DEBUG] plugin: using plugin: version=5
2021-04-09T15:14:44.138+1200 [DEBUG] plugin.terraform-provider-aws_v3.35.0_x5: plugin address: address=/var/folders/hd/_1jqks_53ddd3j41f___mxw40000gn/T/plugin555216248 network=unix timestamp=2021-04-09T15:14:44.137+1200
2021-04-09T15:14:44.255+1200 [WARN]  plugin.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = transport is closing"
2021-04-09T15:14:44.259+1200 [DEBUG] plugin: plugin process exited: path=.terraform/providers/registry.terraform.io/hashicorp/aws/3.35.0/darwin_amd64/terraform-provider-aws_v3.35.0_x5 pid=33069
2021-04-09T15:14:44.259+1200 [DEBUG] plugin: plugin exited
2021/04/09 15:14:44 [INFO] terraform: building graph: GraphTypeValidate
2021/04/09 15:14:44 [DEBUG] adding implicit provider configuration provider["registry.terraform.io/hashicorp/aws"], implied first by data.aws_s3_bucket_object.challenge_file
2021/04/09 15:14:44 [DEBUG] ProviderTransformer: "cloudflare_logpush_ownership_challenge.challenge" (*terraform.NodeValidatableResource) needs provider["registry.terraform.io/cloudflare/cloudflare"]
2021/04/09 15:14:44 [DEBUG] ProviderTransformer: "cloudflare_logpush_job.http_requests_job" (*terraform.NodeValidatableResource) needs provider["registry.terraform.io/cloudflare/cloudflare"]
2021/04/09 15:14:44 [DEBUG] ProviderTransformer: "data.aws_s3_bucket_object.challenge_file" (*terraform.NodeValidatableResource) needs provider["registry.terraform.io/hashicorp/aws"]
2021/04/09 15:14:44 [DEBUG] ReferenceTransformer: "data.aws_s3_bucket_object.challenge_file" references: [var.logpush_bucket_name cloudflare_logpush_ownership_challenge.challenge]
2021/04/09 15:14:44 [DEBUG] ReferenceTransformer: "var.logpush_bucket_region" references: []
2021/04/09 15:14:44 [DEBUG] ReferenceTransformer: "var.logpush_fields" references: []
2021/04/09 15:14:44 [DEBUG] ReferenceTransformer: "var.cloudflare_zone_id" references: []
2021/04/09 15:14:44 [INFO] ReferenceTransformer: reference not found: "path.cwd"
2021/04/09 15:14:44 [DEBUG] ReferenceTransformer: "local.zone_name (expand)" references: []
2021/04/09 15:14:44 [DEBUG] ReferenceTransformer: "cloudflare_logpush_ownership_challenge.challenge" references: [var.cloudflare_zone_id var.logpush_bucket_name local.zone_name (expand) var.logpush_bucket_region]
2021/04/09 15:14:44 [DEBUG] ReferenceTransformer: "cloudflare_logpush_job.http_requests_job" references: [var.cloudflare_zone_id var.logpush_bucket_name local.zone_name (expand) var.logpush_bucket_region var.logpush_fields local.zone_name (expand) data.aws_s3_bucket_object.challenge_file]
2021/04/09 15:14:44 [DEBUG] ReferenceTransformer: "provider[\"registry.terraform.io/hashicorp/aws\"]" references: []
2021/04/09 15:14:44 [DEBUG] ReferenceTransformer: "var.logpush_bucket_name" references: []
2021/04/09 15:14:44 [DEBUG] ReferenceTransformer: "provider[\"registry.terraform.io/cloudflare/cloudflare\"]" references: []
2021/04/09 15:14:44 [DEBUG] Starting graph walk: walkValidate
2021-04-09T15:14:44.261+1200 [INFO]  plugin: configuring client automatic mTLS
2021-04-09T15:14:44.283+1200 [DEBUG] plugin: starting plugin: path=.terraform/providers/registry.terraform.io/cloudflare/cloudflare/2.19.2/darwin_amd64/terraform-provider-cloudflare_v2.19.2 args=[.terraform/providers/registry.terraform.io/cloudflare/cloudflare/2.19.2/darwin_amd64/terraform-provider-cloudflare_v2.19.2]
2021-04-09T15:14:44.458+1200 [DEBUG] plugin: plugin started: path=.terraform/providers/registry.terraform.io/cloudflare/cloudflare/2.19.2/darwin_amd64/terraform-provider-cloudflare_v2.19.2 pid=33070
2021-04-09T15:14:44.458+1200 [DEBUG] plugin: waiting for RPC address: path=.terraform/providers/registry.terraform.io/cloudflare/cloudflare/2.19.2/darwin_amd64/terraform-provider-cloudflare_v2.19.2
2021-04-09T15:14:44.472+1200 [INFO]  plugin.terraform-provider-cloudflare_v2.19.2: configuring server automatic mTLS: timestamp=2021-04-09T15:14:44.471+1200
2021-04-09T15:14:44.504+1200 [DEBUG] plugin.terraform-provider-cloudflare_v2.19.2: plugin address: address=/var/folders/hd/_1jqks_53ddd3j41f___mxw40000gn/T/plugin338493445 network=unix timestamp=2021-04-09T15:14:44.504+1200
2021-04-09T15:14:44.504+1200 [DEBUG] plugin: using plugin: version=5
2021-04-09T15:14:44.550+1200 [INFO]  plugin: configuring client automatic mTLS
2021-04-09T15:14:44.573+1200 [DEBUG] plugin: starting plugin: path=.terraform/providers/registry.terraform.io/hashicorp/aws/3.35.0/darwin_amd64/terraform-provider-aws_v3.35.0_x5 args=[.terraform/providers/registry.terraform.io/hashicorp/aws/3.35.0/darwin_amd64/terraform-provider-aws_v3.35.0_x5]
2021-04-09T15:14:45.930+1200 [DEBUG] plugin: plugin started: path=.terraform/providers/registry.terraform.io/hashicorp/aws/3.35.0/darwin_amd64/terraform-provider-aws_v3.35.0_x5 pid=33071
2021-04-09T15:14:45.930+1200 [DEBUG] plugin: waiting for RPC address: path=.terraform/providers/registry.terraform.io/hashicorp/aws/3.35.0/darwin_amd64/terraform-provider-aws_v3.35.0_x5
2021-04-09T15:14:45.968+1200 [INFO]  plugin.terraform-provider-aws_v3.35.0_x5: configuring server automatic mTLS: timestamp=2021-04-09T15:14:45.968+1200
2021-04-09T15:14:46.006+1200 [DEBUG] plugin.terraform-provider-aws_v3.35.0_x5: plugin address: address=/var/folders/hd/_1jqks_53ddd3j41f___mxw40000gn/T/plugin440312474 network=unix timestamp=2021-04-09T15:14:46.006+1200
2021-04-09T15:14:46.006+1200 [DEBUG] plugin: using plugin: version=5
2021-04-09T15:14:46.193+1200 [WARN]  plugin.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = transport is closing"
2021-04-09T15:14:46.197+1200 [DEBUG] plugin: plugin process exited: path=.terraform/providers/registry.terraform.io/hashicorp/aws/3.35.0/darwin_amd64/terraform-provider-aws_v3.35.0_x5 pid=33071
2021-04-09T15:14:46.197+1200 [DEBUG] plugin: plugin exited
2021-04-09T15:14:46.198+1200 [WARN]  plugin.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = transport is closing"
2021-04-09T15:14:46.199+1200 [DEBUG] plugin: plugin process exited: path=.terraform/providers/registry.terraform.io/cloudflare/cloudflare/2.19.2/darwin_amd64/terraform-provider-cloudflare_v2.19.2 pid=33070
2021-04-09T15:14:46.199+1200 [DEBUG] plugin: plugin exited
2021/04/09 15:14:46 [INFO] backend/local: apply calling Plan
2021/04/09 15:14:46 [INFO] terraform: building graph: GraphTypePlan
2021/04/09 15:14:46 [DEBUG] adding implicit provider configuration provider["registry.terraform.io/hashicorp/aws"], implied first by data.aws_s3_bucket_object.challenge_file (expand)
2021/04/09 15:14:46 [DEBUG] ProviderTransformer: "data.aws_s3_bucket_object.challenge_file (expand)" (*terraform.nodeExpandPlannableResource) needs provider["registry.terraform.io/hashicorp/aws"]
2021/04/09 15:14:46 [DEBUG] ProviderTransformer: "cloudflare_logpush_ownership_challenge.challenge (expand)" (*terraform.nodeExpandPlannableResource) needs provider["registry.terraform.io/cloudflare/cloudflare"]
2021/04/09 15:14:46 [DEBUG] ProviderTransformer: "cloudflare_logpush_job.http_requests_job (expand)" (*terraform.nodeExpandPlannableResource) needs provider["registry.terraform.io/cloudflare/cloudflare"]
2021/04/09 15:14:46 [DEBUG] ReferenceTransformer: "var.cloudflare_zone_id" references: []
2021/04/09 15:14:46 [DEBUG] ReferenceTransformer: "var.logpush_bucket_name" references: []
2021/04/09 15:14:46 [DEBUG] ReferenceTransformer: "var.logpush_fields" references: []
2021/04/09 15:14:46 [INFO] ReferenceTransformer: reference not found: "path.cwd"
2021/04/09 15:14:46 [DEBUG] ReferenceTransformer: "local.zone_name (expand)" references: []
2021/04/09 15:14:46 [DEBUG] ReferenceTransformer: "provider[\"registry.terraform.io/hashicorp/aws\"]" references: []
2021/04/09 15:14:46 [DEBUG] ReferenceTransformer: "cloudflare_logpush_ownership_challenge.challenge (expand)" references: [var.logpush_bucket_name local.zone_name (expand) var.logpush_bucket_region var.cloudflare_zone_id]
2021/04/09 15:14:46 [DEBUG] ReferenceTransformer: "cloudflare_logpush_job.http_requests_job (expand)" references: [local.zone_name (expand) data.aws_s3_bucket_object.challenge_file (expand) var.cloudflare_zone_id var.logpush_bucket_name local.zone_name (expand) var.logpush_bucket_region var.logpush_fields]
2021/04/09 15:14:46 [DEBUG] ReferenceTransformer: "data.aws_s3_bucket_object.challenge_file (expand)" references: [cloudflare_logpush_ownership_challenge.challenge (expand) var.logpush_bucket_name]
2021/04/09 15:14:46 [DEBUG] ReferenceTransformer: "var.logpush_bucket_region" references: []
2021/04/09 15:14:46 [DEBUG] ReferenceTransformer: "provider[\"registry.terraform.io/cloudflare/cloudflare\"]" references: []
2021/04/09 15:14:46 [DEBUG] Starting graph walk: walkPlan
2021-04-09T15:14:46.203+1200 [INFO]  plugin: configuring client automatic mTLS
2021-04-09T15:14:46.226+1200 [DEBUG] plugin: starting plugin: path=.terraform/providers/registry.terraform.io/hashicorp/aws/3.35.0/darwin_amd64/terraform-provider-aws_v3.35.0_x5 args=[.terraform/providers/registry.terraform.io/hashicorp/aws/3.35.0/darwin_amd64/terraform-provider-aws_v3.35.0_x5]
2021-04-09T15:14:47.564+1200 [DEBUG] plugin: plugin started: path=.terraform/providers/registry.terraform.io/hashicorp/aws/3.35.0/darwin_amd64/terraform-provider-aws_v3.35.0_x5 pid=33072
2021-04-09T15:14:47.564+1200 [DEBUG] plugin: waiting for RPC address: path=.terraform/providers/registry.terraform.io/hashicorp/aws/3.35.0/darwin_amd64/terraform-provider-aws_v3.35.0_x5
2021-04-09T15:14:47.601+1200 [INFO]  plugin.terraform-provider-aws_v3.35.0_x5: configuring server automatic mTLS: timestamp=2021-04-09T15:14:47.601+1200
2021-04-09T15:14:47.637+1200 [DEBUG] plugin.terraform-provider-aws_v3.35.0_x5: plugin address: address=/var/folders/hd/_1jqks_53ddd3j41f___mxw40000gn/T/plugin524742223 network=unix timestamp=2021-04-09T15:14:47.637+1200
2021-04-09T15:14:47.637+1200 [DEBUG] plugin: using plugin: version=5
2021-04-09T15:14:47.683+1200 [INFO]  plugin: configuring client automatic mTLS
2021-04-09T15:14:47.707+1200 [DEBUG] plugin: starting plugin: path=.terraform/providers/registry.terraform.io/cloudflare/cloudflare/2.19.2/darwin_amd64/terraform-provider-cloudflare_v2.19.2 args=[.terraform/providers/registry.terraform.io/cloudflare/cloudflare/2.19.2/darwin_amd64/terraform-provider-cloudflare_v2.19.2]
2021-04-09T15:14:47.876+1200 [DEBUG] plugin: plugin started: path=.terraform/providers/registry.terraform.io/cloudflare/cloudflare/2.19.2/darwin_amd64/terraform-provider-cloudflare_v2.19.2 pid=33073
2021-04-09T15:14:47.876+1200 [DEBUG] plugin: waiting for RPC address: path=.terraform/providers/registry.terraform.io/cloudflare/cloudflare/2.19.2/darwin_amd64/terraform-provider-cloudflare_v2.19.2
2021-04-09T15:14:47.888+1200 [INFO]  plugin.terraform-provider-cloudflare_v2.19.2: configuring server automatic mTLS: timestamp=2021-04-09T15:14:47.888+1200
2021-04-09T15:14:47.921+1200 [DEBUG] plugin.terraform-provider-cloudflare_v2.19.2: plugin address: address=/var/folders/hd/_1jqks_53ddd3j41f___mxw40000gn/T/plugin189490788 network=unix timestamp=2021-04-09T15:14:47.921+1200
2021-04-09T15:14:47.921+1200 [DEBUG] plugin: using plugin: version=5
2021-04-09T15:14:47.967+1200 [INFO]  plugin.terraform-provider-aws_v3.35.0_x5: 2021/04/09 15:14:47 [INFO] AWS Auth provider used: "EnvProvider": timestamp=2021-04-09T15:14:47.967+1200
2021-04-09T15:14:47.971+1200 [INFO]  plugin.terraform-provider-aws_v3.35.0_x5: 2021/04/09 15:14:47 [DEBUG] Trying to get account information via sts:GetCallerIdentity: timestamp=2021-04-09T15:14:47.971+1200
2021-04-09T15:14:47.971+1200 [INFO]  plugin.terraform-provider-aws_v3.35.0_x5: 2021/04/09 15:14:47 [DEBUG] [aws-sdk-go] DEBUG: Request sts/GetCallerIdentity Details:
---[ REQUEST POST-SIGN ]-----------------------------
POST / HTTP/1.1
Host: sts.amazonaws.com
User-Agent: aws-sdk-go/1.38.6 (go1.16; darwin; amd64) APN/1.0 HashiCorp/1.0 Terraform/0.14.9 (+https://www.terraform.io) terraform-provider-aws/dev (+https://registry.terraform.io/providers/hashicorp/aws)
Content-Length: 43
Authorization: AWS4-HMAC-SHA256 Credential=[REDACTED]/20210409/us-east-1/sts/aws4_request, SignedHeaders=content-length;content-type;host;x-amz-date;x-amz-security-token, Signature=[REDACTED]
Content-Type: application/x-www-form-urlencoded; charset=utf-8
X-Amz-Date: 20210409T031447Z
X-Amz-Security-Token: [REDACTED]
Accept-Encoding: gzip

Action=GetCallerIdentity&Version=2011-06-15
-----------------------------------------------------: timestamp=2021-04-09T15:14:47.971+1200
2021-04-09T15:14:47.973+1200 [DEBUG] plugin.terraform-provider-cloudflare_v2.19.2: 2021/04/09 15:14:47 [INFO] Cloudflare Client configured for user:
2021/04/09 15:14:47 [DEBUG] Resource instance state not found for node "cloudflare_logpush_ownership_challenge.challenge", instance cloudflare_logpush_ownership_challenge.challenge
2021/04/09 15:14:47 [INFO] ReferenceTransformer: reference not found: "var.logpush_bucket_name"
2021/04/09 15:14:47 [INFO] ReferenceTransformer: reference not found: "local.zone_name"
2021/04/09 15:14:47 [INFO] ReferenceTransformer: reference not found: "var.logpush_bucket_region"
2021/04/09 15:14:47 [INFO] ReferenceTransformer: reference not found: "var.cloudflare_zone_id"
2021/04/09 15:14:47 [DEBUG] ReferenceTransformer: "cloudflare_logpush_ownership_challenge.challenge" references: []
2021/04/09 15:14:47 [DEBUG] refresh: cloudflare_logpush_ownership_challenge.challenge: no state, so not refreshing
2021-04-09T15:14:48.959+1200 [INFO]  plugin.terraform-provider-aws_v3.35.0_x5: 2021/04/09 15:14:48 [DEBUG] [aws-sdk-go] DEBUG: Response sts/GetCallerIdentity Details:
---[ RESPONSE ]--------------------------------------
HTTP/1.1 200 OK
Connection: close
Content-Length: 459
Content-Type: text/xml
Date: Fri, 09 Apr 2021 03:14:48 GMT
X-Amzn-Requestid: 6582b91f-d8d3-4c88-99ec-db0d6a6ef7eb


-----------------------------------------------------: timestamp=2021-04-09T15:14:48.959+1200
2021-04-09T15:14:48.959+1200 [INFO]  plugin.terraform-provider-aws_v3.35.0_x5: 2021/04/09 15:14:48 [DEBUG] [aws-sdk-go] <GetCallerIdentityResponse xmlns="https://sts.amazonaws.com/doc/2011-06-15/">
  <GetCallerIdentityResult>
    <Arn>arn:aws:sts::[ACCOUNT_ID]:assumed-role/cloudformation/1617937947818477000</Arn>
    <UserId>[USER_ID]:1617937947818477000</UserId>
    <Account>[ACCOUNT_ID]</Account>
  </GetCallerIdentityResult>
  <ResponseMetadata>
    <RequestId>6582b91f-d8d3-4c88-99ec-db0d6a6ef7eb</RequestId>
  </ResponseMetadata>
</GetCallerIdentityResponse>: timestamp=2021-04-09T15:14:48.959+1200
2021-04-09T15:14:48.959+1200 [INFO]  plugin.terraform-provider-aws_v3.35.0_x5: 2021/04/09 15:14:48 [DEBUG] Trying to get account information via sts:GetCallerIdentity: timestamp=2021-04-09T15:14:48.959+1200
2021-04-09T15:14:48.959+1200 [INFO]  plugin.terraform-provider-aws_v3.35.0_x5: 2021/04/09 15:14:48 [DEBUG] [aws-sdk-go] DEBUG: Request sts/GetCallerIdentity Details:
---[ REQUEST POST-SIGN ]-----------------------------
POST / HTTP/1.1
Host: sts.amazonaws.com
User-Agent: aws-sdk-go/1.38.6 (go1.16; darwin; amd64) APN/1.0 HashiCorp/1.0 Terraform/0.14.9 (+https://www.terraform.io) terraform-provider-aws/dev (+https://registry.terraform.io/providers/hashicorp/aws)
Content-Length: 43
Authorization: AWS4-HMAC-SHA256 Credential=[REDACTED]/20210409/us-east-1/sts/aws4_request, SignedHeaders=content-length;content-type;host;x-amz-date;x-amz-security-token, Signature=[REDACTED]
Content-Type: application/x-www-form-urlencoded; charset=utf-8
X-Amz-Date: 20210409T031448Z
X-Amz-Security-Token: [REDACTED]
Accept-Encoding: gzip

Action=GetCallerIdentity&Version=2011-06-15
-----------------------------------------------------: timestamp=2021-04-09T15:14:48.959+1200
2021-04-09T15:14:49.802+1200 [INFO]  plugin.terraform-provider-aws_v3.35.0_x5: 2021/04/09 15:14:49 [DEBUG] [aws-sdk-go] DEBUG: Response sts/GetCallerIdentity Details:
---[ RESPONSE ]--------------------------------------
HTTP/1.1 200 OK
Connection: close
Content-Length: 459
Content-Type: text/xml
Date: Fri, 09 Apr 2021 03:14:49 GMT
X-Amzn-Requestid: e845156f-9a1e-43b6-b4ab-478da0b4b8db


-----------------------------------------------------: timestamp=2021-04-09T15:14:49.802+1200
2021-04-09T15:14:49.802+1200 [INFO]  plugin.terraform-provider-aws_v3.35.0_x5: 2021/04/09 15:14:49 [DEBUG] [aws-sdk-go] <GetCallerIdentityResponse xmlns="https://sts.amazonaws.com/doc/2011-06-15/">
  <GetCallerIdentityResult>
    <Arn>arn:aws:sts::[ACCOUNT_ID]:assumed-role/cloudformation/1617937947818477000</Arn>
    <UserId>[USER_ID]:1617937947818477000</UserId>
    <Account>[ACCOUNT_ID]</Account>
  </GetCallerIdentityResult>
  <ResponseMetadata>
    <RequestId>e845156f-9a1e-43b6-b4ab-478da0b4b8db</RequestId>
  </ResponseMetadata>
</GetCallerIdentityResponse>: timestamp=2021-04-09T15:14:49.802+1200
2021-04-09T15:14:49.807+1200 [INFO]  plugin.terraform-provider-aws_v3.35.0_x5: 2021/04/09 15:14:49 [DEBUG] [aws-sdk-go] DEBUG: Request ec2/DescribeAccountAttributes Details:
---[ REQUEST POST-SIGN ]-----------------------------
POST / HTTP/1.1
Host: ec2.us-east-1.amazonaws.com
User-Agent: aws-sdk-go/1.38.6 (go1.16; darwin; amd64) APN/1.0 HashiCorp/1.0 Terraform/0.14.9 (+https://www.terraform.io) terraform-provider-aws/dev (+https://registry.terraform.io/providers/hashicorp/aws)
Content-Length: 87
Authorization: AWS4-HMAC-SHA256 Credential=[REDACTED]/20210409/us-east-1/ec2/aws4_request, SignedHeaders=content-length;content-type;host;x-amz-date;x-amz-security-token, Signature=[REDACTED]
Content-Type: application/x-www-form-urlencoded; charset=utf-8
X-Amz-Date: 20210409T031449Z
X-Amz-Security-Token: [REDACTED]
Accept-Encoding: gzip

Action=DescribeAccountAttributes&AttributeName.1=supported-platforms&Version=2016-11-15
-----------------------------------------------------: timestamp=2021-04-09T15:14:49.807+1200
2021-04-09T15:14:51.038+1200 [INFO]  plugin.terraform-provider-aws_v3.35.0_x5: 2021/04/09 15:14:51 [DEBUG] [aws-sdk-go] DEBUG: Response ec2/DescribeAccountAttributes Details:
---[ RESPONSE ]--------------------------------------
HTTP/1.1 200 OK
Connection: close
Content-Length: 540
Cache-Control: no-cache, no-store
Content-Type: text/xml;charset=UTF-8
Date: Fri, 09 Apr 2021 03:14:50 GMT
Server: AmazonEC2
Strict-Transport-Security: max-age=31536000; includeSubDomains
X-Amzn-Requestid: 824e146d-181f-48bf-ba84-2d20b8ecb0de


-----------------------------------------------------: timestamp=2021-04-09T15:14:51.038+1200
2021-04-09T15:14:51.038+1200 [INFO]  plugin.terraform-provider-aws_v3.35.0_x5: 2021/04/09 15:14:51 [DEBUG] [aws-sdk-go] <?xml version="1.0" encoding="UTF-8"?>
<DescribeAccountAttributesResponse xmlns="http://ec2.amazonaws.com/doc/2016-11-15/">
    <requestId>824e146d-181f-48bf-ba84-2d20b8ecb0de</requestId>
    <accountAttributeSet>
        <item>
            <attributeName>supported-platforms</attributeName>
            <attributeValueSet>
                <item>
                    <attributeValue>VPC</attributeValue>
                </item>
            </attributeValueSet>
        </item>
    </accountAttributeSet>
</DescribeAccountAttributesResponse>: timestamp=2021-04-09T15:14:51.038+1200
2021/04/09 15:14:51 [DEBUG] Resource instance state not found for node "data.aws_s3_bucket_object.challenge_file", instance data.aws_s3_bucket_object.challenge_file
2021/04/09 15:14:51 [INFO] ReferenceTransformer: reference not found: "var.logpush_bucket_name"
2021/04/09 15:14:51 [DEBUG] ReferenceTransformer: "data.aws_s3_bucket_object.challenge_file" references: []
2021/04/09 15:14:51 [DEBUG] Resource instance state not found for node "cloudflare_logpush_job.http_requests_job", instance cloudflare_logpush_job.http_requests_job
2021/04/09 15:14:51 [INFO] ReferenceTransformer: reference not found: "var.cloudflare_zone_id"
2021/04/09 15:14:51 [INFO] ReferenceTransformer: reference not found: "var.logpush_bucket_name"
2021/04/09 15:14:51 [INFO] ReferenceTransformer: reference not found: "local.zone_name"
2021/04/09 15:14:51 [INFO] ReferenceTransformer: reference not found: "var.logpush_bucket_region"
2021/04/09 15:14:51 [INFO] ReferenceTransformer: reference not found: "var.logpush_fields"
2021/04/09 15:14:51 [INFO] ReferenceTransformer: reference not found: "local.zone_name"
2021/04/09 15:14:51 [DEBUG] ReferenceTransformer: "cloudflare_logpush_job.http_requests_job" references: []
2021-04-09T15:14:51.040+1200 [WARN]  plugin.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = transport is closing"
2021-04-09T15:14:51.044+1200 [DEBUG] plugin: plugin process exited: path=.terraform/providers/registry.terraform.io/hashicorp/aws/3.35.0/darwin_amd64/terraform-provider-aws_v3.35.0_x5 pid=33072
2021-04-09T15:14:51.044+1200 [DEBUG] plugin: plugin exited
2021/04/09 15:14:51 [DEBUG] refresh: cloudflare_logpush_job.http_requests_job: no state, so not refreshing
2021-04-09T15:14:51.046+1200 [WARN]  plugin.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = transport is closing"
2021-04-09T15:14:51.048+1200 [DEBUG] plugin: plugin process exited: path=.terraform/providers/registry.terraform.io/cloudflare/cloudflare/2.19.2/darwin_amd64/terraform-provider-cloudflare_v2.19.2 pid=33073
2021-04-09T15:14:51.048+1200 [DEBUG] plugin: plugin exited

An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
  + create
 <= read (data resources)

Terraform will perform the following actions:

  # data.aws_s3_bucket_object.challenge_file will be read during apply
  # (config refers to values not yet known)
 <= data "aws_s3_bucket_object" "challenge_file"  {
2021/04/09 15:14:51 [DEBUG] command: asking for input: "Do you want to perform these actions?"
      + body                          = (known after apply)
      + bucket                        = "[BUCKET_NAME]"
      + cache_control                 = (known after apply)
      + content_disposition           = (known after apply)
      + content_encoding              = (known after apply)
      + content_language              = (known after apply)
      + content_length                = (known after apply)
      + content_type                  = (known after apply)
      + etag                          = (known after apply)
      + expiration                    = (known after apply)
      + expires                       = (known after apply)
      + id                            = (known after apply)
      + key                           = (known after apply)
      + last_modified                 = (known after apply)
      + metadata                      = (known after apply)
      + object_lock_legal_hold_status = (known after apply)
      + object_lock_mode              = (known after apply)
      + object_lock_retain_until_date = (known after apply)
      + server_side_encryption        = (known after apply)
      + sse_kms_key_id                = (known after apply)
      + storage_class                 = (known after apply)
      + tags                          = (known after apply)
      + version_id                    = (known after apply)
      + website_redirect_location     = (known after apply)
    }

  # cloudflare_logpush_job.http_requests_job will be created
  + resource "cloudflare_logpush_job" "http_requests_job" {
      + dataset             = "http_requests"
      + destination_conf    = "s3://[BUCKET_NAME]/[ZONE_NAME]/{DATE}?region=us-east-1"
      + enabled             = true
      + id                  = (known after apply)
      + logpull_options     = "fields=CacheCacheStatus,CacheResponseBytes,CacheResponseStatus,CacheTieredFill,ClientASN,ClientCountry,ClientDeviceType,ClientIP,ClientIPClass,ClientMTLSAuthCertFingerprint,ClientMTLSAuthStatus,ClientRequestBytes,ClientRequestHost,ClientRequestMethod,ClientRequestPath,ClientRequestProtocol,ClientRequestReferer,ClientRequestScheme,ClientRequestSource,ClientRequestURI,ClientRequestUserAgent,ClientSSLCipher,ClientSSLProtocol,ClientSrcPort,ClientTCPRTTMs,ClientXRequestedWith,EdgeCFConnectingO2O,EdgeColoCode,EdgeColoID,EdgeEndTimestamp,EdgePathingOp,EdgePathingSrc,EdgePathingStatus,EdgeRateLimitAction,EdgeRateLimitID,EdgeRequestHost,EdgeResponseBodyBytes,EdgeResponseBytes,EdgeResponseCompressionRatio,EdgeResponseContentType,EdgeResponseStatus,EdgeServerIP,EdgeStartTimestamp,EdgeTimeToFirstByteMs,FirewallMatchesActions,FirewallMatchesRuleIDs,FirewallMatchesSources,OriginDNSResponseTimeMs,OriginIP,OriginRequestHeaderSendDurationMs,OriginResponseBytes,OriginResponseDurationMs,OriginResponseHTTPExpires,OriginResponseHTTPLastModified,OriginResponseHeaderReceiveDurationMs,OriginResponseStatus,OriginResponseTime,OriginSSLProtocol,OriginTCPHandshakeDurationMs,OriginTLSHandshakeDurationMs,ParentRayID,RayID,SecurityLevel,SmartRouteColoID,UpperTierColoID,WAFAction,WAFFlags,WAFMatchedVar,WAFProfile,WAFRuleID,WAFRuleMessage,WorkerCPUTime,WorkerStatus,WorkerSubrequest,WorkerSubrequestCount,ZoneID,ZoneName&timestamps=rfc3339"
      + name                = "[ZONE_NAME]"
      + ownership_challenge = (known after apply)
      + zone_id             = "[ZONE_ID]"
    }

  # cloudflare_logpush_ownership_challenge.challenge will be created
  + resource "cloudflare_logpush_ownership_challenge" "challenge" {
      + destination_conf             = "s3://[BUCKET_NAME]/[ZONE_NAME]?region=us-east-1"
      + id                           = (known after apply)
      + ownership_challenge_filename = (known after apply)
      + zone_id                      = "[ZONE_ID]"
    }

Plan: 2 to add, 0 to change, 0 to destroy.

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

2021/04/09 15:14:54 [INFO] backend/local: apply calling Apply
2021/04/09 15:14:54 [INFO] terraform: building graph: GraphTypeApply
2021/04/09 15:14:54 [DEBUG] Resource state not found for node "cloudflare_logpush_ownership_challenge.challenge", instance cloudflare_logpush_ownership_challenge.challenge
2021/04/09 15:14:54 [DEBUG] Resource state not found for node "data.aws_s3_bucket_object.challenge_file", instance data.aws_s3_bucket_object.challenge_file
2021/04/09 15:14:54 [DEBUG] Resource state not found for node "cloudflare_logpush_job.http_requests_job", instance cloudflare_logpush_job.http_requests_job
2021/04/09 15:14:54 [DEBUG] adding implicit provider configuration provider["registry.terraform.io/hashicorp/aws"], implied first by data.aws_s3_bucket_object.challenge_file (expand)
2021/04/09 15:14:54 [DEBUG] ProviderTransformer: "cloudflare_logpush_ownership_challenge.challenge (expand)" (*terraform.nodeExpandApplyableResource) needs provider["registry.terraform.io/cloudflare/cloudflare"]
2021/04/09 15:14:54 [DEBUG] ProviderTransformer: "cloudflare_logpush_job.http_requests_job (expand)" (*terraform.nodeExpandApplyableResource) needs provider["registry.terraform.io/cloudflare/cloudflare"]
2021/04/09 15:14:54 [DEBUG] ProviderTransformer: "data.aws_s3_bucket_object.challenge_file (expand)" (*terraform.nodeExpandApplyableResource) needs provider["registry.terraform.io/hashicorp/aws"]
2021/04/09 15:14:54 [DEBUG] ProviderTransformer: "cloudflare_logpush_ownership_challenge.challenge" (*terraform.NodeApplyableResourceInstance) needs provider["registry.terraform.io/cloudflare/cloudflare"]
2021/04/09 15:14:54 [DEBUG] ProviderTransformer: "data.aws_s3_bucket_object.challenge_file" (*terraform.NodeApplyableResourceInstance) needs provider["registry.terraform.io/hashicorp/aws"]
2021/04/09 15:14:54 [DEBUG] ProviderTransformer: "cloudflare_logpush_job.http_requests_job" (*terraform.NodeApplyableResourceInstance) needs provider["registry.terraform.io/cloudflare/cloudflare"]
2021/04/09 15:14:54 [DEBUG] ReferenceTransformer: "provider[\"registry.terraform.io/cloudflare/cloudflare\"]" references: []
2021/04/09 15:14:54 [DEBUG] ReferenceTransformer: "cloudflare_logpush_ownership_challenge.challenge (expand)" references: []
2021/04/09 15:14:54 [DEBUG] ReferenceTransformer: "cloudflare_logpush_job.http_requests_job (expand)" references: []
2021/04/09 15:14:54 [DEBUG] ReferenceTransformer: "data.aws_s3_bucket_object.challenge_file (expand)" references: []
2021/04/09 15:14:54 [DEBUG] ReferenceTransformer: "var.logpush_bucket_region" references: []
2021/04/09 15:14:54 [DEBUG] ReferenceTransformer: "var.logpush_fields" references: []
2021/04/09 15:14:54 [DEBUG] ReferenceTransformer: "cloudflare_logpush_ownership_challenge.challenge" references: [var.cloudflare_zone_id var.logpush_bucket_name local.zone_name (expand) var.logpush_bucket_region]
2021/04/09 15:14:54 [DEBUG] ReferenceTransformer: "data.aws_s3_bucket_object.challenge_file" references: [var.logpush_bucket_name cloudflare_logpush_ownership_challenge.challenge (expand) cloudflare_logpush_ownership_challenge.challenge cloudflare_logpush_ownership_challenge.challenge]
2021/04/09 15:14:54 [DEBUG] ReferenceTransformer: "var.cloudflare_zone_id" references: []
2021/04/09 15:14:54 [DEBUG] ReferenceTransformer: "var.logpush_bucket_name" references: []
2021/04/09 15:14:54 [INFO] ReferenceTransformer: reference not found: "path.cwd"
2021/04/09 15:14:54 [DEBUG] ReferenceTransformer: "local.zone_name (expand)" references: []
2021/04/09 15:14:54 [DEBUG] ReferenceTransformer: "cloudflare_logpush_job.http_requests_job" references: [data.aws_s3_bucket_object.challenge_file (expand) data.aws_s3_bucket_object.challenge_file data.aws_s3_bucket_object.challenge_file var.cloudflare_zone_id var.logpush_bucket_name local.zone_name (expand) var.logpush_bucket_region var.logpush_fields local.zone_name (expand)]
2021/04/09 15:14:54 [DEBUG] ReferenceTransformer: "provider[\"registry.terraform.io/hashicorp/aws\"]" references: []
2021/04/09 15:14:54 [DEBUG] Starting graph walk: walkApply
2021-04-09T15:14:54.319+1200 [INFO]  plugin: configuring client automatic mTLS
2021-04-09T15:14:54.343+1200 [DEBUG] plugin: starting plugin: path=.terraform/providers/registry.terraform.io/hashicorp/aws/3.35.0/darwin_amd64/terraform-provider-aws_v3.35.0_x5 args=[.terraform/providers/registry.terraform.io/hashicorp/aws/3.35.0/darwin_amd64/terraform-provider-aws_v3.35.0_x5]
2021-04-09T15:14:55.590+1200 [DEBUG] plugin: plugin started: path=.terraform/providers/registry.terraform.io/hashicorp/aws/3.35.0/darwin_amd64/terraform-provider-aws_v3.35.0_x5 pid=33074
2021-04-09T15:14:55.590+1200 [DEBUG] plugin: waiting for RPC address: path=.terraform/providers/registry.terraform.io/hashicorp/aws/3.35.0/darwin_amd64/terraform-provider-aws_v3.35.0_x5
2021-04-09T15:14:55.631+1200 [INFO]  plugin.terraform-provider-aws_v3.35.0_x5: configuring server automatic mTLS: timestamp=2021-04-09T15:14:55.631+1200
2021-04-09T15:14:55.667+1200 [DEBUG] plugin: using plugin: version=5
2021-04-09T15:14:55.667+1200 [DEBUG] plugin.terraform-provider-aws_v3.35.0_x5: plugin address: address=/var/folders/hd/_1jqks_53ddd3j41f___mxw40000gn/T/plugin377293537 network=unix timestamp=2021-04-09T15:14:55.667+1200
2021-04-09T15:14:55.712+1200 [INFO]  plugin: configuring client automatic mTLS
2021-04-09T15:14:55.733+1200 [DEBUG] plugin: starting plugin: path=.terraform/providers/registry.terraform.io/cloudflare/cloudflare/2.19.2/darwin_amd64/terraform-provider-cloudflare_v2.19.2 args=[.terraform/providers/registry.terraform.io/cloudflare/cloudflare/2.19.2/darwin_amd64/terraform-provider-cloudflare_v2.19.2]
2021-04-09T15:14:55.907+1200 [DEBUG] plugin: plugin started: path=.terraform/providers/registry.terraform.io/cloudflare/cloudflare/2.19.2/darwin_amd64/terraform-provider-cloudflare_v2.19.2 pid=33075
2021-04-09T15:14:55.907+1200 [DEBUG] plugin: waiting for RPC address: path=.terraform/providers/registry.terraform.io/cloudflare/cloudflare/2.19.2/darwin_amd64/terraform-provider-cloudflare_v2.19.2
2021-04-09T15:14:55.920+1200 [INFO]  plugin.terraform-provider-cloudflare_v2.19.2: configuring server automatic mTLS: timestamp=2021-04-09T15:14:55.920+1200
2021-04-09T15:14:55.953+1200 [DEBUG] plugin.terraform-provider-cloudflare_v2.19.2: plugin address: address=/var/folders/hd/_1jqks_53ddd3j41f___mxw40000gn/T/plugin109497206 network=unix timestamp=2021-04-09T15:14:55.953+1200
2021-04-09T15:14:55.953+1200 [DEBUG] plugin: using plugin: version=5
2021-04-09T15:14:55.999+1200 [INFO]  plugin.terraform-provider-aws_v3.35.0_x5: 2021/04/09 15:14:55 [INFO] AWS Auth provider used: "EnvProvider": timestamp=2021-04-09T15:14:55.999+1200
2021-04-09T15:14:56.002+1200 [INFO]  plugin.terraform-provider-aws_v3.35.0_x5: 2021/04/09 15:14:56 [DEBUG] Trying to get account information via sts:GetCallerIdentity: timestamp=2021-04-09T15:14:56.001+1200
2021-04-09T15:14:56.002+1200 [INFO]  plugin.terraform-provider-aws_v3.35.0_x5: 2021/04/09 15:14:56 [DEBUG] [aws-sdk-go] DEBUG: Request sts/GetCallerIdentity Details:
---[ REQUEST POST-SIGN ]-----------------------------
POST / HTTP/1.1
Host: sts.amazonaws.com
User-Agent: aws-sdk-go/1.38.6 (go1.16; darwin; amd64) APN/1.0 HashiCorp/1.0 Terraform/0.14.9 (+https://www.terraform.io) terraform-provider-aws/dev (+https://registry.terraform.io/providers/hashicorp/aws)
Content-Length: 43
Authorization: AWS4-HMAC-SHA256 Credential=[REDACTED]/20210409/us-east-1/sts/aws4_request, SignedHeaders=content-length;content-type;host;x-amz-date;x-amz-security-token, Signature=[REDACTED]
Content-Type: application/x-www-form-urlencoded; charset=utf-8
X-Amz-Date: 20210409T031456Z
X-Amz-Security-Token: [REDACTED]
Accept-Encoding: gzip

Action=GetCallerIdentity&Version=2011-06-15
-----------------------------------------------------: timestamp=2021-04-09T15:14:56.002+1200
2021-04-09T15:14:56.004+1200 [DEBUG] plugin.terraform-provider-cloudflare_v2.19.2: 2021/04/09 15:14:56 [INFO] Cloudflare Client configured for user:
cloudflare_logpush_ownership_challenge.challenge: Creating...
2021/04/09 15:14:56 [DEBUG] EvalApply: ProviderMeta config value set
2021/04/09 15:14:56 [DEBUG] cloudflare_logpush_ownership_challenge.challenge: applying the planned Create change
2021-04-09T15:14:56.006+1200 [DEBUG] plugin.terraform-provider-cloudflare_v2.19.2: 2021/04/09 15:14:56 [DEBUG] Cloudflare API Request Details:
2021-04-09T15:14:56.006+1200 [DEBUG] plugin.terraform-provider-cloudflare_v2.19.2: ---[ REQUEST ]---------------------------------------
2021-04-09T15:14:56.006+1200 [DEBUG] plugin.terraform-provider-cloudflare_v2.19.2: POST /client/v4/zones/[ZONE_ID]/logpush/ownership HTTP/1.1
2021-04-09T15:14:56.006+1200 [DEBUG] plugin.terraform-provider-cloudflare_v2.19.2: Host: api.cloudflare.com
2021-04-09T15:14:56.006+1200 [DEBUG] plugin.terraform-provider-cloudflare_v2.19.2: User-Agent: HashiCorp Terraform/0.14.9 (+https://www.terraform.io) Terraform Plugin SDK/1.16.0 terraform-provider-cloudflare/2.19.2
2021-04-09T15:14:56.006+1200 [DEBUG] plugin.terraform-provider-cloudflare_v2.19.2: Content-Length: 92
2021-04-09T15:14:56.006+1200 [DEBUG] plugin.terraform-provider-cloudflare_v2.19.2: Authorization: Bearer [REDACTED]
2021-04-09T15:14:56.006+1200 [DEBUG] plugin.terraform-provider-cloudflare_v2.19.2: Content-Type: application/json
2021-04-09T15:14:56.006+1200 [DEBUG] plugin.terraform-provider-cloudflare_v2.19.2: Accept-Encoding: gzip
2021-04-09T15:14:56.006+1200 [DEBUG] plugin.terraform-provider-cloudflare_v2.19.2:
2021-04-09T15:14:56.006+1200 [DEBUG] plugin.terraform-provider-cloudflare_v2.19.2: {
2021-04-09T15:14:56.006+1200 [DEBUG] plugin.terraform-provider-cloudflare_v2.19.2:  "destination_conf": "s3://[BUCKET_NAME]/[ZONE_NAME]?region=us-east-1"
2021-04-09T15:14:56.006+1200 [DEBUG] plugin.terraform-provider-cloudflare_v2.19.2: }
2021-04-09T15:14:56.006+1200 [DEBUG] plugin.terraform-provider-cloudflare_v2.19.2: -----------------------------------------------------
2021-04-09T15:14:56.978+1200 [INFO]  plugin.terraform-provider-aws_v3.35.0_x5: 2021/04/09 15:14:56 [DEBUG] [aws-sdk-go] DEBUG: Response sts/GetCallerIdentity Details:
---[ RESPONSE ]--------------------------------------
HTTP/1.1 200 OK
Connection: close
Content-Length: 459
Content-Type: text/xml
Date: Fri, 09 Apr 2021 03:14:56 GMT
X-Amzn-Requestid: c99ccbf0-dc64-4cca-8929-9d73d4594bbf


-----------------------------------------------------: timestamp=2021-04-09T15:14:56.978+1200
2021-04-09T15:14:56.978+1200 [INFO]  plugin.terraform-provider-aws_v3.35.0_x5: 2021/04/09 15:14:56 [DEBUG] [aws-sdk-go] <GetCallerIdentityResponse xmlns="https://sts.amazonaws.com/doc/2011-06-15/">
  <GetCallerIdentityResult>
    <Arn>arn:aws:sts::[ACCOUNT_ID]:assumed-role/cloudformation/1617937947818477000</Arn>
    <UserId>[USER_ID]:1617937947818477000</UserId>
    <Account>[ACCOUNT_ID]</Account>
  </GetCallerIdentityResult>
  <ResponseMetadata>
    <RequestId>c99ccbf0-dc64-4cca-8929-9d73d4594bbf</RequestId>
  </ResponseMetadata>
</GetCallerIdentityResponse>: timestamp=2021-04-09T15:14:56.978+1200
2021-04-09T15:14:56.978+1200 [INFO]  plugin.terraform-provider-aws_v3.35.0_x5: 2021/04/09 15:14:56 [DEBUG] Trying to get account information via sts:GetCallerIdentity: timestamp=2021-04-09T15:14:56.978+1200
2021-04-09T15:14:56.979+1200 [INFO]  plugin.terraform-provider-aws_v3.35.0_x5: 2021/04/09 15:14:56 [DEBUG] [aws-sdk-go] DEBUG: Request sts/GetCallerIdentity Details:
---[ REQUEST POST-SIGN ]-----------------------------
POST / HTTP/1.1
Host: sts.amazonaws.com
User-Agent: aws-sdk-go/1.38.6 (go1.16; darwin; amd64) APN/1.0 HashiCorp/1.0 Terraform/0.14.9 (+https://www.terraform.io) terraform-provider-aws/dev (+https://registry.terraform.io/providers/hashicorp/aws)
Content-Length: 43
Authorization: AWS4-HMAC-SHA256 Credential=[REDACTED]/20210409/us-east-1/sts/aws4_request, SignedHeaders=content-length;content-type;host;x-amz-date;x-amz-security-token, Signature=[REDACTED]
Content-Type: application/x-www-form-urlencoded; charset=utf-8
X-Amz-Date: 20210409T031456Z
X-Amz-Security-Token: [REDACTED]
Accept-Encoding: gzip

Action=GetCallerIdentity&Version=2011-06-15
-----------------------------------------------------: timestamp=2021-04-09T15:14:56.978+1200
2021-04-09T15:14:57.209+1200 [DEBUG] plugin.terraform-provider-cloudflare_v2.19.2: 2021/04/09 15:14:57 [DEBUG] Cloudflare API Response Details:
2021-04-09T15:14:57.209+1200 [DEBUG] plugin.terraform-provider-cloudflare_v2.19.2: ---[ RESPONSE ]--------------------------------------
2021-04-09T15:14:57.209+1200 [DEBUG] plugin.terraform-provider-cloudflare_v2.19.2: HTTP/2.0 200 OK
2021-04-09T15:14:57.209+1200 [DEBUG] plugin.terraform-provider-cloudflare_v2.19.2: Cf-Cache-Status: DYNAMIC
2021-04-09T15:14:57.209+1200 [DEBUG] plugin.terraform-provider-cloudflare_v2.19.2: Cf-Ray: 63d0916d0f7fa42d-AKL
2021-04-09T15:14:57.209+1200 [DEBUG] plugin.terraform-provider-cloudflare_v2.19.2: Cf-Request-Id: 09563938220000a42d9611b000000001
2021-04-09T15:14:57.209+1200 [DEBUG] plugin.terraform-provider-cloudflare_v2.19.2: Cf-Version: 616-c3df1d9
2021-04-09T15:14:57.209+1200 [DEBUG] plugin.terraform-provider-cloudflare_v2.19.2: Content-Type: application/json
2021-04-09T15:14:57.209+1200 [DEBUG] plugin.terraform-provider-cloudflare_v2.19.2: Date: Fri, 09 Apr 2021 03:14:57 GMT
2021-04-09T15:14:57.209+1200 [DEBUG] plugin.terraform-provider-cloudflare_v2.19.2: Expect-Ct: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
2021-04-09T15:14:57.209+1200 [DEBUG] plugin.terraform-provider-cloudflare_v2.19.2: Server: cloudflare
2021-04-09T15:14:57.209+1200 [DEBUG] plugin.terraform-provider-cloudflare_v2.19.2: Set-Cookie: __cfduid=[REDACTED]; expires=Sun, 09-May-21 03:14:56 GMT; path=/; domain=.api.cloudflare.com; HttpOnly; SameSite=Lax; Secure
2021-04-09T15:14:57.209+1200 [DEBUG] plugin.terraform-provider-cloudflare_v2.19.2: Set-Cookie: __cflb=[REDACTED]; SameSite=Lax; path=/; expires=Fri, 09-Apr-21 05:44:58 GMT; HttpOnly
2021-04-09T15:14:57.209+1200 [DEBUG] plugin.terraform-provider-cloudflare_v2.19.2: Set-Cookie: __cfruid=[REDACTED]; path=/; domain=.api.cloudflare.com; HttpOnly; Secure; SameSite=None
2021-04-09T15:14:57.209+1200 [DEBUG] plugin.terraform-provider-cloudflare_v2.19.2: Vary: Accept-Encoding
2021-04-09T15:14:57.209+1200 [DEBUG] plugin.terraform-provider-cloudflare_v2.19.2: X-Envoy-Upstream-Service-Time: 712
2021-04-09T15:14:57.209+1200 [DEBUG] plugin.terraform-provider-cloudflare_v2.19.2:
2021-04-09T15:14:57.209+1200 [DEBUG] plugin.terraform-provider-cloudflare_v2.19.2: {
2021-04-09T15:14:57.209+1200 [DEBUG] plugin.terraform-provider-cloudflare_v2.19.2:  "errors": [],
2021-04-09T15:14:57.209+1200 [DEBUG] plugin.terraform-provider-cloudflare_v2.19.2:  "messages": [],
2021-04-09T15:14:57.209+1200 [DEBUG] plugin.terraform-provider-cloudflare_v2.19.2:  "result": {
2021-04-09T15:14:57.209+1200 [DEBUG] plugin.terraform-provider-cloudflare_v2.19.2:   "filename": "[ZONE_NAME]/ownership-challenge-2d648752.txt",
2021-04-09T15:14:57.209+1200 [DEBUG] plugin.terraform-provider-cloudflare_v2.19.2:   "message": "",
2021-04-09T15:14:57.209+1200 [DEBUG] plugin.terraform-provider-cloudflare_v2.19.2:   "valid": true
2021-04-09T15:14:57.209+1200 [DEBUG] plugin.terraform-provider-cloudflare_v2.19.2:  },
2021-04-09T15:14:57.209+1200 [DEBUG] plugin.terraform-provider-cloudflare_v2.19.2:  "success": true
2021-04-09T15:14:57.209+1200 [DEBUG] plugin.terraform-provider-cloudflare_v2.19.2: }
2021-04-09T15:14:57.209+1200 [DEBUG] plugin.terraform-provider-cloudflare_v2.19.2: -----------------------------------------------------
2021-04-09T15:14:57.209+1200 [DEBUG] plugin.terraform-provider-cloudflare_v2.19.2: 2021/04/09 15:14:57 [INFO] Created Cloudflare Logpush Ownership Challenge: [REDACTED]
cloudflare_logpush_ownership_challenge.challenge: Creation complete after 1s [id=[REDACTED]]
2021-04-09T15:14:57.820+1200 [INFO]  plugin.terraform-provider-aws_v3.35.0_x5: 2021/04/09 15:14:57 [DEBUG] [aws-sdk-go] DEBUG: Response sts/GetCallerIdentity Details:
---[ RESPONSE ]--------------------------------------
HTTP/1.1 200 OK
Connection: close
Content-Length: 459
Content-Type: text/xml
Date: Fri, 09 Apr 2021 03:14:57 GMT
X-Amzn-Requestid: d2709400-3d6c-49cd-9f09-b3cfc38e287a


-----------------------------------------------------: timestamp=2021-04-09T15:14:57.820+1200
2021-04-09T15:14:57.820+1200 [INFO]  plugin.terraform-provider-aws_v3.35.0_x5: 2021/04/09 15:14:57 [DEBUG] [aws-sdk-go] <GetCallerIdentityResponse xmlns="https://sts.amazonaws.com/doc/2011-06-15/">
  <GetCallerIdentityResult>
    <Arn>arn:aws:sts::[ACCOUNT_ID]:assumed-role/cloudformation/1617937947818477000</Arn>
    <UserId>[USER_ID]:1617937947818477000</UserId>
    <Account>[ACCOUNT_ID]</Account>
  </GetCallerIdentityResult>
  <ResponseMetadata>
    <RequestId>d2709400-3d6c-49cd-9f09-b3cfc38e287a</RequestId>
  </ResponseMetadata>
</GetCallerIdentityResponse>: timestamp=2021-04-09T15:14:57.820+1200
2021-04-09T15:14:57.824+1200 [INFO]  plugin.terraform-provider-aws_v3.35.0_x5: 2021/04/09 15:14:57 [DEBUG] [aws-sdk-go] DEBUG: Request ec2/DescribeAccountAttributes Details:
---[ REQUEST POST-SIGN ]-----------------------------
POST / HTTP/1.1
Host: ec2.us-east-1.amazonaws.com
User-Agent: aws-sdk-go/1.38.6 (go1.16; darwin; amd64) APN/1.0 HashiCorp/1.0 Terraform/0.14.9 (+https://www.terraform.io) terraform-provider-aws/dev (+https://registry.terraform.io/providers/hashicorp/aws)
Content-Length: 87
Authorization: AWS4-HMAC-SHA256 Credential=[REDACTED]/20210409/us-east-1/ec2/aws4_request, SignedHeaders=content-length;content-type;host;x-amz-date;x-amz-security-token, Signature=[REDACTED]
Content-Type: application/x-www-form-urlencoded; charset=utf-8
X-Amz-Date: 20210409T031457Z
X-Amz-Security-Token: [REDACTED]
Accept-Encoding: gzip

Action=DescribeAccountAttributes&AttributeName.1=supported-platforms&Version=2016-11-15
-----------------------------------------------------: timestamp=2021-04-09T15:14:57.824+1200
2021-04-09T15:14:58.702+1200 [INFO]  plugin.terraform-provider-aws_v3.35.0_x5: 2021/04/09 15:14:58 [DEBUG] [aws-sdk-go] DEBUG: Response ec2/DescribeAccountAttributes Details:
---[ RESPONSE ]--------------------------------------
HTTP/1.1 200 OK
Connection: close
Content-Length: 540
Cache-Control: no-cache, no-store
Content-Type: text/xml;charset=UTF-8
Date: Fri, 09 Apr 2021 03:14:58 GMT
Server: AmazonEC2
Strict-Transport-Security: max-age=31536000; includeSubDomains
X-Amzn-Requestid: 1e56584e-97dc-494a-9dfe-6b9bd1e51fe2


-----------------------------------------------------: timestamp=2021-04-09T15:14:58.701+1200
data.aws_s3_bucket_object.challenge_file: Reading...
2021-04-09T15:14:58.702+1200 [INFO]  plugin.terraform-provider-aws_v3.35.0_x5: 2021/04/09 15:14:58 [DEBUG] [aws-sdk-go] <?xml version="1.0" encoding="UTF-8"?>
<DescribeAccountAttributesResponse xmlns="http://ec2.amazonaws.com/doc/2016-11-15/">
    <requestId>1e56584e-97dc-494a-9dfe-6b9bd1e51fe2</requestId>
    <accountAttributeSet>
        <item>
            <attributeName>supported-platforms</attributeName>
            <attributeValueSet>
                <item>
                    <attributeValue>VPC</attributeValue>
                </item>
            </attributeValueSet>
        </item>
    </accountAttributeSet>
</DescribeAccountAttributesResponse>: timestamp=2021-04-09T15:14:58.702+1200
2021-04-09T15:14:58.703+1200 [INFO]  plugin.terraform-provider-aws_v3.35.0_x5: 2021/04/09 15:14:58 [DEBUG] Reading S3 Bucket Object: {
  Bucket: "[BUCKET_NAME]",
  Key: "[ZONE_NAME]/ownership-challenge-2d648752.txt"
}: timestamp=2021-04-09T15:14:58.703+1200
2021-04-09T15:14:58.703+1200 [INFO]  plugin.terraform-provider-aws_v3.35.0_x5: 2021/04/09 15:14:58 [DEBUG] [aws-sdk-go] DEBUG: Request s3/HeadObject Details:
---[ REQUEST POST-SIGN ]-----------------------------
HEAD /[ZONE_NAME]/ownership-challenge-2d648752.txt HTTP/1.1
Host: [BUCKET_NAME].s3.amazonaws.com
User-Agent: aws-sdk-go/1.38.6 (go1.16; darwin; amd64) APN/1.0 HashiCorp/1.0 Terraform/0.14.9 (+https://www.terraform.io) terraform-provider-aws/dev (+https://registry.terraform.io/providers/hashicorp/aws)
Authorization: AWS4-HMAC-SHA256 Credential=[REDACTED]/20210409/us-east-1/s3/aws4_request, SignedHeaders=host;x-amz-content-sha256;x-amz-date;x-amz-security-token, Signature=[REDACTED]
X-Amz-Content-Sha256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
X-Amz-Date: 20210409T031458Z
X-Amz-Security-Token: [REDACTED]


-----------------------------------------------------: timestamp=2021-04-09T15:14:58.703+1200
2021-04-09T15:14:59.587+1200 [INFO]  plugin.terraform-provider-aws_v3.35.0_x5: 2021/04/09 15:14:59 [DEBUG] [aws-sdk-go] DEBUG: Response s3/HeadObject Details:
---[ RESPONSE ]--------------------------------------
HTTP/1.1 200 OK
Connection: close
Content-Length: 400
Accept-Ranges: bytes
Content-Encoding: compress
Content-Type: text/plain
Date: Fri, 09 Apr 2021 03:15:00 GMT
Etag: "d6c2e5acff199508b99309162a956a4d"
Last-Modified: Fri, 09 Apr 2021 03:14:57 GMT
Server: AmazonS3
X-Amz-Expiration: expiry-date="Fri, 09 Apr 2027 00:00:00 GMT", rule-id="MjM4Mjc1YTYtYWUwOS00NzE5LWI0ODItMzg2NWRhYWVmY2Fj"
X-Amz-Id-2: sMsyIzwFJjANhknDdlrvc1sP3TMoaxkRLkGpee4p+mOoMiGukdUWBWK9NyuAtWXAzys/fgASi2U=
X-Amz-Request-Id: Z0G9YNXCM4DKTCH6
X-Amz-Server-Side-Encryption: AES256


-----------------------------------------------------: timestamp=2021-04-09T15:14:59.586+1200
2021-04-09T15:14:59.587+1200 [INFO]  plugin.terraform-provider-aws_v3.35.0_x5: 2021/04/09 15:14:59 [DEBUG] [aws-sdk-go]: timestamp=2021-04-09T15:14:59.586+1200
2021-04-09T15:14:59.587+1200 [INFO]  plugin.terraform-provider-aws_v3.35.0_x5: 2021/04/09 15:14:59 [DEBUG] Received S3 object: {
  AcceptRanges: "bytes",
  ContentEncoding: "compress",
  ContentLength: 400,
  ContentType: "text/plain",
  ETag: "\"d6c2e5acff199508b99309162a956a4d\"",
  Expiration: "expiry-date=\"Fri, 09 Apr 2027 00:00:00 GMT\", rule-id=\"MjM4Mjc1YTYtYWUwOS00NzE5LWI0ODItMzg2NWRhYWVmY2Fj\"",
  LastModified: 2021-04-09 03:14:57 +0000 UTC,
  ServerSideEncryption: "AES256"
}: timestamp=2021-04-09T15:14:59.587+1200
2021-04-09T15:14:59.587+1200 [INFO]  plugin.terraform-provider-aws_v3.35.0_x5: 2021/04/09 15:14:59 [DEBUG] [aws-sdk-go] DEBUG: Request s3/GetObject Details:
---[ REQUEST POST-SIGN ]-----------------------------
GET /[ZONE_NAME]/ownership-challenge-2d648752.txt HTTP/1.1
Host: [BUCKET_NAME].s3.amazonaws.com
User-Agent: aws-sdk-go/1.38.6 (go1.16; darwin; amd64) APN/1.0 HashiCorp/1.0 Terraform/0.14.9 (+https://www.terraform.io) terraform-provider-aws/dev (+https://registry.terraform.io/providers/hashicorp/aws)
Authorization: AWS4-HMAC-SHA256 Credential=[REDACTED]/20210409/us-east-1/s3/aws4_request, SignedHeaders=host;x-amz-content-sha256;x-amz-date;x-amz-security-token, Signature=[REDACTED]
X-Amz-Content-Sha256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
X-Amz-Date: 20210409T031459Z
X-Amz-Security-Token: [REDACTED]
Accept-Encoding: gzip


-----------------------------------------------------: timestamp=2021-04-09T15:14:59.587+1200
2021-04-09T15:15:00.429+1200 [INFO]  plugin.terraform-provider-aws_v3.35.0_x5: 2021/04/09 15:15:00 [DEBUG] [aws-sdk-go] DEBUG: Response s3/GetObject Details:
---[ RESPONSE ]--------------------------------------
HTTP/1.1 200 OK
Connection: close
Content-Length: 400
Accept-Ranges: bytes
Content-Encoding: compress
Content-Type: text/plain
Date: Fri, 09 Apr 2021 03:15:01 GMT
Etag: "d6c2e5acff199508b99309162a956a4d"
Last-Modified: Fri, 09 Apr 2021 03:14:57 GMT
Server: AmazonS3
X-Amz-Expiration: expiry-date="Fri, 09 Apr 2027 00:00:00 GMT", rule-id="MjM4Mjc1YTYtYWUwOS00NzE5LWI0ODItMzg2NWRhYWVmY2Fj"
X-Amz-Id-2: K2pcv5QygaOQoxG07B+WeCEtLlSdi5r+/Vm+Yapcmfp7xrygdO+/ZcEXA04s2c3b/lbN2w6jRgo=
X-Amz-Request-Id: XJJJ9AT8EVESM2K3
X-Amz-Server-Side-Encryption: AES256


-----------------------------------------------------: timestamp=2021-04-09T15:15:00.429+1200
2021-04-09T15:15:00.429+1200 [INFO]  plugin.terraform-provider-aws_v3.35.0_x5: 2021/04/09 15:15:00 [DEBUG] [aws-sdk-go]: timestamp=2021-04-09T15:15:00.429+1200
2021-04-09T15:15:00.430+1200 [INFO]  plugin.terraform-provider-aws_v3.35.0_x5: 2021/04/09 15:15:00 [INFO] Saving 400 bytes from S3 object [BUCKET_NAME]/[ZONE_NAME]/ownership-challenge-2d648752.txt: timestamp=2021-04-09T15:15:00.429+1200
2021-04-09T15:15:00.430+1200 [INFO]  plugin.terraform-provider-aws_v3.35.0_x5: 2021/04/09 15:15:00 [DEBUG] Waiting for state to become: [success]: timestamp=2021-04-09T15:15:00.429+1200
2021-04-09T15:15:00.430+1200 [INFO]  plugin.terraform-provider-aws_v3.35.0_x5: 2021/04/09 15:15:00 [DEBUG] [aws-sdk-go] DEBUG: Request s3/GetObjectTagging Details:
---[ REQUEST POST-SIGN ]-----------------------------
GET /[ZONE_NAME]/ownership-challenge-2d648752.txt?tagging= HTTP/1.1
Host: [BUCKET_NAME].s3.amazonaws.com
User-Agent: aws-sdk-go/1.38.6 (go1.16; darwin; amd64) APN/1.0 HashiCorp/1.0 Terraform/0.14.9 (+https://www.terraform.io) terraform-provider-aws/dev (+https://registry.terraform.io/providers/hashicorp/aws)
Authorization: AWS4-HMAC-SHA256 Credential=[REDACTED]/20210409/us-east-1/s3/aws4_request, SignedHeaders=host;x-amz-content-sha256;x-amz-date;x-amz-security-token, Signature=[REDACTED]
X-Amz-Content-Sha256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
X-Amz-Date: 20210409T031500Z
X-Amz-Security-Token: [REDACTED]
Accept-Encoding: gzip


-----------------------------------------------------: timestamp=2021-04-09T15:15:00.430+1200
2021-04-09T15:15:01.301+1200 [INFO]  plugin.terraform-provider-aws_v3.35.0_x5: 2021/04/09 15:15:01 [DEBUG] [aws-sdk-go] DEBUG: Response s3/GetObjectTagging Details:
---[ RESPONSE ]--------------------------------------
HTTP/1.1 200 OK
Connection: close
Transfer-Encoding: chunked
Date: Fri, 09 Apr 2021 03:15:02 GMT
Server: AmazonS3
X-Amz-Id-2: tzU02yvTENQ3qpSQbYlFfAz3NmdyfJXhGwVICqHB2sHWBLe9Zt+6R+C9gOzxwgn/MKNba3bp3vM=
X-Amz-Request-Id: GQPW1G91ZM4REXB9


-----------------------------------------------------: timestamp=2021-04-09T15:15:01.301+1200
2021-04-09T15:15:01.301+1200 [INFO]  plugin.terraform-provider-aws_v3.35.0_x5: 2021/04/09 15:15:01 [DEBUG] [aws-sdk-go] <?xml version="1.0" encoding="UTF-8"?>
<Tagging xmlns="http://s3.amazonaws.com/doc/2006-03-01/"><TagSet/></Tagging>: timestamp=2021-04-09T15:15:01.301+1200
data.aws_s3_bucket_object.challenge_file: Read complete after 2s [id=[BUCKET_NAME]/[ZONE_NAME]/ownership-challenge-2d648752.txt]
2021-04-09T15:15:01.305+1200 [WARN]  plugin.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = transport is closing"
2021-04-09T15:15:01.309+1200 [DEBUG] plugin: plugin process exited: path=.terraform/providers/registry.terraform.io/hashicorp/aws/3.35.0/darwin_amd64/terraform-provider-aws_v3.35.0_x5 pid=33074
2021-04-09T15:15:01.310+1200 [DEBUG] plugin: plugin exited
cloudflare_logpush_job.http_requests_job: Creating...
2021/04/09 15:15:01 [DEBUG] EvalApply: ProviderMeta config value set
2021/04/09 15:15:01 [DEBUG] cloudflare_logpush_job.http_requests_job: applying the planned Create change
[REDACTED] LastComplete:<nil> LastError:<nil> ErrorMessage:}
2021-04-09T15:15:01.312+1200 [DEBUG] plugin.terraform-provider-cloudflare_v2.19.2: 2021/04/09 15:15:01 [DEBUG] Cloudflare API Request Details:
2021-04-09T15:15:01.312+1200 [DEBUG] plugin.terraform-provider-cloudflare_v2.19.2: ---[ REQUEST ]---------------------------------------
2021-04-09T15:15:01.312+1200 [DEBUG] plugin.terraform-provider-cloudflare_v2.19.2: POST /client/v4/zones/[ZONE_ID]/logpush/jobs HTTP/1.1
2021-04-09T15:15:01.312+1200 [DEBUG] plugin.terraform-provider-cloudflare_v2.19.2: Host: api.cloudflare.com
2021-04-09T15:15:01.312+1200 [DEBUG] plugin.terraform-provider-cloudflare_v2.19.2: User-Agent: HashiCorp Terraform/0.14.9 (+https://www.terraform.io) Terraform Plugin SDK/1.16.0 terraform-provider-cloudflare/2.19.2
2021-04-09T15:15:01.312+1200 [DEBUG] plugin.terraform-provider-cloudflare_v2.19.2: Content-Length: 2048
2021-04-09T15:15:01.312+1200 [DEBUG] plugin.terraform-provider-cloudflare_v2.19.2: Authorization: Bearer [REDACTED]
2021-04-09T15:15:01.312+1200 [DEBUG] plugin.terraform-provider-cloudflare_v2.19.2: Content-Type: application/json
2021-04-09T15:15:01.312+1200 [DEBUG] plugin.terraform-provider-cloudflare_v2.19.2: Accept-Encoding: gzip
2021-04-09T15:15:01.312+1200 [DEBUG] plugin.terraform-provider-cloudflare_v2.19.2:
2021-04-09T15:15:01.312+1200 [DEBUG] plugin.terraform-provider-cloudflare_v2.19.2: {
2021-04-09T15:15:01.312+1200 [DEBUG] plugin.terraform-provider-cloudflare_v2.19.2:  "dataset": "http_requests",
2021-04-09T15:15:01.312+1200 [DEBUG] plugin.terraform-provider-cloudflare_v2.19.2:  "enabled": true,
2021-04-09T15:15:01.312+1200 [DEBUG] plugin.terraform-provider-cloudflare_v2.19.2:  "name": "[ZONE_NAME]",
2021-04-09T15:15:01.312+1200 [DEBUG] plugin.terraform-provider-cloudflare_v2.19.2:  "logpull_options": "fields=CacheCacheStatus,CacheResponseBytes,CacheResponseStatus,CacheTieredFill,ClientASN,ClientCountry,ClientDeviceType,ClientIP,ClientIPClass,ClientMTLSAuthCertFingerprint,ClientMTLSAuthStatus,ClientRequestBytes,ClientRequestHost,ClientRequestMethod,ClientRequestPath,ClientRequestProtocol,ClientRequestReferer,ClientRequestScheme,ClientRequestSource,ClientRequestURI,ClientRequestUserAgent,ClientSSLCipher,ClientSSLProtocol,ClientSrcPort,ClientTCPRTTMs,ClientXRequestedWith,EdgeCFConnectingO2O,EdgeColoCode,EdgeColoID,EdgeEndTimestamp,EdgePathingOp,EdgePathingSrc,EdgePathingStatus,EdgeRateLimitAction,EdgeRateLimitID,EdgeRequestHost,EdgeResponseBodyBytes,EdgeResponseBytes,EdgeResponseCompressionRatio,EdgeResponseContentType,EdgeResponseStatus,EdgeServerIP,EdgeStartTimestamp,EdgeTimeToFirstByteMs,FirewallMatchesActions,FirewallMatchesRuleIDs,FirewallMatchesSources,OriginDNSResponseTimeMs,OriginIP,OriginRequestHeaderSendDurationMs,OriginResponseBytes,OriginResponseDurationMs,OriginResponseHTTPExpires,OriginResponseHTTPLastModified,OriginResponseHeaderReceiveDurationMs,OriginResponseStatus,OriginResponseTime,OriginSSLProtocol,OriginTCPHandshakeDurationMs,OriginTLSHandshakeDurationMs,ParentRayID,RayID,SecurityLevel,SmartRouteColoID,UpperTierColoID,WAFAction,WAFFlags,WAFMatchedVar,WAFProfile,WAFRuleID,WAFRuleMessage,WorkerCPUTime,WorkerStatus,WorkerSubrequest,WorkerSubrequestCount,ZoneID,ZoneName\u0026timestamps=rfc3339",
2021-04-09T15:15:01.312+1200 [DEBUG] plugin.terraform-provider-cloudflare_v2.19.2:  "destination_conf": "s3://[BUCKET_NAME]/[ZONE_NAME]/{DATE}?region=us-east-1",
[REDACTED]"
2021-04-09T15:15:01.312+1200 [DEBUG] plugin.terraform-provider-cloudflare_v2.19.2: }
2021-04-09T15:15:01.312+1200 [DEBUG] plugin.terraform-provider-cloudflare_v2.19.2: -----------------------------------------------------
2021-04-09T15:15:02.138+1200 [DEBUG] plugin.terraform-provider-cloudflare_v2.19.2: 2021/04/09 15:15:02 [DEBUG] Cloudflare API Response Details:
2021-04-09T15:15:02.138+1200 [DEBUG] plugin.terraform-provider-cloudflare_v2.19.2: ---[ RESPONSE ]--------------------------------------
2021-04-09T15:15:02.138+1200 [DEBUG] plugin.terraform-provider-cloudflare_v2.19.2: HTTP/2.0 400 Bad Request
2021-04-09T15:15:02.138+1200 [DEBUG] plugin.terraform-provider-cloudflare_v2.19.2: Cf-Cache-Status: DYNAMIC
2021-04-09T15:15:02.138+1200 [DEBUG] plugin.terraform-provider-cloudflare_v2.19.2: Cf-Ray: 63d0918d6e52fb94-AKL
2021-04-09T15:15:02.138+1200 [DEBUG] plugin.terraform-provider-cloudflare_v2.19.2: Cf-Request-Id: 0956394c5e0000fb94700a8000000001
2021-04-09T15:15:02.138+1200 [DEBUG] plugin.terraform-provider-cloudflare_v2.19.2: Cf-Version: 616-c3df1d9
2021-04-09T15:15:02.138+1200 [DEBUG] plugin.terraform-provider-cloudflare_v2.19.2: Content-Type: application/json
2021-04-09T15:15:02.138+1200 [DEBUG] plugin.terraform-provider-cloudflare_v2.19.2: Date: Fri, 09 Apr 2021 03:15:02 GMT
2021-04-09T15:15:02.138+1200 [DEBUG] plugin.terraform-provider-cloudflare_v2.19.2: Expect-Ct: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
2021-04-09T15:15:02.138+1200 [DEBUG] plugin.terraform-provider-cloudflare_v2.19.2: Server: cloudflare
2021-04-09T15:15:02.138+1200 [DEBUG] plugin.terraform-provider-cloudflare_v2.19.2: Set-Cookie: __cfduid=[REDACTED]; expires=Sun, 09-May-21 03:15:01 GMT; path=/; domain=.api.cloudflare.com; HttpOnly; SameSite=Lax; Secure
2021-04-09T15:15:02.139+1200 [DEBUG] plugin.terraform-provider-cloudflare_v2.19.2: Set-Cookie: __cflb=[REDACTED]; SameSite=Lax; path=/; expires=Fri, 09-Apr-21 05:45:03 GMT; HttpOnly
2021-04-09T15:15:02.139+1200 [DEBUG] plugin.terraform-provider-cloudflare_v2.19.2: Set-Cookie: __cfruid=[REDACTED]; path=/; domain=.api.cloudflare.com; HttpOnly; Secure; SameSite=None
2021-04-09T15:15:02.139+1200 [DEBUG] plugin.terraform-provider-cloudflare_v2.19.2: Vary: Accept-Encoding
2021-04-09T15:15:02.139+1200 [DEBUG] plugin.terraform-provider-cloudflare_v2.19.2: X-Envoy-Upstream-Service-Time: 1
2021-04-09T15:15:02.139+1200 [DEBUG] plugin.terraform-provider-cloudflare_v2.19.2:
2021-04-09T15:15:02.139+1200 [DEBUG] plugin.terraform-provider-cloudflare_v2.19.2: {
2021-04-09T15:15:02.139+1200 [DEBUG] plugin.terraform-provider-cloudflare_v2.19.2:  "errors": [
2021-04-09T15:15:02.139+1200 [DEBUG] plugin.terraform-provider-cloudflare_v2.19.2:   {
2021-04-09T15:15:02.139+1200 [DEBUG] plugin.terraform-provider-cloudflare_v2.19.2:    "code": 1002,
2021-04-09T15:15:02.139+1200 [DEBUG] plugin.terraform-provider-cloudflare_v2.19.2:    "message": "incorrect ownership challenge"
 plugin.terraform-provider-cloudflare_v2.19.2:   }
2021-04-09T15:15:02.139+1200 [DEBUG] plugin.terraform-provider-cloudflare_v2.19.2:  ],
2021-04-09T15:15:02.139+1200 [DEBUG] plugin.terraform-provider-cloudflare_v2.19.2:  "messages": [],
2021-04-09T15:15:02.139+1200 [DEBUG] plugin.terraform-provider-cloudflare_v2.19.2:  "result": null,
2021-04-09T15:15:02.139+1200 [DEBUG] plugin.terraform-provider-cloudflare_v2.19.2:  "success": false
2021-04-09T15:15:02.139+1200 [DEBUG] plugin.terraform-provider-cloudflare_v2.19.2: }
2021-04-09T15:15:02.139+1200 [DEBUG] plugin.terraform-provider-cloudflare_v2.19.2: -----------------------------------------------------
2021/04/09 15:15:02 [DEBUG] cloudflare_logpush_job.http_requests_job: apply errored, but we're indicating that via the Error pointer rather than returning it: error creating logpush job: HTTP status 400: incorrect ownership challenge (1002)
2021/04/09 15:15:02 [DEBUG] Uploading remote state to S3: {
  Body: buffer(0xc0012b0d20),
  Bucket: "[STATE_BUCKET]",
  ContentLength: 2772,
  ContentType: "application/json",
  Key: "logpush/[ZONE_NAME].tfstate"
}
2021/04/09 15:15:02 [DEBUG] [aws-sdk-go] DEBUG: Request s3/PutObject Details:
---[ REQUEST POST-SIGN ]-----------------------------
PUT /logpush/[ZONE_NAME].tfstate HTTP/1.1
Host: [STATE_BUCKET].s3.amazonaws.com
User-Agent: aws-sdk-go/1.37.0 (go1.15.6; darwin; amd64) APN/1.0 HashiCorp/1.0 Terraform/0.14.9
Content-Length: 2772
Authorization: AWS4-HMAC-SHA256 Credential=[REDACTED]/20210409/us-east-1/s3/aws4_request, SignedHeaders=content-length;content-md5;content-type;host;x-amz-content-sha256;x-amz-date;x-amz-security-token, Signature=[REDACTED]
Content-Md5: LGJmymUow+aIW9VIVTi7KQ==
Content-Type: application/json
X-Amz-Content-Sha256: 715af62fa73122cb79a40e03fdaff989313f2c39fb55fcf2ea593f5f0b811428
X-Amz-Date: 20210409T031502Z
X-Amz-Security-Token: [REDACTED]
Accept-Encoding: gzip

{
  "version": 4,
  "terraform_version": "0.14.9",
  "serial": 14,
  "lineage": "a6701f5b-6b49-e334-1bee-de8245a4e909",
  "outputs": {},
  "resources": [
    {
      "mode": "data",
      "type": "aws_s3_bucket_object",
      "name": "challenge_file",
      "provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
      "instances": [
        {
          "schema_version": 0,
          "attributes": {
         "body": "[CHALLENGE_VALUE]",
            "bucket": "[BUCKET_NAME]",
            "cache_control": "",
            "content_disposition": "",
            "content_encoding": "compress",
            "content_language": "",
            "content_length": 400,
            "content_type": "text/plain",
            "etag": "d6c2e5acff199508b99309162a956a4d",
            "expiration": "expiry-date=\"Fri, 09 Apr 2027 00:00:00 GMT\", rule-id=\"MjM4Mjc1YTYtYWUwOS00NzE5LWI0ODItMzg2NWRhYWVmY2Fj\"",
            "expires": "",
            "id": "[BUCKET_NAME]/[ZONE_NAME]/ownership-challenge-2d648752.txt",
            "key": "[ZONE_NAME]/ownership-challenge-2d648752.txt",
            "last_modified": "Fri, 09 Apr 2021 03:14:57 UTC",
            "metadata": {},
            "object_lock_legal_hold_status": "",
            "object_lock_mode": "",
            "object_lock_retain_until_date": "",
            "range": null,
            "server_side_encryption": "AES256",
            "sse_kms_key_id": "",
            "storage_class": "STANDARD",
            "tags": {},
            "version_id": "",
            "website_redirect_location": ""
          },
          "sensitive_attributes": []
        }
      ]
    },
    {
      "mode": "managed",
      "type": "cloudflare_logpush_ownership_challenge",
      "name": "challenge",
      "provider": "provider[\"registry.terraform.io/cloudflare/cloudflare\"]",
      "instances": [
        {
          "schema_version": 0,
          "attributes": {
            "destination_conf": "s3://[BUCKET_NAME]/[ZONE_NAME]?region=us-east-1",
": "[REDACTED]",
            "ownership_challenge_filename": "[ZONE_NAME]/ownership-challenge-2d648752.txt",
            "zone_id": "[ZONE_ID]"
          },
          "sensitive_attributes": [],
          "private": "bnVsbA=="
        }
      ]
    }
  ]
}

-----------------------------------------------------
2021/04/09 15:15:03 [DEBUG] [aws-sdk-go] DEBUG: Response s3/PutObject Details:
---[ RESPONSE ]--------------------------------------
HTTP/1.1 200 OK
Connection: close
Content-Length: 0
Date: Fri, 09 Apr 2021 03:15:04 GMT
Etag: "2c6266ca6528c3e6885bd5485538bb29"
Server: AmazonS3
X-Amz-Id-2: V4Oc3JXJiGyneVZbybxjSSBWXIew0eESsQkUZ7eg4dTSeZd9rv27ydimEgFpz5EZ1ozDf4Kntm4=
X-Amz-Request-Id: 3S9676TR6PTSZPV3
X-Amz-Version-Id: iWHMYa02bJk2RJ_Ts61B3sraWCc__2n7


-----------------------------------------------------
2021/04/09 15:15:03 [DEBUG] [aws-sdk-go]

Error: error creating logpush job: HTTP status 400: incorrect ownership challenge (1002)

  on [ZONE_NAME].tf line 19, in resource "cloudflare_logpush_job" "http_requests_job":
  19: resource "cloudflare_logpush_job" "http_requests_job" {


2021-04-09T15:15:03.258+1200 [WARN]  plugin.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = transport is closing"
2021-04-09T15:15:03.261+1200 [DEBUG] plugin: plugin process exited: path=.terraform/providers/registry.terraform.io/cloudflare/cloudflare/2.19.2/darwin_amd64/terraform-provider-cloudflare_v2.19.2 pid=33075
2021-04-09T15:15:03.261+1200 [DEBUG] plugin: plugin exited

Panic output

None

Expected output

The job to be created successfully.

Actual output

An error was thrown:

Error: error creating logpush job: HTTP status 400: incorrect ownership challenge (1002)

  on main.tf line 19, in resource "cloudflare_logpush_job" "http_requests_job":
  19: resource "cloudflare_logpush_job" "http_requests_job" {

Steps to reproduce

  1. Apply the above config with appropriately configured S3 permissions.
  2. Observe error.

Additional factoids

I have confirmed that the ownership_challenge value sent in the job is identical to the value in the ownership challenge file written to S3.

I've come across two minor documentation issues while working on this:

  1. The example documentation uses a data resource, but references it as if it were a standard resource:
    ownership_challenge = aws_s3_bucket_object.challenge_file.body
    should really read:
    ownership_challenge = data.aws_s3_bucket_object.challenge_file.body

  2. There is no mention of required S3 permissions for the ownership challenge. I've found that this code requires GetObject, PutObject, and GetObjectTagging. It would be helpful if these were documented somewhere.

References

No response

@simpsora simpsora added kind/bug Categorizes issue or PR as related to a bug. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Apr 9, 2021
@jacobbednarz
Copy link
Member

This looks to be similar to #954 (pending an upstream Terraform discussion at hashicorp/terraform-plugin-sdk#706) however yours is slightly different that you get an error for an incorrect ownership challenge value. In other cases, this scenario is returning a Error: "ownership_challenge": required field is not set exception instead.

A workaround I've previously used to fix the attached issue is to apply the change in two steps. One for the challenge and another for the logpush job. A brief but slightly different variant of https://registry.terraform.io/providers/cloudflare/cloudflare/latest/docs/resources/logpush_job#example-usage-manual-inspection-of-s3-bucket. This allows you to remove the dependency chain issue while still keeping your resources managed in code.

I might have a play and see if there is a third way we can document for total automation but I recall coming up empty last time I tried to find a better approach.

As for the documentation issues, I'm open to a PR updating those. For the S3 permissions, it might be best over at the log documentation on developers.cloudflare.com as that runs through all the integrations.

@jacobbednarz
Copy link
Member

I just spun up my old test case for this and it worked 🤷‍♂️ The only thing different is that I had an output at the bottom for debugging.

terraform {
  required_providers {
    cloudflare = {
      source = "cloudflare/cloudflare"
      version = "2.19.2"
    }
    aws = {
      source = "hashicorp/aws"
      version = "3.36.0"
    }
  }
}

resource "cloudflare_logpush_ownership_challenge" "ownership_challenge" {
  zone_id = "0da42c8d2132a9ddaf714f9e7c920711"
  destination_conf = "s3://jb-tf-repro-2?region=us-east-1"
}

data "aws_s3_bucket_object" "challenge_file" {
  bucket = "jb-tf-repro-2"
  key    = cloudflare_logpush_ownership_challenge.ownership_challenge.ownership_challenge_filename
}

resource "cloudflare_logpush_job" "example_job" {
  enabled = true
  zone_id = "0da42c8d2132a9ddaf714f9e7c920711"
  name = "My-logpush-job"
  logpull_options = "fields=RayID,ClientIP,EdgeStartTimestamp&timestamps=rfc3339"
  destination_conf = "s3://jb-tf-repro-2?region=us-east-1"
  ownership_challenge = data.aws_s3_bucket_object.challenge_file.body
  dataset = "http_requests"
}

output "debug_thing" {
  value = data.aws_s3_bucket_object.challenge_file.body
}

Steps I took:

  • Create new AWS S3 bucket
  • Apply IAM policy to said bucket
{
    "Version": "2012-10-17",
    "Id": "Policy1506627184792",
    "Statement": [
        {
            "Sid": "Stmt1506627150918",
            "Effect": "Allow",
            "Principal": {
                "AWS": "arn:aws:iam::391854517948:user/cloudflare-logpush"
            },
            "Action": "s3:PutObject",
            "Resource": "arn:aws:s3:::jb-tf-repro-2/*"
        }
    ]
}
  • Run terraform apply with AWS user credentials + Cloudflare credentials
$ terraform -v
Terraform v0.14.9
+ provider registry.terraform.io/cloudflare/cloudflare v2.19.2
+ provider registry.terraform.io/hashicorp/aws v3.36.0

Your version of Terraform is out of date! The latest version
is 0.14.10. You can update by downloading from https://www.terraform.io/downloads.html

Could you try my test above?

@simpsora
Copy link
Contributor Author

simpsora commented Apr 9, 2021

Unfortunately the two-pass apply doesn't work either, fails for the same reason:

Pass 1, just the challenge and the data source (applies successfully):

$ terraform apply

An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
  + create
 <= read (data resources)

Terraform will perform the following actions:

  # data.aws_s3_bucket_object.challenge_file will be read during apply
  # (config refers to values not yet known)
 <= data "aws_s3_bucket_object" "challenge_file"  {
      + body                          = (known after apply)
      + bucket                        = "[BUCKET_NAME]"
      + cache_control                 = (known after apply)
      + content_disposition           = (known after apply)
      + content_encoding              = (known after apply)
      + content_language              = (known after apply)
      + content_length                = (known after apply)
      + content_type                  = (known after apply)
      + etag                          = (known after apply)
      + expiration                    = (known after apply)
      + expires                       = (known after apply)
      + id                            = (known after apply)
      + key                           = (known after apply)
      + last_modified                 = (known after apply)
      + metadata                      = (known after apply)
      + object_lock_legal_hold_status = (known after apply)
      + object_lock_mode              = (known after apply)
      + object_lock_retain_until_date = (known after apply)
      + server_side_encryption        = (known after apply)
      + sse_kms_key_id                = (known after apply)
      + storage_class                 = (known after apply)
      + tags                          = (known after apply)
      + version_id                    = (known after apply)
      + website_redirect_location     = (known after apply)
    }

  # cloudflare_logpush_ownership_challenge.challenge will be created
  + resource "cloudflare_logpush_ownership_challenge" "challenge" {
      + destination_conf             = "s3://[BUCKET_NAME]/[ZONE_NAME]?region=us-east-1"
      + id                           = (known after apply)
      + ownership_challenge_filename = (known after apply)
      + zone_id                      = "[ZONE_ID]"
    }

Plan: 1 to add, 0 to change, 0 to destroy.

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

cloudflare_logpush_ownership_challenge.challenge: Creating...
cloudflare_logpush_ownership_challenge.challenge: Creation complete after 1s [id=6c6393e110c08d3b1bbb894e8ca148ca]
data.aws_s3_bucket_object.challenge_file: Reading...
data.aws_s3_bucket_object.challenge_file: Read complete after 5s [id=[BUCKET_NAME]/[ZONE_NAME]/ownership-challenge-cec5bfcb.txt]

Apply complete! Resources: 1 added, 0 changed, 0 destroyed.

Pass 2: adding back in the job (fails, same error as before):

$ terraform apply
cloudflare_logpush_ownership_challenge.challenge: Refreshing state... [id=6c6393e110c08d3b1bbb894e8ca148ca]

An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  # cloudflare_logpush_job.http_requests_job will be created
  + resource "cloudflare_logpush_job" "http_requests_job" {
      + dataset             = "http_requests"
      + destination_conf    = "s3://[BUCKET_NAME]/[ZONE_NAME]/{DATE}?region=us-east-1"
      + enabled             = true
      + id                  = (known after apply)
      + logpull_options     = "fields=CacheCacheStatus,CacheResponseBytes,...,ZoneName&timestamps=rfc3339"
      + name                = "[ZONE_NAME]"
      + ownership_challenge = "[REDACTED]"
      + zone_id             = "[ZONE_ID]"
    }

Plan: 1 to add, 0 to change, 0 to destroy.

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

cloudflare_logpush_job.http_requests_job: Creating...

Error: error creating logpush job: HTTP status 400: incorrect ownership challenge (1002)

  on main.tf line 19, in resource "cloudflare_logpush_job" "http_requests_job":
  19: resource "cloudflare_logpush_job" "http_requests_job" {

Again, the value displayed in ownership_challenge above matches what's in the challenge file in S3. I even tried hardcoding that value directly into the definition of the job (thereby getting rid of any terraform dependency shenanigans), and it still fails with the incorrect ownership challenge error.

@jacobbednarz
Copy link
Member

Hmm, this feels like something small is being missed resulting in a weird error. Internally the "incorrect ownership challenge" error message is used only for what you'd think it would be -- when the value it gets via the API doesn't match what it is expecting.

To help iron this out, are you able to try this on a fresh new bucket with my example above and slowly add the components to it? I.e. subdirectory configuration, {DATE} placeholders, etc? I'm wondering if one of those should be handled differently by the provider seeing how my vanilla approach worked.

@jacobbednarz
Copy link
Member

Just an observation, the one of the differences here is that your cloudflare_logpush_ownership_challenge doesn't have {DATE} in the destination configuration.

resource "cloudflare_logpush_ownership_challenge" "challenge" {
  zone_id          = var.cloudflare_zone_id
  destination_conf = "s3://${var.logpush_bucket_name}/${local.zone_name}?region=${var.logpush_bucket_region}"
}

I wonder if this is causing an issue when attempting to validate the new logpush job? Could you make it

destination_conf = "s3://${var.logpush_bucket_name}/${local.zone_name}/{DATE}?region=${var.logpush_bucket_region}"

to match the other destination_conf values?

@jacobbednarz
Copy link
Member

Ah! Bingo. That's it. The destination_conf in the cloudflare_logpush_ownership_challenge resource has to match the cloudflare_logpush_job. Without the matching destination_conf values, the check will fail as it's actually comparing two totally different values. One with s3://a/b{DATE}?region=us-east-1 and the other as s3://a/b?region=us-east-1. If you make these two match, you should be good to go.

@vital4ik
Copy link

@jacobbednarz it does not work for me unless its a 2 step approach still. I am using GCP and logpush job still fails since the dependency is still not respected and file does not exist

@jacobbednarz
Copy link
Member

bugger 😢 S3 is now consistently working for me so I wonder if the GCP side of things needs addressing there instead of in this provider 🤔

@simpsora
Copy link
Contributor Author

@jacobbednarz ah, good catch, that worked for me. I left {DATE} off the challenge as it didn't seem to make sense (e.g. it wouldn't put the challenge file in a date subdirectory), but I guess it does make sense after all.

It's all working for me now, in a single pass. I don't have an explicit dependency order, but Terraform applied them in the correct order (whether coincidently or correctly, I'm not sure).

It may be nice in that upcoming docs PR to also mention that the two values need to be identical. It's sort of obvious in hindsight, but there could be others caught up with this same thing.

@jacobbednarz jacobbednarz added kind/documentation Categorizes issue or PR as related to documentation. triage/accepted Indicates an issue or PR is ready to be actively worked on. and removed kind/bug Categorizes issue or PR as related to a bug. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Apr 11, 2021
@jacobbednarz
Copy link
Member

sure, i've opened #1024 to explicitly call this out.

@vital4ik
Copy link

@jacobbednarz yep, just tried few times, still only works if i comment out logpush job and create t during a second run, see the code below

//creating separate 3 buckers for each log type
resource "google_storage_bucket" "log-storage" {
  for_each = var.logpush-schemas
  project       = var.gcp-project
  name          = "${replace(var.global_zonename,".","-")}-${each.key}"
  location      = "US"
  force_destroy = true
  lifecycle_rule {
    condition {
      age = 365
    }
    action {
      type = "SetStorageClass"
      storage_class = "COLDLINE"
    }
  }
}
//setting up iam for access to storage buckets
resource "google_project_iam_binding" "cf-storageadmin" {
  project                                = var.gcp-project
  role                                   = "roles/storage.objectAdmin"
  members = [
                                         "serviceAccount:[email protected]",
  ]
}
data "google_iam_policy" "cf-storageadmin" {
  depends_on = [google_project_iam_binding.cf-storageadmin]
  binding {
    role = "roles/storage.objectAdmin"
    members = [
      "serviceAccount:[email protected]",
    ]
  }
}
resource "google_storage_bucket_iam_policy" "add-cf-storage-admin" {
  depends_on = [google_storage_bucket.log-storage]
  for_each = var.logpush-schemas
  bucket = google_storage_bucket.log-storage[each.key].name
  policy_data = data.google_iam_policy.cf-storageadmin.policy_data
}
resource "cloudflare_logpush_ownership_challenge" "ownership_challenge_logpush" {
  depends_on = [google_storage_bucket_iam_policy.add-cf-storage-admin]
  for_each = var.logpush-schemas
  zone_id = var.zoneid
  destination_conf = "gs://${replace(var.global_zonename,".","-")}-${each.key}"
}
data "google_storage_bucket_object_content" "challenge_data_logpush" {
  for_each = var.logpush-schemas
  bucket = google_storage_bucket.log-storage[each.key].name
  name = cloudflare_logpush_ownership_challenge.ownership_challenge_logpush[each.key].ownership_challenge_filename
}
resource "cloudflare_logpush_job" "cf_logpush_http-requests" {
  for_each = var.logpush-schemas
  depends_on = [data.google_storage_bucket_object_content.challenge_data_logpush]
  enabled = true
  zone_id = var.zoneid
  name = replace(each.key,"_","-")
  logpull_options = "fields=${each.value[1]}"
  destination_conf = "gs://${google_storage_bucket.log-storage[each.key].name}"
  ownership_challenge =  data.google_storage_bucket_object_content.challenge_data_logpush[each.key].content     //lookup(var.challenges,each.key)
  dataset = each.key
}

@vital4ik
Copy link

if i try to execute all of the above in one run i get teh following:
Error: "ownership_challenge": required field is not set

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/documentation Categorizes issue or PR as related to documentation. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
3 participants