{"id":22807992,"url":"https://github.com/amaziahub/gcp-py-cloud-function","last_synced_at":"2026-01-31T17:31:37.464Z","repository":{"id":267479670,"uuid":"901365055","full_name":"amaziahub/gcp-py-cloud-function","owner":"amaziahub","description":"A walk through of creating and deploying a simple gcp could function","archived":false,"fork":false,"pushed_at":"2024-12-10T15:54:11.000Z","size":12,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-01T09:09:50.056Z","etag":null,"topics":["automation","cloud-function","cloud-functions","cloudcomputing","cloudfunctions","developerexperience","devops","function","gcloud","gcp","gcp-cloud-functions","googlecloud","infrastructureascode","python","serverless","terraform"],"latest_commit_sha":null,"homepage":"","language":"HCL","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/amaziahub.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-12-10T14:22:33.000Z","updated_at":"2024-12-10T16:21:57.000Z","dependencies_parsed_at":"2024-12-10T16:23:16.282Z","dependency_job_id":"995faec6-20e5-4c94-a4cb-185bfccecea5","html_url":"https://github.com/amaziahub/gcp-py-cloud-function","commit_stats":null,"previous_names":["amaziahub/gcp-py-cloud-function"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/amaziahub/gcp-py-cloud-function","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amaziahub%2Fgcp-py-cloud-function","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amaziahub%2Fgcp-py-cloud-function/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amaziahub%2Fgcp-py-cloud-function/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amaziahub%2Fgcp-py-cloud-function/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/amaziahub","download_url":"https://codeload.github.com/amaziahub/gcp-py-cloud-function/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amaziahub%2Fgcp-py-cloud-function/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28948456,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-31T14:26:55.697Z","status":"ssl_error","status_checked_at":"2026-01-31T14:26:52.545Z","response_time":128,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["automation","cloud-function","cloud-functions","cloudcomputing","cloudfunctions","developerexperience","devops","function","gcloud","gcp","gcp-cloud-functions","googlecloud","infrastructureascode","python","serverless","terraform"],"created_at":"2024-12-12T11:07:29.980Z","updated_at":"2026-01-31T17:31:37.450Z","avatar_url":"https://github.com/amaziahub.png","language":"HCL","readme":"\n\u003cdiv\u003e\n\n\u003cdiv align=\"center\"\u003e\n\n**gcp-py-cloud-function**\n\u003c/div\u003e\n\n\u003e This project demonstrates how to create, deploy, and test a simple Google Cloud Function using Python. The function responds to HTTP requests and returns a JSON message.\n\n\n\u003cdiv align=\"center\"\u003e\n\n![Terraform](https://img.shields.io/badge/terraform-0.14-blue)\n![GCP](https://img.shields.io/badge/Google_Cloud-Platform-blue)\n![Python](https://img.shields.io/badge/python-3.10-blue)\n![Google Cloud Functions](https://img.shields.io/badge/Google_Cloud_Functions-blue)\n![CI](https://img.shields.io/badge/CI-Passed-green)\n\u003c/div\u003e\n\u003c/div\u003e\n\n## Prerequisites\n\n1. A Google Cloud account with billing enabled.\n2. Python 3.10 or later installed locally.\n3. `gcloud` CLI installed and initialized:\n   - Follow the [GCloud CLI Installation Guide](https://cloud.google.com/sdk/docs/install).\n\n---\n\n## Setup Instructions\n\n### Step 1: Clone This Repository\n```bash\ngit clone git@github.com:amaziahub/gcp-py-cloud-function.git\ncd gcp-py-cloud-function\n```\n\n### Step 2: Create a Google Cloud Project\n- Go to the [Google Cloud Console](https://console.cloud.google.com/)\n- Create a new project\n- Note the project ID for later use\n\n---\n\n## Deploying the Function\n\n### Step 3: Initialize `gcloud` CLI\n1. Set your project ID:\n   ```bash\n   gcloud config set project YOUR_PROJECT_ID\n   ```\n\n2. Enable necessary APIs:\n   ```bash\n   gcloud services enable cloudfunctions.googleapis.com\n   gcloud services enable cloudbuild.googleapis.com\n   ```\n\n---\n\n### Step 4: Deploy the Cloud Function using `gcloud`\nRun the following command to deploy the function:\n```bash\ngcloud functions deploy helloWorld \\\n    --runtime python310 \\\n    --trigger-http \\\n    --allow-unauthenticated \\\n    --entry-point hello_world\n```\n\n---\n\n## Deploying with Terraform\nIf you prefer to manage your Google Cloud Function deployment using **Terraform**, follow these steps:\n\n### Step 1: Install Terraform\nEnsure that Terraform is installed on your machine. If not, follow the [Terraform installation guide](https://developer.hashicorp.com/terraform/tutorials/aws-get-started/install-cli).\n\n### Step 2: Configure Your Google Cloud Project in Terraform\n\nIn the `main.tf` file, update the `project` and `region` with your own values.\nYou can also modify the function runtime, name, and other settings as required.\n\n### Step 3: Deploy with Terraform\n1. Initialize Terraform:\n```bash\nmake init\n```\n2. Apply the configuration to deploy the function:\n```bash\nmake apply\n```\n\n## Testing the Function\n### Step 5: Get the Function URL\nRetrieve the function URL:\n```bash\ngcloud functions describe helloWorld --format='value(httpsTrigger.url)'\n```\n\n### Step 6: Test the Function\nUse `curl` to test the function:\n```bash\ncurl -X POST \\\n    -H \"Content-Type: application/json\" \\\n    -d '{\"name\": \"Amazia\"}' \\\n    FUNCTION_URL\n```\nReplace `FUNCTION_URL` with the URL retrieved in the previous step.\n\n---\n\n## Logs and Debugging\n### View Logs\n```bash\ngcloud functions logs read helloWorld\n```\n---\n\n## Cleanup\n### Delete the Function\nTo avoid incurring costs, delete the deployed function:\n#### with `gcloud`\n```bash\ngcloud functions delete helloWorld\n```\n#### with `terraform`\n```bash\nmake destroy\n```\n\n---\n\nHappy Coding! 🚀\n\n--- \n\n## How to Use It\n```yaml\n---\n\n### How to Use It\nReplace `your-username/your-repo-name` with your GitHub repository’s actual details. This README provides all the necessary steps to recreate, deploy, and test your Cloud Function, along with a structured overview of the project. Let me know if you need further customization!\n\n```\n\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famaziahub%2Fgcp-py-cloud-function","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Famaziahub%2Fgcp-py-cloud-function","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famaziahub%2Fgcp-py-cloud-function/lists"}