Skip to content

Commit bfbd38f

Browse files
author
Eugene Dementiev
committed
Add possibility to specify subnet ids
1 parent 81ab956 commit bfbd38f

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ resource "aws_autoscaling_group" "ASG" {
4040
version = "$Latest"
4141
}
4242

43-
vpc_zone_identifier = data.aws_subnet_ids.subnets.ids
43+
vpc_zone_identifier = coalescelist(var.subnet_ids, list(data.aws_subnet_ids.subnets.ids))
4444
termination_policies = ["OldestInstance"]
4545

4646
tag {

variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,12 @@ variable "security_groups" {
3838
default = []
3939
}
4040

41+
variable "subnet_ids" {
42+
description = "list of subnet ids. By default takes all subnets from the VPC"
43+
type = "list"
44+
default = []
45+
}
46+
4147
variable "spot" {
4248
description = "Whether or not use Spot instances. Warning: most likely not suitable for production!"
4349
default = false

0 commit comments

Comments
 (0)