elastic / terraform-provider-elasticstack

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

[Bug] because of a simple dateparse error, the provider does not work with serverless Elastic flavor #629

Closed ck-ntt closed 6 months ago

ck-ntt commented 6 months ago

Error: parsing time "2023-10-31" as "2006-01-02T15:04:05Z07:00": cannot parse "" as "T"

Cause: Obviously, when connecting, the provider first does an API call on the root /, and then want to parse the responded field version.build_date. E.g. this response:

{
  "name" : "serverless",
  "cluster_name" : "foo",
  "cluster_uuid" : "bar",
  "version" : {
    "number" : "8.11.0",
    "build_flavor" : "serverless",
    "build_type" : "docker",
    "build_hash" : "00000000",
    "build_date" : "2023-10-31",
    "build_snapshot" : false,
    "lucene_version" : "9.7.0",
    "minimum_wire_compatibility_version" : "8.11.0",
    "minimum_index_compatibility_version" : "8.11.0"
  },
  "tagline" : "You Know, for Search"
}

But 2023-10-31 does not look like the expected format. A real Elasticsearch responds for example this:

"build_date": "2022-12-05T18:22:22.226119656Z",

Just because of this simple error, the whole (?) provider doesn't not work. Tried with component template and index template resource, and used the example code from documentation.

tobio commented 6 months ago

Thanks for reporting this @ck-ntt. This will be fixed in 0.11.3 which will be released shortly