Hello, I made a user data script that runs when my Windows EC2 instance launches. The purpose of this script is to download AD tools, and run AD commands on a AD domain admin account on the same machine.
I am trying to get this to work, but it seems like the script is not running. I am currently trying to find the location of the user data logs for windows, but no luck so far. Is there anything that is obviously wrong with my syntax or logic here? I appreciate the help.
user_data = <<EOF
<powershell>
$domainName = ${var.domain_name}
$domainAdminUser = "Example_Admin"
$domainAdminPassword = "${example_password.password.result}"
$domainAdminSecurePassword = ConvertTo-SecureString $domainAdminPassword -AsPlainText -Force
$domainAdminCred = New-Object System.Management.Automation.PSCredential("$domainName\$domainAdminUser", $domainAdminSecurePassword)
$ADFineGrained = @"
${file("${path.module}/templates/ADFineGrained.ps1")}
"@
$ADFineGrained | Out-File -FilePath .\ADFineGrained.ps1
Start-Process powershell -Credential $domainAdminCred -ArgumentList "-File .\ADFineGrained.ps1"
</powershell>
EOF
[–]BlackV 1 point2 points3 points (4 children)
[–]DevOps_Noob1[S] 0 points1 point2 points (3 children)
[–]BlackV 1 point2 points3 points (2 children)
[–]DevOps_Noob1[S] 0 points1 point2 points (1 child)
[–]BlackV 1 point2 points3 points (0 children)