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

Plugin crash importing cloudflare_dns_record in v5.0.0-alpha1 #4130

Closed
3 tasks done
rwgnr opened this issue Sep 26, 2024 · 2 comments
Closed
3 tasks done

Plugin crash importing cloudflare_dns_record in v5.0.0-alpha1 #4130

rwgnr opened this issue Sep 26, 2024 · 2 comments
Labels
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. triage/debug-log-attached Indicates an issue or PR has a complete Terraform debug log.

Comments

@rwgnr
Copy link

rwgnr commented Sep 26, 2024

Confirmation

  • This is a bug with an existing resource and is not a feature request or enhancement. Feature requests should be submitted with Cloudflare Support or your account team.
  • I have searched the issue tracker and my issue isn't already found.
  • I have replicated my issue using the latest version of the provider and it is still present.

Terraform and Cloudflare provider version

Terraform v1.8.3
on linux_amd64

  • provider registry.terraform.io/cloudflare/cloudflare v5.0.0-alpha1

Affected resource(s)

cloudflare_dns_record

Terraform configuration files

terraform {
  required_providers {
    cloudflare = {
      source  = "cloudflare/cloudflare"
      version = "5.0.0-alpha1"
    }
  }
}

provider "cloudflare" {}

resource "cloudflare_dns_record" "example" {
  zone_id = "foo"
  type    = "CNAME"
  name    = "www.example.com"
  content = "1.1.1.1"
  proxied = false
  comment = ""
  tags    = []
  ttl     = 86400
}

import {
  to = cloudflare_dns_record.example
  id = "foo/bar"
}

Link to debug output

https://gist.github.com/rwgnr/d1a97c5ed1335de1c2487057ca13a2c2

Panic output

