diff --git a/internal/backend/remote-state/gcs/backend.go b/internal/backend/remote-state/gcs/backend.go index af2a667eb..1f1577799 100644 --- a/internal/backend/remote-state/gcs/backend.go +++ b/internal/backend/remote-state/gcs/backend.go @@ -4,6 +4,7 @@ package gcs import ( "context" "encoding/base64" + "encoding/json" "fmt" "os" "strings" @@ -141,6 +142,10 @@ func (b *Backend) configure(ctx context.Context) error { return fmt.Errorf("Error loading credentials: %s", err) } + if !json.Valid([]byte(contents)) { + return fmt.Errorf("contents of credentials are invalid json") + } + credOptions = append(credOptions, option.WithCredentialsJSON([]byte(contents))) }