-
Notifications
You must be signed in to change notification settings - Fork 9.5k
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
Cannot delete launch configuration because it is attached to AutoScalingGroup #532
Comments
I am having the same issue. Even changing simple "user_data" triggers this problem. |
I am also running into this. For now, I create a new launch configuration, apply, then remove the old launch configuration, and apply. |
+1 Ran into this within minutes of trying out terraform for the first time with trying to change the Like @motdotla I'm able to work around it with small incremental changes but it would be problematic if terraform were in some sort of automated continuous integration. |
👍 We hit this as well, and like @gwilym above, it's a blocker for integrating Terraform into our CI pipeline. :person_frowning: |
+1 |
👍 im also experiencing this bug. I think #1109 is a duplicate |
exciting, thanks! |
Up until now we were not able to update a launch configuration (i.e.: AMI, user-data, instance type) due to this bug: hashicorp/terraform#532 By removing the launch configuration name, we let Terraform generate a random one for us. This will help when updating the launch configurations (this involves create a new resource and delete the old one).
This seems to be present in 0.7.4 |
I can confirm that this is present in 0.7.4 |
Present in 0.7.7 as well |
Present in Modified Launch config userdata, ran
|
Any update on this? Just bumped into this problem as well. |
Still present in |
Is there any plan to fix this? This bug has been around for 2+ years :/ |
Gyus, AWS won't allow you to delete active launch configuration. The fix for this bug (not really a bug) is to simply add a lifecycle rule "create_before_destroy" in launch configuration section (https://www.terraform.io/docs/configuration/resources.html#lifecycle) |
Aha! All it takes is for someone to post the answer, rather than just sweep it under the rug :) Thanks a ton @rumenvasilev , worked great! |
@rumenvasilev that's the kind of information we were really looking for anyway! |
I would vote we close this issue, any takers? |
I've got this in my resource Error:
|
Still present in 0.8.0 |
Same for 0.8.2. Adding |
Bump. Still present. |
Still present in 0.8.3 when I'm only updating my launch config user_data script file. |
I'm not sure if people have tried this method on this thread, but it is working for me, so I figured I would post.
Also note, if you include |
Thanks Michael - great tip, works for me. I guess the only knock-on effect of this is that you get a new load balancer each time you update your launch config, which means you potentially have to update your DNS and make sure nothing breaks while that's propagated. |
I managed to achieve the right result without step 4 - which avoids the asg being recreated each time. So effectively I just used Michael's step 1 & 2 and all is good! |
I ran into this problem even though I use
terraform then immediately goes on to delete the launch configuration, but the deletion fails because AWS still complains that the launch configuration is associated with an ASG. If I then run I think this is an eventual consistency problem in AWS. Although the ASG is deleted first, it appears we need to wait a few seconds before attempting to delete the launch configuration. |
Ss we still have issue with 0.8.7 even after it's update - we made "fix" :-|
It's "ok" for us, as Terraform made changes in ASG's launch config setting before fail, and this is all we need to deploy an application. Hope this will be fixed soon in a correct way. |
example below works for me esource "aws_launch_configuration" "api_dev_front" { resource "aws_autoscaling_group" "api_dev_front" { |
@michael-henderson If you do not name your launch configuration. Its hard to identify it on the console. So to identify the name of launch configuration need to navigate via Asg ? |
It seems that if you have an autoscaling group that uses I did this, but in a module, and I didn't want every user of the module to have to re-create their ASGs, and only have the I had to revert and instead add another variable where the user can use a random suffix that gets appended to the ASG name. Quite annoying, but less annoying that having terraform fail a lot. |
Not sure if this is related, but when I change some of my launch configurations, the ASGs are not recreated, even though they're using the respective LC's name. |
@hubertgrzeskowiak when you change a launch configuration, the ASGs that use it will be updated to use it. They will not be recreated. Instances in the ASG will remain in place but any new instance launched will use the new launch configuration. |
@joelittlejohn Curious, were you able to resolve this? I'm also seeing the same thing: terraform attempts to delete the launch config, and manually checking it should be able to, so I'm guessing it's an eventual consistency problem. When I re-plan and apply the changes, with nothing else changed, it's able to "depose" of the old launch configurations. I wonder if there's some way for terraform to "sleep" a few seconds or just retry? |
@joelittlejohn Therefore I am using the LC's name as part of the ASG's name. The implicit dependency should re-create it. |
Is there any further guidance for this? I have custom logic to sleep on the terraform run then to remove the oldest LC matching each host configuration. |
Change your launch_configuration to use name_prefix instead of name so there is no conflicts in the name.
|
This still doesn't work at all as of Terraform v0.11.7 despite using name_prefix for the lc as well as create_before_destroy for both lc and asg. I'm seeing the exact same behavior as @joshma - guaranteed to happen every single time.
@phinze could you please reopen this and have another look? |
Hi all, Issues with the terraform AWS provider should be opened in the aws provider repository. Because this closed issue is generating notifications for subscribers, I am going to lock it and encourage anyone experiencing issues with the aws provider to open tickets there. Please continue to open issues here for any other terraform issues you encounter, and thanks! |
Using terraform v0.3.1, when I change the AMI my launch configuration depends on, it fails because of the reference to the autoscaling group.
Here's the relevant section of my configuration:
Here's the result of "terraform apply"
Thanks,
Kief
The text was updated successfully, but these errors were encountered: