Giter Site home page Giter Site logo

kpatel747 / terraform-google-cloud-functions Goto Github PK

View Code? Open in Web Editor NEW

This project forked from googlecloudplatform/terraform-google-cloud-functions

0.0 0.0 0.0 237 KB

Deploys Cloud Functions (Gen 2)

Home Page: https://registry.terraform.io/modules/GoogleCloudPlatform/cloud-functions/google

License: Apache License 2.0

Go 18.77% Makefile 12.07% HCL 69.16%

terraform-google-cloud-functions's Introduction

Terraform Google Cloud Functions (Gen 2) module

The Terraform module handles the deployment of Cloud Functions (Gen 2) on GCP.

The resources/services/activations/deletions that this module will create/trigger are:

  • Deploy Cloud Functions (2nd Gen) with provided source code and trigger
  • Provide Cloud Functions Invoker or Developer roles to the users and service accounts

Assumptions and Prerequisites

This module assumes that below mentioned prerequisites are in place before consuming the module.

  • APIs are enabled
  • Permissions are available

Usage

Basic usage of this module is as follows:

module "cloud_functions2" {
  source  = "terraform-google-modules/cloud-functions/google"
  version = "~> 0.1.0"

  # Required variables
  function_name  = "<FUNCTION_NAME>"
  project_id     = "<PROJECT_ID>"
  location       = "<LOCATION>"
  runtime        = "<RUNTIME>"
  entrypoint     = "<ENTRYPOINT>"
  storage_source = {
    bucket      = "<BUCKET_NAME>"
    object      = "<ARCHIVE_PATH>"
    generation  = "<GCS_GENERATION>"
  }
}

Functional examples are included in the examples directory.

Inputs

Name Description Type Default Required
build_env_variables User-provided build-time environment variables map(string) null no
description Short description of the function string null no
docker_repository User managed repository created in Artifact Registry optionally with a customer managed encryption key. string null no
entrypoint The name of the function (as defined in source code) that will be executed. Defaults to the resource name suffix, if not specified string n/a yes
event_trigger Event triggers for the function
object({
trigger_region = string
event_type = string
service_account_email = string
pubsub_topic = string
retry_policy = string
event_filters = set(object({
attribute = string
attribute_value = string
operator = string
}))
})
null no
function_location The location of this cloud function string n/a yes
function_name A user-defined name of the function string n/a yes
labels A set of key/value label pairs associated with this Cloud Function map(string) null no
members Cloud Function Invoker and Developer roles for Users/SAs. Key names must be developers and/or invokers map(list(string)) {} no
project_id Project ID to create Cloud Function string n/a yes
repo_source Get the source from this location in a Cloud Source Repository
object({
project_id = string
repo_name = string
branch_name = string
dir = string
tag_name = string
commit_sha = string
invert_regex = bool
})
null no
runtime The runtime in which to run the function. string n/a yes
service_config Details of the service
object({
max_instance_count = string
min_instance_count = string
available_memory = string
timeout_seconds = string
runtime_env_variables = map(string)
runtime_secret_env_variables = set(object({
key_name = string
project_id = string
secret = string
version = string
}))
secret_volumes = set(object({
mount_path = string
project_id = string
secret = string
versions = set(object({
version = string
path = string
}))
}))
vpc_connector = string
vpc_connector_egress_settings = string
ingress_settings = string
service_account_email = string
all_traffic_on_latest_revision = bool
})
{
"all_traffic_on_latest_revision": true,
"available_memory": "256M",
"ingress_settings": null,
"max_instance_count": "100",
"min_instance_count": null,
"runtime_env_variables": null,
"runtime_secret_env_variables": null,
"secret_volumes": null,
"service_account_email": null,
"timeout_seconds": "60",
"vpc_connector": null,
"vpc_connector_egress_settings": null
}
no
storage_source Get the source from this location in Google Cloud Storage
object({
bucket = string
object = string
generation = string
})
null no
worker_pool Name of the Cloud Build Custom Worker Pool that should be used to build the function. string null no

Outputs

Name Description
function_name Name of the Cloud Function (Gen 2)
function_uri URI of the Cloud Function (Gen 2)

Requirements

These sections describe requirements for using this module.

Software

The following dependencies must be available:

Service Account

A service account with the following roles must be used to provision the resources of this module:

  • Storage Admin: roles/storage.admin
  • Cloud Functions Admin: roles/cloudfunctions.admin
  • Cloud Run Admin: roles/run.admin
  • Pub/Sub Admin: roles/pubsub.admin
  • Artifact Registry Admin: roles/artifactregistry.admin
  • Cloud Build Editor: roles/cloudbuild.builds.editor
  • Secret Manager Admin: roles/secretmanager.admin

The Project Factory module and the IAM module may be used in combination to provision a service account with the necessary roles applied.

APIs

A project with the following APIs enabled must be used to host the resources of this module:

  • Google Cloud Storage JSON API: storage-api.googleapis.com
  • Cloud Functions API: cloudfunctions.googleapis.com
  • Cloud Run Admin API: run.googleapis.com
  • Cloud Build API: cloudbuild.googleapis.com
  • Artifact Registry API: artifactregistry.googleapis.com
  • Pub/Sub API: pubsub.googleapis.com
  • Secret Manager API: secretmanager.googleapis.com

The Project Factory module can be used to provision a project with the necessary APIs enabled.

Contributing

Refer to the contribution guidelines for information on contributing to this module.

Security Disclosures

Please see our security disclosure process.

terraform-google-cloud-functions's People

Contributors

cloud-foundation-bot avatar dependabot[bot] avatar domengabrovsek avatar prabhu34 avatar release-please[bot] avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.