-
Notifications
You must be signed in to change notification settings - Fork 1
/
Module-Linux VM.tf
executable file
·40 lines (35 loc) · 1.16 KB
/
Module-Linux VM.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
## Variables
variable "Create_Demo_VMs" {
type = bool
default = false
description = "Should this spoke contain a demo VM in each subnet? Defaults to false"
}
variable "Key_Name" {
default = null
description = "The name of the SSH Key to be provided from the AWS APIs. Left blank creates the virtual machine with no SSH key authentication."
}
## Modules
module "Demo_VM_AZ1" {
count = var.Create_Demo_VMs ? 1 : 0
source = "./Linux VM"
Project_Prefix = aws_subnet.az1.tags.Name
Hostname_Suffix = "-demovm"
# Access and Licenses
Key_Name = var.Key_Name != "" ? var.Key_Name : null
# Network location and addressing
Subnet_ID = aws_subnet.az1.id
}
module "Demo_VM_AZ2" {
count = var.Create_Demo_VMs ? 1 : 0
source = "./Linux VM"
Project_Prefix = aws_subnet.az2.tags.Name
Hostname_Suffix = "-demovm"
# Access and Licenses
Key_Name = var.Key_Name != "" ? var.Key_Name : null
# Network location and addressing
Subnet_ID = aws_subnet.az2.id
}
## Outputs
output "Demo_VM_IPs" {
value = "%{for m in module.Demo_VM_AZ1}${m.name} = ${m.ip}, %{endfor}%{for m in module.Demo_VM_AZ2}${m.name} = ${m.ip}%{endfor}"
}