Skip to content

Commit

Permalink
feat: Add tik rekry tg bot
Browse files Browse the repository at this point in the history
  • Loading branch information
joonatanaatos committed Oct 3, 2024
1 parent 4368001 commit bf84f5a
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 0 deletions.
14 changes: 14 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,20 @@ module "tikjob_app" {
dkim_key = "k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDIvN+P4vQeU88WdDcISgVgZzXnGXeCZHU7h826JhE8p3UvLO4NuHJKuXuKmVcRXFcxOro4MJg2dIaU/Yei8QAVN7ZIxXXbPDLncDKJ4XEjdRajbY1oTPJAuy/KjInozSEeZeVwA2aYtbQ/Ttq4fXGwgKe2rS2uvDBVseqj4Oa6wwIDAQAB"
}

module "tikjob_tg_bot" {
source = "./modules/recruiting/tg-bot"

env_name = "prod"
tikweb_rg_name = module.common.resource_group_name
tikweb_rg_location = local.resource_group_location
tikweb_app_plan_id = module.common.tikweb_app_plan_id
storage_account_name = module.tikjob_storage.storage_account_name
storage_account_access_key = module.tikjob_storage.storage_account_key
bot_token = module.keyvault.secrets["tikjob-tg-bot-token"]
ghost_hook_secret = module.keyvault.secrets["tikjob-tg-ghost-hook-secret"]
channel_id = "-1001347398697"
}

module "forum" {
source = "./modules/forum"
env_name = "prod"
Expand Down
32 changes: 32 additions & 0 deletions modules/recruiting/tg-bot/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
resource "azurerm_linux_function_app" "tg-bot" {
name = "tik-rekry-tg-bot-${var.env_name}"
resource_group_name = var.tikweb_rg_name
location = var.tikweb_rg_location

storage_account_name = var.storage_account_name
storage_account_access_key = var.storage_account_access_key

service_plan_id = var.tikweb_app_plan_id

site_config {
application_stack {
docker {
registry_url = "https://ghcr.io"
image_name = "tietokilta/rekry-tg-hook"
image_tag = "latest"
}
}
}

app_settings = {
BOT_TOKEN = var.bot_token
GHOST_HOOK_SECRET = var.ghost_hook_secret
CHANNEL_ID = var.channel_id
}

lifecycle {
ignore_changes = [
site_config.0.application_stack, # deployments are made outside of Terraform
]
}
}
38 changes: 38 additions & 0 deletions modules/recruiting/tg-bot/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
variable "env_name" {
type = string
}

variable "tikweb_rg_name" {
type = string
}

variable "tikweb_rg_location" {
type = string
}

variable "tikweb_app_plan_id" {
type = string
}

variable "bot_token" {
type = string
sensitive = true
}

variable "ghost_hook_secret" {
type = string
sensitive = true
}

variable "channel_id" {
type = string
}

variable "storage_account_name" {
type = string
}

variable "storage_account_access_key" {
type = string
sensitive = true
}

0 comments on commit bf84f5a

Please sign in to comment.