-
Notifications
You must be signed in to change notification settings - Fork 104
Open
Labels
bugSomething isn't workingSomething isn't working
Description
go-tfe version
v1.75.0
Description
When I call GPGKeys.Create()
and Terraform Cloud returns an error, I am unable to print the response itself?
Testing plan
// Add key to provider
options := tfe.GPGKeyCreateOptions{
AsciiArmor: keyData,
Type: "gpg-keys",
Namespace: org,
}
key, err := client.GPGKeys.Create(cmd.Context(), tfe.PrivateRegistry, options)
if err != nil {
log.Printf("Error adding key: %s", err)
return
}
fmt.Printf("Key added successfully: %s\n", key.KeyID)
Expected Behavior
the curl response is:
❯ curl --header "Authorization: Bearer $TFC_TOKEN" --header "Content-Type: application/vnd.api+json" --request POST --data @gpg-output.json https://app.terraform.io/api/registry/private/v2/gpg-keys
{"errors":["could not create GPG key: GPG key REDACTED already exists for namespace REDACTED"]}%
Actual Behavior
log.Printf("Error adding key: %s", err)
prints:
2025/02/12 08:18:29 Error adding key: 400 Bad Request
Additional Context
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working