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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update on dependencies causes aws_autoscaling_notification to error on update #11283

Open
kdanga opened this issue Dec 13, 2019 · 4 comments
Open
Labels
service/autoscaling Issues and PRs that pertain to the autoscaling service. waiting-response Maintainers are waiting on response from community or contributor.

Comments

@kdanga
Copy link

kdanga commented Dec 13, 2019

Community Note

  • Please vote on this issue by adding a 馃憤 reaction to the original issue 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
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform Version

0.12.18

  • provider.aws v2.41.0

Affected Resource(s)

  • aws_autoscaling_notification

Terraform Configuration Files

# Copy-paste your Terraform configurations here - for large Terraform configs,
# please use a service like Dropbox and share a link to the ZIP file. For
# security, you can also encrypt the files using our GPG public key: https://keybase.io/hashicorp

resource "aws_autoscaling_group" "test-asg" {

  launch_configuration      = "${aws_launch_configuration.test-lc.id}"
  max_size                  = 1
  min_size                  = 0
  desired_capacity          = 0

  availability_zones = ["${var.availability_zone}"]

  # interpolate the LC into the ASG name so it always forces an update
  name                = "${aws_launch_configuration.test-lc.name}-asg"
  vpc_zone_identifier = ["${var.subnet}"]
}

resource "aws_launch_configuration" "test-lc" {
  name_prefix = "terraform-test-lc-${var.build}"

  root_block_device {
    volume_type           = "gp2"
    delete_on_termination = true
  }

  image_id             = "${var.image_id}"
  instance_type        = "${var.instance_id}"

  ebs_optimized = true
}

resource "aws_autoscaling_notification" "test-asg-notification" {
  group_names   = ["${aws_autoscaling_group.test-asg.name}"]
  notifications = ["autoscaling:EC2_INSTANCE_TERMINATE"]
  topic_arn     = "${aws_sns_topic.topic.arn}"
}

variable "build" {}

Debug Output

Expected Behavior

When forcing an update on the aws_launch_configuration resource, terraform should update the dependencies without any errors.

Actual Behavior

The aws_autoscaling_notification tries to do an update after both dependencies on aws_autoscaling_group and aws_launch_configuration were replaced. Fails with the following error:

aws_autoscaling_group.test-asg: Destroying... [id=terraform-test-lc-320191213192730297300000001-asg]
aws_autoscaling_group.test-asg: Still destroying... [id=terraform-test-lc-320191213192730297300000001-asg, 10s elapsed]
aws_autoscaling_group.test-asg: Still destroying... [id=terraform-test-lc-320191213192730297300000001-asg, 20s elapsed]
aws_autoscaling_group.test-asg: Destruction complete after 22s
aws_launch_configuration.test-lc: Destroying... [id=terraform-test-lc-320191213192730297300000001]
aws_launch_configuration.test-lc: Destruction complete after 1s
aws_launch_configuration.test-lc: Creating...
aws_launch_configuration.test-lc: Creation complete after 5s [id=terraform-test-lc-220191213192847027200000001]
aws_autoscaling_group.test-asg: Creating...
aws_autoscaling_group.test-asg: Creation complete after 3s [id=terraform-test-lc-220191213192847027200000001-asg]
aws_autoscaling_notification.test-asg-notification: Modifying... [id=arn:aws:sns:us-east-1:494976196876:vrs-alertTermination]

Error: Error deleting notification configuration for ASG "terraform-test-lc-320191213192730297300000001-asg", Topic ARN "arn:aws:sns:us-east-1:494976196876:vrs-alertTermination"

Steps to Reproduce

  1. terraform apply and provide build valueof 1
  2. terraform apply again, but with build value of 2

Important Factoids

References

  • #0000
@ghost ghost added the service/autoscaling Issues and PRs that pertain to the autoscaling service. label Dec 13, 2019
@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label Dec 13, 2019
@lystopad
Copy link

lystopad commented Jun 1, 2021

Hi,
Same for me with terraform v0.14.11 and aws provider v3.42.0.

@mehmetyazicioglu
Copy link

hello,
i am having the same issue with terraform v.0.14.11 and aws provider v3.42.0.

@lystopad
Copy link

@kdanga , hi
I solved it with the following explicit configuration for ASG and LC resources:

    lifecycle {
        create_before_destroy = true
    }

After that terraform is not complaining. Pls, try it.

@justinretzolk
Copy link
Member

Hey y'all 馃憢 Thank you for taking the time to file this, and for the additional discussion around it! Given the workaround provided above, and that there's been a number of AWS provider releases since this was initially field, can anyone confirm whether they're still experiencing this behavior?

@justinretzolk justinretzolk added waiting-response Maintainers are waiting on response from community or contributor. and removed needs-triage Waiting for first response or review from a maintainer. labels Nov 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
service/autoscaling Issues and PRs that pertain to the autoscaling service. waiting-response Maintainers are waiting on response from community or contributor.
Projects
None yet
Development

No branches or pull requests

4 participants