Skip to content

Provider Segfault null pointer reference, when creating dns_a_record with count #87

Open
@frenchtoasters

Description

@frenchtoasters

Hi there,

Thank you for opening an issue. Please note that we try to keep the Terraform issue tracker reserved for bug reports and feature requests. For general usage questions, please see: https://www.terraform.io/community.html.

Terraform Version

[root@bastion terraform]# ./terraform --version
Terraform v0.11.14

  • provider.dns v2.1.1

Affected Resource(s)

Please list the resources as a list, for example:

  • dns_a_record_set

Terraform Configuration Files

resource "dns_a_record_set" "api-external" {
  zone           = "${var.cluster_domain}."
  name           = "api"
  addresses      = ["${concat(var.bootstrap_ips, var.control_plane_ips)}"]
}

resource "dns_a_record_set" "api-internal" {
  zone           = "${var.cluster_domain}."
  name           = "api-int"
  addresses      = ["${concat(var.bootstrap_ips, var.control_plane_ips)}"]
}

resource "dns_a_record_set" "etcd_a_nodes" {
  count     = "${var.control_plane_count}"

  zone      = "${var.cluster_domain}."
  name      = "etcd-${count.index}"
  addresses = ["${element(var.control_plane_ips, count.index)}"]
}

resource "dns_a_record_set" "ingress" {
  zone      = "apps.${var.cluster_domain}."
  name      = "*"
  addresses = ["${var.compute_ips}"]
}

resource "dns_a_record_set" "control_plane_nodes" {
  count     = "${var.control_plane_count}"

  zone      = "${var.cluster_domain}."
  name      = "control-plane-${count.index}"
  addresses = ["${element(var.control_plane_ips, count.index)}"]
}

resource "dns_a_record_set" "compute_nodes" {
  count     = "${var.compute_count}"

  zone      = "${var.cluster_domain}."
  name      = "compute-${count.index}"
  addresses = ["${element(var.compute_ips, count.index)}"]
}

Debug Output

Error: Error applying plan:

7 errors occurred:
	* module.dns.dns_a_record_set.control_plane_nodes[1]: unexpected EOF
	* module.dns.dns_a_record_set.ingress: 1 error occurred:
	* dns_a_record_set.ingress: unexpected EOF


	* module.dns.dns_a_record_set.control_plane_nodes[0]: 1 error occurred:
	* dns_a_record_set.control_plane_nodes.0: unexpected EOF


	* module.dns.dns_a_record_set.compute_nodes[2]: 1 error occurred:
	* dns_a_record_set.compute_nodes.2: unexpected EOF


	* module.dns.dns_a_record_set.control_plane_nodes[2]: unexpected EOF
	* module.dns.dns_a_record_set.compute_nodes[0]: unexpected EOF
	* module.dns.dns_a_record_set.compute_nodes[1]: 1 error occurred:
	* dns_a_record_set.compute_nodes.1: unexpected EOF





Terraform does not automatically rollback in the face of errors.
Instead, your Terraform state file has been partially updated with
any resources that successfully completed. Please address the error
above and apply again to incrementally change your infrastructure.


