Skip to content

Commit ea15764

Browse files
authored
Merge branch 'techiescamp:master' into master
2 parents 92992e6 + 4708cb9 commit ea15764

File tree

5 files changed

+46
-2
lines changed

5 files changed

+46
-2
lines changed

environments/dev/lb-asg/main.tf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,13 @@ module "lb-asg" {
3636
key_name = var.key_name
3737
vpc_id = var.vpc_id
3838
subnets = var.subnets
39+
security_group_ids = var.security_group_ids
3940
public_access = var.public_access
4041
user_data = var.user_data
4142
max_size = var.max_size
4243
min_size = var.min_size
4344
desired_capacity = var.desired_capacity
45+
propagate_at_launch = var.propagate_at_launch
4446
owner = var.owner
4547
environment = var.environment
4648
cost_center = var.cost_center

environments/dev/lb-asg/variables.tf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,11 @@ variable "subnets" {
165165
type = list(string)
166166
}
167167

168+
variable "security_group_ids" {
169+
type = list(string)
170+
description = "Security group id of the ec2 instance"
171+
}
172+
168173
variable "public_access" {
169174
description = "Whether the instance is public or not"
170175
type = bool
@@ -190,6 +195,11 @@ variable "desired_capacity" {
190195
type = number
191196
}
192197

198+
variable "propagate_at_launch" {
199+
description = "To enable ot disable propagate_at_launch"
200+
type = bool
201+
}
202+
193203
variable "owner" {
194204
type = string
195205
description = "Name of owner"

modules/lb-asg/main.tf

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,28 @@ resource "aws_autoscaling_group" "application_asg" {
161161

162162
tag {
163163
key = "Name"
164-
value = "petclinic"
165-
propagate_at_launch = true
164+
value = "${var.environment}-${var.application}-asg"
165+
propagate_at_launch = var.propagate_at_launch
166+
}
167+
tag {
168+
key = "Owner"
169+
value = var.owner
170+
propagate_at_launch = var.propagate_at_launch
171+
}
172+
tag {
173+
key = "Environment"
174+
value = var.environment
175+
propagate_at_launch = var.propagate_at_launch
176+
}
177+
tag {
178+
key = "CostCenter"
179+
value = var.cost_center
180+
propagate_at_launch = var.propagate_at_launch
181+
}
182+
tag {
183+
key = "Application"
184+
value = var.application
185+
propagate_at_launch = var.propagate_at_launch
166186
}
167187

168188
}

modules/lb-asg/variables.tf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,11 @@ variable "subnets" {
165165
type = list(string)
166166
}
167167

168+
variable "security_group_ids" {
169+
type = list(string)
170+
description = "Security group id of the ec2 instance"
171+
}
172+
168173
variable "public_access" {
169174
description = "Whether the instance is public or not"
170175
type = bool
@@ -190,6 +195,11 @@ variable "desired_capacity" {
190195
type = number
191196
}
192197

198+
variable "propagate_at_launch" {
199+
description = "To enable ot disable propagate_at_launch"
200+
type = bool
201+
}
202+
193203
variable "owner" {
194204
type = string
195205
description = "Name of owner"

vars/dev/lb-asg.tfvars

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ instance_type = "t2.medium"
4343
key_name = "aswin-key"
4444
vpc_id = "vpc-0a5ca4a92c2e10163"
4545
subnets = ["subnet-058a7514ba8adbb07", "subnet-0dbcd1ac168414927", "subnet-032f5077729435858"]
46+
security_group_ids = ["sg-056e31eec8fdb151f"]
4647
public_access = true
4748

4849
#user_data
@@ -55,6 +56,7 @@ user_data = <<-EOF
5556
max_size = 1
5657
min_size = 1
5758
desired_capacity = 1
59+
propagate_at_launch = true
5860

5961
#tags
6062
owner = "techiescamp-devops"

0 commit comments

Comments
 (0)