From 186e6b369953e33098c136d60674f706424c0219 Mon Sep 17 00:00:00 2001 From: Ryan Malloy Date: Thu, 14 Nov 2024 18:47:08 +0000 Subject: [PATCH] Update windows-ad/main.tf --- windows-ad/main.tf | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/windows-ad/main.tf b/windows-ad/main.tf index 3883336..a65b77f 100644 --- a/windows-ad/main.tf +++ b/windows-ad/main.tf @@ -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" { ami = "ami-0d8f6eb4f641ef691" # Change to a Windows Server AMI in your region instance_type = "t3.medium" @@ -55,7 +68,7 @@ resource "aws_instance" "windows_ad_server" { vpc_security_group_ids = [aws_security_group.ad_sg.id] 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 provisioner "local-exec" {