elastic / terraform-provider-elasticstack

Terraform provider for Elastic Stack
https://registry.terraform.io/providers/elastic/elasticstack/latest/docs
Apache License 2.0
171 stars 93 forks source link

[Bug] modifying elasticstack_fleet_server_host.fleet_host returns 404 #864

Open kaykhan opened 3 weeks ago

kaykhan commented 3 weeks ago

Describe the bug

When attempting to modify elasticstack_fleet_server_host.fleet_host to update the hosts value we receive {"statusCode":404,"error":"Not Found","message":"Not Found"}

A clear and concise description of what the bug is.

To Reproduce Steps to reproduce the behavior:

1.

resource "elasticstack_fleet_server_host" "fleet_host" {
  name    = "fleet"
  default = true
  hosts = [
    "https://${local.fleet_server_name}-fleet-server-agent-http.elastic-system.svc:8220", // update this value
  ]
  depends_on = [
    helm_release.fleet_server
  ]
}

Expected behavior We expect the value of hosts = [] to be modifiable

Screenshots Image

Versions (please complete the following information):

Additional context

We are also unable to delete this resource after its created.

Image

kaykhan commented 3 weeks ago

I was able to delete the fleet_server_host using the api - i also had to set default to false first.

GET kbn:/api/fleet/fleet_server_host

PUT kbn:/api/fleet/fleet_server_hosts/b1bfad95-0361-49bf-8d3d-060b2f41eb57
{
  "is_default": false
}

DELETE kbn:/api/fleet/fleet_server_hosts/b1bfad95-0361-49bf-8d3d-060b2f41eb57
{
  "items": [
    {
      "id": "b1bfad95-0361-49bf-8d3d-060b2f41eb57",
      "host_urls": [
        "https://fleet-server-prod-fleet-server-agent-http.elastic-system.svc:8220"
      ],
      "is_default": true,
      "name": "fleet",
      "is_preconfigured": false
    }
  ],
  "page": 1,
  "perPage": 10000,
  "total": 1
}
kaykhan commented 3 weeks ago

Also similar issues when working with https://registry.terraform.io/providers/elastic/elasticstack/latest/docs/resources/fleet_output