Skip to content

Terraform module to create a Google Cloud Function

License

Notifications You must be signed in to change notification settings

blackbird-cloud/terraform-google-function2

Repository files navigation

blackbird-logo

Requirements

Name Version
terraform >= 0.1
archive >= 2.3
google >= 4.11, < 5.0
null >= 3.2

Providers

Name Version
archive >= 2.3
google >= 4.11, < 5.0
null >= 3.2

Modules

No modules.

Resources

Name Type
google_cloudfunctions2_function.main resource
google_storage_bucket.main resource
google_storage_bucket_object.main resource
null_resource.dependent_files resource
archive_file.main data source
google_project.default data source
google_project.nums data source
null_data_source.wait_for_files data source

Inputs

Name Description Type Default Required
all_traffic_on_latest_revision (Optional) Whether 100% of traffic is routed to the latest revision. Defaults to true. bool true no
available_cpu (Optional) The number of CPUs used in a single container instance. Default value is calculated from available memory. string "" no
available_memory (Optional) The amount of memory available for a function. Defaults to 256M. Supported units are k, M, G, Mi, Gi. If no unit is supplied the value is interpreted as bytes. string "256Mi" no
bucket_force_destroy When deleting the GCS bucket containing the cloud function, delete all objects in the bucket first. bool false no
bucket_labels A set of key/value label pairs to assign to the function source archive bucket. map(string) {} no
bucket_name The name to apply to the bucket. Will default to a string of the function name. string "" no
build_environment_variables A set of key/value environment variable pairs available during build time. map(string) {} no
create_bucket Whether to create a new bucket or use an existing one. If false, bucket_name should reference the name of the alternate bucket to use. bool true no
description The description of the function. string "Processes events." no
entry_point The name of a method in the function source which will be invoked when the function is executed. string n/a yes
environment_variables A set of key/value environment variable pairs to assign to the function. map(string) {} no
files_to_exclude_in_source_dir Specify files to ignore when reading the source_dir list(string) [] no
ingress_settings The ingress settings for the function. Allowed values are ALLOW_ALL, ALLOW_INTERNAL_AND_GCLB and ALLOW_INTERNAL_ONLY. Changes to this field will recreate the cloud function. string "ALLOW_ALL" no
labels A set of key/value label pairs to assign to the Cloud Function. map(string) {} no
location (Optional) The location of this cloud function. string "" no
log_bucket Log bucket string null no
log_object_prefix Log object prefix string null no
max_instance_count (Optional) The limit on the maximum number of function instances that may coexist at a given time. number 100 no
max_instance_request_concurrency (Optional) Sets the maximum number of concurrent requests that each instance can receive. Defaults to 1. number 1 no
min_instance_count (Optional) The limit on the minimum number of function instances that may coexist at a given time. number null no
name The name to apply to any nameable resources. string n/a yes
project_id The ID of the project to which resources will be applied. string n/a yes
region The region in which resources will be applied. string n/a yes
runtime The runtime in which the function will be executed. string n/a yes
secret_environment_variables A list of maps which contains key, project_id, secret_name (not the full secret id) and version to assign to the function as a set of secret environment variables. list(map(string)) [] no
service_account_email The service account to run the function as. string "" no
source_dependent_files A list of any Terraform created local_files that the module will wait for before creating the archive.
list(object({
filename = string
id = string
}))
[] no
source_directory The pathname of the directory which contains the function source code. string n/a yes
timeout_s The amount of time in seconds allotted for the execution of the function. number 60 no
vpc_connector The VPC Network Connector that this cloud function can connect to. It should be set up as fully-qualified URI. The format of this field is projects//locations//connectors/*. string null no
vpc_connector_egress_settings The egress settings for the connector, controlling what traffic is diverted through it. Allowed values are ALL_TRAFFIC and PRIVATE_RANGES_ONLY. If unset, this field preserves the previously set value. string "PRIVATE_RANGES_ONLY" no

Outputs

Name Description
function The google cloud function2.
name The name of the function.

About

We are Blackbird Cloud, Amsterdam based cloud consultancy, and cloud management service provider. We help companies build secure, cost efficient, and scale-able solutions.

Checkout our other 👉 terraform modules

Copyright

Copyright © 2017-2023 Blackbird Cloud