terraformterraform-provider-gcpterraform-cloud

how to provide service account details to terraform cloud variable? throws 'unexpected end of JSON input'


I'm trying to use terraform cloud with a gcp provider, a pretty basic use case.

The major issue is -- how do I provide the google provider as a variable to the cloud version of terraform? I've added the JSON variable and removed the \n as instructed, but it still throws unexpected end of JSON input when running terraform apply

There is no documentation mentioning terraform cloud in the google provider documentation or for the terraform documention on google pages.

I've been beyond the 10th page of google for various searches with no luck, I literally can't use terraform cloud with GCP for the most basic tasks and the lack of support around this issue is shocking.


Solution

  • Solution was found on a few hashicorp forum posts -- for the GCP provider specifically the environment variable name must be set to GOOGLE_CREDENTIALS and it does not appear to work with other variable values for this specific provider, it also doesn't seem to be documented on the gcp provider page or on any terraform-cloud specific pages.

    You also have to edit your json to remove all the whitespace so that you have everything on 1 line before copy-pasting it into terraform cloud. In my case, I was already doing that but others might not be aware.