Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions environments/dev/lb-asg/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,13 @@ module "lb-asg" {
key_name = var.key_name
vpc_id = var.vpc_id
subnets = var.subnets
security_group_ids = var.security_group_ids
public_access = var.public_access
user_data = var.user_data
max_size = var.max_size
min_size = var.min_size
desired_capacity = var.desired_capacity
propagate_at_launch = var.propagate_at_launch
owner = var.owner
environment = var.environment
cost_center = var.cost_center
Expand Down
10 changes: 10 additions & 0 deletions environments/dev/lb-asg/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,11 @@ variable "subnets" {
type = list(string)
}

variable "security_group_ids" {
type = list(string)
description = "Security group id of the ec2 instance"
}

variable "public_access" {
description = "Whether the instance is public or not"
type = bool
Expand All @@ -190,6 +195,11 @@ variable "desired_capacity" {
type = number
}

variable "propagate_at_launch" {
description = "To enable ot disable propagate_at_launch"
type = bool
}

variable "owner" {
type = string
description = "Name of owner"
Expand Down
24 changes: 22 additions & 2 deletions modules/lb-asg/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,28 @@ resource "aws_autoscaling_group" "application_asg" {

tag {
key = "Name"
value = "petclinic"
propagate_at_launch = true
value = "${var.environment}-${var.application}-asg"
propagate_at_launch = var.propagate_at_launch
}
tag {
key = "Owner"
value = var.owner
propagate_at_launch = var.propagate_at_launch
}
tag {
key = "Environment"
value = var.environment
propagate_at_launch = var.propagate_at_launch
}
tag {
key = "CostCenter"
value = var.cost_center
propagate_at_launch = var.propagate_at_launch
}
tag {
key = "Application"
value = var.application
propagate_at_launch = var.propagate_at_launch
}

}
Expand Down
10 changes: 10 additions & 0 deletions modules/lb-asg/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,11 @@ variable "subnets" {
type = list(string)
}

variable "security_group_ids" {
type = list(string)
description = "Security group id of the ec2 instance"
}

variable "public_access" {
description = "Whether the instance is public or not"
type = bool
Expand All @@ -190,6 +195,11 @@ variable "desired_capacity" {
type = number
}

variable "propagate_at_launch" {
description = "To enable ot disable propagate_at_launch"
type = bool
}

variable "owner" {
type = string
description = "Name of owner"
Expand Down
2 changes: 2 additions & 0 deletions vars/dev/lb-asg.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ instance_type = "t2.medium"
key_name = "aswin-key"
vpc_id = "vpc-0a5ca4a92c2e10163"
subnets = ["subnet-058a7514ba8adbb07", "subnet-0dbcd1ac168414927", "subnet-032f5077729435858"]
security_group_ids = ["sg-056e31eec8fdb151f"]
public_access = true

#user_data
Expand All @@ -55,6 +56,7 @@ user_data = <<-EOF
max_size = 1
min_size = 1
desired_capacity = 1
propagate_at_launch = true

#tags
owner = "techiescamp-devops"
Expand Down