Manage Telegram resources with Terraform
If we have a bot implemented as a Google Cloud Function, we can set the bot webhook in the same Terraform project:
resource "google_cloudfunctions_function" "my_bot" {
name = "my-bot"
trigger_http = true
# other arguments
}
resource "telegram_bot_webhook" "my_bot" {
url = google_cloudfunctions_function.my_bot.https_trigger_url
}
You can also manage bot commands using Terraform:
resource "telegram_bot_commands" "example" {
commands = [
{
command = "start",
description = "View welcome message"
},
{
command = "help",
description = "Show help"
}
]
}
You can find this provider on the Terraform Registry:
https://registry.terraform.io/providers/yi-jiayu/telegram/latest
telegram_bot
- Get information about the currently-authenticated Telegram bot
telegram_bot_webhook
- Manage the webhook for the currently-authenticated Telegram bottelegram_bot_commands
- Manage commands for the currently-authenticated Telegram bot