When using Terraform CLI locally, there are a variety of ways to allow the Google Cloud credential JSON to be read. When using Terraform with Terraform Cloud or Terraform Enterprise set up as the
remote backend, however, the credentials need to be set as an environment variable on the workspace(s). This requires entering the contents of a service account key file in JSON format.
- Navigate to the Terraform Enterprise UI.
- If necessary, select the appropriate organization from the list of available organizations.
- Select the appropriate workspace.
- Select Variables
- In the Environment Variables section, click Add Variable.
GOOGLE_CREDENTIALSas the key.
- Open the service account key file, copy the contents, then paste the content into the value field.
- Mark the environment variable as sensitive.
- Click Save Variable.
- Queue a plan on the workspace to verify that the credentials are being used.