I have a windows ECS instance on Open Telekom Cloud and instead of using the key-pair I would like to set the admin Password when the instance will launch and the Cloudbase-init will run and set the password. So that I can login to the machine using that password.
For this I am using Terraform and this is the code looks like:
resource "opentelekomcloud_compute_instance_v2" "windows_ecs" {
name = "test-windows"
flavor_id = "s3.large.2"
image_name = "Enterprise_Windows-Server_2022_STD_amd64_uefi_latest"
availability_zone = var.az
network {
uuid = opentelekomcloud_vpc_subnet_v1.test_subnet.id
}
security_groups = [opentelekomcloud_networking_secgroup_v2.rdp_sg.name]
user_data = base64encode(file("${path.module}/bootstrap-windows.ps1"))
}
and then the bootstrap-windows.ps1 file is
#ps1
net user "Administrator" "SecurePassword!"
net user Administrator /active:yes
when it provisioned the ecs I can see the script is running and then the ecs is rebooting but when I try to login to the machine using this set password, I am not able to do that.
Where am I going wrong, but for the linux machine this works.