Closed tinova closed 8 months ago
Hi @tinova
After several attempts I can't reproduce the issue. When I try to add a Host to OpenNebula that can be monitored (assigning at the same time a Cluster as you show in your example) it always works fine no matter how many times I apply the changes.
However, if I apply exactly the file that you comment in the body of the issue, the behavior is as follows:
deployment_issue-host
) stays in error state as it cannot be monitored. This is to be expected since there is no host accessible via this hostname in my test lab:
opennebula_host.this: Creating...
opennebula_host.this: Still creating... [10s elapsed]
╷
│ Error: Failed to wait host to be in MONITORED state
│
│ with opennebula_host.this,
│ on site.tf line 31, in resource "opennebula_host" "this":
│ 31: resource "opennebula_host" "this" {
│
│ host (ID: 5): Host (ID:5) entered fail state, error: Thu Nov 2 11:29:29 2023 : Error monitoring Host development_host (5):
╵
root@frontend:~/trrfrm# onehost list
ID NAME CLUSTER TVM ALLOCATED_CPU ALLOCATED_MEM STAT
5 development_host deployment 0 - - err
When running terraform apply again, the host is indeed destroyed, but it's recreated again where this new host is correctly added to the cluster.
Terraform will perform the following actions:
# opennebula_host.this is tainted, so must be replaced
-/+ resource "opennebula_host" "this" {
~ default_tags = {} -> (known after apply)
~ id = "6" -> (known after apply)
name = "development_host"
~ tags = {
~ "deployment_id" = "" -> "deployment_issue"
}
~ tags_all = {
- "deployment_id" = ""
} -> (known after apply)
# (2 unchanged attributes hidden)
}
Plan: 1 to add, 0 to change, 1 to destroy.
opennebula_host.this: Destroying... [id=5]
opennebula_host.this: Still destroying... [id=5, 10s elapsed]
opennebula_host.this: Destruction complete after 10s
opennebula_host.this: Creating...
opennebula_host.this: Still creating... [10s elapsed]
╷
│ Error: Failed to wait host to be in MONITORED state
│
│ with opennebula_host.this,
│ on site.tf line 22, in resource "opennebula_host" "this":
│ 22: resource "opennebula_host" "this" {
│
│ host (ID: 6): Host (ID:6) entered fail state, error: Thu Nov 2 11:23:14 2023 : Error monitoring Host deployment_issue-host
│ (6):
╵
root@frontend:~/trrfrm# onehost list
ID NAME CLUSTER TVM ALLOCATED_CPU ALLOCATED_MEM STAT
6 deployment_issue-host deployment 0 - - err
Isn't this the expected behavior? Maybe there is something I am not taking into account?
My test environement configuration:
closing until we get more info to reproduce it
Description
Registering a host first time works as expected. Registering a second time removes it from the host cluster.
Terraform and Provider version
terraform 1.4.2
Affected resources and data sources
Terraform configuration
No response
Expected behavior
Applying the same plan shouldn't change the previously created host.
Actual behavior
Host was removed from the cluster
Steps to Reproduce
Run this twice, host is out of the cluster
Debug output
No response
Panic output
No response
Important factoids
No response
References
No response