-
Notifications
You must be signed in to change notification settings - Fork 105
[Bug] Cannot authenticate with user apikey #415
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I think that's a duplicate of #364 actually. |
@pyranja I think you close the issue too soon. I am facing the same issue and you were right on you supposition : here in the fleet client code we can see that the Authorization header is prefixed by the Bearer keyword instead of ApiKey https://github.com./elastic/terraform-provider-elasticstack/blob/main/internal/clients/fleet/client.go#L102 |
FWIW the correct link for the Kibana API is here. It's lacking some detail on how to use API key auth though. The conclusion is however still correct, i.e we need to use the The docs linked to in the original issue are for the ESS (Cloud) API which currently uses a different API key to Kibana/Elasticsearch. |
solved by #576 |
Describe the bug
I'm trying to use the
elasticstack_fleet_enrollment_tokens
data source, when using an api key for authentication.Performing a
terraform plan
fails with a401 Unauthorized
status.To Reproduce
Steps to reproduce the behavior:
Expected behavior
Can use an apikey to authenticate with fleet.
Debug output
Run
terraform
command withTF_LOG=trace
and provide extended information on TF operations.Additional context
I verified that the apikey works when contacting the api directly.
After checking the provider implementation, I suspect that the provider sends authorization headers with the
Bearer
prefix. Apikeys are expected to use theApikey
prefix though - https://www.elastic.co/guide/en/cloud/current/ec-api-authentication.htmlThe text was updated successfully, but these errors were encountered: