0

We are trying to create a remote desktop service that allows users to manage and access remote desktops where each remote desktop is a virtual machine on a vCenter. Users should be able to create and destroy them often. I am evaluating Pulumi as a possible way for us to manage those virtual machines but I don't understand how to use it to power off an existing VM.

I Tried creating a VM using vsphere.VirtualMachine and expected there to be a powerState parameter that allows me to control whether the vm should be on or off, but I cant find such parameter. It seems that the only input parameters concerned with power state are forcePowerOff, poweronTimeout, and shutdownWaitTimeout. There is however a powerState output.

bobby
  • 1
  • 1

1 Answers1

0

Pulumi is an infrastructure deployment tool. It uses the providers' APIs to create and configure resources: it is concerned only with "deploy-time" problems.

Turning a machine on or off is a "run-time" problem. Pulumi isn't designed to handle this sort of issue. Things like running a program on the machine, or listing the directory contents of a bucket, are just not what Pulumi is for. Consider the risk this sort of thing brings: your code is run to create a new environment; and later, to eliminate drift and ensure the resources are configured correctly. If every time you checked your infrastructure for drift (pulumi up) you also turned off a machine (even if it's in use), then you'd have some angry users, I think?

vSphere's own APIs may provide a way to do this from your program. The Pulumi provider doesn't.

Paul Hicks
  • 13,289
  • 5
  • 51
  • 78