# Injecting GCP Service Account credentials using templates

**URL:** <https://community.doppler.com/t/injecting-gcp-service-account-credentials-using-templates/1324>\
**Category:** Need Help\
**Created:** [September 1, 2023, 5:18am UTC](https://community.doppler.com/t/injecting-gcp-service-account-credentials-using-templates/1324 "2023-09-01T05:18:47Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![enmanuelmoreira](https://avatars.discourse-cdn.com/v4/letter/e/82dd89/32.png) [@enmanuelmoreira](https://community.doppler.com/u/enmanuelmoreira)\
**Post date:** [September 1, 2023, 5:18am UTC](https://community.doppler.com/t/injecting-gcp-service-account-credentials-using-templates/1324/1 "2023-09-01T05:18:47Z")

</div>

How I can import a json gcp service account file using templates?

My secret:  
{  
“REPOSITORY\_TEMPLATE”: “gs:lxsj5esx”,  
“RESTIC\_PASSWORD”: “password”,  
“GOOGLE\_PROJECT\_ID”: “project\_id”,  
“GOOGLE\_APPLICATION\_CREDENTIALS”: “I need to import the json sa key here”  
}

---

<div class="post-metadata">

**Author:** ![watsonian](https://sea2.discourse-cdn.com/flex016/user_avatar/community.doppler.com/watsonian/32/267_2.png) [@watsonian](https://community.doppler.com/u/watsonian)\
**Post date:** [September 1, 2023, 2:54pm UTC](https://community.doppler.com/t/injecting-gcp-service-account-credentials-using-templates/1324/2 "2023-09-01T14:54:57Z")

</div>

Hi @enmanuelmoreira!

Welcome to the Doppler Community!

Just to make sure I’m understanding you right – you have a secret in Doppler that’s a JSON string similar to what you posted. One of the keys in that JSON string needs to have a value that’s also JSON. Is that right so far?

Are you trying to set this up using [project templates](https://docs.doppler.com/docs/project-templates)? Or is it just the JSON inside JSON bit that’s causing you problems?

Regards,  
-Joel

---

<div class="post-metadata">

**Author:** ![enmanuelmoreira](https://avatars.discourse-cdn.com/v4/letter/e/82dd89/32.png) [@enmanuelmoreira](https://community.doppler.com/u/enmanuelmoreira)\
**Post date:** [September 2, 2023, 3:10am UTC](https://community.doppler.com/t/injecting-gcp-service-account-credentials-using-templates/1324/3 "2023-09-02T03:10:41Z")

</div>

Hi @watsonian

Thank you for your reply. The thing is that the secret is in Doppler, I need to parse a Google Cloud credential into the variable GOOGLE\_APPLICATION\_CREDENTIALS, including scapes. I don’t know how I archive this.

I figured out to create another secret in the Doppler CLI referencing the value that I need with ${GOOGLE\_APPLICATION\_CREDENTIALS} variable.

---

<div class="post-metadata">

**Author:** ![watsonian](https://sea2.discourse-cdn.com/flex016/user_avatar/community.doppler.com/watsonian/32/267_2.png) [@watsonian](https://community.doppler.com/u/watsonian)\
**Post date:** [September 5, 2023, 2:26pm UTC](https://community.doppler.com/t/injecting-gcp-service-account-credentials-using-templates/1324/4 "2023-09-05T14:26:43Z")

</div>

Ah, I see! Yep, in that case storing the credentials in a separate secret and then using [secret referencing](https://docs.doppler.com/docs/secrets#referencing-secrets) would certainly work! Glad you were able to get something working for you!
