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

CNAME with two trailing dots causes SIGSEGV #243

Open
1 task done
dh-apporto opened this issue Nov 15, 2022 · 0 comments
Open
1 task done

CNAME with two trailing dots causes SIGSEGV #243

dh-apporto opened this issue Nov 15, 2022 · 0 comments
Labels

Comments

@dh-apporto
Copy link

Terraform CLI and Provider Versions

Terraform v1.1.0
on linux_amd64

  • provider registry.terraform.io/hashicorp/aws v4.39.0

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

Terraform Configuration

resource "dns_cname_record" "cname_dns_endpoints" {
  for_each =  local.cname_dns_endpoints

  zone    = "${var.dns_zone}."
  name    = each.key
  ttl     = var.ttl
  cname   = "${each.value.endpoints[0]}."
}

Expected Behavior

On configuration error, I would expect a message to be displayed saying the configuration requested is invalid.

Actual Behavior

I added the trailing dot twice in my configuration (once in the values file, and then in the module, I also added the trailing dot).

NOTE: it also skipped all requests even though only the CNAME was bad.

SIGSEGV is generated:

    <snip>

  # dns_cname_record.cname_dns_endpoints["ccv-hyperstream"] will be created
  + resource "dns_cname_record" "cname_dns_endpoints" {
      + cname = "CCV-HYPERSTREAM-GEN1-LB-14194968.us-east-1.elb.amazonaws.com.."
      + id    = (known after apply)
      + name  = "ccv-hyperstream"
      + ttl   = 300
      + zone  = "bobdobbs.com."
    }

Plan: 3 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

dns_cname_record.cname_dns_endpoints["ccv-hyperstream"]: Creating...
dns_a_record_set.a_dns_endpoints["ccv-hypers-1-srv01"]: Creating...
dns_a_record_set.a_dns_endpoints["ccv-hypers-1-srv02"]: Creating...
╷
│ Error: Request cancelled
│ 
│   with dns_a_record_set.a_dns_endpoints["ccv-hypers-1-srv02"],
│   on main.tf line 1, in resource "dns_a_record_set" "a_dns_endpoints":
│    1: resource "dns_a_record_set" "a_dns_endpoints" {
│ 
│ The plugin.(*GRPCProvider).ApplyResourceChange request was cancelled.
╵
╷
│ Error: Request cancelled
│ 
│   with dns_a_record_set.a_dns_endpoints["ccv-hypers-1-srv01"],
│   on main.tf line 1, in resource "dns_a_record_set" "a_dns_endpoints":
│    1: resource "dns_a_record_set" "a_dns_endpoints" {
│ 
│ The plugin.(*GRPCProvider).ApplyResourceChange request was cancelled.
╵
╷
│ Error: Request cancelled
│ 
│   with dns_cname_record.cname_dns_endpoints["ccv-hyperstream"],
│   on main.tf line 10, in resource "dns_cname_record" "cname_dns_endpoints":
│   10: resource "dns_cname_record" "cname_dns_endpoints" {
│ 
│ The plugin.(*GRPCProvider).ApplyResourceChange request was cancelled.
╵

Stack trace from the terraform-provider-dns_v3.2.3_x5 plugin:

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

goroutine 14 [running]:
github.com/miekg/dns.(*Msg).Insert(0xc0001e7cb0, 0xc0003cd128, 0x1, 0x1)
	github.com/miekg/[email protected]/update.go:75 +0x8a
github.com/hashicorp/terraform-provider-dns/internal/provider.resourceDnsCnameRecordUpdate(0xc0002bca00, 0xc79000, 0xc0001fe790, 0xc00039ff20, 0xc0003c4680)
	github.com/hashicorp/terraform-provider-dns/internal/provider/resource_dns_cname_record.go:102 +0x5fc
github.com/hashicorp/terraform-provider-dns/internal/provider.resourceDnsCnameRecordCreate(0xc0002bca00, 0xc79000, 0xc0001fe790, 0x0, 0xffffffffffffffff)
	github.com/hashicorp/terraform-provider-dns/internal/provider/resource_dns_cname_record.go:52 +0x5b
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).create(0xc0001c3420, 0xedbee0, 0xc00039f800, 0xc0002bca00, 0xc79000, 0xc0001fe790, 0x0, 0x0, 0x0)
	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:330 +0x1ee
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).Apply(0xc0001c3420, 0xedbee0, 0xc00039f800, 0xc000287ee0, 0xc0002bc880, 0xc79000, 0xc0001fe790, 0x0, 0x0, 0x0, ...)
	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:472 +0x79d
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ApplyResourceChange(0xc0000aaa68, 0xedbe38, 0xc0003c2180, 0xc0002e8b90, 0xdd3516, 0x12, 0x0)
	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/grpc_provider.go:1021 +0xb0f
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ApplyResourceChange(0xc0002340a0, 0xedbee0, 0xc00039f110, 0xc0002f4620, 0x0, 0x0, 0x0)
	github.com/hashicorp/[email protected]/tfprotov5/tf5server/server.go:812 +0x73c
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ApplyResourceChange_Handler(0xd93360, 0xc0002340a0, 0xedbee0, 0xc00039f110, 0xc0001df5c0, 0x0, 0xedbee0, 0xc00039f110, 0xc00049c280, 0x130)
	github.com/hashicorp/[email protected]/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:385 +0x214
google.golang.org/grpc.(*Server).processUnaryRPC(0xc0001ae700, 0xee5738, 0xc0001ba680, 0xc0001dcc60, 0xc000269860, 0x13864e0, 0x0, 0x0, 0x0)
	google.golang.org/[email protected]/server.go:1282 +0x52b
google.golang.org/grpc.(*Server).handleStream(0xc0001ae700, 0xee5738, 0xc0001ba680, 0xc0001dcc60, 0x0)
	google.golang.org/[email protected]/server.go:1619 +0xd0c
google.golang.org/grpc.(*Server).serveStreams.func1.2(0xc000036220, 0xc0001ae700, 0xee5738, 0xc0001ba680, 0xc0001dcc60)
	google.golang.org/[email protected]/server.go:921 +0xab
created by google.golang.org/grpc.(*Server).serveStreams.func1
	google.golang.org/[email protected]/server.go:919 +0x1fd

Error: The terraform-provider-dns_v3.2.3_x5 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.

ERRO[0011] 1 error occurred:
	* exit status 1
          

Steps to Reproduce

  1. terraform apply

How much impact is this issue causing?

Low

Logs

No response

Additional Information

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@dh-apporto dh-apporto added the bug label Nov 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant