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 crashes when trying to import DNS records into state #4883

Closed
3 tasks done
deipra-sf opened this issue Jan 14, 2025 · 4 comments
Closed
3 tasks done

Plugin crashes when trying to import DNS records into state #4883

deipra-sf opened this issue Jan 14, 2025 · 4 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

@deipra-sf
Copy link

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

Provider version: v5.0.0-rc1
Terraform: v1.10.4

Affected resource(s)

cloudflare_dns_record

Terraform configuration files

variable "dns_a_proxied" {
  type = set(string)
  default = [
    # General
    "example1",
    "example2"
  ]
}

resource "cloudflare_dns_record" "dns_record_a_proxied" {
  for_each = var.dns_a_proxied
  zone_id = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
  content   = "x.x.x.x"
  name = each.value
  proxied = true
  ttl = 1
  type = "A"
  tags = ["env:common"]
}

Link to debug output

https://gist.github.com/deipra-sf/792208dc5bb0439d9e6ab1b4383afccd

Panic output

panic: runtime error: invalid memory address or nil pointer dereference

Expected output

Successful import

Actual output

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

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

goroutine 40 [running]:
github.com/cloudflare/terraform-provider-cloudflare/internal/services/dns_record.(*DNSRecordResource).ImportState(0xc000f38000, {0x4388e08, 0xc000ec7530}, {{0xc00097e1e0?, 0x3e5a3d1?}, {0x2d?}}, 0xc000e64180)
        github.com/cloudflare/terraform-provider-cloudflare/internal/services/dns_record/resource.go:236 +0x1f0
github.com/hashicorp/terraform-plugin-framework/internal/fwserver.(*Server).ImportResourceState(0xc0001b3b08, {0x4388e08, 0xc000ec7530}, 0xc000dc8150, 0xc0001455f8)
        github.com/hashicorp/[email protected]/internal/fwserver/server_importresourcestate.go:136 +0x7ec
github.com/hashicorp/terraform-plugin-framework/internal/proto6server.(*Server).ImportResourceState(0xc0001b3b08, {0x4388e08?, 0xc000ec7440?}, 0xc000ec73e0)
        github.com/hashicorp/[email protected]/internal/proto6server/server_importresourcestate.go:47 +0x2a5
github.com/hashicorp/terraform-plugin-go/tfprotov6/tf6server.(*server).ImportResourceState(0xc00016c8c0, {0x4388e08?, 0xc000ec6a50?}, 0xc0009352c0)
        github.com/hashicorp/[email protected]/tfprotov6/tf6server/server.go:896 +0x24d
github.com/hashicorp/terraform-plugin-go/tfprotov6/internal/tfplugin6._Provider_ImportResourceState_Handler({0x3d977c0, 0xc00016c8c0}, {0x4388e08, 0xc000ec6a50}, 0xc000929c80, 0x0)
        github.com/hashicorp/[email protected]/tfprotov6/internal/tfplugin6/tfplugin6_grpc.pb.go:629 +0x1a6
google.golang.org/grpc.(*Server).processUnaryRPC(0xc0001d8e00, {0x4388e08, 0xc000ec69c0}, {0x4419e60, 0xc0001a1520}, 0xc000e3e000, 0xc000d44180, 0x76887d0, 0x0)
        google.golang.org/[email protected]/server.go:1394 +0xe2b
google.golang.org/grpc.(*Server).handleStream(0xc0001d8e00, {0x4419e60, 0xc0001a1520}, 0xc000e3e000)
        google.golang.org/[email protected]/server.go:1805 +0xe8b
google.golang.org/grpc.(*Server).serveStreams.func2.1()
        google.golang.org/[email protected]/server.go:1029 +0x7f
created by google.golang.org/grpc.(*Server).serveStreams.func2 in goroutine 16
        google.golang.org/[email protected]/server.go:1040 +0x125

Error: The terraform-provider-cloudflare_v5.0.0-rc1 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.

Steps to reproduce

  1. Have an existing DNS record in Cloudflare
  2. Create resources that includes the same DNS record
  3. Attempt to import DNS resource to terraform state
  4. panic

Additional factoids

No response

References

No response

@deipra-sf deipra-sf 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 Jan 14, 2025
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 Jan 14, 2025
@mmoscher
Copy link

Same issue for me, if helpful I could share a stack trace as well (looks identically excepting memory addresses)

@jacobbednarz
Copy link
Member

this has been fixed on next - c621c11. feel free to pull that down, build a custom provider and give it a go.

@deipra-sf
Copy link
Author

That solved the issue, thanks. Any idea when this change will hit the next release?

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

3 participants