terraform-provider-opennebula icon indicating copy to clipboard operation
terraform-provider-opennebula copied to clipboard

Add resource for managing VM state

Open xorel opened this issue 1 year ago • 5 comments

Description

While opennebula_virtual_machine can create and destroy the VM, it would be nice to have a resource to handle the VM state.

New or affected resources and data sources

new: opennebula_virtual_machine_state

Potential terraform configuration

resource "opennebula_virtual_machine_state" "vm_state" {
  opennebula_virtual_machine_state = var.vm_id
  state       = "undeployed"
}

References

OpenNebula documentation

xorel avatar Oct 09 '23 11:10 xorel

Hello @xorel,

I am not sure to understand why we would need a dedicated state resource. What do you mean by 'handle the VM state'? Do you have some use cases?

frousselet avatar Oct 16 '23 12:10 frousselet

I am not 100% sure it fits well into Terraform design but my intention is to be able to undeploy VM.

I think it might be similar to aws_ec2_instance_state

xorel avatar Oct 16 '23 12:10 xorel

If I understand the AWS issue regarding the state resource, they did this because they need it to be usable with AWS STS.

In our case I'm quite sure we can integrate it as an attribute of opennebula_virtual_machine.

So I am thinking about something like this:

resource "opennebula_virtual_machine" "example" {
  # ...

  state = "Stopped"   # or "Running" (default) or "Undeployed" or "Suspended" or "PowerOff"
  hard  = true        # or false (default)
}

frousselet avatar Oct 16 '23 12:10 frousselet

Looks good to me

xorel avatar Oct 16 '23 14:10 xorel

This issue is stale because it has been open for 30 days with no activity and it has not the 'status: confirmed' label or it is not in a milestone. Remove the 'status: stale' label or comment, or this will be closed in 5 days.

github-actions[bot] avatar Nov 16 '23 00:11 github-actions[bot]