Problem
When running a plan using the Terraform Google provider, an "unable to parse credentials unexpected end of JSON input error" occurs even though the credentials are set in the Terraform Cloud workspace and valid.
Cause
The error is caused by the Google provider v4.59 and below treating ""
as fully valid credentials in Terraform configuration whereas the Google provider v4.60+ correctly reports that ""
isn't a parsable set of credentials.
provider "google" {
credentials = ""
}
Solutions:
- For provider v4.60 and above an empty string can no longer be used as a default value so it will need to be removed from the code and the
GOOGLE_CREDENTIALS
can be picked up from the environment variable in the Terraform Cloud workspace.-
provider "google" { ## credentials = "" }
-
- For provider v4.59 and lower an empty string is valid and Terraform will still be able to acquire
GOOGLE_CREDENTIALS
from the Terraform Cloud workspace.-
provider "google" { credentials = "" }
-