You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please vote on this issue by adding a 馃憤 reaction to the original issue to help the community and maintainers prioritize this request
Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
If you are interested in working on this issue or have submitted a pull request, please leave a comment
Terraform Version
v0.12.24
Affected Resource(s)
Provider authentication using a valid api_key
Terraform Configuration Files
# Copy-paste your Terraform configurations here - for large Terraform configs,# please use a service like Dropbox and share a link to the ZIP file.provider"artifactory" {
url ="https://my-artifactory.domain.com/artifactory"
api_key =var.admin_apikey#valid API Key, because authentication works fine via curl -H 'X-JFrog-Art-Api:${api_key}'
}
Debug Output
Panic Output
Expected Behavior
Authntication through provider using api_key should have ben successful, just the way it works with REST API using header 'X-JFrog-Art-Api'
e.g -
curl -k -H "X-JFrog-Art-Api:${api_key}" https://localhost:443/artifactory/api/system/ping
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 2 0 2 0 0 5 0 --:--:-- --:--:-- --:--:-- 5
OK
Ok so finally I could figure out what's going wrong here.
Actually the issue is not as such in provider schema logic, but because the way we our use case is. We are using (another) existing Artifactory for storing tf state file and have ARTIFACTORY_USERNAME and ARTIFACTORY_PASSWORD set in env of our calling CI code.
So in effect the Artifactory provider gets username and password from above 2 env variables (https://github.com/atlassian/terraform-provider-artifactory/blob/v2.0.0/pkg/artifactory/provider.go#L27 and line 34). And we are passing (a valid) api_key in provider too. Hence the conflict!!
So now I am passing ARTIFACTORY_USERNAME and ARTIFACTORY_PASSWORD explicitly during tf init with artifactory backend. And then making these variables empty before calling say terraform validate/plan/import/apply etc. This way provider gets only api_key and it stays happy without any conflicts.
Community Note
Terraform Version
v0.12.24
Affected Resource(s)
Provider authentication using a valid api_key
Terraform Configuration Files
Debug Output
Panic Output
Expected Behavior
Authntication through provider using api_key should have ben successful, just the way it works with REST API using header 'X-JFrog-Art-Api'
e.g -
curl -k -H "X-JFrog-Art-Api:${api_key}" https://localhost:443/artifactory/api/system/ping
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 2 0 2 0 0 5 0 --:--:-- --:--:-- --:--:-- 5
OK
Actual Behavior
Error: GET https://my-artifactory.domain.com/artifactory/api/system/ping: 401 [{Status:401 Message:Bad credentials}]
on providers.tf line 1, in provider "artifactory":
1: provider "artifactory" {
Steps to Reproduce
terraform apply
Important Factoids
References
The text was updated successfully, but these errors were encountered: