hashicorp / terraform-provider-aws

The AWS Provider enables Terraform to manage AWS resources.
https://registry.terraform.io/providers/hashicorp/aws
Mozilla Public License 2.0
9.76k stars 9.11k forks source link

unexpected EOF at resource aws_alb_target_group creation #4672

Closed ghost closed 6 years ago

ghost commented 6 years ago

This issue was originally opened by @awuetz as hashicorp/terraform#18133. It was migrated here as a result of the provider split. The original body of the issue is below.


Hi *,

i just faced an terrafrom crash / (panic: runtime error: invalid memory address or nil pointer dereference) by the attemt to create an aws_alb_target_group. As per my understanding this

* aws_lb.nlb: Error creating Application Load Balancer: ResourceInUse: The allocation IDs are not available for use
  status code: 400, request id: <REMOVED FROM OUTPUT BY USER>
2018/05/28 07:48:19 [ERROR] root.website: eval: *terraform.EvalSequence, err: 1 error(s) occurred:

is the source of the issue.

Short output of the crash:

Error: Error applying plan:

1 error(s) occurred:

* module.website.aws_alb_target_group.nlb_tg: 1 error(s) occurred:

* aws_alb_target_group.nlb_tg: 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

Terraform Version

This behaviour was reproduced with Version 0.11.3 and 0.11.7

