Skip to content

Commit

Permalink
Fix AWS main.tf
Browse files Browse the repository at this point in the history
  • Loading branch information
clong committed Mar 30, 2021
1 parent cb553c9 commit 7b80f8d
Showing 1 changed file with 36 additions and 35 deletions.
71 changes: 36 additions & 35 deletions AWS/Terraform/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -285,41 +285,42 @@ resource "aws_instance" "wef" {
}
}

resource "aws_instance" "exchange" {
instance_type = "t3.medium"
count = var.create_exchange_server ? 1 : 0

provisioner "remote-exec" {
inline = [
"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 windomain.local'\"",
"ipconfig /renew",
]

connection {
type = "winrm"
user = "vagrant"
password = "vagrant"
host = coalesce(self.public_ip, self.private_ip)
}
}

# Uses the local variable if external data source resolution fails
ami = coalesce(var.exchange_ami, data.aws_ami.exchange_ami.image_id)

tags = merge(var.custom-tags, map(
"Name", "${var.instance_name_prefix}exchange.windomain.local"
))

subnet_id = aws_subnet.default.id
vpc_security_group_ids = [aws_security_group.windows.id]
private_ip = "192.168.38.106"

root_block_device {
delete_on_termination = true
}
}
# Uncomment when the AMI has been created
# resource "aws_instance" "exchange" {
# instance_type = "t3.medium"
# count = var.create_exchange_server ? 1 : 0

# provisioner "remote-exec" {
# inline = [
# "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 windomain.local'\"",
# "ipconfig /renew",
# ]

# connection {
# type = "winrm"
# user = "vagrant"
# password = "vagrant"
# host = coalesce(self.public_ip, self.private_ip)
# }
# }

# # Uses the local variable if external data source resolution fails
# ami = coalesce(var.exchange_ami, data.aws_ami.exchange_ami.image_id)

# tags = merge(var.custom-tags, map(
# "Name", "${var.instance_name_prefix}exchange.windomain.local"
# ))

# subnet_id = aws_subnet.default.id
# vpc_security_group_ids = [aws_security_group.windows.id]
# private_ip = "192.168.38.106"

# root_block_device {
# delete_on_termination = true
# }
# }

resource "aws_instance" "win10" {
instance_type = "t2.medium"
Expand Down

0 comments on commit 7b80f8d

Please sign in to comment.