diff --git a/AWS/Terraform/main.tf b/AWS/Terraform/main.tf index 52fb98e..18324a5 100644 --- a/AWS/Terraform/main.tf +++ b/AWS/Terraform/main.tf @@ -159,7 +159,7 @@ resource "aws_instance" "logger" { ami = coalesce(var.logger_ami, data.aws_ami.logger_ami.image_id) tags = { - Name = "logger" + Name = "${var.tag_prefix}logger" } subnet_id = aws_subnet.default.id @@ -223,7 +223,7 @@ resource "aws_instance" "dc" { ami = coalesce(var.dc_ami, data.aws_ami.dc_ami.image_id) tags = { - Name = "dc.windomain.local" + Name = "${var.tag_prefix}dc.windomain.local" } subnet_id = aws_subnet.default.id @@ -258,7 +258,7 @@ resource "aws_instance" "wef" { ami = coalesce(var.wef_ami, data.aws_ami.wef_ami.image_id) tags = { - Name = "wef.windomain.local" + Name = "${var.tag_prefix}wef.windomain.local" } subnet_id = aws_subnet.default.id @@ -293,7 +293,7 @@ resource "aws_instance" "win10" { ami = coalesce(var.win10_ami, data.aws_ami.win10_ami.image_id) tags = { - Name = "win10.windomain.local" + Name = "${var.tag_prefix}win10.windomain.local" } subnet_id = aws_subnet.default.id @@ -304,4 +304,3 @@ resource "aws_instance" "win10" { delete_on_termination = true } } - diff --git a/AWS/Terraform/terraform.tfvars.example b/AWS/Terraform/terraform.tfvars.example index 56a3c38..49521d2 100644 --- a/AWS/Terraform/terraform.tfvars.example +++ b/AWS/Terraform/terraform.tfvars.example @@ -6,3 +6,4 @@ public_key_path = "/home/user/.ssh/id_logger.pub" private_key_path = "/home/user/.ssh/id_logger" ip_whitelist = ["1.2.3.4/32"] availability_zone = "us-west-1b" +// tag_prefix = "some_prefix_" diff --git a/AWS/Terraform/variables.tf b/AWS/Terraform/variables.tf index 3371d49..8efd508 100644 --- a/AWS/Terraform/variables.tf +++ b/AWS/Terraform/variables.tf @@ -6,6 +6,11 @@ variable "profile" { default = "terraform" } +variable "tag_prefix" { + description = "Optional string to prefix at the front of instance names in case you need to run multiple DetectionLab environments in the same AWS account" + default = "" +} + variable "availability_zone" { description = "https://www.terraform.io/docs/providers/aws/d/availability_zone.html" default = ""