FAQ | This is a LIVE service | Changelog

Skip to content
Snippets Groups Projects
faas.tf 1.81 KiB
Newer Older
resource "google_pubsub_topic" "faas_test" {
  name    = "faas-test"
  project = local.project
}

module "faas_service" {

  source                   = "./modules/faas"
  name                     = "faas-test-pubsub"
  project                  = local.project
  function_container_image = "${local.container_images.function_base}:${local.container_images.function_tag}"
  function                 = "example_cloud_event"

  timeout_seconds = 10

  triggers = {
    pubsub_topic_id = google_pubsub_topic.faas_test.id
  }

  function_env = [
    {
      name  = "TEST_VAR"
      value = "WORKING"
    }
  ]

  concurrency = {
    max_concurrent_functions = 1
  }

}

module "faas_service_set_retry" {

  source                   = "./modules/faas"
  name                     = "faas-test-set-retry"
  project                  = local.project
  function_container_image = "${local.container_images.function_base}:${local.container_images.function_tag}"
  function                 = "example_cloud_event"

  timeout_seconds = 20

  triggers = {
    pubsub_topic_id = google_pubsub_topic.faas_test.id
  }

  retry_count = 4

  function_env = [
    {
      name  = "TEST_VAR"
      value = "WORKING"
    }
  ]

  concurrency = {
    max_concurrent_functions = 1
  }

}

module "faas_service_cron" {

  source                   = "./modules/faas"
  name                     = "faas-test-cron"
  project                  = local.project
  function_container_image = "${local.container_images.function_base}:${local.container_images.function_tag}"
  function                 = "example_cloud_event"

  timeout_seconds = 20

  triggers = {
    cron_schedules = ["00 0 */7 * *", "0 12 */7 * *", ]
  }

  retry_count = 4

  function_env = [
    {
      name  = "TEST_VAR"
      value = "WORKING"
    }
  ]

  concurrency = {
    max_concurrent_functions = 1
  }

}