From c51a2ba5fc65e82c4c078e7882d0eac67a09abda Mon Sep 17 00:00:00 2001 From: Steven Moser Date: Tue, 4 Oct 2022 13:09:42 -0700 Subject: [PATCH 01/70] Update NOTICE --- NOTICE | 3 --- 1 file changed, 3 deletions(-) diff --git a/NOTICE b/NOTICE index 547595f909..4851a737ca 100644 --- a/NOTICE +++ b/NOTICE @@ -4,9 +4,6 @@ All Rights Reserved. Licensed under the LinkedIn Learning Exercise File License (the "License"). See LICENSE in the project root for license information. -ATTRIBUTIONS: -[PLEASE PROVIDE ATTRIBUTIONS OR DELETE THIS AND THE ABOVE LINE “ATTRIBUTIONS”] - Please note, this project may automatically load third party code from external repositories (for example, NPM modules, Composer packages, or other dependencies). If so, such third party code may be subject to other license terms than as set From 86efb799b9178891501327a779c2ddcf9c8ca811 Mon Sep 17 00:00:00 2001 From: cmosier-LiL <88352515+cmosier-LiL@users.noreply.github.com> Date: Fri, 21 Oct 2022 21:48:35 -0700 Subject: [PATCH 02/70] Update README.md --- README.md | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index a277b16cf0..a13d5279d9 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,9 @@ # Learning Terraform -This is the repository for the LinkedIn Learning course `Learning Terraform`. The full course is available from [LinkedIn Learning][lil-course-url]. +This is the repository for the LinkedIn Learning course Learning Terraform. The full course is available from [LinkedIn Learning][lil-course-url]. + +![Learning Terraform][lil-thumbnail-url] + +Terraform is a DevOps tool for declarative infrastructure—infrastructure as code. It simplifies and accelerates the configuration of cloud-based environments. In this course, instructor Josh Samuelson shows how to use Terraform to configure infrastructure and manage resources with Amazon Web Services (AWS). After demonstrating how to set up AWS for Terraform, Josh covers how Terraform manages your infrastructure, as well as how to use core Terraform commands. He also delves into more advanced topics, including how to leverage code modules from the Terraform registry and how to create your own modules. Upon wrapping up this course, you'll have the knowledge you need to efficiently define and manage infrastructure with this powerful tool. _See the readme file in the main branch for updated instructions and information._ ## Instructions @@ -10,8 +14,15 @@ The branches are structured to correspond to the videos in the course. The namin The `main` branch contains the starting code for the course and the `final` branch contains the completed code. -[0]: # (Replace these placeholder URLs with actual course URLs) +### Instructor + +Josh Samuelson + +DevOps Engineer + + -[lil-course-url]: https://www.linkedin.com/learning/ -[lil-thumbnail-url]: http:// +Check out my other courses on [LinkedIn Learning](https://www.linkedin.com/learning/instructors/josh-samuelson). +[lil-course-url]: https://www.linkedin.com/learning/learning-terraform-15575129?dApp=59033956 +[lil-thumbnail-url]: https://cdn.lynda.com/course/3087701/3087701-1666200696363-16x9.jpg From a7a48df9bcb00f46f508514dcc2d458088c850bb Mon Sep 17 00:00:00 2001 From: Steven Moser Date: Wed, 19 Jul 2023 10:24:05 -0700 Subject: [PATCH 03/70] Update NOTICE --- NOTICE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NOTICE b/NOTICE index 4851a737ca..6e2b44a461 100644 --- a/NOTICE +++ b/NOTICE @@ -1,4 +1,4 @@ -Copyright 2022 LinkedIn Corporation +Copyright 2023 LinkedIn Corporation All Rights Reserved. Licensed under the LinkedIn Learning Exercise File License (the "License"). From 59b4f9e2ac30896a5427c619cfad1308d6b1cfff Mon Sep 17 00:00:00 2001 From: bsdeol <108632450+bsdeol@users.noreply.github.com> Date: Tue, 9 Sep 2025 11:00:52 -0700 Subject: [PATCH 04/70] Initial Commit --- main.tf | 2 +- outputs.tf | 12 ++++++------ variables.tf | 8 ++++---- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/main.tf b/main.tf index 9b32ce06bb..0bfc354510 100644 --- a/main.tf +++ b/main.tf @@ -16,7 +16,7 @@ data "aws_ami" "app_ami" { resource "aws_instance" "web" { ami = data.aws_ami.app_ami.id - instance_type = "t3.nano" + instance_type = var.instance_type tags = { Name = "HelloWorld" diff --git a/outputs.tf b/outputs.tf index b35171bef1..c429b19b48 100644 --- a/outputs.tf +++ b/outputs.tf @@ -1,7 +1,7 @@ -#output "instance_ami" { -# value = aws_instance.web.ami -#} +output "instance_ami" { + value = aws_instance.web.ami +} -#output "instance_arn" { -# value = aws_instance.web.arn -#} +output "instance_arn" { + value = aws_instance.web.arn +} diff --git a/variables.tf b/variables.tf index c750667e0f..60856bc925 100644 --- a/variables.tf +++ b/variables.tf @@ -1,4 +1,4 @@ -#variable "instance_type" { -# description = "Type of EC2 instance to provision" -# default = "t3.nano" -#} +variable "instance_type" { + description = "Type of EC2 instance to provision" + default = "t3.nano" +} From 7910c1bba971e39c0c53c5efc9583e361e745824 Mon Sep 17 00:00:00 2001 From: bsdeol <108632450+bsdeol@users.noreply.github.com> Date: Tue, 9 Sep 2025 16:10:19 -0700 Subject: [PATCH 05/70] Update main.tf --- main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.tf b/main.tf index 0bfc354510..a5284ea024 100644 --- a/main.tf +++ b/main.tf @@ -14,7 +14,7 @@ data "aws_ami" "app_ami" { owners = ["979382823631"] # Bitnami } -resource "aws_instance" "web" { +resource "aws_instance" "blog" { ami = data.aws_ami.app_ami.id instance_type = var.instance_type From ed677284404e1e35f17d711a9ae709dddf972068 Mon Sep 17 00:00:00 2001 From: bsdeol <108632450+bsdeol@users.noreply.github.com> Date: Tue, 9 Sep 2025 16:12:54 -0700 Subject: [PATCH 06/70] changed web to blob in outputs.tf --- outputs.tf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/outputs.tf b/outputs.tf index c429b19b48..b15873cef5 100644 --- a/outputs.tf +++ b/outputs.tf @@ -1,7 +1,7 @@ output "instance_ami" { - value = aws_instance.web.ami + value = aws_instance.blob.ami } output "instance_arn" { - value = aws_instance.web.arn + value = aws_instance.blob.arn } From aaa50e6cf5ada30491497e4991efa7e3151a82fe Mon Sep 17 00:00:00 2001 From: bsdeol <108632450+bsdeol@users.noreply.github.com> Date: Tue, 9 Sep 2025 16:15:32 -0700 Subject: [PATCH 07/70] Update outputs.tf fixed blob to blog --- outputs.tf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/outputs.tf b/outputs.tf index b15873cef5..7e9410b55c 100644 --- a/outputs.tf +++ b/outputs.tf @@ -1,7 +1,7 @@ output "instance_ami" { - value = aws_instance.blob.ami + value = aws_instance.blog.ami } output "instance_arn" { - value = aws_instance.blob.arn + value = aws_instance.blog.arn } From 00e16b7e89c6d51b92c4146ae91e4123ca3dc3cc Mon Sep 17 00:00:00 2001 From: bsdeol <108632450+bsdeol@users.noreply.github.com> Date: Tue, 9 Sep 2025 18:19:30 -0700 Subject: [PATCH 08/70] created security grouip --- main.tf | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/main.tf b/main.tf index a5284ea024..d9931734bb 100644 --- a/main.tf +++ b/main.tf @@ -14,11 +14,44 @@ data "aws_ami" "app_ami" { owners = ["979382823631"] # Bitnami } +data "aws_vpc" "default" { + default = true +} + resource "aws_instance" "blog" { ami = data.aws_ami.app_ami.id instance_type = var.instance_type + + vpc_security_groups_ids = [aws_security_group.blog.id] tags = { Name = "HelloWorld" } } + +resource "aws_security_group" "blog" { + name = "blog" + description = "Allow http and https in. Allow everything out" + + vpc_id = data.aws.vpc.default.id +} + +resource "aws_security_group_rule" "blog_http_in" { + type = "ingress" + from_port = 80 + to_port = 80 + protocol = "tcp" + cidr_blocks = ["0.0.0.0/0"] + + security_group_id = aws_security_group.blog.id +} + +resource "aws_security_group_rule" "blog_everything_out" { + type = "egress" + from_port = 0 + to_port = 0 + protocol = "-1" + cidr_blocks = ["0.0.0.0/0"] + + security_group_id = aws_security_group.blog.id +} \ No newline at end of file From 34e9c0ad18a00b6c2fbbb02b79882a159ddfca19 Mon Sep 17 00:00:00 2001 From: bsdeol <108632450+bsdeol@users.noreply.github.com> Date: Tue, 9 Sep 2025 18:27:35 -0700 Subject: [PATCH 09/70] fixed a typo --- main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.tf b/main.tf index d9931734bb..e7ab2aebae 100644 --- a/main.tf +++ b/main.tf @@ -22,7 +22,7 @@ resource "aws_instance" "blog" { ami = data.aws_ami.app_ami.id instance_type = var.instance_type - vpc_security_groups_ids = [aws_security_group.blog.id] + vpc_security_group_ids = [aws_security_group.blog.id] tags = { Name = "HelloWorld" From 19c6e5b63d636ff54bae5cc4b19bab87a5d853dc Mon Sep 17 00:00:00 2001 From: bsdeol <108632450+bsdeol@users.noreply.github.com> Date: Tue, 9 Sep 2025 18:33:02 -0700 Subject: [PATCH 10/70] fixed a typo --- main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.tf b/main.tf index e7ab2aebae..aa464dfb96 100644 --- a/main.tf +++ b/main.tf @@ -33,7 +33,7 @@ resource "aws_security_group" "blog" { name = "blog" description = "Allow http and https in. Allow everything out" - vpc_id = data.aws.vpc.default.id + vpc_id = data.aws_vpc.default.id } resource "aws_security_group_rule" "blog_http_in" { From 4f89472d1d56408053803ce59e63eafe2d9601d1 Mon Sep 17 00:00:00 2001 From: bsdeol <108632450+bsdeol@users.noreply.github.com> Date: Tue, 9 Sep 2025 18:41:46 -0700 Subject: [PATCH 11/70] output public ip --- outputs.tf | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/outputs.tf b/outputs.tf index 7e9410b55c..e612252cd8 100644 --- a/outputs.tf +++ b/outputs.tf @@ -5,3 +5,11 @@ output "instance_ami" { output "instance_arn" { value = aws_instance.blog.arn } + +output "ec2_public_ip" { + value = aws_instance.blog.public_ip +} + +output "ec2_public_dns" { + value = aws_instance.blog.public_dns +} \ No newline at end of file From a7762a0d61a866d1b92d796954447938d80c6eb8 Mon Sep 17 00:00:00 2001 From: bsdeol <108632450+bsdeol@users.noreply.github.com> Date: Tue, 9 Sep 2025 19:04:54 -0700 Subject: [PATCH 12/70] used module for security group --- main.tf | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/main.tf b/main.tf index aa464dfb96..b214fd2107 100644 --- a/main.tf +++ b/main.tf @@ -22,13 +22,27 @@ resource "aws_instance" "blog" { ami = data.aws_ami.app_ami.id instance_type = var.instance_type - vpc_security_group_ids = [aws_security_group.blog.id] + #vpc_security_group_ids = [aws_security_group.blog.id] + vpc_security_group_ids = [module.blog_sg_security_group_id] tags = { Name = "HelloWorld" } } +module "blog_sg" { + source = "terraform-aws-modules/security-group/aws" + version = "5.3.0" + name = "blog_new" + + vpc_id = data.aws_vpc.default.id + ingress_rules = ["http-80-tcp", "https-443-tcp"] + ingress_cidr_blocks = ["0.0.0.0/0"] + + egress_rule = ["all-all"] + egress_cidr_blocks = ["0.0.0.0/0"] +} + resource "aws_security_group" "blog" { name = "blog" description = "Allow http and https in. Allow everything out" From 81304f04f3bb1d2f4b24bb1a00179b4fb10cf72d Mon Sep 17 00:00:00 2001 From: bsdeol <108632450+bsdeol@users.noreply.github.com> Date: Tue, 9 Sep 2025 19:05:41 -0700 Subject: [PATCH 13/70] fixed a typo --- main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.tf b/main.tf index b214fd2107..685ea478b6 100644 --- a/main.tf +++ b/main.tf @@ -39,7 +39,7 @@ module "blog_sg" { ingress_rules = ["http-80-tcp", "https-443-tcp"] ingress_cidr_blocks = ["0.0.0.0/0"] - egress_rule = ["all-all"] + egress_rules = ["all-all"] egress_cidr_blocks = ["0.0.0.0/0"] } From c6d9e670e26859c06da962ca8ade9c8eb94a8499 Mon Sep 17 00:00:00 2001 From: bsdeol <108632450+bsdeol@users.noreply.github.com> Date: Tue, 9 Sep 2025 19:09:05 -0700 Subject: [PATCH 14/70] fixed a typo --- main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.tf b/main.tf index 685ea478b6..96cd21afaf 100644 --- a/main.tf +++ b/main.tf @@ -23,7 +23,7 @@ resource "aws_instance" "blog" { instance_type = var.instance_type #vpc_security_group_ids = [aws_security_group.blog.id] - vpc_security_group_ids = [module.blog_sg_security_group_id] + vpc_security_group_ids = [module.blog_sg.security_group_id] tags = { Name = "HelloWorld" From 9ce91bce717c15ff466c7092d162f97928afd5c1 Mon Sep 17 00:00:00 2001 From: bsdeol <108632450+bsdeol@users.noreply.github.com> Date: Tue, 9 Sep 2025 19:15:52 -0700 Subject: [PATCH 15/70] commented out the smanually created security group and rules --- main.tf | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/main.tf b/main.tf index 96cd21afaf..cbadde5970 100644 --- a/main.tf +++ b/main.tf @@ -42,7 +42,7 @@ module "blog_sg" { egress_rules = ["all-all"] egress_cidr_blocks = ["0.0.0.0/0"] } - +/* resource "aws_security_group" "blog" { name = "blog" description = "Allow http and https in. Allow everything out" @@ -68,4 +68,5 @@ resource "aws_security_group_rule" "blog_everything_out" { cidr_blocks = ["0.0.0.0/0"] security_group_id = aws_security_group.blog.id -} \ No newline at end of file +} +*/ \ No newline at end of file From 98b6d14ec9eb3594beeb3357a23c3a3ea730c761 Mon Sep 17 00:00:00 2001 From: bsdeol <108632450+bsdeol@users.noreply.github.com> Date: Wed, 10 Sep 2025 09:54:37 -0700 Subject: [PATCH 16/70] removed the commented block in main.tf --- main.tf | 28 ---------------------------- 1 file changed, 28 deletions(-) diff --git a/main.tf b/main.tf index cbadde5970..3b37d244b0 100644 --- a/main.tf +++ b/main.tf @@ -42,31 +42,3 @@ module "blog_sg" { egress_rules = ["all-all"] egress_cidr_blocks = ["0.0.0.0/0"] } -/* -resource "aws_security_group" "blog" { - name = "blog" - description = "Allow http and https in. Allow everything out" - - vpc_id = data.aws_vpc.default.id -} - -resource "aws_security_group_rule" "blog_http_in" { - type = "ingress" - from_port = 80 - to_port = 80 - protocol = "tcp" - cidr_blocks = ["0.0.0.0/0"] - - security_group_id = aws_security_group.blog.id -} - -resource "aws_security_group_rule" "blog_everything_out" { - type = "egress" - from_port = 0 - to_port = 0 - protocol = "-1" - cidr_blocks = ["0.0.0.0/0"] - - security_group_id = aws_security_group.blog.id -} -*/ \ No newline at end of file From 1b02b7bc10a07fa4e438440bc7153137bcd6de31 Mon Sep 17 00:00:00 2001 From: bsdeol <108632450+bsdeol@users.noreply.github.com> Date: Wed, 10 Sep 2025 10:02:41 -0700 Subject: [PATCH 17/70] Create new dev VPC using module --- main.tf | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/main.tf b/main.tf index 3b37d244b0..1b8efa3714 100644 --- a/main.tf +++ b/main.tf @@ -18,12 +18,31 @@ data "aws_vpc" "default" { default = true } +module "blog_vpc" { + source = "terraform-aws-modules/vpc/aws" + + name = "dev" + cidr = "10.0.0.0/16" + + azs = ["us-west-2a", "us-west-2b", "us-west-2c"] + + public_subnets = ["10.0.101.0/24", "10.0.102.0/24", "10.0.103.0/24"] + + tags = { + Terraform = "true" + Environment = "dev" + } +} + resource "aws_instance" "blog" { ami = data.aws_ami.app_ami.id instance_type = var.instance_type #vpc_security_group_ids = [aws_security_group.blog.id] - vpc_security_group_ids = [module.blog_sg.security_group_id] + vpc_security_group_ids = [module.blog_sg.security_group_id] + + subnet_id = module.blog_vpc.public_subnets[0] + tags = { Name = "HelloWorld" @@ -35,7 +54,8 @@ module "blog_sg" { version = "5.3.0" name = "blog_new" - vpc_id = data.aws_vpc.default.id + #vpc_id = data.aws_vpc.default.id + vpc_id = module.blog_vpc.vpc_id ingress_rules = ["http-80-tcp", "https-443-tcp"] ingress_cidr_blocks = ["0.0.0.0/0"] From 8dc781368d1fb36bda5c61314ab0c2ffb533e3b5 Mon Sep 17 00:00:00 2001 From: bsdeol <108632450+bsdeol@users.noreply.github.com> Date: Wed, 10 Sep 2025 10:24:55 -0700 Subject: [PATCH 18/70] added LB --- main.tf | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/main.tf b/main.tf index 1b8efa3714..b878d7cf44 100644 --- a/main.tf +++ b/main.tf @@ -49,6 +49,40 @@ resource "aws_instance" "blog" { } } +#Application Load Balanceer +module "alb" { + source = "terraform-aws-modules/alb/aws" + + name = "blog-alb" + vpc_id = module.blog_vpc.vpc_id + subnets = module.blog_vpc.public_subnets + security_group = module.blog_sg.security_group_id + + target_groups = { + ex-instance = { + name_prefix = "blog-" + protocol = "HTTP" + port = 80 + target_type = "instance" + target_id = aws_instance.blog.id + } + } + + http_tcp_listeners = { + { + port = 80 + protocol = http + target_groups = 0 + } + } + + + tags = { + Environment = "dev" + } +} + +#Security Group module "blog_sg" { source = "terraform-aws-modules/security-group/aws" version = "5.3.0" From 7a979a741c6fb458cbf7cdddec0e5227299d2b62 Mon Sep 17 00:00:00 2001 From: bsdeol <108632450+bsdeol@users.noreply.github.com> Date: Wed, 10 Sep 2025 10:27:08 -0700 Subject: [PATCH 19/70] fixed quotes around HTTP --- main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.tf b/main.tf index b878d7cf44..0d9bfee76c 100644 --- a/main.tf +++ b/main.tf @@ -71,7 +71,7 @@ module "alb" { http_tcp_listeners = { { port = 80 - protocol = http + protocol = "HTTP" target_groups = 0 } } From f85a85fb823ecbf2dbd49ff7d0c1a75146af85f9 Mon Sep 17 00:00:00 2001 From: bsdeol <108632450+bsdeol@users.noreply.github.com> Date: Wed, 10 Sep 2025 10:30:40 -0700 Subject: [PATCH 20/70] changed braces --- main.tf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.tf b/main.tf index 0d9bfee76c..4cebf06cf5 100644 --- a/main.tf +++ b/main.tf @@ -68,13 +68,13 @@ module "alb" { } } - http_tcp_listeners = { + http_tcp_listeners = [ { port = 80 protocol = "HTTP" target_groups = 0 } - } + ] tags = { From a15c270a35c85add85245e115063f20a219baaed Mon Sep 17 00:00:00 2001 From: bsdeol <108632450+bsdeol@users.noreply.github.com> Date: Wed, 10 Sep 2025 10:35:49 -0700 Subject: [PATCH 21/70] fixed alb --- main.tf | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/main.tf b/main.tf index 4cebf06cf5..d2725fbba0 100644 --- a/main.tf +++ b/main.tf @@ -50,23 +50,26 @@ resource "aws_instance" "blog" { } #Application Load Balanceer -module "alb" { +module "blog_alb" { source = "terraform-aws-modules/alb/aws" - name = "blog-alb" + + name = "blog-alb" + + load_balancer_type = "application" + vpc_id = module.blog_vpc.vpc_id subnets = module.blog_vpc.public_subnets security_group = module.blog_sg.security_group_id - target_groups = { - ex-instance = { + target_groups = [ + { name_prefix = "blog-" - protocol = "HTTP" - port = 80 + backend_protocol = "HTTP" + backend_port = 80 target_type = "instance" - target_id = aws_instance.blog.id } - } + ] http_tcp_listeners = [ { @@ -76,7 +79,6 @@ module "alb" { } ] - tags = { Environment = "dev" } From 54b376f3681bd5b53bcc52fdf4f7adb0297e520a Mon Sep 17 00:00:00 2001 From: bsdeol <108632450+bsdeol@users.noreply.github.com> Date: Wed, 10 Sep 2025 10:37:45 -0700 Subject: [PATCH 22/70] added [] for security groups --- main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.tf b/main.tf index d2725fbba0..fbbf7fd2e3 100644 --- a/main.tf +++ b/main.tf @@ -60,7 +60,7 @@ module "blog_alb" { vpc_id = module.blog_vpc.vpc_id subnets = module.blog_vpc.public_subnets - security_group = module.blog_sg.security_group_id + security_group = [module.blog_sg.security_group_id] target_groups = [ { From 6b43257cbca14112b94807f98012f85dc13cc3e9 Mon Sep 17 00:00:00 2001 From: bsdeol <108632450+bsdeol@users.noreply.github.com> Date: Wed, 10 Sep 2025 11:13:10 -0700 Subject: [PATCH 23/70] fixed on 11:13 --- main.tf | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/main.tf b/main.tf index fbbf7fd2e3..ab684fb39d 100644 --- a/main.tf +++ b/main.tf @@ -53,14 +53,13 @@ resource "aws_instance" "blog" { module "blog_alb" { source = "terraform-aws-modules/alb/aws" - name = "blog-alb" load_balancer_type = "application" vpc_id = module.blog_vpc.vpc_id subnets = module.blog_vpc.public_subnets - security_group = [module.blog_sg.security_group_id] + security_groups = [module.blog_sg.security_group_id] target_groups = [ { @@ -68,6 +67,13 @@ module "blog_alb" { backend_protocol = "HTTP" backend_port = 80 target_type = "instance" + + targets = { + my_target = { + target_id = aws_instance.blog.id + port = 80 + } + } } ] From 2e757721593468779e759b91eae91c7f965ac64a Mon Sep 17 00:00:00 2001 From: bsdeol <108632450+bsdeol@users.noreply.github.com> Date: Wed, 10 Sep 2025 11:17:22 -0700 Subject: [PATCH 24/70] fixed 1117 --- main.tf | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/main.tf b/main.tf index ab684fb39d..24f7b1bc4e 100644 --- a/main.tf +++ b/main.tf @@ -79,9 +79,9 @@ module "blog_alb" { http_tcp_listeners = [ { - port = 80 - protocol = "HTTP" - target_groups = 0 + port = 80 + protocol = "HTTP" + target_group_index = 0 } ] From 9b7df6a833926b407d4cf59daeb85d9f05719d28 Mon Sep 17 00:00:00 2001 From: bsdeol <108632450+bsdeol@users.noreply.github.com> Date: Wed, 10 Sep 2025 11:19:13 -0700 Subject: [PATCH 25/70] added version --- main.tf | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/main.tf b/main.tf index 24f7b1bc4e..33f9ecda48 100644 --- a/main.tf +++ b/main.tf @@ -52,7 +52,8 @@ resource "aws_instance" "blog" { #Application Load Balanceer module "blog_alb" { source = "terraform-aws-modules/alb/aws" - + version = "~> 6.0" + name = "blog-alb" load_balancer_type = "application" From 98c4ad43655c5d5ab681436dd0bbd86323bfaebd Mon Sep 17 00:00:00 2001 From: bsdeol <108632450+bsdeol@users.noreply.github.com> Date: Wed, 10 Sep 2025 11:31:18 -0700 Subject: [PATCH 26/70] auto scalling group --- main.tf | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/main.tf b/main.tf index 33f9ecda48..73906b86d6 100644 --- a/main.tf +++ b/main.tf @@ -34,26 +34,27 @@ module "blog_vpc" { } } -resource "aws_instance" "blog" { - ami = data.aws_ami.app_ami.id - instance_type = var.instance_type - - #vpc_security_group_ids = [aws_security_group.blog.id] - vpc_security_group_ids = [module.blog_sg.security_group_id] - - subnet_id = module.blog_vpc.public_subnets[0] - - - tags = { - Name = "HelloWorld" - } +module "autoscaling" { + source = "terraform-aws-modules/autoscaling/aws" + version = "9.0.1" + # insert the 1 required variable here + name = "blog" + min_size = 1 + max_size = 2 + + vpc_zone_identifier = module.blog_vpc.public_subnets + target_group_arns = modele.blog_alb.target_group_arns + secuirty_groups = [module.blog_sg.security_group_id] + + image_id = data.aws_ami.app_ami.id + instance_type = var.instance_type } #Application Load Balanceer module "blog_alb" { source = "terraform-aws-modules/alb/aws" version = "~> 6.0" - + name = "blog-alb" load_balancer_type = "application" From 07f07ab484b31687151c06f66c0bdfe068e93d92 Mon Sep 17 00:00:00 2001 From: bsdeol <108632450+bsdeol@users.noreply.github.com> Date: Wed, 10 Sep 2025 11:33:16 -0700 Subject: [PATCH 27/70] fixed module typo --- main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.tf b/main.tf index 73906b86d6..9532807d62 100644 --- a/main.tf +++ b/main.tf @@ -43,7 +43,7 @@ module "autoscaling" { max_size = 2 vpc_zone_identifier = module.blog_vpc.public_subnets - target_group_arns = modele.blog_alb.target_group_arns + target_group_arns = module.blog_alb.target_group_arns secuirty_groups = [module.blog_sg.security_group_id] image_id = data.aws_ami.app_ami.id From 57a598b2bdfcf2274d61878f617eb392aad8424d Mon Sep 17 00:00:00 2001 From: bsdeol <108632450+bsdeol@users.noreply.github.com> Date: Wed, 10 Sep 2025 11:35:21 -0700 Subject: [PATCH 28/70] version --- main.tf | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/main.tf b/main.tf index 9532807d62..dee0521415 100644 --- a/main.tf +++ b/main.tf @@ -36,8 +36,8 @@ module "blog_vpc" { module "autoscaling" { source = "terraform-aws-modules/autoscaling/aws" - version = "9.0.1" - # insert the 1 required variable here + version = "6.5.2" + name = "blog" min_size = 1 max_size = 2 @@ -47,7 +47,7 @@ module "autoscaling" { secuirty_groups = [module.blog_sg.security_group_id] image_id = data.aws_ami.app_ami.id - instance_type = var.instance_type + instance_type = var.instance_type } #Application Load Balanceer From 86f2048a6c480b570396e0ce6e21535c610562d3 Mon Sep 17 00:00:00 2001 From: bsdeol <108632450+bsdeol@users.noreply.github.com> Date: Wed, 10 Sep 2025 11:39:51 -0700 Subject: [PATCH 29/70] removed alb target --- main.tf | 7 ------- 1 file changed, 7 deletions(-) diff --git a/main.tf b/main.tf index dee0521415..dd639a4b50 100644 --- a/main.tf +++ b/main.tf @@ -69,13 +69,6 @@ module "blog_alb" { backend_protocol = "HTTP" backend_port = 80 target_type = "instance" - - targets = { - my_target = { - target_id = aws_instance.blog.id - port = 80 - } - } } ] From 9f1005742bcd1242338ec02475385ceec17ee293 Mon Sep 17 00:00:00 2001 From: bsdeol <108632450+bsdeol@users.noreply.github.com> Date: Wed, 10 Sep 2025 11:44:35 -0700 Subject: [PATCH 30/70] security_groups --- main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.tf b/main.tf index dd639a4b50..fb573ca676 100644 --- a/main.tf +++ b/main.tf @@ -44,7 +44,7 @@ module "autoscaling" { vpc_zone_identifier = module.blog_vpc.public_subnets target_group_arns = module.blog_alb.target_group_arns - secuirty_groups = [module.blog_sg.security_group_id] + security_groups = [module.blog_sg.security_group_id] image_id = data.aws_ami.app_ami.id instance_type = var.instance_type From e5725d98d736279c018fd2cf045d70792d3cc417 Mon Sep 17 00:00:00 2001 From: bsdeol <108632450+bsdeol@users.noreply.github.com> Date: Wed, 10 Sep 2025 11:51:57 -0700 Subject: [PATCH 31/70] removed outputs --- outputs.tf | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/outputs.tf b/outputs.tf index e612252cd8..e69de29bb2 100644 --- a/outputs.tf +++ b/outputs.tf @@ -1,15 +0,0 @@ -output "instance_ami" { - value = aws_instance.blog.ami -} - -output "instance_arn" { - value = aws_instance.blog.arn -} - -output "ec2_public_ip" { - value = aws_instance.blog.public_ip -} - -output "ec2_public_dns" { - value = aws_instance.blog.public_dns -} \ No newline at end of file From 441ae0486875277247c85a5e2712eed262f853f1 Mon Sep 17 00:00:00 2001 From: bsdeol <108632450+bsdeol@users.noreply.github.com> Date: Wed, 10 Sep 2025 11:55:22 -0700 Subject: [PATCH 32/70] update autoscaling version --- main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.tf b/main.tf index fb573ca676..08572e7d7e 100644 --- a/main.tf +++ b/main.tf @@ -36,7 +36,7 @@ module "blog_vpc" { module "autoscaling" { source = "terraform-aws-modules/autoscaling/aws" - version = "6.5.2" + version = "9.0.1" name = "blog" min_size = 1 From fbf4ad7d76c17978f19d85a5b7066b81f86c07fd Mon Sep 17 00:00:00 2001 From: bsdeol <108632450+bsdeol@users.noreply.github.com> Date: Wed, 10 Sep 2025 11:56:52 -0700 Subject: [PATCH 33/70] autoscaling_group_target_group_arns --- main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.tf b/main.tf index 08572e7d7e..04c4ee2879 100644 --- a/main.tf +++ b/main.tf @@ -43,7 +43,7 @@ module "autoscaling" { max_size = 2 vpc_zone_identifier = module.blog_vpc.public_subnets - target_group_arns = module.blog_alb.target_group_arns + autoscaling_group_target_group_arns = module.blog_alb.target_group_arns security_groups = [module.blog_sg.security_group_id] image_id = data.aws_ami.app_ami.id From 1965e8454381a63e42b6d8d179b5c7393b37f9f2 Mon Sep 17 00:00:00 2001 From: bsdeol <108632450+bsdeol@users.noreply.github.com> Date: Wed, 10 Sep 2025 12:00:22 -0700 Subject: [PATCH 34/70] version 8.0 --- main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.tf b/main.tf index 04c4ee2879..6fe9182437 100644 --- a/main.tf +++ b/main.tf @@ -36,7 +36,7 @@ module "blog_vpc" { module "autoscaling" { source = "terraform-aws-modules/autoscaling/aws" - version = "9.0.1" + version = "~> 8.0" name = "blog" min_size = 1 From eb9373610bc348a05077fb8a4c1e4bffe48a47c3 Mon Sep 17 00:00:00 2001 From: bsdeol <108632450+bsdeol@users.noreply.github.com> Date: Wed, 10 Sep 2025 12:02:13 -0700 Subject: [PATCH 35/70] 6.0 --- main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.tf b/main.tf index 6fe9182437..268adadeb4 100644 --- a/main.tf +++ b/main.tf @@ -36,7 +36,7 @@ module "blog_vpc" { module "autoscaling" { source = "terraform-aws-modules/autoscaling/aws" - version = "~> 8.0" + version = "~> 6.0" name = "blog" min_size = 1 From c6180e84fee8474c648f8169a65f59ebfade5471 Mon Sep 17 00:00:00 2001 From: bsdeol <108632450+bsdeol@users.noreply.github.com> Date: Wed, 10 Sep 2025 12:03:19 -0700 Subject: [PATCH 36/70] removed "autoscaling_group" --- main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.tf b/main.tf index 268adadeb4..6fc359c462 100644 --- a/main.tf +++ b/main.tf @@ -43,7 +43,7 @@ module "autoscaling" { max_size = 2 vpc_zone_identifier = module.blog_vpc.public_subnets - autoscaling_group_target_group_arns = module.blog_alb.target_group_arns + target_group_arns = module.blog_alb.target_group_arns security_groups = [module.blog_sg.security_group_id] image_id = data.aws_ami.app_ami.id From 6853ea09fa3b8dcb24a0b67b84aa76f6008f7d60 Mon Sep 17 00:00:00 2001 From: bsdeol <108632450+bsdeol@users.noreply.github.com> Date: Wed, 10 Sep 2025 12:07:04 -0700 Subject: [PATCH 37/70] version 6.5.2 --- main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.tf b/main.tf index 6fc359c462..8ac9c76a66 100644 --- a/main.tf +++ b/main.tf @@ -36,7 +36,7 @@ module "blog_vpc" { module "autoscaling" { source = "terraform-aws-modules/autoscaling/aws" - version = "~> 6.0" + version = "6.5.2" name = "blog" min_size = 1 From 367c5836a6c4acce83816004da752b6ff54defe6 Mon Sep 17 00:00:00 2001 From: bsdeol <108632450+bsdeol@users.noreply.github.com> Date: Wed, 10 Sep 2025 12:08:16 -0700 Subject: [PATCH 38/70] version = "~> 9.0" --- main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.tf b/main.tf index 8ac9c76a66..c6b01fe17a 100644 --- a/main.tf +++ b/main.tf @@ -36,7 +36,7 @@ module "blog_vpc" { module "autoscaling" { source = "terraform-aws-modules/autoscaling/aws" - version = "6.5.2" + version = "~> 9.0" name = "blog" min_size = 1 From 69ae0d094f017c5bf65ad2d9b3573f678aba0a05 Mon Sep 17 00:00:00 2001 From: bsdeol <108632450+bsdeol@users.noreply.github.com> Date: Wed, 10 Sep 2025 12:09:12 -0700 Subject: [PATCH 39/70] commented line 46 --- main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.tf b/main.tf index c6b01fe17a..bc2e60f223 100644 --- a/main.tf +++ b/main.tf @@ -43,7 +43,7 @@ module "autoscaling" { max_size = 2 vpc_zone_identifier = module.blog_vpc.public_subnets - target_group_arns = module.blog_alb.target_group_arns + #target_group_arns = module.blog_alb.target_group_arns security_groups = [module.blog_sg.security_group_id] image_id = data.aws_ami.app_ami.id From 865eb9e512a2184bd5ac46682e6829afc41c742c Mon Sep 17 00:00:00 2001 From: bsdeol <108632450+bsdeol@users.noreply.github.com> Date: Wed, 10 Sep 2025 12:14:28 -0700 Subject: [PATCH 40/70] attaching asg to alb --- main.tf | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/main.tf b/main.tf index bc2e60f223..a3dee3fdef 100644 --- a/main.tf +++ b/main.tf @@ -48,6 +48,9 @@ module "autoscaling" { image_id = data.aws_ami.app_ami.id instance_type = var.instance_type + + # <-- Attach ASG to ALB target group(s) + target_group_arns = module.blog_alb.target_group_arns } #Application Load Balanceer @@ -55,7 +58,7 @@ module "blog_alb" { source = "terraform-aws-modules/alb/aws" version = "~> 6.0" - name = "blog-alb" + name = "blog_alb" load_balancer_type = "application" From 1d460d9f16e215484e3869ece63f95504e1ee92d Mon Sep 17 00:00:00 2001 From: bsdeol <108632450+bsdeol@users.noreply.github.com> Date: Wed, 10 Sep 2025 12:17:58 -0700 Subject: [PATCH 41/70] target groups --- main.tf | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/main.tf b/main.tf index a3dee3fdef..334848ff1d 100644 --- a/main.tf +++ b/main.tf @@ -50,7 +50,12 @@ module "autoscaling" { instance_type = var.instance_type # <-- Attach ASG to ALB target group(s) - target_group_arns = module.blog_alb.target_group_arns + target_groups = [ + { + arn = module.blog_alb.target_group_arns[0] + port = 80 # or 8080 if that’s what your app uses + } + ] } #Application Load Balanceer From 53ad7893c460ed0e8dcf5c842157cf511468ead8 Mon Sep 17 00:00:00 2001 From: bsdeol <108632450+bsdeol@users.noreply.github.com> Date: Wed, 10 Sep 2025 12:23:37 -0700 Subject: [PATCH 42/70] commented autoscaling group --- main.tf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.tf b/main.tf index 334848ff1d..2b4f1e1eb8 100644 --- a/main.tf +++ b/main.tf @@ -33,7 +33,7 @@ module "blog_vpc" { Environment = "dev" } } - +/* module "autoscaling" { source = "terraform-aws-modules/autoscaling/aws" version = "~> 9.0" @@ -57,7 +57,7 @@ module "autoscaling" { } ] } - +*/ #Application Load Balanceer module "blog_alb" { source = "terraform-aws-modules/alb/aws" From 93264b9a2dd3626cecaa95d3c8833e4e9fb4f110 Mon Sep 17 00:00:00 2001 From: bsdeol <108632450+bsdeol@users.noreply.github.com> Date: Wed, 10 Sep 2025 12:26:32 -0700 Subject: [PATCH 43/70] commented asg --- main.tf | 1 + 1 file changed, 1 insertion(+) diff --git a/main.tf b/main.tf index 2b4f1e1eb8..acd258b674 100644 --- a/main.tf +++ b/main.tf @@ -58,6 +58,7 @@ module "autoscaling" { ] } */ + #Application Load Balanceer module "blog_alb" { source = "terraform-aws-modules/alb/aws" From 5ee88c2b53dc2428757e988ed1752e99bb6ddec2 Mon Sep 17 00:00:00 2001 From: bsdeol <108632450+bsdeol@users.noreply.github.com> Date: Wed, 10 Sep 2025 12:29:15 -0700 Subject: [PATCH 44/70] update blog_alb --- main.tf | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/main.tf b/main.tf index acd258b674..3d7727763b 100644 --- a/main.tf +++ b/main.tf @@ -62,9 +62,9 @@ module "autoscaling" { #Application Load Balanceer module "blog_alb" { source = "terraform-aws-modules/alb/aws" - version = "~> 6.0" + version = "~> 9.8" - name = "blog_alb" + name = "blog-alb" load_balancer_type = "application" @@ -81,7 +81,7 @@ module "blog_alb" { } ] - http_tcp_listeners = [ + listeners = [ { port = 80 protocol = "HTTP" From e2b674fb12ec696c10ae3b238aec62167d95d638 Mon Sep 17 00:00:00 2001 From: bsdeol <108632450+bsdeol@users.noreply.github.com> Date: Wed, 10 Sep 2025 12:32:09 -0700 Subject: [PATCH 45/70] copied from 04_04 --- main.tf | 90 ++++++++++++++++++++++++--------------------------------- 1 file changed, 37 insertions(+), 53 deletions(-) diff --git a/main.tf b/main.tf index 3d7727763b..fe6ef759fb 100644 --- a/main.tf +++ b/main.tf @@ -3,7 +3,7 @@ data "aws_ami" "app_ami" { filter { name = "name" - values = ["bitnami-tomcat-*-x86_64-hvm-ebs-nami"] + values = [var.ami_filter.name] } filter { @@ -11,66 +11,53 @@ data "aws_ami" "app_ami" { values = ["hvm"] } - owners = ["979382823631"] # Bitnami + owners = [var.ami_filter.owner] # Bitnami } -data "aws_vpc" "default" { - default = true -} module "blog_vpc" { source = "terraform-aws-modules/vpc/aws" - name = "dev" - cidr = "10.0.0.0/16" + name = var.environment.name + cidr = "${var.environment.network_prefix}.0.0/16" - azs = ["us-west-2a", "us-west-2b", "us-west-2c"] + azs = ["us-west-2a","us-west-2b","us-west-2c"] + public_subnets = ["${var.environment.network_prefix}.101.0/24", "${var.environment.network_prefix}.102.0/24", "${var.environment.network_prefix}.103.0/24"] - public_subnets = ["10.0.101.0/24", "10.0.102.0/24", "10.0.103.0/24"] tags = { Terraform = "true" - Environment = "dev" + Environment = var.environment.name } } -/* -module "autoscaling" { - source = "terraform-aws-modules/autoscaling/aws" - version = "~> 9.0" - name = "blog" - min_size = 1 - max_size = 2 - vpc_zone_identifier = module.blog_vpc.public_subnets - #target_group_arns = module.blog_alb.target_group_arns - security_groups = [module.blog_sg.security_group_id] +module "blog_autoscaling" { + source = "terraform-aws-modules/autoscaling/aws" + version = "6.5.2" - image_id = data.aws_ami.app_ami.id - instance_type = var.instance_type + name = "blog" - # <-- Attach ASG to ALB target group(s) - target_groups = [ - { - arn = module.blog_alb.target_group_arns[0] - port = 80 # or 8080 if that’s what your app uses - } - ] + min_size = var.asg_min + max_size = var.asg_max + vpc_zone_identifier = module.blog_vpc.public_subnets + target_group_arns = module.blog_alb.target_group_arns + security_groups = [module.blog_sg.security_group_id] + instance_type = var.instance_type + image_id = data.aws_ami.app_ami.id } -*/ -#Application Load Balanceer module "blog_alb" { - source = "terraform-aws-modules/alb/aws" - version = "~> 9.8" + source = "terraform-aws-modules/alb/aws" + version = "~> 6.0" + + name = "blog-alb" - name = "blog-alb" + load_balancer_type = "application" - load_balancer_type = "application" - - vpc_id = module.blog_vpc.vpc_id - subnets = module.blog_vpc.public_subnets - security_groups = [module.blog_sg.security_group_id] + vpc_id = module.blog_vpc.vpc_id + subnets = module.blog_vpc.public_subnets + security_groups = [module.blog_sg.security_group_id] target_groups = [ { @@ -81,11 +68,11 @@ module "blog_alb" { } ] - listeners = [ + http_tcp_listeners = [ { - port = 80 - protocol = "HTTP" - target_group_index = 0 + port = 80 + protocol = "HTTP" + target_group_index = 0 } ] @@ -94,17 +81,14 @@ module "blog_alb" { } } -#Security Group module "blog_sg" { source = "terraform-aws-modules/security-group/aws" - version = "5.3.0" - name = "blog_new" + version = "4.13.0" - #vpc_id = data.aws_vpc.default.id - vpc_id = module.blog_vpc.vpc_id - ingress_rules = ["http-80-tcp", "https-443-tcp"] + vpc_id = module.blog_vpc.vpc_id + name = "blog" + ingress_rules = ["https-443-tcp","http-80-tcp"] ingress_cidr_blocks = ["0.0.0.0/0"] - - egress_rules = ["all-all"] - egress_cidr_blocks = ["0.0.0.0/0"] -} + egress_rules = ["all-all"] + egress_cidr_blocks = ["0.0.0.0/0"] +} \ No newline at end of file From 51bc56dde78b53787bd795e14c9ef630fbe5793f Mon Sep 17 00:00:00 2001 From: bsdeol <108632450+bsdeol@users.noreply.github.com> Date: Wed, 10 Sep 2025 12:33:53 -0700 Subject: [PATCH 46/70] added varirales to variables.tf from 04_04 --- variables.tf | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/variables.tf b/variables.tf index 60856bc925..134b70f769 100644 --- a/variables.tf +++ b/variables.tf @@ -2,3 +2,40 @@ variable "instance_type" { description = "Type of EC2 instance to provision" default = "t3.nano" } + +variable "ami_filter" { + description = "Name filter and owner for AMI" + + type = object ({ + name = string + owner = string + }) + + default = { + name = "bitnami-tomcat-*-x86_64-hvm-ebs-nami" + owner = "979382823631" # Bitnami + } +} + +variable "environment" { + description = "Deployment environment" + + type = object ({ + name = string + network_prefix = string + }) + default = { + name = "dev" + network_prefix = "10.0" + } +} + +variable "asg_min" { + description = "Minimum instance count for the ASG" + default = 1 +} + +variable "asg_max" { + description = "Maximum instance count for the ASG" + default = 2 +} \ No newline at end of file From 1842eb764169f2725bdbff1810fcd1d059774da9 Mon Sep 17 00:00:00 2001 From: bsdeol <108632450+bsdeol@users.noreply.github.com> Date: Wed, 10 Sep 2025 12:39:57 -0700 Subject: [PATCH 47/70] reverted 04_04 --- variables.tf | 37 ------------------------------------- 1 file changed, 37 deletions(-) diff --git a/variables.tf b/variables.tf index 134b70f769..48b7a75904 100644 --- a/variables.tf +++ b/variables.tf @@ -1,41 +1,4 @@ variable "instance_type" { description = "Type of EC2 instance to provision" default = "t3.nano" -} - -variable "ami_filter" { - description = "Name filter and owner for AMI" - - type = object ({ - name = string - owner = string - }) - - default = { - name = "bitnami-tomcat-*-x86_64-hvm-ebs-nami" - owner = "979382823631" # Bitnami - } -} - -variable "environment" { - description = "Deployment environment" - - type = object ({ - name = string - network_prefix = string - }) - default = { - name = "dev" - network_prefix = "10.0" - } -} - -variable "asg_min" { - description = "Minimum instance count for the ASG" - default = 1 -} - -variable "asg_max" { - description = "Maximum instance count for the ASG" - default = 2 } \ No newline at end of file From 4794962957dda767559d3db0fb7a309187dd136c Mon Sep 17 00:00:00 2001 From: bsdeol <108632450+bsdeol@users.noreply.github.com> Date: Wed, 10 Sep 2025 13:33:08 -0700 Subject: [PATCH 48/70] deleted main, variable and output --- main.tf | 94 ---------------------------------------------------- outputs.tf | 0 variables.tf | 4 --- 3 files changed, 98 deletions(-) delete mode 100644 main.tf delete mode 100644 outputs.tf delete mode 100644 variables.tf diff --git a/main.tf b/main.tf deleted file mode 100644 index fe6ef759fb..0000000000 --- a/main.tf +++ /dev/null @@ -1,94 +0,0 @@ -data "aws_ami" "app_ami" { - most_recent = true - - filter { - name = "name" - values = [var.ami_filter.name] - } - - filter { - name = "virtualization-type" - values = ["hvm"] - } - - owners = [var.ami_filter.owner] # Bitnami -} - - -module "blog_vpc" { - source = "terraform-aws-modules/vpc/aws" - - name = var.environment.name - cidr = "${var.environment.network_prefix}.0.0/16" - - azs = ["us-west-2a","us-west-2b","us-west-2c"] - public_subnets = ["${var.environment.network_prefix}.101.0/24", "${var.environment.network_prefix}.102.0/24", "${var.environment.network_prefix}.103.0/24"] - - - tags = { - Terraform = "true" - Environment = var.environment.name - } -} - - -module "blog_autoscaling" { - source = "terraform-aws-modules/autoscaling/aws" - version = "6.5.2" - - name = "blog" - - min_size = var.asg_min - max_size = var.asg_max - vpc_zone_identifier = module.blog_vpc.public_subnets - target_group_arns = module.blog_alb.target_group_arns - security_groups = [module.blog_sg.security_group_id] - instance_type = var.instance_type - image_id = data.aws_ami.app_ami.id -} - -module "blog_alb" { - source = "terraform-aws-modules/alb/aws" - version = "~> 6.0" - - name = "blog-alb" - - load_balancer_type = "application" - - vpc_id = module.blog_vpc.vpc_id - subnets = module.blog_vpc.public_subnets - security_groups = [module.blog_sg.security_group_id] - - target_groups = [ - { - name_prefix = "blog-" - backend_protocol = "HTTP" - backend_port = 80 - target_type = "instance" - } - ] - - http_tcp_listeners = [ - { - port = 80 - protocol = "HTTP" - target_group_index = 0 - } - ] - - tags = { - Environment = "dev" - } -} - -module "blog_sg" { - source = "terraform-aws-modules/security-group/aws" - version = "4.13.0" - - vpc_id = module.blog_vpc.vpc_id - name = "blog" - ingress_rules = ["https-443-tcp","http-80-tcp"] - ingress_cidr_blocks = ["0.0.0.0/0"] - egress_rules = ["all-all"] - egress_cidr_blocks = ["0.0.0.0/0"] -} \ No newline at end of file diff --git a/outputs.tf b/outputs.tf deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/variables.tf b/variables.tf deleted file mode 100644 index 48b7a75904..0000000000 --- a/variables.tf +++ /dev/null @@ -1,4 +0,0 @@ -variable "instance_type" { - description = "Type of EC2 instance to provision" - default = "t3.nano" -} \ No newline at end of file From c6c37c5f5f254ad830aa40ebec330f183fff0c97 Mon Sep 17 00:00:00 2001 From: bsdeol <108632450+bsdeol@users.noreply.github.com> Date: Wed, 10 Sep 2025 15:16:16 -0700 Subject: [PATCH 49/70] changed versions --- main.tf | 2 +- providers.tf | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/main.tf b/main.tf index 7691553417..3d458a7a74 100644 --- a/main.tf +++ b/main.tf @@ -34,7 +34,7 @@ module "blog_vpc" { module "blog_autoscaling" { source = "terraform-aws-modules/autoscaling/aws" - version = "6.5.2" + version = "~> 9.3" name = "blog" diff --git a/providers.tf b/providers.tf index c41e3650b5..fd07223def 100644 --- a/providers.tf +++ b/providers.tf @@ -2,6 +2,7 @@ terraform { required_providers { aws = { source = "hashicorp/aws" + version = "~> 6.0" } } } From 6105854f46a3ea0e6eff150391de451ed1e4e638 Mon Sep 17 00:00:00 2001 From: bsdeol <108632450+bsdeol@users.noreply.github.com> Date: Wed, 10 Sep 2025 15:18:23 -0700 Subject: [PATCH 50/70] 9.0.1 --- main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.tf b/main.tf index 3d458a7a74..0e9daf3001 100644 --- a/main.tf +++ b/main.tf @@ -34,7 +34,7 @@ module "blog_vpc" { module "blog_autoscaling" { source = "terraform-aws-modules/autoscaling/aws" - version = "~> 9.3" + version = "9.0.1" name = "blog" From bcb57e5f0c3a931d649049bc7a7ab75ea203d603 Mon Sep 17 00:00:00 2001 From: bsdeol <108632450+bsdeol@users.noreply.github.com> Date: Wed, 10 Sep 2025 15:20:47 -0700 Subject: [PATCH 51/70] changed target_groups --- main.tf | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/main.tf b/main.tf index 0e9daf3001..7746d940e9 100644 --- a/main.tf +++ b/main.tf @@ -41,7 +41,13 @@ module "blog_autoscaling" { min_size = var.asg_min max_size = var.asg_max vpc_zone_identifier = module.blog_vpc.public_subnets - target_group_arns = module.blog_alb.target_group_arns + target_groups = [ + { + arn = module.blog_alb.target_group_arns[0] + port = 80 # use 8080 if your app listens on 8080 + } + ] + security_groups = [module.blog_sg.security_group_id] instance_type = var.instance_type image_id = data.aws_ami.app_ami.id From 8a2e0cfbbfa43028e3ede2436ee267633b66afdb Mon Sep 17 00:00:00 2001 From: bsdeol <108632450+bsdeol@users.noreply.github.com> Date: Wed, 10 Sep 2025 15:24:38 -0700 Subject: [PATCH 52/70] added traffic_source_attachement --- main.tf | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/main.tf b/main.tf index 7746d940e9..0d07c2206e 100644 --- a/main.tf +++ b/main.tf @@ -41,12 +41,12 @@ module "blog_autoscaling" { min_size = var.asg_min max_size = var.asg_max vpc_zone_identifier = module.blog_vpc.public_subnets - target_groups = [ - { - arn = module.blog_alb.target_group_arns[0] - port = 80 # use 8080 if your app listens on 8080 + + traffic_source_attachments = { + alb = { + traffic_source_identifier = module.blog_alb.target_group_arns[0] } - ] + } security_groups = [module.blog_sg.security_group_id] instance_type = var.instance_type From e2dc8005b257181f1f1235b690ac8eea7666adc4 Mon Sep 17 00:00:00 2001 From: bsdeol <108632450+bsdeol@users.noreply.github.com> Date: Wed, 10 Sep 2025 15:47:34 -0700 Subject: [PATCH 53/70] added url to outputs --- outputs.tf | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/outputs.tf b/outputs.tf index 8b13789179..d99ef75877 100644 --- a/outputs.tf +++ b/outputs.tf @@ -1 +1,3 @@ - +output "env_url" { + value = module.blog_alb.dns_name +} From a02635069b95fd7bfef5d4cf7ca3f600bd2eb709 Mon Sep 17 00:00:00 2001 From: bsdeol <108632450+bsdeol@users.noreply.github.com> Date: Wed, 10 Sep 2025 15:49:35 -0700 Subject: [PATCH 54/70] lb_dns_name --- outputs.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/outputs.tf b/outputs.tf index d99ef75877..b500ddcfef 100644 --- a/outputs.tf +++ b/outputs.tf @@ -1,3 +1,3 @@ output "env_url" { - value = module.blog_alb.dns_name + value = module.blog_alb.lb_dns_name } From 3242658cee7e3abb489c1bc3d69eaa50131eee43 Mon Sep 17 00:00:00 2001 From: bsdeol <108632450+bsdeol@users.noreply.github.com> Date: Wed, 10 Sep 2025 16:16:48 -0700 Subject: [PATCH 55/70] used variables --- main.tf | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/main.tf b/main.tf index 0d07c2206e..47b83562d6 100644 --- a/main.tf +++ b/main.tf @@ -18,7 +18,7 @@ data "aws_ami" "app_ami" { module "blog_vpc" { source = "terraform-aws-modules/vpc/aws" - name = var.environment.name + name =${var.environment.name}-blog-vpc cidr = "${var.environment.network_prefix}.0.0/16" azs = ["us-west-2a","us-west-2b","us-west-2c"] @@ -36,7 +36,7 @@ module "blog_autoscaling" { source = "terraform-aws-modules/autoscaling/aws" version = "9.0.1" - name = "blog" + name = "${var.enviornment.name}-blog-asg" min_size = var.asg_min max_size = var.asg_max @@ -57,7 +57,7 @@ module "blog_alb" { source = "terraform-aws-modules/alb/aws" version = "~> 6.0" - name = "blog-alb" + name = "${var.enviornment.name}-blog-alb" load_balancer_type = "application" @@ -83,7 +83,7 @@ module "blog_alb" { ] tags = { - Environment = "dev" + Environment = var.enviornment.name } } @@ -92,7 +92,7 @@ module "blog_sg" { version = "4.13.0" vpc_id = module.blog_vpc.vpc_id - name = "blog" + name = "${var.enviornment.name}-blog-sg" ingress_rules = ["https-443-tcp","http-80-tcp"] ingress_cidr_blocks = ["0.0.0.0/0"] egress_rules = ["all-all"] From ee1fd37d3c848c25e2cdb133f31b6fa6625dc202 Mon Sep 17 00:00:00 2001 From: bsdeol <108632450+bsdeol@users.noreply.github.com> Date: Wed, 10 Sep 2025 16:19:18 -0700 Subject: [PATCH 56/70] typo --- main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.tf b/main.tf index 47b83562d6..c03d2629da 100644 --- a/main.tf +++ b/main.tf @@ -18,7 +18,7 @@ data "aws_ami" "app_ami" { module "blog_vpc" { source = "terraform-aws-modules/vpc/aws" - name =${var.environment.name}-blog-vpc + name = ${var.environment.name}-blog-vpc cidr = "${var.environment.network_prefix}.0.0/16" azs = ["us-west-2a","us-west-2b","us-west-2c"] From 177930e050cad44ffa4d4cb202aa782dfb364b87 Mon Sep 17 00:00:00 2001 From: bsdeol <108632450+bsdeol@users.noreply.github.com> Date: Wed, 10 Sep 2025 16:20:41 -0700 Subject: [PATCH 57/70] quotes --- main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.tf b/main.tf index c03d2629da..e085e027a7 100644 --- a/main.tf +++ b/main.tf @@ -18,7 +18,7 @@ data "aws_ami" "app_ami" { module "blog_vpc" { source = "terraform-aws-modules/vpc/aws" - name = ${var.environment.name}-blog-vpc + name = "${var.environment.name}-blog-vpc" cidr = "${var.environment.network_prefix}.0.0/16" azs = ["us-west-2a","us-west-2b","us-west-2c"] From 918a4bc1cfb85f107db80e2e72af616d7f0df507 Mon Sep 17 00:00:00 2001 From: bsdeol <108632450+bsdeol@users.noreply.github.com> Date: Wed, 10 Sep 2025 16:23:12 -0700 Subject: [PATCH 58/70] typo in environment --- main.tf | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/main.tf b/main.tf index e085e027a7..4dc2ea07cb 100644 --- a/main.tf +++ b/main.tf @@ -36,7 +36,7 @@ module "blog_autoscaling" { source = "terraform-aws-modules/autoscaling/aws" version = "9.0.1" - name = "${var.enviornment.name}-blog-asg" + name = "${var.environment.name}-blog-asg" min_size = var.asg_min max_size = var.asg_max @@ -57,7 +57,7 @@ module "blog_alb" { source = "terraform-aws-modules/alb/aws" version = "~> 6.0" - name = "${var.enviornment.name}-blog-alb" + name = "${var.environment.name}-blog-alb" load_balancer_type = "application" @@ -83,7 +83,7 @@ module "blog_alb" { ] tags = { - Environment = var.enviornment.name + Environment = var.environment.name } } @@ -92,7 +92,7 @@ module "blog_sg" { version = "4.13.0" vpc_id = module.blog_vpc.vpc_id - name = "${var.enviornment.name}-blog-sg" + name = "${var.environment.name}-blog-sg" ingress_rules = ["https-443-tcp","http-80-tcp"] ingress_cidr_blocks = ["0.0.0.0/0"] egress_rules = ["all-all"] From 4c7701f2484e5f30f62360f0f61404ae794e2567 Mon Sep 17 00:00:00 2001 From: bsdeol <108632450+bsdeol@users.noreply.github.com> Date: Wed, 10 Sep 2025 16:29:02 -0700 Subject: [PATCH 59/70] modulerized --- providers.tf => dev/providers.tf | 0 main.tf => modules/blob/main.tf | 0 outputs.tf => modules/blob/outputs.tf | 0 variables.tf => modules/blob/variables.tf | 0 4 files changed, 0 insertions(+), 0 deletions(-) rename providers.tf => dev/providers.tf (100%) rename main.tf => modules/blob/main.tf (100%) rename outputs.tf => modules/blob/outputs.tf (100%) rename variables.tf => modules/blob/variables.tf (100%) diff --git a/providers.tf b/dev/providers.tf similarity index 100% rename from providers.tf rename to dev/providers.tf diff --git a/main.tf b/modules/blob/main.tf similarity index 100% rename from main.tf rename to modules/blob/main.tf diff --git a/outputs.tf b/modules/blob/outputs.tf similarity index 100% rename from outputs.tf rename to modules/blob/outputs.tf diff --git a/variables.tf b/modules/blob/variables.tf similarity index 100% rename from variables.tf rename to modules/blob/variables.tf From 13a5742d0780f0edd3f53ca45a1379832e0fdccc Mon Sep 17 00:00:00 2001 From: bsdeol <108632450+bsdeol@users.noreply.github.com> Date: Wed, 10 Sep 2025 19:12:42 -0700 Subject: [PATCH 60/70] defined dev env. --- dev/main.tf | 3 +++ modules/{blob => blog}/main.tf | 0 modules/{blob => blog}/outputs.tf | 0 modules/{blob => blog}/variables.tf | 0 4 files changed, 3 insertions(+) create mode 100644 dev/main.tf rename modules/{blob => blog}/main.tf (100%) rename modules/{blob => blog}/outputs.tf (100%) rename modules/{blob => blog}/variables.tf (100%) diff --git a/dev/main.tf b/dev/main.tf new file mode 100644 index 0000000000..08a6a8eac2 --- /dev/null +++ b/dev/main.tf @@ -0,0 +1,3 @@ +module "dev" { + source = "../module/blog" +} \ No newline at end of file diff --git a/modules/blob/main.tf b/modules/blog/main.tf similarity index 100% rename from modules/blob/main.tf rename to modules/blog/main.tf diff --git a/modules/blob/outputs.tf b/modules/blog/outputs.tf similarity index 100% rename from modules/blob/outputs.tf rename to modules/blog/outputs.tf diff --git a/modules/blob/variables.tf b/modules/blog/variables.tf similarity index 100% rename from modules/blob/variables.tf rename to modules/blog/variables.tf From edfbb372bb84e70f751bef1aef9b2c2b3f5783f4 Mon Sep 17 00:00:00 2001 From: bsdeol <108632450+bsdeol@users.noreply.github.com> Date: Wed, 10 Sep 2025 19:13:51 -0700 Subject: [PATCH 61/70] typo --- dev/main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/main.tf b/dev/main.tf index 08a6a8eac2..deb7e7d8be 100644 --- a/dev/main.tf +++ b/dev/main.tf @@ -1,3 +1,3 @@ module "dev" { - source = "../module/blog" + source = "../modules/blog" } \ No newline at end of file From 90147f3609f6be40c19b078b10ef2bc8356a4f07 Mon Sep 17 00:00:00 2001 From: bsdeol <108632450+bsdeol@users.noreply.github.com> Date: Thu, 11 Sep 2025 12:02:00 -0700 Subject: [PATCH 62/70] defined qa environment --- qa/main.tf | 12 ++++++++++++ qa/outputs.tf | 3 +++ qa/providers.tf | 12 ++++++++++++ 3 files changed, 27 insertions(+) create mode 100644 qa/main.tf create mode 100644 qa/outputs.tf create mode 100644 qa/providers.tf diff --git a/qa/main.tf b/qa/main.tf new file mode 100644 index 0000000000..cae44ce6fb --- /dev/null +++ b/qa/main.tf @@ -0,0 +1,12 @@ +module "qa" { + source = "../modules/blog" + + environment = { + name = "qa" + network_prefix = "10.1" + } + + asg_min = 1 + asg_max = 1 + +} \ No newline at end of file diff --git a/qa/outputs.tf b/qa/outputs.tf new file mode 100644 index 0000000000..6ec72c91f5 --- /dev/null +++ b/qa/outputs.tf @@ -0,0 +1,3 @@ +output = "env_url" { + value = module.qa.env_url +} \ No newline at end of file diff --git a/qa/providers.tf b/qa/providers.tf new file mode 100644 index 0000000000..fd07223def --- /dev/null +++ b/qa/providers.tf @@ -0,0 +1,12 @@ +terraform { + required_providers { + aws = { + source = "hashicorp/aws" + version = "~> 6.0" + } + } +} + +provider "aws" { + region = "us-west-2" +} From ee08d44e7cb6679e4bb102b22621c6395d8957c1 Mon Sep 17 00:00:00 2001 From: bsdeol <108632450+bsdeol@users.noreply.github.com> Date: Thu, 11 Sep 2025 12:10:58 -0700 Subject: [PATCH 63/70] commit --- qa/outputs.tf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/qa/outputs.tf b/qa/outputs.tf index 6ec72c91f5..aa913dd9ea 100644 --- a/qa/outputs.tf +++ b/qa/outputs.tf @@ -1,3 +1,3 @@ -output = "env_url" { - value = module.qa.env_url +output = "environment_url" { + value = module.qa.environment_url } \ No newline at end of file From 21286c6db24d27bce46109ebc4266f5aecb7da53 Mon Sep 17 00:00:00 2001 From: bsdeol <108632450+bsdeol@users.noreply.github.com> Date: Thu, 11 Sep 2025 12:13:21 -0700 Subject: [PATCH 64/70] coomit --- qa/outputs.tf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/qa/outputs.tf b/qa/outputs.tf index aa913dd9ea..31cdb3a320 100644 --- a/qa/outputs.tf +++ b/qa/outputs.tf @@ -1,3 +1,3 @@ -output = "environment_url" { - value = module.qa.environment_url +output = "env_url" { + value = module.blog_alb.lb_dns_name } \ No newline at end of file From df4d1bf44d791122fa4245ff71c5f2cd7c91cb41 Mon Sep 17 00:00:00 2001 From: bsdeol <108632450+bsdeol@users.noreply.github.com> Date: Thu, 11 Sep 2025 12:14:23 -0700 Subject: [PATCH 65/70] commit --- qa/outputs.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qa/outputs.tf b/qa/outputs.tf index 31cdb3a320..9359e15189 100644 --- a/qa/outputs.tf +++ b/qa/outputs.tf @@ -1,3 +1,3 @@ -output = "env_url" { +output "env_url" { value = module.blog_alb.lb_dns_name } \ No newline at end of file From 40c2c42674cd593cb6a85d65903b0f9a8128d5f7 Mon Sep 17 00:00:00 2001 From: bsdeol <108632450+bsdeol@users.noreply.github.com> Date: Thu, 11 Sep 2025 12:21:46 -0700 Subject: [PATCH 66/70] commit again --- qa/outputs.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qa/outputs.tf b/qa/outputs.tf index 9359e15189..909a577466 100644 --- a/qa/outputs.tf +++ b/qa/outputs.tf @@ -1,3 +1,3 @@ output "env_url" { - value = module.blog_alb.lb_dns_name + value = module.qa.env_url } \ No newline at end of file From 7f3065730809d3d273269eb183f3caa4a8d5573a Mon Sep 17 00:00:00 2001 From: bsdeol <108632450+bsdeol@users.noreply.github.com> Date: Thu, 11 Sep 2025 12:35:53 -0700 Subject: [PATCH 67/70] change environment_url in outputs --- modules/blog/outputs.tf | 2 +- qa/outputs.tf | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/blog/outputs.tf b/modules/blog/outputs.tf index b500ddcfef..379bf9b567 100644 --- a/modules/blog/outputs.tf +++ b/modules/blog/outputs.tf @@ -1,3 +1,3 @@ -output "env_url" { +output "environment_url" { value = module.blog_alb.lb_dns_name } diff --git a/qa/outputs.tf b/qa/outputs.tf index 909a577466..5424184cbc 100644 --- a/qa/outputs.tf +++ b/qa/outputs.tf @@ -1,3 +1,3 @@ -output "env_url" { - value = module.qa.env_url +output "environment_url" { + value = module.qa.environment_url } \ No newline at end of file From bcce4677c686e1c135aa06236d7a2426256b5f5a Mon Sep 17 00:00:00 2001 From: bsdeol <108632450+bsdeol@users.noreply.github.com> Date: Thu, 11 Sep 2025 13:18:49 -0700 Subject: [PATCH 68/70] commit --- qa/outputs.tf | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/qa/outputs.tf b/qa/outputs.tf index 5424184cbc..9d8cda671f 100644 --- a/qa/outputs.tf +++ b/qa/outputs.tf @@ -1,3 +1,7 @@ output "environment_url" { value = module.qa.environment_url +} + +output "env_url" { + value = module.qa.environment_url } \ No newline at end of file From 5ae14fc4823b348342405a5622df7456cc809527 Mon Sep 17 00:00:00 2001 From: bsdeol <108632450+bsdeol@users.noreply.github.com> Date: Thu, 11 Sep 2025 13:24:03 -0700 Subject: [PATCH 69/70] added output to dev --- dev/outputs.tf | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 dev/outputs.tf diff --git a/dev/outputs.tf b/dev/outputs.tf new file mode 100644 index 0000000000..112f5c77a8 --- /dev/null +++ b/dev/outputs.tf @@ -0,0 +1,3 @@ +output "env_url" { + value = module.dev.environment_url +} \ No newline at end of file From 03079eafc90989844da7495c7da87f4e5677b45f Mon Sep 17 00:00:00 2001 From: bsdeol <108632450+bsdeol@users.noreply.github.com> Date: Thu, 11 Sep 2025 13:29:20 -0700 Subject: [PATCH 70/70] added target_group_name --- dev/outputs.tf | 4 ++++ modules/blog/outputs.tf | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/dev/outputs.tf b/dev/outputs.tf index 112f5c77a8..73e1256158 100644 --- a/dev/outputs.tf +++ b/dev/outputs.tf @@ -1,3 +1,7 @@ output "env_url" { value = module.dev.environment_url +} + +output "target_grp_name" { + value = module.dev.target_group_name } \ No newline at end of file diff --git a/modules/blog/outputs.tf b/modules/blog/outputs.tf index 379bf9b567..585e2b7f34 100644 --- a/modules/blog/outputs.tf +++ b/modules/blog/outputs.tf @@ -1,3 +1,7 @@ output "environment_url" { value = module.blog_alb.lb_dns_name } + +output "target_group_name" { + value = module.blog_alb.target_group_names +} \ No newline at end of file