You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Terraform
Hello all,
I am looking for a way to call the AWS AD connector in a terraform script to automatically join an instance to the domain. I can do it with no issues in the AWS GUI, but need to be able to script it. I'm also looking for a way to call in a powershell user_data script within my terraform script.
Here is what I have. The powershell section will grab the tag "Name" and rename the hostname to it, then reboot.It does not work within the TF script, but works on the GUI.
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to terrafo...@googlegroups.com
Hi,
I haven't tried this myself, as I have used my own scripts to join the servers to the domain, but you could look at this as a possible way of doing it:
I don't know if this will work since I haven't had huge exposure to SSM, but the way I understand it works is that it will contact the SSM server and identify the configuration it needs after booting.
In terms of the userdata, I have the same system as you renaming the system to the instance ID and rebooting. I do it like this:
--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Terraform
I do the same thing as you're posting here, except I make sure that i'm referencing the "Connection" block so that Winrm knows how to connect remotely and run the provisioner, so make sure you're using a local admin account.
Leo Tarafa
unread,
Feb 23, 2017, 12:03:10 PM2/23/17
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Terraform
I've finally got this working just right. it's a bit messy, bit it works every time.
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Terraform
Behind this door, in my recent experience, is still a mess of race conditions. Most of the time, this works, but even if you have your user data kill the ssm service (so that it doesnt kick in for a split second before the restart), ec2config will bring it back, and itll do just that. Maybe a long enough sleep in user data would do the trick.
The solution that ultimately worked for me "every time" was having an action in the SSM document perform the rename, without a restart. This way the rename is fully done before the domain join plugin picks up, and that plugin is restart-aware.