Terraform v0.11.3
+ provider.aws v1.9.0
+ provider.template v1.0.0
Blue/Green deployment fails on the AllowTraffic hook on the new instances with the error:
The specified load balancer does not exist. for activityId="5" of activityType={Name: ExecuteCentralizedCommandOnInstanceActivity.runCentralizedCommand,Version: 1.00}
This config successfully copies the AutoScaling group using the given launch config, as well as successfully deploys the application, it passes the AfterInstall local health check.
Am I missing something basic and making a boneheaded mistake? Googling terraform The specified load balancer does not exist. yields nothing. From my seat this is pretty close to the example given in the docs, but no one else reporting anything about this leads me to believe I missed something major.
resource "aws_lb" "applicationELB" {
name = "${var.appName}-aelb"
internal = false
security_groups = "${var.elbSecurityGroups}"
subnets = ["${data.aws_subnet.allSubnets.*.id}"]
tags = {
terraformStack = "${var.appName}"
ManagedBy = "terraform"
}
# Snips target groups, listeners etc.
}
resource "aws_autoscaling_group" "application" {
availability_zones = ["${data.aws_availability_zones.available.names}"]
name = "${var.appName}-autoscale"
max_size = "${var.max}"
min_size = "${var.min}"
health_check_grace_period = 300
health_check_type = "ELB"
desired_capacity = "${var.min}"
launch_configuration = "${aws_launch_configuration.launchConf.name}"
timeouts {
delete = "15m"
}
lifecycle {
create_before_destroy = true
}
}
# Snips Tags, launch config etc.
The var.elbName here is passed in from the ELB module output.
resource "aws_codedeploy_app" "application" {
name = "${var.appName}-codeDeploy"
}
resource "aws_codedeploy_deployment_group" "example" {
app_name = "${aws_codedeploy_app.application.name}"
deployment_group_name = "${var.appName}-deployment-group"
service_role_arn = "${var.instanceRoleArn}"
autoscaling_groups = ["${var.autoscalingGroups}"]
deployment_style {
deployment_option = "WITH_TRAFFIC_CONTROL"
deployment_type = "BLUE_GREEN"
}
load_balancer_info {
elb_info {
name = "${var.elbName}"
}
}
blue_green_deployment_config {
deployment_ready_option {
action_on_timeout = "STOP_DEPLOYMENT"
wait_time_in_minutes = 60
}
green_fleet_provisioning_option {
action = "COPY_AUTO_SCALING_GROUP"
}
terminate_blue_instances_on_deployment_success {
action = "TERMINATE"
termination_wait_time_in_minutes = 15
}
}
}
Some hours later.
The docs appear to be unclear.
load_balancer_info {
elb_info {
name = "${var.elbName}"
}
}
Is only for a network ELB.
For an Application load balancer, you will want to use
load_balancer_info {
target_group_info {
name = "${var.elbTargetName}"
}
}
Though only being able to attach a single target is a drag.
@JimtotheB Thanks for the clarification I just want into this myself.
I have submitted #6681 to hopefully clear up the resource documentation about this. 👍
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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!
Most helpful comment
Some hours later.
The docs appear to be unclear.
Is only for a network ELB.
For an Application load balancer, you will want to use
Though only being able to attach a single target is a drag.