From d6e8660cc81514cece36bce3e9abd207b270fbd9 Mon Sep 17 00:00:00 2001 From: jameslaneovermind <122231433+jameslaneovermind@users.noreply.github.com> Date: Tue, 5 Mar 2024 15:25:15 +0000 Subject: [PATCH 1/2] updated target group ARN --- .terraform.lock.hcl | 19 +++++++++++++++++++ modules/scenarios/asg_change.tf | 14 +++++++++++++- 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/.terraform.lock.hcl b/.terraform.lock.hcl index 33cfece..d0857ab 100644 --- a/.terraform.lock.hcl +++ b/.terraform.lock.hcl @@ -1,6 +1,25 @@ # This file is maintained automatically by "terraform init". # Manual edits may be lost in future updates. +provider "registry.terraform.io/hashicorp/archive" { + version = "2.4.2" + hashes = [ + "h1:1eOz9vM/55vnQjxk23RhnYga7PZq8n2rGxG+2Vx2s6w=", + "zh:08faed7c9f42d82bc3d406d0d9d4971e2d1c2d34eae268ad211b8aca57b7f758", + "zh:3564112ed2d097d7e0672378044a69b06642c326f6f1584d81c7cdd32ebf3a08", + "zh:53cd9afd223c15828c1916e68cb728d2be1cbccb9545568d6c2b122d0bac5102", + "zh:5ae4e41e3a1ce9d40b6458218a85bbde44f21723943982bca4a3b8bb7c103670", + "zh:5b65499218b315b96e95c5d3463ea6d7c66245b59461217c99eaa1611891cd2c", + "zh:78d5eefdd9e494defcb3c68d282b8f96630502cac21d1ea161f53cfe9bb483b3", + "zh:7f45b35a8330bebd184c2545a41782ff58240ed6ba947274d9881dd5da44b02e", + "zh:87e67891033214e55cfead1391d68e6a3bf37993b7607753237e82aa3250bb71", + "zh:de3590d14037ad81fc5cedf7cfa44614a92452d7b39676289b704a962050bc5e", + "zh:e7e6f2ea567f2dbb3baa81c6203be69f9cd6aeeb01204fd93e3cf181e099b610", + "zh:fd24d03c89a7702628c2e5a3c732c0dede56fa75a08da4a1efe17b5f881c88e2", + "zh:febf4b7b5f3ff2adff0573ef6361f09b6638105111644bdebc0e4f575373935f", + ] +} + provider "registry.terraform.io/hashicorp/aws" { version = "5.37.0" constraints = ">= 4.9.0, >= 4.29.0, >= 4.55.0, >= 5.0.0" diff --git a/modules/scenarios/asg_change.tf b/modules/scenarios/asg_change.tf index 7f15db5..15e6cf0 100644 --- a/modules/scenarios/asg_change.tf +++ b/modules/scenarios/asg_change.tf @@ -21,13 +21,25 @@ resource "aws_lb_target_group" "my_target_group" { } } +# Create a second Target Group +resource "aws_lb_target_group" "my_new_target_group" { + name = "asg-new-change-tg" + port = 80 + protocol = "HTTP" + vpc_id = data.aws_vpc.default.id + + health_check { + path = "/" + } + } + # Create an Auto Scaling Group resource "aws_autoscaling_group" "my_asg" { name = "asg-change-test-asg" min_size = 0 max_size = 2 desired_capacity = 1 - target_group_arns = [aws_lb_target_group.my_target_group.arn] + target_group_arns = [aws_lb_target_group.my_new_target_group.arn] availability_zones = ["eu-west-2a"] # Replace with your desired AZs health_check_type = "EC2" health_check_grace_period = 300 From 89077e954890c25daf37aa932cf3bcb2be278df8 Mon Sep 17 00:00:00 2001 From: jameslaneovermind <122231433+jameslaneovermind@users.noreply.github.com> Date: Tue, 5 Mar 2024 15:37:48 +0000 Subject: [PATCH 2/2] update --- modules/scenarios/asg_change.tf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/scenarios/asg_change.tf b/modules/scenarios/asg_change.tf index 15e6cf0..684acdd 100644 --- a/modules/scenarios/asg_change.tf +++ b/modules/scenarios/asg_change.tf @@ -21,7 +21,7 @@ resource "aws_lb_target_group" "my_target_group" { } } -# Create a second Target Group + # Create a second Target Group resource "aws_lb_target_group" "my_new_target_group" { name = "asg-new-change-tg" port = 80 @@ -39,7 +39,7 @@ resource "aws_autoscaling_group" "my_asg" { min_size = 0 max_size = 2 desired_capacity = 1 - target_group_arns = [aws_lb_target_group.my_new_target_group.arn] + target_group_arns = [aws_lb_target_group.my_target_group.arn] availability_zones = ["eu-west-2a"] # Replace with your desired AZs health_check_type = "EC2" health_check_grace_period = 300