Fix AWS main.tf

This commit is contained in:
Chris Long
2021-03-29 20:54:47 -07:00
parent cb553c989b
commit 7b80f8d6b2

View File

@@ -285,41 +285,42 @@ resource "aws_instance" "wef" {
} }
} }
resource "aws_instance" "exchange" { # Uncomment when the AMI has been created
instance_type = "t3.medium" # resource "aws_instance" "exchange" {
count = var.create_exchange_server ? 1 : 0 # instance_type = "t3.medium"
# count = var.create_exchange_server ? 1 : 0
provisioner "remote-exec" { # provisioner "remote-exec" {
inline = [ # inline = [
"choco install -force -y winpcap", # "choco install -force -y winpcap",
"powershell.exe -c \"Add-Content 'c:\\windows\\system32\\drivers\\etc\\hosts' ' 192.168.38.102 dc.windomain.local'\"", # "powershell.exe -c \"Add-Content 'c:\\windows\\system32\\drivers\\etc\\hosts' ' 192.168.38.102 dc.windomain.local'\"",
"powershell.exe -c \"Add-Content 'c:\\windows\\system32\\drivers\\etc\\hosts' ' 192.168.38.102 windomain.local'\"", # "powershell.exe -c \"Add-Content 'c:\\windows\\system32\\drivers\\etc\\hosts' ' 192.168.38.102 windomain.local'\"",
"ipconfig /renew", # "ipconfig /renew",
] # ]
connection { # connection {
type = "winrm" # type = "winrm"
user = "vagrant" # user = "vagrant"
password = "vagrant" # password = "vagrant"
host = coalesce(self.public_ip, self.private_ip) # host = coalesce(self.public_ip, self.private_ip)
} # }
} # }
# Uses the local variable if external data source resolution fails # # Uses the local variable if external data source resolution fails
ami = coalesce(var.exchange_ami, data.aws_ami.exchange_ami.image_id) # ami = coalesce(var.exchange_ami, data.aws_ami.exchange_ami.image_id)
tags = merge(var.custom-tags, map( # tags = merge(var.custom-tags, map(
"Name", "${var.instance_name_prefix}exchange.windomain.local" # "Name", "${var.instance_name_prefix}exchange.windomain.local"
)) # ))
subnet_id = aws_subnet.default.id # subnet_id = aws_subnet.default.id
vpc_security_group_ids = [aws_security_group.windows.id] # vpc_security_group_ids = [aws_security_group.windows.id]
private_ip = "192.168.38.106" # private_ip = "192.168.38.106"
root_block_device { # root_block_device {
delete_on_termination = true # delete_on_termination = true
} # }
} # }
resource "aws_instance" "win10" { resource "aws_instance" "win10" {
instance_type = "t2.medium" instance_type = "t2.medium"