Hi,
We started using Terraform to deploy virtual machines within Azure. We would like to add these vm's to our Active Directory Domain once they are created and I implemented the desired Terraform configuration for it:
resource "azure_instance" "terraform" {
name = "${var.vmname}"
image = "Windows Server 2012 R2 Datacenter, February 2016"
size = "Basic_A1"
virtual_network = "VNETwe"
subnet = "Servers"
location = "West Europe"
time_zone = "Europe/Amsterdam"
username = "terraform"
password = "clearedpassword"
domain_ou = "OU=terraform,DC=ourdomain,DC=nl"
domain_username = "administrator"
domain_password = "clearedpassword"
}
If I run a terraform plan and a terraform apply it fails with the following error:
Error applying plan:
1 error(s) occurred:
* azure_instance.terraform: Error creating instance terraformwin01: Error response from Azure. Code: BadRequest, Message: Invalid domain join information specified. Ensure that the JoinDomain setting is specified, and that either the Credentials or Provisioning setting is specified. See the Windows Automated Installation Kit documentation for more information.
Terraform does not automatically rollback in the face of errors.
Instead, your Terraform state file has been partially updated with
any resources that successfully completed. Please address the error
above and apply again to incrementally change your infrastructure.
Anybody else had this problem? How can I fix this? Manually joining a VM to our domain after it is created works, so it looks like it has something to do with our terraform configuration.
With best regards,
Wesley van den Hengel