2018/05/28 07:47:30 [INFO] Terraform version: 0.11.3  3802b14260603f90c7a1faf55994dcc8933e2069
2018/05/28 07:47:30 [INFO] Go runtime version: go1.9.1
2018/05/28 07:47:30 [INFO] CLI args: []string{terraform-0.11.3", "apply", "-input=false", "-refresh=true", "-var-file=./dev-1.tfvars"}

Terraform Configuration Files

This is the part of the config files, i added and tried to apply:

resource "aws_lb" "nlb" {
  name               = "${var.env}-nlb"
  internal           = false
  load_balancer_type = "network"

  subnet_mapping {
    subnet_id     = "${aws_subnet.public-subnet.0.id}"
    allocation_id = "${aws_eip.nlb_eip.0.id}"
  }

  subnet_mapping {
    subnet_id     = "${aws_subnet.public-subnet.1.id}"
    allocation_id = "${aws_eip.nlb_eip.1.id}"
  }

  idle_timeout               = "290"
  enable_deletion_protection = true

  tags {
    Name        = "${var.env}-nlb"
    Environment = "${var.env}"
  }
}

resource "aws_alb_listener" "listener_tcp_80" {
  load_balancer_arn = "${aws_lb.nlb.arn}"
  port              = "80"
  protocol          = "TCP"

  default_action {
    target_group_arn = "${aws_alb_target_group.nlb_tg.arn}"
    type             = "forward"
  }
}

resource "aws_alb_listener" "listener_tcp_443" {
  load_balancer_arn = "${aws_lb.nlb.arn}"
  port              = "443"
  protocol          = "TCP"

  default_action {
    target_group_arn = "${aws_alb_target_group.nlb_tg.arn}"
    type             = "forward"
  }
}

# Target Group for TCP:9000
resource "aws_alb_target_group" "nlb_tg" {
  name     = "${var.env}-nlb-tg"
  port     = 9000
  protocol = "TCP"
  vpc_id   = "${var.vpc_id}"

  health_check = {
    protocol = "TCP"
  }

  tags {
    Name        = "${var.env}-nlb-tg"
    Environment = "${var.env}"
  }
}

resource "aws_alb_target_group_attachment" "nlb_tg_attach" {
  target_group_arn = "${aws_alb_target_group.nlb_tg.arn}"
  target_id        = "${element(aws_instance.web.*.id, count.index)}"
  port             = 9000
  count            = "${var.web["count"]}"
}

Debug Output

  + create

Terraform will perform the following actions:

  + module.website.aws_alb_listener.listener_tcp_443
      id:                                 <computed>
      arn:                                <computed>
      default_action.#:                   "1"
      default_action.0.target_group_arn:  "${aws_alb_target_group.nlb_tg.arn}"
      default_action.0.type:              "forward"
      load_balancer_arn:                  "<REMOVED FROM OUTPUT>"
      port:                               "443"
      protocol:                           "TCP"
      ssl_policy:                         <computed>

  + module.website.aws_alb_listener.listener_tcp_80
      id:                                 <computed>
      arn:                                <computed>
      default_action.#:                   "1"
      default_action.0.target_group_arn:  "${aws_alb_target_group.nlb_tg.arn}"
      default_action.0.type:              "forward"
      load_balancer_arn:                  "<REMOVED FROM OUTPUT>"
      port:                               "80"
      protocol:                           "TCP"
      ssl_policy:                         <computed>

  + module.website.aws_alb_target_group.nlb_tg
      id:                                 <computed>
      arn:                                <computed>
      arn_suffix:                         <computed>
      deregistration_delay:               "300"
      health_check.#:                     "1"
      health_check.0.healthy_threshold:   "3"
      health_check.0.interval:            "30"
      health_check.0.matcher:             <computed>
      health_check.0.path:                <computed>
      health_check.0.port:                "traffic-port"
      health_check.0.protocol:            "TCP"
      health_check.0.timeout:             <computed>
      health_check.0.unhealthy_threshold: "3"
      name:                               "saw-dev-1-nlb-tg"
      port:                               "9000"
      protocol:                           "TCP"
      stickiness.#:                       <computed>
      tags.%:                             "2"
      tags.Environment:                   "saw-dev-1"
      tags.Name:                          "saw-dev-1-nlb-tg"
      target_type:                        "instance"
      vpc_id:                             "<REMOVED FROM OUTPUT>"

  + module.website.aws_alb_target_group_attachment.nlb_tg_attach
      id:                                 <computed>
      port:                               "9000"
      target_group_arn:                   "${aws_alb_target_group.nlb_tg.arn}"
      target_id:                          "<REMOVED FROM OUTPUT>"

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

module.website.aws_alb_target_group.nlb_tg: Creating...
  arn:                                "" => "<computed>"
  arn_suffix:                         "" => "<computed>"
  deregistration_delay:               "" => "300"
  health_check.#:                     "" => "1"
  health_check.0.healthy_threshold:   "" => "3"
  health_check.0.interval:            "" => "30"
  health_check.0.matcher:             "" => "<computed>"
  health_check.0.path:                "" => "<computed>"
  health_check.0.port:                "" => "traffic-port"
  health_check.0.protocol:            "" => "TCP"
  health_check.0.timeout:             "" => "<computed>"
  health_check.0.unhealthy_threshold: "" => "3"
  name:                               "" => "saw-dev-1-nlb-tg"
  port:                               "" => "9000"
  protocol:                           "" => "TCP"
  stickiness.#:                       "" => "<computed>"
  tags.%:                             "" => "2"
  tags.Environment:                   "" => "saw-dev-1"
  tags.Name:                          "" => "saw-dev-1-nlb-tg"
  target_type:                        "" => "instance"
  vpc_id:                             "" => "<REMOVED FROM OUTPUT>"

Error: Error applying plan:

1 error(s) occurred:

* module.website.aws_alb_target_group.nlb_tg: 1 error(s) occurred:

* aws_alb_target_group.nlb_tg: 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
2018-05-28T07:42:19.108+0200 [DEBUG] plugin.terraform-provider-aws_v1.8.0_x4: [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x1c657ed]
2018-05-28T07:42:19.108+0200 [DEBUG] plugin.terraform-provider-aws_v1.8.0_x4:
2018-05-28T07:42:19.109+0200 [DEBUG] plugin.terraform-provider-aws_v1.8.0_x4: goroutine 2956 [running]:
2018-05-28T07:42:19.109+0200 [DEBUG] plugin.terraform-provider-aws_v1.8.0_x4: github.com/terraform-providers/terraform-provider-aws/aws.flattenAwsLbTargetGroupResource(0xc4206101c0, 0x24fd280, 0xc4201d6c80, 0xc4205cca20, 0x0, 0xc4201e1330)
2018-05-28T07:42:19.109+0200 [DEBUG] plugin.terraform-provider-aws_v1.8.0_x4:   /opt/teamcity-agent/work/222ea50a1b4f75f4/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_lb_target_group.go:529 +0x62d
2018-05-28T07:42:19.109+0200 [DEBUG] plugin.terraform-provider-aws_v1.8.0_x4: github.com/terraform-providers/terraform-provider-aws/aws.resourceAwsLbTargetGroupRead(0xc4206101c0, 0x24fd280, 0xc4201d6c80, 0x0, 0x0)
2018-05-28T07:42:19.109+0200 [DEBUG] plugin.terraform-provider-aws_v1.8.0_x4:   /opt/teamcity-agent/work/222ea50a1b4f75f4/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_lb_target_group.go:273 +0x28b
2018-05-28T07:42:19.110+0200 [DEBUG] plugin.terraform-provider-aws_v1.8.0_x4: github.com/terraform-providers/terraform-provider-aws/aws.resourceAwsLbTargetGroupUpdate(0xc4206101c0, 0x24fd280, 0xc4201d6c80, 0x0, 0x0)
2018-05-28T07:42:19.110+0200 [DEBUG] plugin.terraform-provider-aws_v1.8.0_x4:   /opt/teamcity-agent/work/222ea50a1b4f75f4/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_lb_target_group.go:371 +0x178
2018-05-28T07:42:19.110+0200 [DEBUG] plugin.terraform-provider-aws_v1.8.0_x4: github.com/terraform-providers/terraform-provider-aws/aws.resourceAwsLbTargetGroupCreate(0xc4206101c0, 0x24fd280, 0xc4201d6c80, 0xc4206101c0, 0x0)
2018-05-28T07:42:19.110+0200 [DEBUG] plugin.terraform-provider-aws_v1.8.0_x4:   /opt/teamcity-agent/work/222ea50a1b4f75f4/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_lb_target_group.go:251 +0x8f9
2018-05-28T07:42:19.111+0200 [DEBUG] plugin.terraform-provider-aws_v1.8.0_x4: github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema.(*Resource).Apply(0xc42029c150, 0xc4206e0050, 0xc420764a00, 0x24fd280, 0xc4201d6c80, 0x1, 0xc4206942a0, 0xc420759ee0)
2018-05-28T07:42:19.111+0200 [DEBUG] plugin.terraform-provider-aws_v1.8.0_x4:   /opt/teamcity-agent/work/222ea50a1b4f75f4/src/github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema/resource.go:227 +0x364
2018-05-28T07:42:19.111+0200 [DEBUG] plugin.terraform-provider-aws_v1.8.0_x4: github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema.(*Provider).Apply(0xc42029c3f0, 0xc4206e0000, 0xc4206e0050, 0xc420764a00, 0x7f53043b1000, 0x0, 0x18)
2018-05-28T07:42:19.111+0200 [DEBUG] plugin.terraform-provider-aws_v1.8.0_x4:   /opt/teamcity-agent/work/222ea50a1b4f75f4/src/github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema/provider.go:283 +0xa4
2018-05-28T07:42:19.112+0200 [DEBUG] plugin.terraform-provider-aws_v1.8.0_x4: github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/plugin.(*ResourceProviderServer).Apply(0xc420308e80, 0xc420764440, 0xc4204d2480, 0x0, 0x0)
2018-05-28T07:42:19.112+0200 [DEBUG] plugin.terraform-provider-aws_v1.8.0_x4:   /opt/teamcity-agent/work/222ea50a1b4f75f4/src/github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/plugin/resource_provider.go:527 +0x57
2018-05-28T07:42:19.112+0200 [DEBUG] plugin.terraform-provider-aws_v1.8.0_x4: reflect.Value.call(0xc4204a23c0, 0xc420615b00, 0x13, 0x28f602e, 0x4, 0xc420aaaf20, 0x3, 0x3, 0x403a23, 0xc420385180, ...)
2018-05-28T07:42:19.112+0200 [DEBUG] plugin.terraform-provider-aws_v1.8.0_x4:   /usr/local/go/src/reflect/value.go:434 +0x905
2018-05-28T07:42:19.113+0200 [DEBUG] plugin.terraform-provider-aws_v1.8.0_x4: reflect.Value.Call(0xc4204a23c0, 0xc420615b00, 0x13, 0xc420a0ff20, 0x3, 0x3, 0xc420a0ff20, 0xc420a0ff28, 0xc42069c5c0)
2018-05-28T07:42:19.113+0200 [DEBUG] plugin.terraform-provider-aws_v1.8.0_x4:   /usr/local/go/src/reflect/value.go:302 +0xa4
2018-05-28T07:42:19.113+0200 [DEBUG] plugin.terraform-provider-aws_v1.8.0_x4: net/rpc.(*service).call(0xc420aeffc0, 0xc4206c2870, 0xc42077fd20, 0xc420aead00, 0xc420308f80, 0x2071fe0, 0xc420764440, 0x16, 0x2072020, 0xc4204d2480, ...)
2018-05-28T07:42:19.113+0200 [DEBUG] plugin.terraform-provider-aws_v1.8.0_x4:   /usr/local/go/src/net/rpc/server.go:381 +0x142
2018-05-28T07:42:19.113+0200 [DEBUG] plugin.terraform-provider-aws_v1.8.0_x4: created by net/rpc.(*Server).ServeCodec
2018-05-28T07:42:19.113+0200 [DEBUG] plugin.terraform-provider-aws_v1.8.0_x4:   /usr/local/go/src/net/rpc/server.go:475 +0x36b
2018/05/28 07:42:19 [TRACE] root.website: eval: *terraform.EvalWriteState
2018/05/28 07:42:19 [TRACE] root.website: eval: *terraform.EvalApplyProvisioners
2018/05/28 07:42:19 [TRACE] root.website: eval: *terraform.EvalIf
2018/05/28 07:42:19 [TRACE] root.website: eval: *terraform.EvalWriteState
2018/05/28 07:42:19 [TRACE] root.website: eval: *terraform.EvalWriteDiff
2018/05/28 07:42:19 [TRACE] root.website: eval: *terraform.EvalApplyPost
2018/05/28 07:42:19 [ERROR] root.website: eval: *terraform.EvalApplyPost, err: 1 error(s) occurred:

* aws_alb_target_group.nlb_tg: unexpected EOF
2018/05/28 07:42:19 [ERROR] root.website: eval: *terraform.EvalSequence, err: 1 error(s) occurred:

* aws_alb_target_group.nlb_tg: unexpected EOF
2018/05/28 07:42:19 [TRACE] [walkApply] Exiting eval tree: module.website.aws_alb_target_group.nlb_tg
2018/05/28 07:42:19 [TRACE] dag/walk: upstream errored, not walking "module.website.aws_alb_listener.listener_tcp_443"
2018/05/28 07:42:19 [TRACE] dag/walk: upstream errored, not walking "module.website.aws_alb_listener.listener_tcp_80"
2018/05/28 07:42:19 [TRACE] dag/walk: upstream errored, not walking "module.website.aws_alb_target_group_attachment.nlb_tg_attach"
2018/05/28 07:42:19 [TRACE] dag/walk: upstream errored, not walking "provider.aws (close)"
2018/05/28 07:42:19 [TRACE] dag/walk: upstream errored, not walking "meta.count-boundary (count boundary fixup)"
2018/05/28 07:42:19 [TRACE] dag/walk: upstream errored, not walking "root"
2018-05-28T07:42:19.133+0200 [DEBUG] plugin: plugin process exited: path=<REMOVED FROM OUTPUT>/.terraform/plugins/linux_amd64/terraform-provider-aws_v1.8.0_x4
2018/05/28 07:42:19 [TRACE] Preserving existing state lineage "39186fc3-8182-4e8c-b189-ebf643faa732"
2018/05/28 07:42:19 [TRACE] Preserving existing state lineage "39186fc3-8182-4e8c-b189-ebf643faa732"
2018/05/28 07:42:19 [TRACE] Preserving existing state lineage "39186fc3-8182-4e8c-b189-ebf643faa732"
2018/05/28 07:42:19 [TRACE] Preserving existing state lineage "39186fc3-8182-4e8c-b189-ebf643faa732"
2018/05/28 07:42:19 [DEBUG] plugin: waiting for all plugin processes to complete...
2018-05-28T07:42:19.235+0200 [WARN ] plugin: error closing client during Kill: err="connection is shut down"
2018-05-28T07:42:19.235+0200 [DEBUG] plugin: plugin process exited: path=<REMOVED FROM OUTPUT>/.terraform/plugins/linux_amd64/terraform-provider-template_v1.0.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 !!!!!!!!!!!!!!!!!!!!!!!!!!!!
Makefile:35: recipe for target 'apply' failed
make: *** [apply] Error 1

Crash Output

2018/05/28 07:48:18 [DEBUG] apply: aws_alb_target_group.nlb_tg: executing Apply
2018-05-28T07:48:18.680+0200 [DEBUG] plugin.terraform-provider-aws_v1.8.0_x4: 2018/05/28 07:48:18 [DEBUG] Matching ^aws: with Name
2018-05-28T07:48:18.680+0200 [DEBUG] plugin.terraform-provider-aws_v1.8.0_x4: 2018/05/28 07:48:18 [DEBUG] Matching ^aws: with Environment
2018-05-28T07:48:18.680+0200 [DEBUG] plugin.terraform-provider-aws_v1.8.0_x4: 2018/05/28 07:48:18 [DEBUG] ALB create configuration: {
2018-05-28T07:48:18.680+0200 [DEBUG] plugin.terraform-provider-aws_v1.8.0_x4:   Name: "saw-dev-1-nlb",
2018-05-28T07:48:18.680+0200 [DEBUG] plugin.terraform-provider-aws_v1.8.0_x4:   SubnetMappings: [{
2018-05-28T07:48:18.680+0200 [DEBUG] plugin.terraform-provider-aws_v1.8.0_x4:       AllocationId: "<REMOVED FROM OUTPUT BY USER>",
2018-05-28T07:48:18.680+0200 [DEBUG] plugin.terraform-provider-aws_v1.8.0_x4:       SubnetId: "<REMOVED FROM OUTPUT BY USER>"
2018-05-28T07:48:18.680+0200 [DEBUG] plugin.terraform-provider-aws_v1.8.0_x4:     },{
2018-05-28T07:48:18.680+0200 [DEBUG] plugin.terraform-provider-aws_v1.8.0_x4:       AllocationId: "<REMOVED FROM OUTPUT BY USER>",
2018-05-28T07:48:18.680+0200 [DEBUG] plugin.terraform-provider-aws_v1.8.0_x4:       SubnetId: "<REMOVED FROM OUTPUT BY USER>"
2018-05-28T07:48:18.680+0200 [DEBUG] plugin.terraform-provider-aws_v1.8.0_x4:     }],
2018-05-28T07:48:18.680+0200 [DEBUG] plugin.terraform-provider-aws_v1.8.0_x4:   Tags: [{
2018-05-28T07:48:18.681+0200 [DEBUG] plugin.terraform-provider-aws_v1.8.0_x4:       Key: "Name",
2018-05-28T07:48:18.681+0200 [DEBUG] plugin.terraform-provider-aws_v1.8.0_x4:       Value: "saw-dev-1-nlb"
2018-05-28T07:48:18.681+0200 [DEBUG] plugin.terraform-provider-aws_v1.8.0_x4:     },{
2018-05-28T07:48:18.681+0200 [DEBUG] plugin.terraform-provider-aws_v1.8.0_x4:       Key: "Environment",
2018-05-28T07:48:18.681+0200 [DEBUG] plugin.terraform-provider-aws_v1.8.0_x4:       Value: "saw-dev-1"
2018-05-28T07:48:18.681+0200 [DEBUG] plugin.terraform-provider-aws_v1.8.0_x4:     }],
2018-05-28T07:48:18.681+0200 [DEBUG] plugin.terraform-provider-aws_v1.8.0_x4:   Type: "network"
2018-05-28T07:48:18.681+0200 [DEBUG] plugin.terraform-provider-aws_v1.8.0_x4: }
2018-05-28T07:48:18.879+0200 [DEBUG] plugin.terraform-provider-aws_v1.8.0_x4: 2018/05/28 07:48:18 [DEBUG] Matching ^aws: with Environment
2018-05-28T07:48:18.879+0200 [DEBUG] plugin.terraform-provider-aws_v1.8.0_x4: 2018/05/28 07:48:18 [DEBUG] Matching ^aws: with Name
2018-05-28T07:48:18.880+0200 [DEBUG] plugin.terraform-provider-aws_v1.8.0_x4: 2018/05/28 07:48:18 [DEBUG] Matching ^aws: with Environment
2018-05-28T07:48:18.880+0200 [DEBUG] plugin.terraform-provider-aws_v1.8.0_x4: 2018/05/28 07:48:18 [DEBUG] Matching ^aws: with Name
2018-05-28T07:48:18.880+0200 [DEBUG] plugin.terraform-provider-aws_v1.8.0_x4: 2018/05/28 07:48:18 [DEBUG] Creating tags: [{
2018-05-28T07:48:18.880+0200 [DEBUG] plugin.terraform-provider-aws_v1.8.0_x4:   Key: "Environment",
2018-05-28T07:48:18.880+0200 [DEBUG] plugin.terraform-provider-aws_v1.8.0_x4:   Value: "saw-dev-1"
2018-05-28T07:48:18.880+0200 [DEBUG] plugin.terraform-provider-aws_v1.8.0_x4: } {
2018-05-28T07:48:18.880+0200 [DEBUG] plugin.terraform-provider-aws_v1.8.0_x4:   Key: "Name",
2018-05-28T07:48:18.881+0200 [DEBUG] plugin.terraform-provider-aws_v1.8.0_x4:   Value: "saw-dev-1-nlb-tg"
2018-05-28T07:48:18.881+0200 [DEBUG] plugin.terraform-provider-aws_v1.8.0_x4: }] for arn:aws:elasticloadbalancing:<REMOVED FROM OUTPUT BY USER>
2018/05/28 07:48:19 [TRACE] root.website: eval: *terraform.EvalWriteState
2018/05/28 07:48:19 [TRACE] root.website: eval: *terraform.EvalApplyProvisioners
2018/05/28 07:48:19 [TRACE] root.website: eval: *terraform.EvalIf
2018/05/28 07:48:19 [TRACE] root.website: eval: *terraform.EvalWriteState
2018/05/28 07:48:19 [TRACE] root.website: eval: *terraform.EvalWriteDiff
2018/05/28 07:48:19 [TRACE] root.website: eval: *terraform.EvalApplyPost
2018/05/28 07:48:19 [ERROR] root.website: eval: *terraform.EvalApplyPost, err: 1 error(s) occurred:

* aws_lb.nlb: Error creating Application Load Balancer: ResourceInUse: The allocation IDs are not available for use
  status code: 400, request id: <REMOVED FROM OUTPUT BY USER>
2018/05/28 07:48:19 [ERROR] root.website: eval: *terraform.EvalSequence, err: 1 error(s) occurred:

* aws_lb.nlb: Error creating Application Load Balancer: ResourceInUse: The allocation IDs are not available for use
  status code: 400, request id: b906dd28-623a-11e8-ade5-c7a5f7584972
2018/05/28 07:48:19 [TRACE] [walkApply] Exiting eval tree: module.website.aws_lb.nlb
2018-05-28T07:48:19.226+0200 [DEBUG] plugin.terraform-provider-aws_v1.8.0_x4: panic: runtime error: invalid memory address or nil pointer dereference
2018-05-28T07:48:19.227+0200 [DEBUG] plugin.terraform-provider-aws_v1.8.0_x4: [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x1c657ed]
2018-05-28T07:48:19.227+0200 [DEBUG] plugin.terraform-provider-aws_v1.8.0_x4:
2018-05-28T07:48:19.227+0200 [DEBUG] plugin.terraform-provider-aws_v1.8.0_x4: goroutine 3010 [running]:
2018-05-28T07:48:19.228+0200 [DEBUG] plugin.terraform-provider-aws_v1.8.0_x4: github.com/terraform-providers/terraform-provider-aws/aws.flattenAwsLbTargetGroupResource(0xc42086b650, 0x24fd280, 0xc420079180, 0xc42031d950, 0x0, 0xc4209c8730)
2018-05-28T07:48:19.228+0200 [DEBUG] plugin.terraform-provider-aws_v1.8.0_x4:   /opt/teamcity-agent/work/222ea50a1b4f75f4/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_lb_target_group.go:529 +0x62d
2018-05-28T07:48:19.229+0200 [DEBUG] plugin.terraform-provider-aws_v1.8.0_x4: github.com/terraform-providers/terraform-provider-aws/aws.resourceAwsLbTargetGroupRead(0xc42086b650, 0x24fd280, 0xc420079180, 0x0, 0x0)
2018-05-28T07:48:19.229+0200 [DEBUG] plugin.terraform-provider-aws_v1.8.0_x4:   /opt/teamcity-agent/work/222ea50a1b4f75f4/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_lb_target_group.go:273 +0x28b
2018-05-28T07:48:19.230+0200 [DEBUG] plugin.terraform-provider-aws_v1.8.0_x4: github.com/terraform-providers/terraform-provider-aws/aws.resourceAwsLbTargetGroupUpdate(0xc42086b650, 0x24fd280, 0xc420079180, 0x0, 0x0)
2018-05-28T07:48:19.230+0200 [DEBUG] plugin.terraform-provider-aws_v1.8.0_x4:   /opt/teamcity-agent/work/222ea50a1b4f75f4/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_lb_target_group.go:371 +0x178
2018-05-28T07:48:19.231+0200 [DEBUG] plugin.terraform-provider-aws_v1.8.0_x4: github.com/terraform-providers/terraform-provider-aws/aws.resourceAwsLbTargetGroupCreate(0xc42086b650, 0x24fd280, 0xc420079180, 0xc42086b650, 0x0)
2018-05-28T07:48:19.231+0200 [DEBUG] plugin.terraform-provider-aws_v1.8.0_x4:   /opt/teamcity-agent/work/222ea50a1b4f75f4/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_lb_target_group.go:251 +0x8f9
2018-05-28T07:48:19.231+0200 [DEBUG] plugin.terraform-provider-aws_v1.8.0_x4: github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema.(*Resource).Apply(0xc420aa9d50, 0xc42043a640, 0xc4205a1a00, 0x24fd280, 0xc420079180, 0x1, 0xc42068f170, 0xc42068f170)
2018-05-28T07:48:19.231+0200 [DEBUG] plugin.terraform-provider-aws_v1.8.0_x4:   /opt/teamcity-agent/work/222ea50a1b4f75f4/src/github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema/resource.go:227 +0x364
2018-05-28T07:48:19.232+0200 [DEBUG] plugin.terraform-provider-aws_v1.8.0_x4: github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema.(*Provider).Apply(0xc420932000, 0xc42043a5f0, 0xc42043a640, 0xc4205a1a00, 0x7f9eab1ba000, 0x0, 0xc4207558a0)
2018-05-28T07:48:19.232+0200 [DEBUG] plugin.terraform-provider-aws_v1.8.0_x4:   /opt/teamcity-agent/work/222ea50a1b4f75f4/src/github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema/provider.go:283 +0xa4
2018-05-28T07:48:19.232+0200 [DEBUG] plugin.terraform-provider-aws_v1.8.0_x4: github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/plugin.(*ResourceProviderServer).Apply(0xc420363560, 0xc4205a1980, 0xc42036e920, 0x0, 0x0)
2018-05-28T07:48:19.232+0200 [DEBUG] plugin.terraform-provider-aws_v1.8.0_x4:   /opt/teamcity-agent/work/222ea50a1b4f75f4/src/github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/plugin/resource_provider.go:527 +0x57
2018-05-28T07:48:19.232+0200 [DEBUG] plugin.terraform-provider-aws_v1.8.0_x4: reflect.Value.call(0xc4204a2360, 0xc420569b20, 0x13, 0x28f602e, 0x4, 0xc420a18f20, 0x3, 0x3, 0x403a23, 0xc420021860, ...)
2018-05-28T07:48:19.233+0200 [DEBUG] plugin.terraform-provider-aws_v1.8.0_x4:   /usr/local/go/src/reflect/value.go:434 +0x905
2018-05-28T07:48:19.233+0200 [DEBUG] plugin.terraform-provider-aws_v1.8.0_x4: reflect.Value.Call(0xc4204a2360, 0xc420569b20, 0x13, 0xc420029720, 0x3, 0x3, 0x0, 0xc420903740, 0xc4201e8320)
2018-05-28T07:48:19.233+0200 [DEBUG] plugin.terraform-provider-aws_v1.8.0_x4:   /usr/local/go/src/reflect/value.go:302 +0xa4
2018-05-28T07:48:19.233+0200 [DEBUG] plugin.terraform-provider-aws_v1.8.0_x4: net/rpc.(*service).call(0xc42089dbc0, 0xc420408d20, 0xc420419590, 0xc420533780, 0xc420363680, 0x2071fe0, 0xc4205a1980, 0x16, 0x2072020, 0xc42036e920, ...)
2018-05-28T07:48:19.233+0200 [DEBUG] plugin.terraform-provider-aws_v1.8.0_x4:   /usr/local/go/src/net/rpc/server.go:381 +0x142
2018-05-28T07:48:19.234+0200 [DEBUG] plugin.terraform-provider-aws_v1.8.0_x4: created by net/rpc.(*Server).ServeCodec
2018-05-28T07:48:19.234+0200 [DEBUG] plugin.terraform-provider-aws_v1.8.0_x4:   /usr/local/go/src/net/rpc/server.go:475 +0x36b
2018/05/28 07:48:19 [TRACE] root.website: eval: *terraform.EvalWriteState
2018/05/28 07:48:19 [TRACE] root.website: eval: *terraform.EvalApplyProvisioners
2018/05/28 07:48:19 [TRACE] root.website: eval: *terraform.EvalIf
2018/05/28 07:48:19 [TRACE] root.website: eval: *terraform.EvalWriteState
2018/05/28 07:48:19 [TRACE] root.website: eval: *terraform.EvalWriteDiff
2018/05/28 07:48:19 [TRACE] root.website: eval: *terraform.EvalApplyPost
2018/05/28 07:48:19 [ERROR] root.website: eval: *terraform.EvalApplyPost, err: 1 error(s) occurred:

* aws_alb_target_group.nlb_tg: unexpected EOF
2018/05/28 07:48:19 [ERROR] root.website: eval: *terraform.EvalSequence, err: 1 error(s) occurred:

* aws_alb_target_group.nlb_tg: unexpected EOF
2018/05/28 07:48:19 [TRACE] [walkApply] Exiting eval tree: module.website.aws_alb_target_group.nlb_tg
2018/05/28 07:48:19 [TRACE] dag/walk: upstream errored, not walking "module.website.aws_alb_target_group_attachment.nlb_tg_attach"
2018/05/28 07:48:19 [TRACE] dag/walk: upstream errored, not walking "module.website.aws_alb_listener.listener_tcp_80"
2018/05/28 07:48:19 [TRACE] dag/walk: upstream errored, not walking "module.website.aws_alb_listener.listener_tcp_443"
2018/05/28 07:48:19 [TRACE] dag/walk: upstream errored, not walking "meta.count-boundary (count boundary fixup)"
2018/05/28 07:48:19 [TRACE] dag/walk: upstream errored, not walking "provider.aws (close)"
2018/05/28 07:48:19 [TRACE] dag/walk: upstream errored, not walking "root"
2018-05-28T07:48:19.248+0200 [DEBUG] plugin: plugin process exited: path=<REMOVED FROM OUTPUT BY USER>/.terraform/plugins/linux_amd64/terraform-provider-aws_v1.8.0_x4
2018/05/28 07:48:19 [TRACE] Preserving existing state lineage "39186fc3-8182-4e8c-b189-ebf643faa732"
2018/05/28 07:48:19 [TRACE] Preserving existing state lineage "39186fc3-8182-4e8c-b189-ebf643faa732"
2018/05/28 07:48:19 [TRACE] Preserving existing state lineage "39186fc3-8182-4e8c-b189-ebf643faa732"
2018/05/28 07:48:19 [TRACE] Preserving existing state lineage "39186fc3-8182-4e8c-b189-ebf643faa732"
2018/05/28 07:48:19 [DEBUG] plugin: waiting for all plugin processes to complete...
2018-05-28T07:48:19.439+0200 [WARN ] plugin: error closing client during Kill: err="connection is shut down"
2018-05-28T07:48:19.441+0200 [DEBUG] plugin: plugin process exited: path=<REMOVED FROM OUTPUT BY USER>/.terraform/plugins/linux_amd64/terraform-provider-template_v1.0.0_x4

Expected Behavior

I expected the two listeners, target group and the attachment to the nlb to be created.

Actual Behavior

TF crashed.

Steps to Reproduce

Use the above mentioned tf version and config and run terraform apply

Kind regards, alex

awuetz commented 6 years ago

Update: I recently updated the aws provider to

and it seems this solved my issue.

awuetz commented 6 years ago

@hashibot : Please close the ticket.

ghost commented 4 years ago

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!