34 lines
1.1 KiB
HCL

# Cloud Functionのリソース
# 第2世代Cloud Function (Cloud Functions 2nd Gen) を使用
# https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/cloudfunctions2_function
# 第1世代Cloud Function (Cloud Functions 1st Gen) を使用する場合はこちらを参照
# https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/cloudfunctions_function
resource "google_cloudfunctions2_function" "function" {
name = "cf-${var.env_name}-${var.component_name}"
location = var.region
description = "${var.component_name}のCloud Function"
build_config {
runtime = var.runtime
entry_point = var.entry_point
source {
storage_source {
bucket = google_storage_bucket.bucket.name
object = google_storage_bucket_object.source.name
}
}
}
service_config {
max_instance_count = var.max_instance_count
min_instance_count = var.min_instance_count
timeout_seconds = var.timeout_seconds
available_memory = var.available_memory
service_account_email = google_service_account.account.email
}
}