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

State 'loses' resources? #18646

Closed
huseyinham opened this issue Aug 9, 2018 · 3 comments
Closed

State 'loses' resources? #18646

huseyinham opened this issue Aug 9, 2018 · 3 comments

Comments

@huseyinham
Copy link

huseyinham commented Aug 9, 2018

Hi! I'm not sure if this should go to core or AWS-provider but I seem to be having an issue where terraform 'loses' state when applying and destroying fairly large amounts of listener rules over a short period of time (but over different applies in parallel)?

One apply contains 6 listener rules being created, so all-in-all I'm probably creating around 180 listener rules. I originally had less terraform runs because I bundled listener rule creation into the same file as target groups, but when I ran into this issue I thought it may be a race condition of some kind during the destruct so split them out, however it still occurs.

Terraform Version

v0.11.0

Terraform Configuration Files

I'm using modules that utilise these resources:

resource "aws_lb_listener_rule" "scope" {
  count        = "${var.count            }"
  listener_arn = "${var.http_listener_arn}"
  priority     = "${var.rule_priority    }"

  action {
    type             = "forward"
    target_group_arn = "${data.aws_lb_target_group.tg.arn}"
  }

  condition {
    field  =   "host-header"
    values = [ ... ]
  }
}

resource "aws_lb_listener_rule" "https" {
  count        = "${var.count             }"
  listener_arn = "${var.https_listener_arn}"
  priority     = "${var.rule_priority     }"

  action {
    type             = "forward"
    target_group_arn = "${data.aws_lb_target_group.tg.arn}"
  }

  condition {
    field  =   "host-header"
    values = [ ... ]
  }
}

Example 1

Creation of 2 listener rules:

14:43:58 module.balancer_app_cc_route.aws_lb_listener_rule.scope: Creating...
14:43:58 module.balancer_app_cc_route.aws_lb_listener_rule.scope: Creation complete after 0s (ID: arn:aws:elasticloadbalancing:eu-west-1:...adc8fc0412ca8ca3)
14:43:58 module.balancer_cc_route.aws_lb_listener_rule.scope: Creating...
14:43:58 module.balancer_cc_route.aws_lb_listener_rule.scope: Creation complete after 0s

Destruction of 1 listener rule only(?):

14:48:56 module.balancer_app_cc_route.aws_lb_listener_rule.scope: Destroying... (ID: arn:aws:elasticloadbalancing:eu-west-1:...adc8fc0412ca8ca3)
14:48:56 module.balancer_app_cc_route.aws_lb_listener_rule.scope: Destruction complete after 1s

Example 2

14:36:22 module.balancer_cc_route.aws_lb_listener_rule.scope: Creating...
14:36:22 module.balancer_app_cc_route.aws_lb_listener_rule.scope: Creating...
14:36:23 module.balancer_cc_route.aws_lb_listener_rule.scope: Creation complete after 0s (ID: arn:aws:elasticloadbalancing:eu-west-1:...b43aac1d4ffdbd72)
14:36:23 module.balancer_app_cc_route.aws_lb_listener_rule.scope: Creation complete after 0s
14:59:43 module.balancer_cc_route.aws_lb_listener_rule.scope: Destroying... (ID: arn:aws:elasticloadbalancing:eu-west-1:...b43aac1d4ffdbd72)
14:59:43 module.balancer_cc_route.aws_lb_listener_rule.scope: Destruction complete after 0s

Expected Behavior

The listeners created via an apply are destroyed when a destruct is run.

Actual Behavior

Some of the listener_rules are 'lost' and therefore doesn't destroy them (although terraform claims they were). Then when I try to destroy the Target Groups (via a different terraform destroy run), it can't due to it still being attached to a listener rule.

I noticed that during creation, the problematic listener rule never gives an arn ID after when it states 'Creation Complete'.

I'm not really sure how to proceed to debug from here though I'm afraid so any support or highlighting my stupidity is appreciated.

@apparentlymart
Copy link
Contributor

Hi @huseyinham! Sorry for this concerning behavior.

At first glance this seems like an issue specific to that resource, so for now I'm going to have our bot move this into the AWS provider repository where the team is more equipped to dig into the details here and figure out what's going on against the underlying API. If it turns out that this is a result of a Terraform Core bug then we'll reopen this issue here and figure out how to address it.

Thanks for reporting this!

@ghost
Copy link

ghost commented Aug 9, 2018

This issue has been automatically migrated to hashicorp/terraform-provider-aws#5490 because it looks like an issue with that provider. If you believe this is not an issue with the provider, please reply to hashicorp/terraform-provider-aws#5490.

@ghost
Copy link

ghost commented Apr 2, 2020

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 have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Apr 2, 2020
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants