From 1bb114714f43a38378c62b39d422327bd9d8598a Mon Sep 17 00:00:00 2001 From: Ole Langbehn <ole.langbehn@inoio.de> Date: Sat, 24 Aug 2024 01:28:48 +0200 Subject: [PATCH] NOISSUE add labels to functions and run services for monitoring&logging --- terraform/environments/function.tf | 5 +++++ terraform/environments/vars.tf | 1 + 2 files changed, 6 insertions(+) diff --git a/terraform/environments/function.tf b/terraform/environments/function.tf index bcd0c84..863fb67 100644 --- a/terraform/environments/function.tf +++ b/terraform/environments/function.tf @@ -74,6 +74,11 @@ resource "google_cloudfunctions2_function" "holi-chat-integration" { } } + labels = { + "environment_type" = local.environment_type + "holi_service" = "chat-integration" + } + # taken from https://github.com/hashicorp/terraform-provider-google/issues/1938#issuecomment-1229042663 lifecycle { replace_triggered_by = [ diff --git a/terraform/environments/vars.tf b/terraform/environments/vars.tf index de1465d..0df1873 100644 --- a/terraform/environments/vars.tf +++ b/terraform/environments/vars.tf @@ -2,6 +2,7 @@ locals { # predefined environment names are staging, production, and <branchname> environment = terraform.workspace environment_name = trim(substr(local.environment, 0, 22), ".-") # limits the length of the name that it fits constraints google imposes for some resources, e.g. project ids + environment_type = contains(["staging", "production"], local.environment) ? local.environment : "review" default_region = data.terraform_remote_state.holi_infra_state.outputs.default_region } -- GitLab