Move Exchange to AddOns Folder

This commit is contained in:
Chris Long
2021-05-05 21:40:48 -07:00
parent ed30d82600
commit fbb03be0d0
34 changed files with 237 additions and 234 deletions

View File

@@ -4,5 +4,4 @@ locals {
ata_url = "https://${azurerm_public_ip.wef-publicip.ip_address}"
guacamole_url = "http://${azurerm_public_ip.logger-publicip.ip_address}:8080/guacamole"
velociraptor_url = "https://${azurerm_public_ip.logger-publicip.ip_address}:9999"
exchange_url = "https://${var.create_exchange_server ? azurerm_public_ip.exchange-publicip[0].ip_address : ""}"
}

View File

@@ -366,33 +366,6 @@ resource "azurerm_public_ip" "win10-publicip" {
}
}
resource "azurerm_network_interface" "exchange-nic" {
count = var.create_exchange_server ? 1 : 0
name = "exchange-nic"
location = var.region
resource_group_name = azurerm_resource_group.detectionlab.name
ip_configuration {
name = "myNicConfiguration"
subnet_id = azurerm_subnet.detectionlab-subnet.id
private_ip_address_allocation = "Static"
private_ip_address = "192.168.38.106"
public_ip_address_id = azurerm_public_ip.exchange-publicip[count.index].id
}
}
resource "azurerm_public_ip" "exchange-publicip" {
count = var.create_exchange_server ? 1 : 0
name = "exchange-public-ip"
location = var.region
resource_group_name = azurerm_resource_group.detectionlab.name
allocation_method = "Static"
tags = {
role = "exchange"
}
}
resource "azurerm_virtual_machine" "dc" {
name = "dc.windomain.local"
location = var.region
@@ -506,64 +479,6 @@ resource "azurerm_virtual_machine" "wef" {
}
}
resource "azurerm_virtual_machine" "exchange" {
count = var.create_exchange_server ? 1 : 0
name = "exchange.windomain.local"
location = var.region
resource_group_name = azurerm_resource_group.detectionlab.name
network_interface_ids = [azurerm_network_interface.exchange-nic[count.index].id]
vm_size = "Standard_D3_v2"
delete_os_disk_on_termination = true
storage_image_reference {
publisher = "MicrosoftWindowsServer"
offer = "WindowsServer"
sku = "2016-Datacenter"
version = "latest"
}
os_profile {
computer_name = "exchange"
admin_username = "vagrant"
admin_password = "Vagrant123"
custom_data = local.custom_data_content
}
os_profile_windows_config {
provision_vm_agent = true
enable_automatic_upgrades = false
# Auto-Login's required to configure WinRM
additional_unattend_config {
pass = "oobeSystem"
component = "Microsoft-Windows-Shell-Setup"
setting_name = "AutoLogon"
content = "<AutoLogon><Password><Value>Vagrant123</Value></Password><Enabled>true</Enabled><LogonCount>1</LogonCount><Username>vagrant</Username></AutoLogon>"
}
# Unattend config is to enable basic auth in WinRM, required for the provisioner stage.
# https://github.com/terraform-providers/terraform-provider-azurerm/blob/master/examples/virtual-machines/provisioners/windows/files/FirstLogonCommands.xml
additional_unattend_config {
pass = "oobeSystem"
component = "Microsoft-Windows-Shell-Setup"
setting_name = "FirstLogonCommands"
content = file("${path.module}/files/FirstLogonCommands.xml")
}
}
storage_os_disk {
name = "OsDiskExchange"
caching = "ReadWrite"
create_option = "FromImage"
managed_disk_type = "Standard_LRS"
}
tags = {
role = "exchange"
}
}
resource "azurerm_virtual_machine" "win10" {
name = "win10.windomain.local"
location = var.region

View File

@@ -18,10 +18,6 @@ output "win10_public_ip" {
value = azurerm_public_ip.win10-publicip.ip_address
}
output "exchange_public_ip" {
value = "${var.create_exchange_server ? azurerm_public_ip.exchange-publicip[0].ip_address : null}"
}
output "ata_url" {
value = local.ata_url
}
@@ -41,7 +37,3 @@ output "guacamole_url" {
output "velociraptor_url" {
value = local.velociraptor_url
}
output "exchange_url" {
value = "${var.create_exchange_server ? local.exchange_url : null}"
}

View File

@@ -39,10 +39,4 @@ variable "external_dns_servers" {
description = "Configure lab to allow external DNS resolution"
type = list(string)
default = ["8.8.8.8"]
}
variable "create_exchange_server" {
description = "If set to true, adds an additional host that installs exchange"
type = bool
default = false
}