From 6c582c6ff592f4a1a5a607e5ce07c23a57f83737 Mon Sep 17 00:00:00 2001
From: Dima Rosmait <dima.rosmait@holi.team>
Date: Thu, 26 Oct 2023 16:24:46 +0200
Subject: [PATCH] NOISSUE: disable holi-chat-integration-production in
 Terraform

---
 terraform/common/function.tf | 128 +++++++++++++++++------------------
 terraform/common/pubsub.tf   |  36 +++++-----
 2 files changed, 82 insertions(+), 82 deletions(-)

diff --git a/terraform/common/function.tf b/terraform/common/function.tf
index 6b08b46..7a254b5 100644
--- a/terraform/common/function.tf
+++ b/terraform/common/function.tf
@@ -60,15 +60,15 @@ data "google_secret_manager_secret" "chat_admin_access_token_development" {
   project   = data.terraform_remote_state.holi_infra_state.outputs.shared_project_id
 }
 
-data "google_secret_manager_secret" "chat_admin_username_production" {
-  secret_id = "CHAT_ADMIN_USERNAME_PRODUCTION"
-  project   = data.terraform_remote_state.holi_infra_state.outputs.shared_project_id
-}
+# data "google_secret_manager_secret" "chat_admin_username_production" {
+#   secret_id = "CHAT_ADMIN_USERNAME_PRODUCTION"
+#   project   = data.terraform_remote_state.holi_infra_state.outputs.shared_project_id
+# }
 
-data "google_secret_manager_secret" "chat_admin_access_token_production" {
-  secret_id = "CHAT_ADMIN_ACCESS_TOKEN_PRODUCTION"
-  project   = data.terraform_remote_state.holi_infra_state.outputs.shared_project_id
-}
+# data "google_secret_manager_secret" "chat_admin_access_token_production" {
+#   secret_id = "CHAT_ADMIN_ACCESS_TOKEN_PRODUCTION"
+#   project   = data.terraform_remote_state.holi_infra_state.outputs.shared_project_id
+# }
 
 resource "google_cloudfunctions2_function" "holi-chat-integration-staging" {
   project     = data.terraform_remote_state.holi_infra_state.outputs.shared_project_id
@@ -127,59 +127,59 @@ resource "google_cloudfunctions2_function" "holi-chat-integration-staging" {
   }
 }
 
