File tree Expand file tree Collapse file tree 5 files changed +46
-2
lines changed Expand file tree Collapse file tree 5 files changed +46
-2
lines changed Original file line number Diff line number Diff 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
Original file line number Diff line number Diff 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+
168173variable "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+
193203variable "owner" {
194204 type = string
195205 description = " Name of owner"
Original file line number Diff line number Diff 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}
Original file line number Diff line number Diff 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+
168173variable "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+
193203variable "owner" {
194204 type = string
195205 description = " Name of owner"
Original file line number Diff line number Diff line change @@ -43,6 +43,7 @@ instance_type = "t2.medium"
4343key_name = " aswin-key"
4444vpc_id = " vpc-0a5ca4a92c2e10163"
4545subnets = [" subnet-058a7514ba8adbb07" , " subnet-0dbcd1ac168414927" , " subnet-032f5077729435858" ]
46+ security_group_ids = [" sg-056e31eec8fdb151f" ]
4647public_access = true
4748
4849# user_data
@@ -55,6 +56,7 @@ user_data = <<-EOF
5556max_size = 1
5657min_size = 1
5758desired_capacity = 1
59+ propagate_at_launch = true
5860
5961# tags
6062owner = " techiescamp-devops"
You can’t perform that action at this time.
0 commit comments