brikis98 / terraform-up-and-running-code

Code samples for the book "Terraform: Up & Running" by Yevgeniy Brikman
http://www.terraformupandrunning.com/
MIT License
2.87k stars 1.92k forks source link

Chapter 2 Target group and health check not working #39

Closed SylvainMartel closed 4 years ago

SylvainMartel commented 4 years ago

When we create the target group, with the load balancer and the health check, the result is always unhealthy so it keeps deregistering old vm and spinning new one. But looking at the code, the HTTP health check is done on port 80, while the VM security group, and the httpd are configured on port 8080 only

brikis98 commented 4 years ago

The book and code examples do not set the port parameter in the health_check block: https://github.com/brikis98/terraform-up-and-running-code/blob/master/code/terraform/02-intro-to-terraform-syntax/webserver-cluster/main.tf#L92-L109. That means it should fall back to the traffic port, which is set to var.server_port, which is 8080. Are you seeing something different?

SylvainMartel commented 4 years ago

Found my mistake, error in the server_port variable. Closing this, thanks!