OpenNebula / terraform-provider-opennebula

Terraform provider for OpenNebula
https://www.terraform.io/docs/providers/opennebula/
Mozilla Public License 2.0
61 stars 54 forks source link

Add resource for managing VM state #492

Open xorel opened 9 months ago

xorel commented 9 months ago

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

frousselet commented 9 months ago

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?

xorel commented 9 months ago

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

frousselet commented 9 months ago

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)
}
xorel commented 9 months ago

Looks good to me

github-actions[bot] commented 8 months ago

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.