Add windows_11_client/main.tf
This commit is contained in:
parent
0af8e817e1
commit
01833b75a2
|
@ -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
|
||||
<powershell>
|
||||
# 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
|
||||
</powershell>
|
||||
EOF
|
||||
|
||||
tags = {
|
||||
Name = "Windows10-DomainJoined"
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue