Skip to content

Commit 1a8c956

Browse files
committed
[#33] Update missing Bastion's resources
1 parent b41f84d commit 1a8c956

File tree

4 files changed

+31
-0
lines changed

4 files changed

+31
-0
lines changed

core/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,5 +118,6 @@ module "bastion" {
118118
source = "../modules/bastion"
119119

120120
environment = var.environment
121+
subnet_ids = module.vpc.public_subnet_ids
121122
instance_security_group_ids = module.security_group.bastion_security_group_ids
122123
}

modules/bastion/locals.tf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,13 @@ locals {
66

77
# The instance type
88
instance_type = "t3.nano"
9+
10+
# The minimum number of instances
11+
min_instance_count = 1
12+
13+
# The maximum number of instances
14+
max_instance_count = 1
15+
16+
# The desired number of instances
17+
instance_desired_count = 1
918
}

modules/bastion/main.tf

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,19 @@ resource "aws_launch_configuration" "bastion_instance" {
2424
encrypted = true
2525
}
2626
}
27+
28+
29+
resource "aws_autoscaling_group" "bastion_instance" {
30+
name = "${local.namespace}-instance"
31+
min_size = local.min_instance_count
32+
max_size = local.max_instance_count
33+
desired_capacity = local.instance_desired_count
34+
launch_configuration = aws_launch_configuration.bastion_instance.name
35+
vpc_zone_identifier = var.subnet_ids
36+
37+
tag {
38+
key = "Name"
39+
value = "${local.namespace}-instance"
40+
propagate_at_launch = true
41+
}
42+
}

modules/bastion/variables.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,8 @@ variable "instance_security_group_ids" {
22
description = "The security group IDs for the instance"
33
type = list(string)
44
}
5+
6+
variable "subnet_ids" {
7+
description = "The subnet IDs for the instance"
8+
type = list(string)
9+
}

0 commit comments

Comments
 (0)