panic: runtime error: invalid memory address or nil pointer dereference
2019-07-16T15:46:50.918-0400 [DEBUG] plugin.terraform-provider-dns_v2.1.1_x4: [signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0xcdb9f9]
2019-07-16T15:46:50.918-0400 [DEBUG] plugin.terraform-provider-dns_v2.1.1_x4: 
2019-07-16T15:46:50.918-0400 [DEBUG] plugin.terraform-provider-dns_v2.1.1_x4: goroutine 125 [running]:
2019-07-16T15:46:50.918-0400 [DEBUG] plugin.terraform-provider-dns_v2.1.1_x4: github.com/terraform-providers/terraform-provider-dns/vendor/github.com/miekg/dns.(*Msg).Insert(0xc0003a9920, 0xc0003a9840, 0x1, 0x1)
2019-07-16T15:46:50.918-0400 [DEBUG] plugin.terraform-provider-dns_v2.1.1_x4: 	/opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-dns/vendor/github.com/miekg/dns/update.go:71 +0x89
2019-07-16T15:46:50.918-0400 [DEBUG] plugin.terraform-provider-dns_v2.1.1_x4: github.com/terraform-providers/terraform-provider-dns/dns.resourceDnsARecordSetUpdate(0xc0001baee0, 0xd8dd00, 0xc000404960, 0xc0001baee0, 0xc000495c80)
2019-07-16T15:46:50.919-0400 [DEBUG] plugin.terraform-provider-dns_v2.1.1_x4: 	/opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-dns/dns/resource_dns_a_record_set.go:114 +0x635
2019-07-16T15:46:50.919-0400 [DEBUG] plugin.terraform-provider-dns_v2.1.1_x4: github.com/terraform-providers/terraform-provider-dns/dns.resourceDnsARecordSetCreate(0xc0001baee0, 0xd8dd00, 0xc000404960, 0xc0001baee0, 0x0)
2019-07-16T15:46:50.919-0400 [DEBUG] plugin.terraform-provider-dns_v2.1.1_x4: 	/opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-dns/dns/resource_dns_a_record_set.go:54 +0x5b
2019-07-16T15:46:50.919-0400 [DEBUG] plugin.terraform-provider-dns_v2.1.1_x4: github.com/terraform-providers/terraform-provider-dns/vendor/github.com/hashicorp/terraform/helper/schema.(*Resource).Apply(0xc00040a080, 0xc000393860, 0xc000495c80, 0xd8dd00, 0xc000404960, 0x40b801, 0xc0000b6b80, 0x4c117c)
2019-07-16T15:46:50.919-0400 [DEBUG] plugin.terraform-provider-dns_v2.1.1_x4: 	/opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-dns/vendor/github.com/hashicorp/terraform/helper/schema/resource.go:286 +0x363
2019-07-16T15:46:50.919-0400 [DEBUG] plugin.terraform-provider-dns_v2.1.1_x4: github.com/terraform-providers/terraform-provider-dns/vendor/github.com/hashicorp/terraform/helper/schema.(*Provider).Apply(0xc00040ad80, 0xc000393810, 0xc000393860, 0xc000495c80, 0xc000355500, 0x18, 0x7fe5a67f1000)
2019-07-16T15:46:50.919-0400 [DEBUG] plugin.terraform-provider-dns_v2.1.1_x4: 	/opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-dns/vendor/github.com/hashicorp/terraform/helper/schema/provider.go:285 +0x9c
2019-07-16T15:46:50.919-0400 [DEBUG] plugin.terraform-provider-dns_v2.1.1_x4: github.com/terraform-providers/terraform-provider-dns/vendor/github.com/hashicorp/terraform/plugin.(*ResourceProviderServer).Apply(0xc0004a0ee0, 0xc000495c00, 0xc0002fed90, 0x0, 0x0)
2019-07-16T15:46:50.919-0400 [DEBUG] plugin.terraform-provider-dns_v2.1.1_x4: 	/opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-dns/vendor/github.com/hashicorp/terraform/plugin/resource_provider.go:530 +0x57
2019-07-16T15:46:50.919-0400 [DEBUG] plugin.terraform-provider-dns_v2.1.1_x4: reflect.Value.call(0xc000137800, 0xc00000c058, 0x13, 0xf4049c, 0x4, 0xc0000b6f18, 0x3, 0x3, 0xc00013e680, 0x0, ...)
2019-07-16T15:46:50.919-0400 [DEBUG] plugin.terraform-provider-dns_v2.1.1_x4: 	/opt/goenv/versions/1.11.5/src/reflect/value.go:447 +0x454
2019-07-16T15:46:50.919-0400 [DEBUG] plugin.terraform-provider-dns_v2.1.1_x4: reflect.Value.Call(0xc000137800, 0xc00000c058, 0x13, 0xc000363718, 0x3, 0x3, 0x0, 0x0, 0x0)
2019-07-16T15:46:50.919-0400 [DEBUG] plugin.terraform-provider-dns_v2.1.1_x4: 	/opt/goenv/versions/1.11.5/src/reflect/value.go:308 +0xa4
2019-07-16T15:46:50.919-0400 [DEBUG] plugin.terraform-provider-dns_v2.1.1_x4: net/rpc.(*service).call(0xc0003d6840, 0xc000426190, 0xc0003701b0, 0xc0003701c0, 0xc0002be000, 0xc000495be0, 0xd91d00, 0xc000495c00, 0x16, 0xd91d40, ...)
2019-07-16T15:46:50.919-0400 [DEBUG] plugin.terraform-provider-dns_v2.1.1_x4: 	/opt/goenv/versions/1.11.5/src/net/rpc/server.go:384 +0x14e
2019-07-16T15:46:50.919-0400 [DEBUG] plugin.terraform-provider-dns_v2.1.1_x4: created by net/rpc.(*Server).ServeCodec
2019-07-16T15:46:50.919-0400 [DEBUG] plugin.terraform-provider-dns_v2.1.1_x4: 	/opt/goenv/versions/1.11.5/src/net/rpc/server.go:481 +0x47e
2019/07/16 15:46:50 [ERROR] root.dns: eval: *terraform.EvalDiff, err: unexpected EOF
2019/07/16 15:46:50 [ERROR] root.dns: eval: *terraform.EvalDiff, err: unexpected EOF
2019/07/16 15:46:50 [ERROR] root.dns: eval: *terraform.EvalDiff, err: unexpected EOF
2019/07/16 15:46:50 [TRACE] root.dns: eval: *terraform.EvalWriteState
2019-07-16T15:46:50.920-0400 [DEBUG] plugin: plugin process exited: path=/etc/ansible/installer-configs/vsphere/.terraform/plugins/linux_amd64/terraform-provider-dns_v2.1.1_x4
2019/07/16 15:46:50 [ERROR] root.dns: eval: *terraform.EvalSequence, err: unexpected EOF
2019/07/16 15:46:50 [TRACE] [walkApply] Exiting eval tree: module.dns.dns_a_record_set.control_plane_nodes[2]
2019/07/16 15:46:50 [ERROR] root.dns: eval: *terraform.EvalSequence, err: unexpected EOF
2019/07/16 15:46:50 [TRACE] [walkApply] Exiting eval tree: module.dns.dns_a_record_set.control_plane_nodes[1]
2019/07/16 15:46:50 [ERROR] root.dns: eval: *terraform.EvalSequence, err: unexpected EOF
2019/07/16 15:46:50 [TRACE] [walkApply] Exiting eval tree: module.dns.dns_a_record_set.compute_nodes[0]
2019/07/16 15:46:50 [TRACE] root.dns: eval: *terraform.EvalWriteState
2019/07/16 15:46:50 [TRACE] root.dns: eval: *terraform.EvalApplyProvisioners
2019/07/16 15:46:50 [TRACE] root.dns: eval: *terraform.EvalIf
2019/07/16 15:46:50 [TRACE] root.dns: eval: *terraform.EvalWriteState
2019/07/16 15:46:50 [TRACE] root.dns: eval: *terraform.EvalWriteDiff
2019/07/16 15:46:50 [TRACE] root.dns: eval: *terraform.EvalApplyPost
2019/07/16 15:46:50 [TRACE] root.dns: eval: *terraform.EvalWriteState
2019/07/16 15:46:50 [TRACE] root.dns: eval: *terraform.EvalApplyProvisioners
2019/07/16 15:46:50 [TRACE] root.dns: eval: *terraform.EvalIf
2019/07/16 15:46:50 [TRACE] root.dns: eval: *terraform.EvalWriteState
2019/07/16 15:46:50 [TRACE] root.dns: eval: *terraform.EvalWriteDiff
2019/07/16 15:46:50 [TRACE] root.dns: eval: *terraform.EvalApplyPost
2019/07/16 15:46:50 [TRACE] root.dns: eval: *terraform.EvalWriteState
2019/07/16 15:46:50 [TRACE] root.dns: eval: *terraform.EvalApplyProvisioners
2019/07/16 15:46:50 [TRACE] root.dns: eval: *terraform.EvalIf
2019/07/16 15:46:50 [TRACE] root.dns: eval: *terraform.EvalWriteState
2019/07/16 15:46:50 [TRACE] root.dns: eval: *terraform.EvalWriteDiff
2019/07/16 15:46:50 [TRACE] root.dns: eval: *terraform.EvalApplyPost
2019/07/16 15:46:50 [ERROR] root.dns: eval: *terraform.EvalApplyPost, err: 1 error occurred:
	* dns_a_record_set.control_plane_nodes.0: unexpected EOF

