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

Read cloudflare_record resources where type is DNSKEY #2558

Closed
2 tasks done
Cyb3r-Jak3 opened this issue Jun 28, 2023 · 2 comments · Fixed by #2568
Closed
2 tasks done

Read cloudflare_record resources where type is DNSKEY #2558

Cyb3r-Jak3 opened this issue Jun 28, 2023 · 2 comments · Fixed by #2568
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.
Milestone

Comments

@Cyb3r-Jak3
Copy link
Contributor

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 and Cloudflare provider version

Terraform v1.5.0
on windows_amd64

  • provider registry.terraform.io/cloudflare/cloudflare v4.8.0

Affected resource(s)

cloudflare_record

Terraform configuration files

terraform {
  required_providers {
    cloudflare = {
      source  = "cloudflare/cloudflare"
      version = "~> 4"
    }
  }
}
resource "cloudflare_record" "terraform_managed_resource_cde2a1432fd4c975f921e6ea5177b5a9" {
  name    = "<name>"
  proxied = false
  ttl     = 1
  type    = "DNSKEY"
  zone_id = var.zone_id
  data {
    algorithm  = 2
    flags      = 2371
    protocol   = 13
    public_key = "<key>"
  }
}

Link to debug output

https://gist.github.com/Cyb3r-Jak3/dbfe4842ef677254efbbefae8be7b213

Panic output

Stack trace from the terraform-provider-cloudflare_v4.8.0.exe plugin:

panic: interface conversion: interface {} is float64, not string

goroutine 95 [running]:
github.com/cloudflare/terraform-provider-cloudflare/internal/sdkv2provider.transformToCloudflareDNSData({0xc00012a108, 0x6}, {0xc00012a158?, 0x9?}, {0x139a600, 0xc00012a168})
        github.com/cloudflare/terraform-provider-cloudflare/internal/sdkv2provider/resource_cloudflare_record.go:436 +0x505
github.com/cloudflare/terraform-provider-cloudflare/internal/sdkv2provider.resourceCloudflareRecordRead({0x16ecca0, 0xc00045d830}, 0xc00064ea80, {0x15291e0?, 0xc000174780})
        github.com/cloudflare/terraform-provider-cloudflare/internal/sdkv2provider/resource_cloudflare_record.go:221 +0x855
github.com/cloudflare/terraform-provider-cloudflare/internal/sdkv2provider.resourceCloudflareRecordImport({0x16ecca0, 0xc00045d830}, 0xc00064ea80, {0x15291e0?, 0xc000174780?})
        github.com/cloudflare/terraform-provider-cloudflare/internal/sdkv2provider/resource_cloudflare_record.go:396 +0x738
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Provider).ImportState(0xc000090ea0, {0x16ecca0, 0xc00045d830}, 0xc00086f390, {0xc000478000, 0x41})
        github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/provider.go:385 +0x1ac
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ImportResourceState(0xc000009338, {0x16ecca0?, 0xc00045d710?}, 0xc0006100c0)
        github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/grpc_provider.go:1088 +0xf4
github.com/hashicorp/terraform-plugin-mux/tf5to6server.v5tov6Server.ImportResourceState({{0x16f29f0?, 0xc000009338?}}, {0x16ecca0?, 0xc00045d710?}, 0xc0006100a0?)
        github.com/hashicorp/[email protected]/tf5to6server/tf5to6server.go:67 +0xd0
github.com/hashicorp/terraform-plugin-mux/tf6muxserver.muxServer.ImportResourceState({0xc0003b31a0, 0xc0003b3200, {0xc000611480, 0x2, 0x2}, {0x0, 0x0, 0x0}, {0x0, 0x0, ...}, ...}, ...)
        github.com/hashicorp/[email protected]/tf6muxserver/mux_server_ImportResourceState.go:27 +0x102
github.com/hashicorp/terraform-plugin-go/tfprotov6/tf6server.(*server).ImportResourceState(0xc0004cb0e0, {0x16ecca0?, 0xc00045cab0?}, 0xc00046c0f0)
        github.com/hashicorp/[email protected]/tfprotov6/tf6server/server.go:846 +0x1f6
github.com/hashicorp/terraform-plugin-go/tfprotov6/internal/tfplugin6._Provider_ImportResourceState_Handler({0x14f9b20?, 0xc0004cb0e0}, {0x16ecca0, 0xc00045cab0}, 0xc0001ae070, 0x0)
        github.com/hashicorp/[email protected]/tfprotov6/internal/tfplugin6/tfplugin6_grpc.pb.go:437 +0x170
google.golang.org/grpc.(*Server).processUnaryRPC(0xc0004b85a0, {0x16f1978, 0xc0005841a0}, 0xc0004de000, 0xc000433a10, 0x1cf8278, 0x0)
        google.golang.org/[email protected]/server.go:1345 +0xdf3
google.golang.org/grpc.(*Server).handleStream(0xc0004b85a0, {0x16f1978, 0xc0005841a0}, 0xc0004de000, 0x0)
        google.golang.org/[email protected]/server.go:1722 +0xa36
google.golang.org/grpc.(*Server).serveStreams.func1.2()
        google.golang.org/[email protected]/server.go:966 +0x98
created by google.golang.org/grpc.(*Server).serveStreams.func1
        google.golang.org/[email protected]/server.go:964 +0x28a

Error: The terraform-provider-cloudflare_v4.8.0.exe plugin crashed!

Expected output

Able to import DNSKEY record

Actual output

Plugin crashes

Steps to reproduce

  1. Have a DNSKEY record in dashboard
  2. Use cf-terraforming to generate the resource block
  3. Attempt to import.

Additional factoids

Record was generated using cf-terraform

References

Just need to move strings.ToUpper(recordType) == "DNSKEY": to where the CAA type is

https://github.com/cloudflare/terraform-provider-cloudflare/blob/master/internal/sdkv2provider/resource_cloudflare_record.go#L432-L448

@Cyb3r-Jak3 Cyb3r-Jak3 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 Jun 28, 2023
@github-actions
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 Jun 28, 2023
@Cyb3r-Jak3 Cyb3r-Jak3 changed the title Unable to import cloudflare_record where type is DNSKEY Read cloudflare_record resources where type is DNSKEY Jun 30, 2023
@github-actions github-actions bot added this to the v4.10.0 milestone Jul 7, 2023
@github-actions
Copy link
Contributor

This functionality has been released in v4.10.0 of the Terraform Cloudflare Provider.

Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 12, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
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

Successfully merging a pull request may close this issue.

1 participant