kkkkrkrkkk
kkkkrkrkkk

Reputation: 31

Terraform failed API authorization

following this tutorial: https://learn.hashicorp.com/tutorials/terraform/cloud-sign-up?in=terraform/cloud-get-started#create-an-organization i was directed to this: https://app.terraform.io/app/getting-started/example and i can't succeed in first step -

terraform login

i copied and pasted the the token from opened website and this is the result: │ Error: Failed to create API client: Get "https://app.terraform.io/api/v2/ping": net/http: invalid header field value "Bearer \x16" for key Authorization

error message i know it looks like i provided wrong token/some typo but i tried couple of times so i have no idea how could i every time wrongly copied&pasted the token

i was following previous tutorials from Hashicorp very carefully

Upvotes: 1

Views: 4910

Answers (3)

Lord02
Lord02

Reputation: 121

The only way for me to get this working was to use the "Open New Extenal Terminal" in VsCode ... it simply doesn't work to paste the token in the Internal Terminal in VsCode, I tried both Powershell 5.1 and 7.1, neither of them work! VsCode seems to add some symbols to make the token invalid if pasted inside the Internal Terminal of VsCode!

Upvotes: 0

Jason
Jason

Reputation: 2617

I ran into this same error and solved it by switching the terminal application I was using. Apparently the terminal in VS Code on Windows appends an extra unicode character when you paste into it. Pasting the token in Windows Powershell worked perfectly.

Upvotes: 7

kkkkrkrkkk
kkkkrkrkkk

Reputation: 31

updating version of terraform helped. I used Chocolatey to download terraform, and it downloaded outdated version.

Upvotes: 0

Related Questions