Useful or not, from you.
terraform-provider-restapi Getting 401 even though credentials are provided

I'm trying to POST a request using basic auth with the following:

terraform {
  required_providers {
    restapi = {
      source = "fmontezuma/restapi"
      version = "1.14.1"
    }
  }
}

provider "restapi" {
  uri = "http://test.com"
  headers = {
    "Authorization": "Basic abc"
  }
  debug = true
  write_returns_object = true
}

resource "restapi_object" "mapping" {
  path = "/elastic/_mapping/"
  data = file("${path.module}/mapping.json")
}

Unfortunately I'm getting the following error:

Error: Unexpected response code '401': {"error":{"root_cause":[{"type":"security_exception","reason":"missing authentication credentials for REST request [/elastic/_mapping/]","header":{"WWW-Authenticate":["Bearer realm=\"security\"","
ApiKey","Basic realm=\"security\" charset=\"UTF-8\""]}}],"type":"security_exception","reason":"missing authentication credentials for REST request [/elastic/_mapping/]","header":{"WWW-Authenticate":["Bearer realm=\"security\"","ApiKey"
,"Basic realm=\"security\" charset=\"UTF-8\""]}},"status":401}

Any idea what I might be doing wrong?

I've also tried with the following but getting the same error:

provider "restapi" {
  uri = "http://test.com"
  username = "test"
  password = "test"
  debug = true
  write_returns_object = true
}
That's a useful answer
Without any help

Hey, yeah I copy pasted the header from this working curl so not sure why it's not working:

curl --location --request POST 'http://xxx.elastic.com/_template/template_xxx' \
--header 'Authorization: Basic xxx' \
--header 'Content-Type: application/json' \