Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jeffbryner/gcp-cloud-function-kickstarter
bootstrap your way into a gcp cloud function
https://github.com/jeffbryner/gcp-cloud-function-kickstarter
Last synced: 11 days ago
JSON representation
bootstrap your way into a gcp cloud function
- Host: GitHub
- URL: https://github.com/jeffbryner/gcp-cloud-function-kickstarter
- Owner: jeffbryner
- License: mpl-2.0
- Created: 2021-11-07T01:32:57.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2022-04-11T00:08:29.000Z (almost 3 years ago)
- Last Synced: 2024-11-08T21:19:02.341Z (2 months ago)
- Language: HCL
- Size: 14.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Why?
While serverless.com is a great way to boot up lambas and cloud functions, it's not always compatible with terraform ci/cd pipelines.This project is meant to be a terraform ci/cd friendly way to bootstrap your way into a gcp cloud function with ease!
## Assumptions
- You have an existing GCP project
- You'd like to add a python based cloud function
- You'd like a simple way to add it that's compatible with a terraform-based ci/cd pipeline## How?
Copy the terraform.tfvars.example as terraform.tfvars, retrieve the project ID for your target GCP project/environment and add it to the file.
In the directory where you stored main.tf:
- terraform init
- Import the target project into terraform ala: terraform import google_project.target prj-sample-project-id-goes-here
- Edit terraform.tfvars to match the basic project elements (name, billing accoujnt, id)
- Make a copy of backend.tf.example as backend.tf with a proper bucket name, etc if you'd like to store terraform state in GCP and run terraform init --force-copy to copy state to the bucket.
- A terraform apply should now create the zip file for the main.py function, upload it to a bucket, create a cloud function and emit the url for you to call it.
- Voila! A basic kickstart.## Next steps
This pattern is a simple 'zip and deploy' and includes sample dependencies on numpy and pandas just to show how to include libraries in your requirements.txt.