2019/07/16 15:46:50 [TRACE] root.dns: eval: *terraform.EvalApplyProvisioners
2019/07/16 15:46:50 [TRACE] root.dns: eval: *terraform.EvalIf
2019/07/16 15:46:50 [TRACE] root.dns: eval: *terraform.EvalWriteState
2019/07/16 15:46:50 [TRACE] root.dns: eval: *terraform.EvalWriteDiff
2019/07/16 15:46:50 [TRACE] root.dns: eval: *terraform.EvalApplyPost
2019/07/16 15:46:50 [ERROR] root.dns: eval: *terraform.EvalApplyPost, err: 1 error occurred:
	* dns_a_record_set.ingress: unexpected EOF

2019/07/16 15:46:50 [ERROR] root.dns: eval: *terraform.EvalSequence, err: 1 error occurred:
	* dns_a_record_set.ingress: unexpected EOF

2019/07/16 15:46:50 [TRACE] [walkApply] Exiting eval tree: module.dns.dns_a_record_set.ingress
2019/07/16 15:46:50 [ERROR] root.dns: eval: *terraform.EvalApplyPost, err: 1 error occurred:
	* dns_a_record_set.compute_nodes.2: unexpected EOF

2019/07/16 15:46:50 [ERROR] root.dns: eval: *terraform.EvalSequence, err: 1 error occurred:
	* dns_a_record_set.compute_nodes.2: unexpected EOF

2019/07/16 15:46:50 [ERROR] root.dns: eval: *terraform.EvalApplyPost, err: 1 error occurred:
	* dns_a_record_set.compute_nodes.1: unexpected EOF

2019/07/16 15:46:50 [ERROR] root.dns: eval: *terraform.EvalSequence, err: 1 error occurred:
	* dns_a_record_set.compute_nodes.1: unexpected EOF

2019/07/16 15:46:50 [TRACE] [walkApply] Exiting eval tree: module.dns.dns_a_record_set.compute_nodes[1]
2019/07/16 15:46:50 [ERROR] root.dns: eval: *terraform.EvalSequence, err: 1 error occurred:
	* dns_a_record_set.control_plane_nodes.0: unexpected EOF

2019/07/16 15:46:50 [TRACE] [walkApply] Exiting eval tree: module.dns.dns_a_record_set.control_plane_nodes[0]
2019/07/16 15:46:50 [TRACE] [walkApply] Exiting eval tree: module.dns.dns_a_record_set.compute_nodes[2]
2019/07/16 15:46:50 [TRACE] dag/walk: upstream errored, not walking "module.dns.provider.dns (close)"
2019/07/16 15:46:50 [TRACE] dag/walk: upstream errored, not walking "meta.count-boundary (count boundary fixup)"
2019/07/16 15:46:50 [TRACE] dag/walk: upstream errored, not walking "root"
2019/07/16 15:46:50 [TRACE] Preserving existing state lineage "02baadb6-6fe1-57b9-e769-2e8dd4bc6102"
2019/07/16 15:46:50 [TRACE] Preserving existing state lineage "02baadb6-6fe1-57b9-e769-2e8dd4bc6102"
2019/07/16 15:46:50 [TRACE] Preserving existing state lineage "02baadb6-6fe1-57b9-e769-2e8dd4bc6102"
2019/07/16 15:46:50 [TRACE] Preserving existing state lineage "02baadb6-6fe1-57b9-e769-2e8dd4bc6102"
2019/07/16 15:46:50 [DEBUG] plugin: waiting for all plugin processes to complete...
2019-07-16T15:46:50.958-0400 [WARN ] plugin: error closing client during Kill: err="connection is shut down"
2019-07-16T15:46:50.959-0400 [DEBUG] plugin.terraform-provider-null_v2.1.2_x4: 2019/07/16 15:46:50 [ERR] plugin: plugin server: accept unix /tmp/plugin187427790: use of closed network connection
2019-07-16T15:46:50.959-0400 [DEBUG] plugin.terraform-provider-template_v2.1.2_x4: 2019/07/16 15:46:50 [ERR] plugin: plugin server: accept unix /tmp/plugin954229151: use of closed network connection
2019-07-16T15:46:50.959-0400 [DEBUG] plugin.terraform: local-exec-provisioner (internal) 2019/07/16 15:46:50 [ERR] plugin: plugin server: accept unix /tmp/plugin385291182: use of closed network connection
2019-07-16T15:46:50.959-0400 [DEBUG] plugin.terraform: local-exec-provisioner (internal) 2019/07/16 15:46:50 [DEBUG] plugin: waiting for all plugin processes to complete...
2019-07-16T15:46:50.959-0400 [DEBUG] plugin.terraform-provider-vsphere_v1.12.0_x4: 2019/07/16 15:46:50 [ERR] plugin: plugin server: accept unix /tmp/plugin084236766: use of closed network connection
2019-07-16T15:46:50.959-0400 [DEBUG] plugin.terraform-provider-external_v1.2.0_x4: 2019/07/16 15:46:50 [ERR] plugin: plugin server: accept unix /tmp/plugin991095398: use of closed network connection
2019-07-16T15:46:50.960-0400 [DEBUG] plugin: plugin process exited: path=/etc/ansible/installer-configs/vsphere/.terraform/plugins/linux_amd64/terraform-provider-template_v2.1.2_x4
2019-07-16T15:46:50.960-0400 [DEBUG] plugin.terraform-provider-ignition_v1.1.0_x4: 2019/07/16 15:46:50 [ERR] plugin: plugin server: accept unix /tmp/plugin388543880: use of closed network connection
2019-07-16T15:46:50.960-0400 [DEBUG] plugin: plugin process exited: path=/etc/ansible/installer-configs/vsphere/terraform
2019-07-16T15:46:50.960-0400 [DEBUG] plugin: plugin process exited: path=/etc/ansible/installer-configs/vsphere/.terraform/plugins/linux_amd64/terraform-provider-external_v1.2.0_x4
2019-07-16T15:46:50.960-0400 [DEBUG] plugin: plugin process exited: path=/etc/ansible/installer-configs/vsphere/.terraform/plugins/linux_amd64/terraform-provider-null_v2.1.2_x4
2019-07-16T15:46:50.961-0400 [DEBUG] plugin: plugin process exited: path=/etc/ansible/installer-configs/vsphere/.terraform/plugins/linux_amd64/terraform-provider-vsphere_v1.12.0_x4
2019-07-16T15:46:50.961-0400 [DEBUG] plugin: plugin process exited: path=/etc/ansible/installer-configs/vsphere/.terraform/plugins/linux_amd64/terraform-provider-ignition_v1.1.0_x4



!!!!!!!!!!!!!!!!!!!!!!!!!!! TERRAFORM CRASH !!!!!!!!!!!!!!!!!!!!!!!!!!!!

Terraform crashed! This is always indicative of a bug within Terraform.
A crash log has been placed at "crash.log" relative to your current
working directory. It would be immensely helpful if you could please
report the crash with Terraform[1] so that we can fix this.

When reporting bugs, please include your terraform version. That
information is available on the first line of crash.log. You can also
get it by running 'terraform --version' on the command line.

[1]: https://github.com/hashicorp/terraform/issues

!!!!!!!!!!!!!!!!!!!!!!!!!!! TERRAFORM CRASH !!!!!!!!!!!!!!!!!!!!!!!!!!!!

Panic Output

https://gist.github.com/frenchtoasters/aadadaa7b13708cf82bb276ddb05a75c

Expected Behavior

Add all the DNS A records to the bind server

Actual Behavior

Terraform crashes when trying to add multiple A record resources that all use the count variable.

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. terraform apply

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions