Problem
When starting, a Terraform Enterprise instance may fail with an error related to object storage credentials. This can occur if the Google Cloud Storage (GCS) credentials file is expired, invalid, or malformed.
Prerequisites
- A self-hosted Terraform Enterprise instance configured to use Google Cloud Storage (GCS) for object storage.
- Administrative access to the Terraform Enterprise instance to run
replicatedctlcommands.
Cause
The instance fails to start and logs the following error message, indicating a problem parsing the GCS credentials file.
failed to start server { err="failed parsing credentials: invalid character '\\n' in string literal" }This error typically occurs when the GCS credential JSON file contains unexpected characters, such as a newline (\n), often due to incorrect formatting when the value was set.
Solution
To resolve this issue, you must provide a correctly formatted GCS credential file to the Terraform Enterprise configuration.
- Download a new, valid service account key file in JSON format from the Google Cloud IAM & Admin console. Save this file as
GCP-key.jsonon the Terraform Enterprise instance. Update the
gcs_credentialsconfiguration setting by passing the contents of the new key file. Ensure you use standard double quotes.$ replicatedctl app-config set gcs_credentials --value "$(cat GCP-key.json)"
Outcome
After you update the credentials and restart the Terraform Enterprise application, the parsing error is resolved, and the instance should start successfully.