-resource "google_cloudfunctions2_function" "holi-chat-integration-production" {
-  project     = data.terraform_remote_state.holi_infra_state.outputs.shared_project_id
-  name        = "holi-chat-integration-production"
-  location    = "europe-north1"
-  description = "holi-chat-integration-production function"
-
-  build_config {
-    runtime     = "nodejs18"
-    entry_point = "receiveEvent"
-
-    source {
-      storage_source {
-        bucket = google_storage_bucket.bucket.name
-        object = google_storage_bucket_object.function_source.name
-      }
-    }
-  }
-
-  service_config {
-    max_instance_count = 3
-    min_instance_count = 0
-    available_memory   = "128Mi"
-    timeout_seconds    = 60
-    environment_variables = {
-      ENVIRONMENT                  = "production"
-      CHAT_OIDC_ISSUER             = "https://auth.holi.social"
-      CHAT_SERVER_URL              = "https://chat.holi.social"
-    }
-    vpc_connector                  = data.terraform_remote_state.holi_infra_state.outputs.vpc_access_connector_name
-    vpc_connector_egress_settings  = "PRIVATE_RANGES_ONLY"
-    ingress_settings               = "ALLOW_INTERNAL_ONLY"
-    all_traffic_on_latest_revision = true
-    service_account_email          = google_service_account.account.email
-
-    secret_environment_variables {
-      key        = "CHAT_ADMIN_USERNAME"
-      project_id = data.terraform_remote_state.holi_infra_state.outputs.shared_project_id
-      secret     = data.google_secret_manager_secret.chat_admin_username_production.secret_id
-      version    = "latest"
-    }
-
-    secret_environment_variables {
-      key        = "CHAT_ADMIN_ACCESS_TOKEN"
-      project_id = data.terraform_remote_state.holi_infra_state.outputs.shared_project_id
-      secret     = data.google_secret_manager_secret.chat_admin_access_token_production.secret_id
-      version    = "latest"
-    }
-  }
-
-  # taken from https://github.com/hashicorp/terraform-provider-google/issues/1938#issuecomment-1229042663
-  lifecycle {
-    replace_triggered_by = [
-      google_storage_bucket_object.function_source
-    ]
-  }
-}
+# resource "google_cloudfunctions2_function" "holi-chat-integration-production" {
+#   project     = data.terraform_remote_state.holi_infra_state.outputs.shared_project_id
+#   name        = "holi-chat-integration-production"
+#   location    = "europe-north1"
+#   description = "holi-chat-integration-production function"
+
+#   build_config {
+#     runtime     = "nodejs18"
+#     entry_point = "receiveEvent"
+
+#     source {
+#       storage_source {
+#         bucket = google_storage_bucket.bucket.name
+#         object = google_storage_bucket_object.function_source.name
+#       }
+#     }
+#   }
+
+#   service_config {
+#     max_instance_count = 3
+#     min_instance_count = 0
+#     available_memory   = "128Mi"
+#     timeout_seconds    = 60
+#     environment_variables = {
+#       ENVIRONMENT                  = "production"
+#       CHAT_OIDC_ISSUER             = "https://auth.holi.social"
+#       CHAT_SERVER_URL              = "https://chat.holi.social"
+#     }
+#     vpc_connector                  = data.terraform_remote_state.holi_infra_state.outputs.vpc_access_connector_name
+#     vpc_connector_egress_settings  = "PRIVATE_RANGES_ONLY"
+#     ingress_settings               = "ALLOW_INTERNAL_ONLY"
+#     all_traffic_on_latest_revision = true
+#     service_account_email          = google_service_account.account.email
+
+#     secret_environment_variables {
+#       key        = "CHAT_ADMIN_USERNAME"
+#       project_id = data.terraform_remote_state.holi_infra_state.outputs.shared_project_id
+#       secret     = data.google_secret_manager_secret.chat_admin_username_production.secret_id
+#       version    = "latest"
+#     }
+
+#     secret_environment_variables {
+#       key        = "CHAT_ADMIN_ACCESS_TOKEN"
+#       project_id = data.terraform_remote_state.holi_infra_state.outputs.shared_project_id
+#       secret     = data.google_secret_manager_secret.chat_admin_access_token_production.secret_id
+#       version    = "latest"
+#     }
+#   }
+
+#   # taken from https://github.com/hashicorp/terraform-provider-google/issues/1938#issuecomment-1229042663
+#   lifecycle {
+#     replace_triggered_by = [
+#       google_storage_bucket_object.function_source
+#     ]
+#   }
+# }
diff --git a/terraform/common/pubsub.tf b/terraform/common/pubsub.tf
index 6d40cd2..2fa3c08 100644
--- a/terraform/common/pubsub.tf
+++ b/terraform/common/pubsub.tf
@@ -39,21 +39,21 @@ resource "google_pubsub_subscription" "holi-chat-integration-okuna-staging-sub"
   }
 }
 
-resource "google_pubsub_subscription" "holi-chat-integration-okuna-production-sub" {
-  project = data.terraform_remote_state.holi_infra_state.outputs.shared_project_id
-  name    = "holi-chat-integration-okuna-production-sub"
-  topic   = data.terraform_remote_state.okuna-common_state.outputs.google_pubsub_topic_okuna_production
-
-  ack_deadline_seconds = 10 * 60 # 10 minutes, max. value
-  expiration_policy {
-    ttl = "" # never expire
-  }
-
-  push_config {
-    push_endpoint = google_cloudfunctions2_function.holi-chat-integration-production.service_config[0].uri
-
-    oidc_token {
-      service_account_email = google_service_account.account.email
-    }
-  }
-}
+# resource "google_pubsub_subscription" "holi-chat-integration-okuna-production-sub" {
+#   project = data.terraform_remote_state.holi_infra_state.outputs.shared_project_id
+#   name    = "holi-chat-integration-okuna-production-sub"
+#   topic   = data.terraform_remote_state.okuna-common_state.outputs.google_pubsub_topic_okuna_production
+
+#   ack_deadline_seconds = 10 * 60 # 10 minutes, max. value
+#   expiration_policy {
+#     ttl = "" # never expire
+#   }
+
+#   push_config {
+#     push_endpoint = google_cloudfunctions2_function.holi-chat-integration-production.service_config[0].uri
+
+#     oidc_token {
+#       service_account_email = google_service_account.account.email
+#     }
+#   }
+# }
-- 
GitLab