Sitemap
TDS Archive

An archive of data science, data analytics, data engineering, machine learning, and artificial intelligence writing from the former Towards Data Science Medium publication.

Follow publication

Deploy Cloud Functions on GCP with Terraform

5 min readJan 21, 2022

--

Image by geralt | Pixabay

Prerequisites

Objectives

Project Structure

.cloud_function_project/
β”‚
β”œβ”€β”€ terraform/
β”‚ β”‚
β”‚ β”œβ”€β”€ backend.tf
β”‚ β”œβ”€β”€ function.tf
β”‚ β”œβ”€β”€ main.tf
β”‚ β”œβ”€β”€ storage.tf
β”‚ └── variables.tf
β”‚
└── src/
β”‚
β”œβ”€β”€ main.py
└── requirements.txt

Create the Cloud Function

Create the Terraform Infrastructure

Backend

Variables

Main

Google Cloud Storage

Google Cloud Function

Deploy the environment

$ cd ./terraform
$ terraform init
$ terraform plan
$ terraform apply

Test your Cloud Function

Going further

--

--

TDS Archive
TDS Archive

Published in TDS Archive

An archive of data science, data analytics, data engineering, machine learning, and artificial intelligence writing from the former Towards Data Science Medium publication.

Responses (2)