From 01833b75a293f9c2b9475d4e82542b109627a6a1 Mon Sep 17 00:00:00 2001 From: Ryan Malloy Date: Thu, 14 Nov 2024 19:39:57 +0000 Subject: [PATCH] Add windows_11_client/main.tf --- windows_11_client/main.tf | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 windows_11_client/main.tf diff --git a/windows_11_client/main.tf b/windows_11_client/main.tf new file mode 100644 index 0000000..9798ee2 --- /dev/null +++ b/windows_11_client/main.tf @@ -0,0 +1,33 @@ + + + + + +resource "aws_instance" "windows10" { + ami = var.ami_id + instance_type = var.instance_type + key_name = var.key_name + subnet_id = var.subnet_id + security_groups = var.vpc_security_group_ids + + user_data = <<-EOF + + # Enable RDP + Set-ItemProperty -Path "HKLM:\System\CurrentControlSet\Control\Terminal Server" -Name "fDenyTSConnections" -Value 0 + Enable-NetFirewallRule -DisplayGroup "Remote Desktop" + + # Set the Domain Name and Credentials + $domain = "${var.domain_name}" + $username = "${var.domain_admin_user}" + $password = ConvertTo-SecureString "${var.domain_admin_password}" -AsPlainText -Force + $credential = New-Object System.Management.Automation.PSCredential ("$domain\\$username", $password) + + # Join the domain + Add-Computer -DomainName $domain -Credential $credential -Force -Restart + + EOF + + tags = { + Name = "Windows10-DomainJoined" + } +}