2024-09-26T15:27:30.499-0500 [INFO] Terraform version: 1.8.3
2024-09-26T15:27:30.500-0500 [DEBUG] using github.com/hashicorp/go-tfe v1.51.0
2024-09-26T15:27:30.500-0500 [DEBUG] using github.com/hashicorp/hcl/v2 v2.20.0
2024-09-26T15:27:30.500-0500 [DEBUG] using github.com/hashicorp/terraform-svchost v0.1.1
2024-09-26T15:27:30.500-0500 [DEBUG] using github.com/zclconf/go-cty v1.14.3
2024-09-26T15:27:30.500-0500 [INFO] Go runtime version: go1.22.1
2024-09-26T15:27:30.500-0500 [INFO] CLI args: []string{"terraform", "plan"}
2024-09-26T15:27:30.500-0500 [DEBUG] Attempting to open CLI config file: /home/redacted/.terraformrc
2024-09-26T15:27:30.500-0500 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2024-09-26T15:27:30.500-0500 [INFO] Loading CLI configuration from /home/redacted/.terraform.d/credentials.tfrc.json
2024-09-26T15:27:30.503-0500 [DEBUG] ignoring non-existing provider search directory terraform.d/plugins
2024-09-26T15:27:30.503-0500 [DEBUG] ignoring non-existing provider search directory /home/redacted/.terraform.d/plugins
2024-09-26T15:27:30.503-0500 [DEBUG] ignoring non-existing provider search directory /home/redacted/.local/share/terraform/plugins
2024-09-26T15:27:30.503-0500 [DEBUG] ignoring non-existing provider search directory /usr/local/share/terraform/plugins
2024-09-26T15:27:30.503-0500 [DEBUG] ignoring non-existing provider search directory /usr/share/terraform/plugins
2024-09-26T15:27:30.503-0500 [DEBUG] ignoring non-existing provider search directory /var/lib/snapd/desktop/terraform/plugins
2024-09-26T15:27:30.506-0500 [INFO] CLI command args: []string{"plan"}
2024-09-26T15:27:30.530-0500 [DEBUG] New state was assigned lineage "f597840f-220c-224c-fd06-efba301a9424"
2024-09-26T15:27:31.448-0500 [DEBUG] checking for provisioner in "."
2024-09-26T15:27:31.461-0500 [DEBUG] checking for provisioner in "/usr/bin"
2024-09-26T15:27:31.472-0500 [INFO] backend/local: starting Plan operation
2024-09-26T15:27:31.517-0500 [DEBUG] created provider logger: level=debug
2024-09-26T15:27:31.522-0500 [INFO] provider: configuring client automatic mTLS
2024-09-26T15:27:31.529-0500 [DEBUG] provider: starting plugin: path=.terraform/providers/registry.terraform.io/cloudflare/cloudflare/5.0.0-alpha1/linux_amd64/terraform-provider-cloudflare_v5.0.0-alpha1 args=[".terraform/providers/registry.terraform.io/cloudflare/cloudflare/5.0.0-alpha1/linux_amd64/terraform-provider-cloudflare_v5.0.0-alpha1"]
2024-09-26T15:27:31.539-0500 [DEBUG] provider: plugin started: path=.terraform/providers/registry.terraform.io/cloudflare/cloudflare/5.0.0-alpha1/linux_amd64/terraform-provider-cloudflare_v5.0.0-alpha1 pid=18956
2024-09-26T15:27:31.539-0500 [DEBUG] provider: waiting for RPC address: path=.terraform/providers/registry.terraform.io/cloudflare/cloudflare/5.0.0-alpha1/linux_amd64/terraform-provider-cloudflare_v5.0.0-alpha1
2024-09-26T15:27:32.488-0500 [INFO] provider.terraform-provider-cloudflare_v5.0.0-alpha1: configuring server automatic mTLS: timestamp=2024-09-26T15:27:32.488-0500
2024-09-26T15:27:32.506-0500 [DEBUG] provider.terraform-provider-cloudflare_v5.0.0-alpha1: plugin address: address=/tmp/plugin3197124194 network=unix timestamp=2024-09-26T15:27:32.505-0500
2024-09-26T15:27:32.506-0500 [DEBUG] provider: using plugin: version=6
2024-09-26T15:27:33.517-0500 [DEBUG] No provider meta schema returned
2024-09-26T15:27:33.527-0500 [DEBUG] provider.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = error reading from server: EOF"
2024-09-26T15:27:33.533-0500 [DEBUG] provider: plugin process exited: path=.terraform/providers/registry.terraform.io/cloudflare/cloudflare/5.0.0-alpha1/linux_amd64/terraform-provider-cloudflare_v5.0.0-alpha1 pid=18956
2024-09-26T15:27:33.533-0500 [DEBUG] provider: plugin exited
2024-09-26T15:27:33.535-0500 [DEBUG] Building and walking validate graph
2024-09-26T15:27:33.537-0500 [DEBUG] ProviderTransformer: "cloudflare_dns_record.example" (*terraform.NodeValidatableResource) needs provider["registry.terraform.io/cloudflare/cloudflare"]
2024-09-26T15:27:33.537-0500 [DEBUG] ReferenceTransformer: "cloudflare_dns_record.example" references: []
2024-09-26T15:27:33.537-0500 [DEBUG] ReferenceTransformer: "provider["registry.terraform.io/cloudflare/cloudflare"]" references: []
2024-09-26T15:27:33.537-0500 [DEBUG] Starting graph walk: walkValidate
2024-09-26T15:27:33.548-0500 [DEBUG] created provider logger: level=debug
2024-09-26T15:27:33.548-0500 [INFO] provider: configuring client automatic mTLS
2024-09-26T15:27:33.551-0500 [DEBUG] provider: starting plugin: path=.terraform/providers/registry.terraform.io/cloudflare/cloudflare/5.0.0-alpha1/linux_amd64/terraform-provider-cloudflare_v5.0.0-alpha1 args=[".terraform/providers/registry.terraform.io/cloudflare/cloudflare/5.0.0-alpha1/linux_amd64/terraform-provider-cloudflare_v5.0.0-alpha1"]
2024-09-26T15:27:33.559-0500 [DEBUG] provider: plugin started: path=.terraform/providers/registry.terraform.io/cloudflare/cloudflare/5.0.0-alpha1/linux_amd64/terraform-provider-cloudflare_v5.0.0-alpha1 pid=18978
2024-09-26T15:27:33.560-0500 [DEBUG] provider: waiting for RPC address: path=.terraform/providers/registry.terraform.io/cloudflare/cloudflare/5.0.0-alpha1/linux_amd64/terraform-provider-cloudflare_v5.0.0-alpha1
2024-09-26T15:27:34.237-0500 [INFO] provider.terraform-provider-cloudflare_v5.0.0-alpha1: configuring server automatic mTLS: timestamp=2024-09-26T15:27:34.237-0500
2024-09-26T15:27:34.262-0500 [DEBUG] provider.terraform-provider-cloudflare_v5.0.0-alpha1: plugin address: address=/tmp/plugin33131820 network=unix timestamp=2024-09-26T15:27:34.262-0500
2024-09-26T15:27:34.262-0500 [DEBUG] provider: using plugin: version=6
2024-09-26T15:27:34.296-0500 [DEBUG] skipping FixUpBlockAttrs
2024-09-26T15:27:34.636-0500 [DEBUG] provider.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = error reading from server: EOF"
2024-09-26T15:27:34.640-0500 [DEBUG] provider: plugin process exited: path=.terraform/providers/registry.terraform.io/cloudflare/cloudflare/5.0.0-alpha1/linux_amd64/terraform-provider-cloudflare_v5.0.0-alpha1 pid=18978
2024-09-26T15:27:34.640-0500 [DEBUG] provider: plugin exited
2024-09-26T15:27:34.640-0500 [INFO] backend/local: plan calling Plan
2024-09-26T15:27:34.640-0500 [DEBUG] Building and walking plan graph for NormalMode
2024-09-26T15:27:34.642-0500 [DEBUG] ProviderTransformer: "cloudflare_dns_record.example (expand)" (*terraform.nodeExpandPlannableResource) needs provider["registry.terraform.io/cloudflare/cloudflare"]
2024-09-26T15:27:34.642-0500 [DEBUG] ReferenceTransformer: "cloudflare_dns_record.example (expand)" references: []
2024-09-26T15:27:34.642-0500 [DEBUG] ReferenceTransformer: "provider["registry.terraform.io/cloudflare/cloudflare"]" references: []
2024-09-26T15:27:34.642-0500 [DEBUG] Starting graph walk: walkPlan
2024-09-26T15:27:34.652-0500 [DEBUG] created provider logger: level=debug
2024-09-26T15:27:34.652-0500 [INFO] provider: configuring client automatic mTLS
2024-09-26T15:27:34.654-0500 [DEBUG] provider: starting plugin: path=.terraform/providers/registry.terraform.io/cloudflare/cloudflare/5.0.0-alpha1/linux_amd64/terraform-provider-cloudflare_v5.0.0-alpha1 args=[".terraform/providers/registry.terraform.io/cloudflare/cloudflare/5.0.0-alpha1/linux_amd64/terraform-provider-cloudflare_v5.0.0-alpha1"]
2024-09-26T15:27:34.663-0500 [DEBUG] provider: plugin started: path=.terraform/providers/registry.terraform.io/cloudflare/cloudflare/5.0.0-alpha1/linux_amd64/terraform-provider-cloudflare_v5.0.0-alpha1 pid=18999
2024-09-26T15:27:34.663-0500 [DEBUG] provider: waiting for RPC address: path=.terraform/providers/registry.terraform.io/cloudflare/cloudflare/5.0.0-alpha1/linux_amd64/terraform-provider-cloudflare_v5.0.0-alpha1
2024-09-26T15:27:35.393-0500 [INFO] provider.terraform-provider-cloudflare_v5.0.0-alpha1: configuring server automatic mTLS: timestamp=2024-09-26T15:27:35.393-0500
2024-09-26T15:27:35.414-0500 [DEBUG] provider.terraform-provider-cloudflare_v5.0.0-alpha1: plugin address: network=unix address=/tmp/plugin3078070743 timestamp=2024-09-26T15:27:35.414-0500
2024-09-26T15:27:35.415-0500 [DEBUG] provider: using plugin: version=6
2024-09-26T15:27:35.552-0500 [DEBUG] Resource instance state not found for node "cloudflare_dns_record.example", instance cloudflare_dns_record.example
2024-09-26T15:27:35.552-0500 [DEBUG] ReferenceTransformer: "cloudflare_dns_record.example" references: []
cloudflare_dns_record.example: Preparing import... [id=foo/bar]
2024-09-26T15:27:35.917-0500 [DEBUG] provider.terraform-provider-cloudflare_v5.0.0-alpha1: panic: runtime error: invalid memory address or nil pointer dereference
2024-09-26T15:27:35.917-0500 [DEBUG] provider.terraform-provider-cloudflare_v5.0.0-alpha1: [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x101121e]
2024-09-26T15:27:35.917-0500 [DEBUG] provider.terraform-provider-cloudflare_v5.0.0-alpha1
2024-09-26T15:27:35.917-0500 [DEBUG] provider.terraform-provider-cloudflare_v5.0.0-alpha1: goroutine 45 [running]:
2024-09-26T15:27:35.926-0500 [DEBUG] provider.terraform-provider-cloudflare_v5.0.0-alpha1: github.com/cloudflare/terraform-provider-cloudflare/internal/services/dns_record.(*DNSRecordResource).ImportState(0xc0000d0790, {0x3393778, 0xc000d15920}, {{0xc000d26050?, 0x2f3c87d?}, {0x2d?}}, 0xc0000f9b00)
2024-09-26T15:27:35.926-0500 [DEBUG] provider.terraform-provider-cloudflare_v5.0.0-alpha1: github.com/cloudflare/terraform-provider-cloudflare/internal/services/dns_record/resource.go:231 +0x21e
2024-09-26T15:27:35.926-0500 [DEBUG] provider.terraform-provider-cloudflare_v5.0.0-alpha1: github.com/hashicorp/terraform-plugin-framework/internal/fwserver.(*Server).ImportResourceState(0xc000b96000, {0x3393778, 0xc000d15920}, 0xc0002259d0, 0xc000bc3688)
2024-09-26T15:27:35.926-0500 [DEBUG] provider.terraform-provider-cloudflare_v5.0.0-alpha1: github.com/hashicorp/terraform-plugin-framework@v1.9.0/internal/fwserver/server_importresourcestate.go:136 +0x7d4
2024-09-26T15:27:35.926-0500 [DEBUG] provider.terraform-provider-cloudflare_v5.0.0-alpha1: github.com/hashicorp/terraform-plugin-framework/internal/proto6server.(*Server).ImportResourceState(0xc000b96000, {0x3393778?, 0xc000d15830?}, 0xc000d157d0)
2024-09-26T15:27:35.926-0500 [DEBUG] provider.terraform-provider-cloudflare_v5.0.0-alpha1: github.com/hashicorp/terraform-plugin-framework@v1.9.0/internal/proto6server/server_importresourcestate.go:47 +0x2a5
2024-09-26T15:27:35.926-0500 [DEBUG] provider.terraform-provider-cloudflare_v5.0.0-alpha1: github.com/hashicorp/terraform-plugin-go/tfprotov6/tf6server.(*server).ImportResourceState(0xc0001fa1e0, {0x3393778?, 0xc000d14e70?}, 0xc00011c4b0)
2024-09-26T15:27:35.926-0500 [DEBUG] provider.terraform-provider-cloudflare_v5.0.0-alpha1: github.com/hashicorp/terraform-plugin-go@v0.23.0/tfprotov6/tf6server/server.go:896 +0x265
2024-09-26T15:27:35.926-0500 [DEBUG] provider.terraform-provider-cloudflare_v5.0.0-alpha1: github.com/hashicorp/terraform-plugin-go/tfprotov6/internal/tfplugin6._Provider_ImportResourceState_Handler({0x2e309a0, 0xc0001fa1e0}, {0x3393778, 0xc000d14e70}, 0xc000030880, 0x0)
2024-09-26T15:27:35.926-0500 [DEBUG] provider.terraform-provider-cloudflare_v5.0.0-alpha1: github.com/hashicorp/terraform-plugin-go@v0.23.0/tfprotov6/internal/tfplugin6/tfplugin6_grpc.pb.go:536 +0x1a6
2024-09-26T15:27:35.926-0500 [DEBUG] provider.terraform-provider-cloudflare_v5.0.0-alpha1: google.golang.org/grpc.(*Server).processUnaryRPC(0xc000b92000, {0x3393778, 0xc000d14de0}, {0x33f8800, 0xc000c6e000}, 0xc000d3d9e0, 0xc000b98060, 0x584e1d0, 0x0)
2024-09-26T15:27:35.926-0500 [DEBUG] provider.terraform-provider-cloudflare_v5.0.0-alpha1: google.golang.org/grpc@v1.63.2/server.go:1369 +0xdf8
2024-09-26T15:27:35.926-0500 [DEBUG] provider.terraform-provider-cloudflare_v5.0.0-alpha1: google.golang.org/grpc.(*Server).handleStream(0xc000b92000, {0x33f8800, 0xc000c6e000}, 0xc000d3d9e0)
2024-09-26T15:27:35.926-0500 [DEBUG] provider.terraform-provider-cloudflare_v5.0.0-alpha1: google.golang.org/grpc@v1.63.2/server.go:1780 +0xe8b
2024-09-26T15:27:35.926-0500 [DEBUG] provider.terraform-provider-cloudflare_v5.0.0-alpha1: google.golang.org/grpc.(*Server).serveStreams.func2.1()
2024-09-26T15:27:35.926-0500 [DEBUG] provider.terraform-provider-cloudflare_v5.0.0-alpha1: google.golang.org/grpc@v1.63.2/server.go:1019 +0x8b
2024-09-26T15:27:35.926-0500 [DEBUG] provider.terraform-provider-cloudflare_v5.0.0-alpha1: created by google.golang.org/grpc.(*Server).serveStreams.func2 in goroutine 67
2024-09-26T15:27:35.926-0500 [DEBUG] provider.terraform-provider-cloudflare_v5.0.0-alpha1: google.golang.org/grpc@v1.63.2/server.go:1030 +0x125
2024-09-26T15:27:35.927-0500 [DEBUG] provider.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = error reading from server: EOF"
2024-09-26T15:27:35.928-0500 [ERROR] plugin6.(*GRPCProvider).ImportResourceState: error="rpc error: code = Unavailable desc = error reading from server: EOF"
2024-09-26T15:27:35.929-0500 [ERROR] vertex "cloudflare_dns_record.example" error: Plugin did not respond
2024-09-26T15:27:35.929-0500 [ERROR] vertex "cloudflare_dns_record.example (expand)" error: Plugin did not respond
2024-09-26T15:27:35.929-0500 [WARN] Planning encountered errors, so plan is not applyable
2024-09-26T15:27:35.929-0500 [INFO] backend/local: plan operation completed
2024-09-26T15:27:35.930-0500 [DEBUG] provider: plugin process exited: path=.terraform/providers/registry.terraform.io/cloudflare/cloudflare/5.0.0-alpha1/linux_amd64/terraform-provider-cloudflare_v5.0.0-alpha1 pid=18999 error="exit status 2"

Planning failed. Terraform encountered an error while generating this plan.


│ Error: Plugin did not respond

│ The plugin encountered an error, and failed to respond to the plugin6.(*GRPCProvider).ImportResourceState call. The plugin logs may contain more details.

Stack trace from the terraform-provider-cloudflare_v5.0.0-alpha1 plugin:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x101121e]

goroutine 45 [running]:
github.com/cloudflare/terraform-provider-cloudflare/internal/services/dns_record.(*DNSRecordResource).ImportState(0xc0000d0790, {0x3393778, 0xc000d15920}, {{0xc000d26050?, 0x2f3c87d?}, {0x2d?}}, 0xc0000f9b00)
github.com/cloudflare/terraform-provider-cloudflare/internal/services/dns_record/resource.go:231 +0x21e
github.com/hashicorp/terraform-plugin-framework/internal/fwserver.(*Server).ImportResourceState(0xc000b96000, {0x3393778, 0xc000d15920}, 0xc0002259d0, 0xc000bc3688)
github.com/hashicorp/terraform-plugin-framework@v1.9.0/internal/fwserver/server_importresourcestate.go:136 +0x7d4
github.com/hashicorp/terraform-plugin-framework/internal/proto6server.(*Server).ImportResourceState(0xc000b96000, {0x3393778?, 0xc000d15830?}, 0xc000d157d0)
github.com/hashicorp/terraform-plugin-framework@v1.9.0/internal/proto6server/server_importresourcestate.go:47 +0x2a5
github.com/hashicorp/terraform-plugin-go/tfprotov6/tf6server.(*server).ImportResourceState(0xc0001fa1e0, {0x3393778?, 0xc000d14e70?}, 0xc00011c4b0)
github.com/hashicorp/terraform-plugin-go@v0.23.0/tfprotov6/tf6server/server.go:896 +0x265
github.com/hashicorp/terraform-plugin-go/tfprotov6/internal/tfplugin6._Provider_ImportResourceState_Handler({0x2e309a0, 0xc0001fa1e0}, {0x3393778, 0xc000d14e70}, 0xc000030880, 0x0)
github.com/hashicorp/terraform-plugin-go@v0.23.0/tfprotov6/internal/tfplugin6/tfplugin6_grpc.pb.go:536 +0x1a6
google.golang.org/grpc.(*Server).processUnaryRPC(0xc000b92000, {0x3393778, 0xc000d14de0}, {0x33f8800, 0xc000c6e000}, 0xc000d3d9e0, 0xc000b98060, 0x584e1d0, 0x0)
google.golang.org/grpc@v1.63.2/server.go:1369 +0xdf8
google.golang.org/grpc.(*Server).handleStream(0xc000b92000, {0x33f8800, 0xc000c6e000}, 0xc000d3d9e0)
google.golang.org/grpc@v1.63.2/server.go:1780 +0xe8b
google.golang.org/grpc.(*Server).serveStreams.func2.1()
google.golang.org/grpc@v1.63.2/server.go:1019 +0x8b
created by google.golang.org/grpc.(*Server).serveStreams.func2 in goroutine 67
google.golang.org/grpc@v1.63.2/server.go:1030 +0x125

