File tree Expand file tree Collapse file tree 4 files changed +31
-0
lines changed
Expand file tree Collapse file tree 4 files changed +31
-0
lines changed Original file line number Diff line number Diff 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}
Original file line number Diff line number Diff 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}
Original file line number Diff line number Diff 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+ }
Original file line number Diff line number Diff 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+ }
You can’t perform that action at this time.
0 commit comments