Update windows-ad/main.tf

This commit is contained in:
Ryan Malloy 2024-11-14 18:47:08 +00:00
parent 506e1cbd40
commit 186e6b3699
1 changed files with 14 additions and 1 deletions

View File

@ -48,6 +48,19 @@ resource "aws_security_group" "ad_sg" {
} }
} }
data "template_file" "init" {
template = "${file("populate_ad/run.ps1.tpl")}"
vars = {
forest_mode = ""
domain_mode = ""
domain_name = "${aws_instance.some.private_ip}"
domain_netbios_name = ""
safe_mode_password = ""
domain_admin_password = ""
}
}
resource "aws_instance" "windows_ad_server" { resource "aws_instance" "windows_ad_server" {
ami = "ami-0d8f6eb4f641ef691" # Change to a Windows Server AMI in your region ami = "ami-0d8f6eb4f641ef691" # Change to a Windows Server AMI in your region
instance_type = "t3.medium" instance_type = "t3.medium"
@ -55,7 +68,7 @@ resource "aws_instance" "windows_ad_server" {
vpc_security_group_ids = [aws_security_group.ad_sg.id] vpc_security_group_ids = [aws_security_group.ad_sg.id]
associate_public_ip_address = true associate_public_ip_address = true
user_data = file("userdata.ps1") # Loads the PowerShell script to initialize AD user_data = ${data.template_file.init.rendered}
# Wait until instance status is ready before proceeding # Wait until instance status is ready before proceeding
provisioner "local-exec" { provisioner "local-exec" {