Error: The terraform-provider-cloudflare_v5.0.0-alpha1 plugin crashed!

This is always indicative of a bug within the plugin. It would be immensely
helpful if you could report the crash with the plugin's maintainers so that it
can be fixed. The output above should help diagnose the issue.

2024-09-26T15:27:35.939-0500 [DEBUG] provider: plugin exited

Expected output

Import of the DNS record into state

Actual output

Plugin crashed

Steps to reproduce

  1. Create DNS record in Cloudflare outside of Terraform
  2. Attempt to import that existing DNS record into Terraform

Additional factoids

No response

References

No response

@rwgnr rwgnr 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 Sep 26, 2024
Copy link
Contributor

Community Note

Voting for Prioritization

  • Please vote on this issue by adding a 👍 reaction to the original post to help the community and maintainers prioritize this request.
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.

Volunteering to Work on This Issue

  • If you are interested in working on this issue, please leave a comment.
  • If this would be your first contribution, please review the contribution guide.

@github-actions github-actions bot added the triage/debug-log-attached Indicates an issue or PR has a complete Terraform debug log. label Sep 26, 2024
@jacobbednarz jacobbednarz closed this as not planned Won't fix, can't repro, duplicate, stale Sep 26, 2024
@jacobbednarz
Copy link
Member

importing is not yet fully supported in the alpha. it will be improved as we get closer to general availability.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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. triage/debug-log-attached Indicates an issue or PR has a complete Terraform debug log.
Projects
None yet
Development

No branches or pull requests

2 participants