FAQ | This is a LIVE service | Changelog

Skip to content

Move to using Cloud Functions gen 2

Dr Rich Wareham requested to merge issue-11-cloud-functions-gen-2 into master

As noted in #11 (closed), we have a scheduled script where we'd like to, if possible, use a gen 2 runtime for the longer timeout.

This MR ports us over to using gen 2 runtimes instead of gen 1. Since this involves a destroy and re-create of the Cloud Function, a possible change to runtime behaviour and a small change to the service_account variable and output types, this is marked as a breaking feature will cause a new major release of the module.

The actual port is small and the changes are restricted to main.tf. They are broken out as a separate commit for ease of review. There is a wrinkle when upgrading an existing scheduled script from a gen 1 runtime to gen 2 in that terraform doesn't know that it should fully destroy the gen 1 function before creating the gen 2 function since they share the same namespace. Work around this by giving the gen 2 function a unique random suffix to the name which will allow terraform to create it and destroy the gen 1 function in parallel.

The other part of this MR is porting the pre-commit jobs, CI jobs, terraform-docs and release it configuration from the GCP Cloud Run app module.

This involved some automated and some manual fixups to files to appease the tflint and trivy gods. In particular we needed to add a type annotation to the service_account variable, change the service_account output to match, rename the CHANGELOG file and re-structure the README to be terraform-docs friendly.

Since the types of the service_account variable and output have changed, also mark this as a breaking feature.

Closes #11 (closed)

Edited by Dr Rich Wareham

Merge request reports

Loading