# AWX, Workload Identity Federation & GCP

**URL:** <https://forum.ansible.com/t/awx-workload-identity-federation-gcp/10799>\
**Category:** Get Help\
**Tags:** gcp, awx\
**Created:** [November 9, 2024, 7:39pm UTC](https://forum.ansible.com/t/awx-workload-identity-federation-gcp/10799 "2024-11-09T19:39:22Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![iamroddo](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/iamroddo/32/321_2.png) [@iamroddo](https://forum.ansible.com/u/iamroddo)\
**Post date:** [November 9, 2024, 7:39pm UTC](https://forum.ansible.com/t/awx-workload-identity-federation-gcp/10799/1 "2024-11-09T19:39:22Z")

</div>

I’m looking for a solution to enable AWX to authenticate against GCP keylessly. I’ve seen implementations of such using GitHub Actions and Jenkins which use Workload Identity Federation. To the best of my understanding, a trust relationship is setup between a local entity that is able to impersonate a GCP service account and issue tokens on behalf of it that are valid in GCP. I don’t think such a feature exists in AWX. If it were, I suppose it would be based around a new credential type which would inject a GCP token into a job.

I could sort of do this using a GCP secrets engine in Hashicorp Vault to generate the token and a Hashicorp Vault Secret Lookup to read the generated token from Vault. However the GCP secret in Hashicorp Vault requires a GCP key and the Hashicorp Vault Secret Lookup in AWX requires a client ID and client secret. All of which is potentially vulnerable to exfiltration and needs to be regularly rotated.

---

<div class="post-metadata">

**Author:** ![chrismeyersfsu](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/chrismeyersfsu/32/1016_2.png) [@chrismeyersfsu](https://forum.ansible.com/u/chrismeyersfsu)\
**Post date:** [November 16, 2024, 12:53pm UTC](https://forum.ansible.com/t/awx-workload-identity-federation-gcp/10799/2 "2024-11-16T12:53:31Z")

</div>

Interesting. This has led me to begin reading about “Workload Identity Federation”. Do you agree that [Service Account Key JSON](https://github.com/google-github-actions/auth?tab=readme-ov-file#sake)" is not what you are looking for?

I’m going to try and read more about #1 and #2

edit:  
[Autenticar cargas de trabalho nas APIs do Google Cloud usando contas de serviço &nbsp;|&nbsp; Compute Engine Documentation](https://cloud.google.com/compute/docs/access/authenticate-workloads) If you are staying in GCP, I think this is all you need.

---

<div class="post-metadata">

**Author:** ![iamroddo](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/iamroddo/32/321_2.png) [@iamroddo](https://forum.ansible.com/u/iamroddo)\
**Post date:** [November 17, 2024, 5:23am UTC](https://forum.ansible.com/t/awx-workload-identity-federation-gcp/10799/3 "2024-11-17T05:23:37Z")

</div>

It’s not what I’m looking for. The SA key is a long-lived key and providing that to AWX is what I want to avoid.

BTW The link you provide is for authentication to GCP using Github Actions where you can either configure a SA key or set up Workload Identity Federation. I have done the latter, with Github Actions. I’m looking for the same possibility with AWX.

---

<div class="post-metadata">

**Author:** ![no-12](https://avatars.discourse-cdn.com/v4/letter/n/d07c76/32.png) [@no-12](https://forum.ansible.com/u/no-12)\
**Post date:** [November 17, 2024, 1:49pm UTC](https://forum.ansible.com/t/awx-workload-identity-federation-gcp/10799/4 "2024-11-17T13:49:29Z")

</div>

If you run AWX inside GKE you can use WIF with the k8s ServiceAccount runnig the AWX pod.

This is very easy to setup with container groups. You just have to set ‘automountServiceAccountToken’ in the pod spec to true.

And give the k8s ServiceAccount the needed permission in GCP directly or allow it to impersonate as a GCP service account.

We use this setup to generate GCP service account access tokens within some custom action plugins.  
That access tokens can be passed to modules run on remote hosts.

---

<div class="post-metadata">

**Author:** ![iamroddo](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/iamroddo/32/321_2.png) [@iamroddo](https://forum.ansible.com/u/iamroddo)\
**Post date:** [November 19, 2024, 7:43am UTC](https://forum.ansible.com/t/awx-workload-identity-federation-gcp/10799/5 "2024-11-19T07:43:10Z")

</div>

Thanks but that’s not an option for me.
