opensearch-project / terraform-provider-opensearch

https://registry.terraform.io/providers/opensearch-project/opensearch
Apache License 2.0
73 stars 56 forks source link

[BUG] Bearer token is not working when insecure = true #152

Open 360build opened 7 months ago

360build commented 7 months ago

What is the bug?

When setting up the opensearch provider it is not possible to use a bearer token and set the flag: insecure = true

How can one reproduce the bug?

`provider "opensearch" { url = "https://localhost:5000"

token = var.opensearch_jwt_token token_name = "Bearer"

insecure = true healthcheck = false }`

Basic auth is working

What is the expected behavior?

I would expect that when setting the insecure = true the bearer token is still set as header. When I remove the insecure flag it works.

Do you have any additional context?

Link to the code that creates the issue.

The problem is in the if else statement. When setting the insecure flag the tlsHttpClient is always used. It can never go to the tokenHttpClient

prudhvigodithi commented 6 months ago

[Triage] Thanks @360build, we might need another condition to execute the tokenHttpClient while applying insecure as well. Thanks

Adding @bbarani @rblcoder @peterzhuamazon for more thoughts.