Skip to content

Some service agent accounts are provisioned on a just-in-time principle when the first call to their respective API is made. This repository is a showcase example of working around this limitation.

Notifications You must be signed in to change notification settings

aablsk/terraform-jit-sa-provisioning

Repository files navigation

Problem definition

  • We want to create authoritative project IAM bindings with terraform (e.g. as part of Disaster Recovery requirements).
  • This implies creating the necessary bindings for P4SA/Service Agent account.
  • If we simply enable APIs, the P4SA is not necessarily created as they may be created just in time (JIT), when the services API is called for the first time.
  • If the P4SA does not exist, assigning IAM roles will fail.

How to reproduce the issue (reproduction branch)

  • switch to branch reproduction to reproduce
  • ensure you are using a new project and DO NOT navigate to Data Transfer UI as this will trigger the creation of the P4SA

Example case

  • Use bigquerydatatransfer.googleapis.com as example as the corresponding P4SA "serviceAccount:service-$PROJECT_NUMBER@gcp-sa-bigquerydatatransfer.iam.gserviceaccount.com" is created JIT, when the first API call to Data Transfer API is made.

Solution

Notes

About

Some service agent accounts are provisioned on a just-in-time principle when the first call to their respective API is made. This repository is a showcase example of working around this limitation.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages