ionos-cloud / terraform-provider-ionoscloud

The IonosCloud Terraform provider gives the ability to deploy and configure resources using the IonosCloud APIs.
Mozilla Public License 2.0
34 stars 23 forks source link

feat: Support state in ionoscloud_server to set the power state #412

Closed hegerdes closed 11 months ago

hegerdes commented 1 year ago

Current Provider Version

terraform {
  required_version = ">= 1.4.0"
  required_providers {
    ionoscloud = {
      source  = "ionos-cloud/ionoscloud"
      version = "6.4.1"
    }
    random = {
      source  = "hashicorp/random"
      version = "3.5.1"
    }
  }
}

Use-cases

It would be awesome to support the ionos_server_state prob to stop severs via terraform. The ansibe-modules support a state prob to set for each server. As far as I know there are the following states in the DCD:

Attempted Solutions

Currently this is not supported in this provider. You have to extract the server id form the state (or output the ids to a file) and make a extra api request in an arbitrary language

Proposal

Support the state prob in the ionoscloud_server

References

cristiGuranIonos commented 1 year ago

Thanks for raising this. We'll take a look at it.

cbeti-ionos commented 11 months ago

Support for modifying the power state for servers through the vm_state field should be available in the next release.

hegerdes commented 11 months ago

Nice to hear! Are all three states (running, stopped, reset) supported?

cristiGuranIonos commented 11 months ago

Fixed in https://github.com/ionos-cloud/terraform-provider-ionoscloud/releases/tag/v6.4.10

mitnicki commented 9 months ago

also need this feature. foremost the reboot (reset) state. Is the reset state also supported in the new provider version ?

cristiGuranIonos commented 9 months ago

Reboot is not supported yet. It is harder to implement in terraform due to how the concept of state works. This is because reboot is a transient state so we can't really measure if a reboot was done or not. I would suggest using ionosctl maybe to reboot a server: ionosctl server reboot --datacenter-id DATACENTER_ID --server-id SERVER_ID