Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new vm_state attribute to manage running/stopped VMs #725

Merged
merged 1 commit into from
Mar 30, 2023

Conversation

jonglezb
Copy link
Contributor

This is useful in two cases:

  • when some VMs should be stopped (for security reasons or maintenance): this is now possible from Terraform

  • when a VM has been stopped manually in Proxmox: Terraform will now start the VM when applying the configuration

This deprecates the "oncreate" attribute following the guidelines from https://developer.hashicorp.com/terraform/plugin/sdkv2/best-practices/deprecations#renaming-an-optional-attribute

This is useful in two cases:

- when some VMs should be stopped (for security reasons or maintenance):
  this is now possible from Terraform

- when a VM has been stopped manually in Proxmox: Terraform will now
  start the VM when applying the configuration

This deprecates the "oncreate" attribute following the guidelines from
https://developer.hashicorp.com/terraform/plugin/sdkv2/best-practices/deprecations#renaming-an-optional-attribute
@mleone87
Copy link
Collaborator

nice one, thanks

@mleone87 mleone87 merged commit d772e79 into Telmate:master Mar 30, 2023
@kencx kencx mentioned this pull request Mar 31, 2023
@mleone87
Copy link
Collaborator

hello @jonglezb

please notice that setting the vm_state as "stopped" when the vm is running will stop the vm as intended.
but setting the state as "running" when the vm is stopped does not start the vm

@jonglezb
Copy link
Contributor Author

Strange, it should work, I did test this feature before submitting (this is my main use-case). Can you give more information about how you run this? Any debug log?

@mleone87
Copy link
Collaborator

that's easy to spot, maybe your are not using agent=1 parameter?

The actual code order in update function checks for the ip before starting the vm and goes on for 20min at least. then it arrives to the code that powers on the vm

I'll make a fix later today

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants