Icinga / terraform-provider-icinga2

Terraform Icinga2 provider
https://www.terraform.io/docs/providers/icinga2/
Mozilla Public License 2.0
21 stars 19 forks source link

object updates #46

Open networksecadmin opened 3 years ago

networksecadmin commented 3 years ago

Hi together,

I hope you can help us with our updating problems.

Terraform Version

v0.12

Affected Resource(s)

icinga2_host

Terraform Configuration Files

We added some icinga host objects and services in our azure terraform infrastructur code and the deployment worked without any problems. After that we added a new variable (deployment = "terraform"). The terraform plan said that the host will be changing (nothing will remove), The result of this was that we saw the host object with the new variable in the icinga2 web portal but all associated services were missed. Now when we trigger a new deployment it will fail because the tfstate file says: "Error: Failed to Read Service".

resource "icinga2_host" "icinga_pg_host" {
  hostname      = azurerm_postgresql_server.pg_server.name
  address       = azurerm_postgresql_server.pg_server.id
  **vars = {
    deployment       = "terraform"
  }**
}

resource "icinga2_service" "icinga_pg_service_ressourcehealth" {
  name          = var.service_pg_ressourcehealth
  hostname      = icinga2_host.icinga_pg_host.hostname
}

I think the problem is that terraform will change the object without touching any service of it. icinga otherwise delete this host object with every associated service. The service objects still exist in the tfstate file.

We have many problems with updating services or host objects. Sometimes we get the following error after changing some existing objects: "Error: 500 Internal Server Error". Only this problem can be solved by restarting icinga.

Best regards