gke-policy-automation
gke-policy-automation copied to clipboard
Serverless: use Terraform resource for Cloud Run jobs
Community Note
- Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
- Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
- If you are interested in working on this issue or have submitted a pull request, please leave a comment.
Description
Cloud Run jobs resource is finally available in Google Terraform provider! The existing Terraform solution should be adapted to leverage the new CloudRun resource to create it without manual step.
References
+1
Update: I played around with Cloud Run jobs Terraform resource. It works good but there is a dependency on a container image presence in Artifact Registry - job creation fails, when there is no image in Artifact Registry. That is the case during the Terraform run.
Option 1 : Use Artifact Registry remote repository
In this option, the new Artifact Regsitry remote repositories feature will be used. It will allow to avoid any manual tasks of moving tool's image to the Artifact Registry. The remote repo will proxy / cache the tool's repo from Github. The only problem is that, for now, remote repos support only docker hub as an upstream.
Option 2: Run scrip that moves image as Terraform local-exec resource
In this option, we run script that copies tool's image to Artifact Registry as a Terraform resource. Then we create CloudRun jobs. I'm not a big fan of running scripts from the Terraform however, but we will avoid script step.
I think that #option 1 is the future direction once Artifact Registry will be ready. Im' just not sure if we should move script to Terraform or stay as it is for now.