cfalta / activedirectory-lab Goto Github PK
View Code? Open in Web Editor NEWTerraform config to spin up a domain controller and some member servers in azure
License: BSD 3-Clause "New" or "Revised" License
Terraform config to spin up a domain controller and some member servers in azure
License: BSD 3-Clause "New" or "Revised" License
Just thought I'd share here, since I spent some time getting this to work...
I had problems with the sleep resource occasionally not being long enough causing the terraform to fail at the join_domain resource, so I searched for a way to test the DC dynamically and came up with the following. It does use the CustomScriptExtension, which you can [absurdly] only have one of for a VM, so take that into consideration.
locals {
...
# use the nltest command to see if the domain controller is fully is up
wait_for_dc = "while (-not(((nltest /dsgetdc:${var.active_directory_domain}) | Out-String).Contains('successfully'))) { sleep 10 } ; Write-Host 'Successful'"
}
##########################################################
# Wait - we need this to give the DC enough time to provision before joining VMs
##########################################################
# we have intermittent failures in joining the domain that appear to be timing-related (DC not fully up yet).
# this is to avoid a long static sleep
resource "azurerm_virtual_machine_extension" "wait_for_dc" {
count = var.node_count
virtual_machine_id = azurerm_windows_virtual_machine.member_vm[count.index].id
name = "wait_for_dc"
publisher = "Microsoft.Compute"
type = "CustomScriptExtension"
type_handler_version = "1.10"
auto_upgrade_minor_version = true
settings = <<SETTINGS
{
"commandToExecute": "powershell.exe -Command \"${local.wait_for_dc}\""
}
SETTINGS
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.