-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.tf
55 lines (48 loc) · 1.24 KB
/
main.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "5.55.0"
}
upstash = {
source = "upstash/upstash"
version = "1.5.3"
}
}
}
provider "upstash" {
email = var.upstash_user
api_key = var.upstash_api_key
}
resource "upstash_redis_database" "telegram" {
database_name = var.upstash_db_name
region = "us-east-1"
tls = true
eviction = true
auto_scale = false
}
provider "aws" {
region = "us-east-1"
access_key = var.aws_access_key
secret_key = var.aws_secret_key
}
resource "aws_ssm_parameter" "telegram_bot_token" {
name = "/telegram/bot/token"
type = "SecureString"
value = var.telegram_bot_token
}
resource "aws_ssm_parameter" "telegram_webhook_secret" {
name = "/telegram/webhook/secret"
type = "SecureString"
value = var.telegram_webhook_secret
}
resource "aws_ssm_parameter" "redis_endpoint" {
name = "/redis/endpoint"
type = "SecureString"
value = "rediss://default:${upstash_redis_database.telegram.password}@${upstash_redis_database.telegram.endpoint}:${upstash_redis_database.telegram.port}"
}
resource "aws_ssm_parameter" "backend_url" {
name = "/backend/url"
type = "SecureString"
value = var.backend_url
}