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
Trying to debug some issues with Terraform module for Harness, and found that after trying to use the underlying SDK for Go directly myself that it suffers from the same problem I was seeing: 401 unauthorized.
Looking into the various underlying operations, such as GetClusterList we see the auth code is trying to read from the context:
if ctx != nil {
// API Key Authentication
if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
var key string
if auth.Prefix != "" {
key = auth.Prefix + " " + auth.Key
} else {
key = auth.Key
}
localVarHeaderParams["x-api-key"] = key
}
}
However, I'm not sure - but don't these need to also check the c.client.cfg.ApiKey? I'm passing the API key as a setup parameter to the nextgen API client, and it's being propagated into the struct for the clusters APIs etc. If I hack the code to manually set my API key from the structs API key, then it seems to work fine though. It seems like this is a pattern throughout the whole SDK.
Trying to debug some issues with Terraform module for Harness, and found that after trying to use the underlying SDK for Go directly myself that it suffers from the same problem I was seeing: 401 unauthorized.
Looking into the various underlying operations, such as
GetClusterList
we see the auth code is trying to read from the context:However, I'm not sure - but don't these need to also check the c.client.cfg.ApiKey? I'm passing the API key as a setup parameter to the nextgen API client, and it's being propagated into the struct for the clusters APIs etc. If I hack the code to manually set my API key from the structs API key, then it seems to work fine though. It seems like this is a pattern throughout the whole SDK.
Cross reference at: harness/terraform-provider-harness#260
The text was updated successfully, but these errors were encountered: