0.12.14
resource "aws_autoscaling_group" "web" {
name = "web-asg-${aws_launch_configuration.web.name}"
availability_zones = var.availablility_zones
desired_capacity = 1
max_size = 1
min_size = 1
launch_configuration = aws_launch_configuration.web.name
target_group_arns = ["${aws_lb_target_group.web.arn}"]
lifecycle {
create_before_destroy = true
}
}
resource "aws_autoscaling_policy" "web" {
name = "Scale Group Size"
policy_type = "TargetTrackingScaling"
cooldown = 0
scaling_adjustment = 0
estimated_instance_warmup = 90
autoscaling_group_name = aws_autoscaling_group.web.name
target_tracking_configuration {
disable_scale_in = false
target_value = 70
predefined_metric_specification {
predefined_metric_type = "ASGAverageCPUUtilization"
}
}
}
resource "aws_launch_configuration" "web" {
name_prefix = "web-lc-"
image_id = data.aws_ami.web.id
instance_type = "t3a.medium"
security_groups = ["${aws_default_vpc.main.default_security_group_id}"]
key_name = "keyname"
ebs_optimized = false
iam_instance_profile = "AppInstanceProfile"
root_block_device {
...
}
lifecycle {
create_before_destroy = true
}
}
Creates a new autoscaling group with launch config and policy and attaches to the same load balancer
Produces a cycle error
Error: Cycle: aws_autoscaling_policy.web, aws_autoscaling_group.web, aws_autoscaling_group.web (destroy deposed c2bfe635), aws_launch_configuration.web (destroy deposed e45910f9)
Please list the full steps required to reproduce the issue, for example:
terraform initterraform applyterraform apply
produced with
terraform plan -out=tfplan && terraform graph -draw-cycles -type=apply tfplan | dot -Tsvg > graph.svg
May have something to do with the policy having a dependency on the launch configuration for some reason
I have the same error and dependency with aws_ecs_service and aws_ecs_task_definition.
The problem seems to be based around how the dependencies are mapped when using create_before_destroy. The Cycle error goes away when i remove it but then i also lose blue-green deployments. Not a solution unfortunately as it incurs downtime.
Seeing this error with aws_launch_configuration and aws_autoscaling_group too on 0.12.14 and 0.12.15. Our temporary fix is to downgrade to 0.12.13.
Seeing this error with
aws_launch_configurationandaws_autoscaling_grouptoo on0.12.14and0.12.15. Our temporary fix is to downgrade to0.12.13.
Same here.
Seeing this error with
aws_launch_configurationandaws_autoscaling_grouptoo on0.12.14and0.12.15. Our temporary fix is to downgrade to0.12.13.
Same here.
I just hit the same issue. Any ETA on the fix?
The team is working on a fix.
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.
Most helpful comment
The team is working on a fix.