Skip to content

Commit

Permalink
Add check for no access token in provider config
Browse files Browse the repository at this point in the history
  • Loading branch information
alexhung committed Aug 23, 2024
1 parent b12bb7a commit ffbb0db
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkg/xray/provider/sdkv2.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,12 @@ func providerConfigure(ctx context.Context, d *schema.ResourceData, terraformVer
accessToken = v.(string)
}

if accessToken == "" {
return nil, diag.Errorf("While configuring the provider, the Access Token was not found in " +
"the JFROG_ACCESS_TOKEN/XRAY_ACCESS_TOKEN environment variable, or provider " +
"configuration block access_token attribute, or from Terraform Cloud Workload Identity token.")
}

restyClient, err = client.AddAuth(restyClient, "", accessToken)
if err != nil {
return nil, diag.FromErr(err)
Expand Down

0 comments on commit ffbb0db

Please sign in to comment.