Template_file to run powershell script

Can i use the template_file block to specify a powershell script in on my machine to run on the aws instance?

I got this to work

data “template_file” “init” {
template = <<EOF

$admin = [ADSI](“WinNT://./administrator, user”)
admin.SetPassword("{var.admin_password}")
$NewComputerName = “win2016-test”
Rename-Computer -NewName NewComputerName Start-Sleep -Seconds 5 Restart-Computer -Force </powershell> EOF vars = { admin_password = "{var.admin_password}"
}
}

but I dont want to put the script into the terrraform file

how can i do this?