-
Notifications
You must be signed in to change notification settings - Fork 8.9k
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
Autoscaling Group - Target groups are getting removed #14540
Comments
Have same issue. resource "aws_autoscaling_attachment" "example" {
autoscaling_group_name = aws_autoscaling_group.example.id
elb = aws_elb.example.id
} Once applied, terraform removes this |
@vishwakumba I think if you apply third time it will remove the For now I ignore any changes in resource "aws_autoscaling_group" "example" {
lifecycle {
ignore_changes = [load_balancers]
}
} |
Hi any progress on this? |
I can confirm this is still an issue with the latest provider version, |
I figured this out with @shamil's comment and after re-reading updated documentation: Similar to I should have read https://registry.terraform.io/providers/hashicorp/aws/latest/docs/guides/version-3-upgrade#resource-aws_autoscaling_group a bit closer. |
I've added this to the autoscale group definition
and it's still trying to remove the target groups
|
I deleted destroyed everything and rebuilt, it's now honoring the ignore |
I have a similar setup and added the lifecycle rules as explained and the change still shows up. I also tried rebuilding the entire ASG and related resources as @cgkades did, but that did not fix the issue for me. Is there anything else I could try? :/ |
@jgelens we also made sure it wasn't generating a different name every time it ran. Can you paste your ASG section? |
@cgkades The names I use are static. resource "aws_autoscaling_group" "default" {
name = "${var.env}-asg-${var.name}"
launch_configuration = aws_launch_configuration.default.name
wait_for_capacity_timeout = 0
max_size = var.asg_max_size
min_size = var.asg_min_size
vpc_zone_identifier = var.subnets
suspended_processes = var.suspended_processes
lifecycle {
create_before_destroy = true
ignore_changes = [load_balancers, target_group_arns]
}
}
resource "aws_autoscaling_attachment" "vpn_api_alb" {
autoscaling_group_name = module.service_vpn_api.asg_id
alb_target_group_arn = module.alb_vpn_api.alb_target_group_arn
}
locals {
alb_name = "${var.env}-${var.name}"
}
resource "aws_alb" "default" {
name = local.alb_name
internal = var.alb_internal
security_groups = [module.sg.sg_id]
subnets = var.subnets
ip_address_type = "ipv4"
idle_timeout = var.alb_idle_timeout
} |
Hi. |
- aws_route_table에서 NAT Gateway 지정을 gateway_id에서 nat_gateway_id로 변경 - aws_autoscaling_group에서 load_balancers와 target_group_arns 속성을 change_ignore에 추가(중복 속성) hashicorp/terraform-provider-aws#14540
Marking this issue as stale due to inactivity. This helps our maintainers find and focus on the active issues. If this issue receives no comments in the next 30 days it will automatically be closed. Maintainers can also remove the stale label. If this issue was automatically closed and you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thank you! |
Issue Description
We upgraded aws terraform version from 2.70.0 to 3.0.0 on 03.08.20 for our terraform project. We also changed the EC2 Instance type, which usually is a small change for us in our Production Env. We were expecting the launch configuration(LC) and autoscaling groups(ASG) to be updated. The new aws terraform provider 3.0.0, updated the LC and ASG but also removed the attached target groups to the autoscaling group. This resulted in the Load balancer producing a lot of errors as it did not find out valid target groups.
Running terraform apply the second time, seems to add the missing autoscaling attachments to the target groups.
Terraform CLI and Terraform AWS Provider Version
Terraform v0.12.13
Affected Resource(s)
Terraform Configuration Files
And the terraform plan output:
Expected Behavior
Target groups containing the EC2 Instances serving requests should have been retained in the Autoscaling Group
Actual Behavior
Target groups containing the EC2 Instances serving requests have been removed from the Autoscaling Group.
Using aws terraform provider 3.0.0 or 3.1.0 seems to remove the target groups associated.
This piece of code works fine in version 2.70.0
Steps to Reproduce
Note: Running terraform apply, the second time, seems to add the missing autoscaling attachments.
The text was updated successfully, but these errors were encountered: