HewlettPackard/terraform-provider-oneview

Trying to power off server with oneview_server_hardware"

kristyburns opened this issue · 5 comments

Below is my root module, When I apply it is says it all works but it actually does not power off the server. I first add the server and then try to power it off before adding a profile. Is there a bug or am I doing something wrong


resource "oneview_server_hardware" "sh" {
configuration_state = "Managed"
hostname = "10.10.198.101"
username = var.username
password = var.password
licensing_intent = "OneViewNoiLO"
}

Updates Power State of the server hardware

resource "oneview_server_hardware" "power" {
depends_on = [oneview_server_hardware.sh]
configuration_state = "update"
name = "${oneview_server_hardware.sh.name}"
username = var.username
password = var.password
server_power_state {
power_state = "Off"
power_control = "PressAndHold"
}
}

output "oneview_server_hardware_value" {
value = "${oneview_server_hardware.sh.name}"
}

I tried this with a synergy server and that seemed to work but for a rack mount server does not seem to work

Ok I just figured out that it only works if you first turn on the server and then turn it off. If I set power to on even of the server is on and then set power to off it will work. If I try to set the power to off first it does not work even if the power is already on. This happens for both rackmount and synergy servers

I am new to terraform and I don;t think I understand how within a module I can create a resource for a new serverthat is added to oneview and then force it to be powered off so I can apply a profile. I see if I update the module it seems to work but that is not want I would like to do. I included the server_power_state to off when adding the sever but that does not power off the server

Hi Kristy,

Trying to understand the scenario in which power off is not working.

Can you share the exact steps to reproduce the issue as I was able to to power off a rack server( previously powered on)?

Closing this as there is no response. Please reopen if it is still an issue.