-
Notifications
You must be signed in to change notification settings - Fork 3
/
budget_modules.tf
92 lines (70 loc) · 2.29 KB
/
budget_modules.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# Cloud Storage / Bucket for Budget Alert Service
module "storage_budget_alert_service" {
source = "./modules/storage"
storage_name = "budget-alert-service"
storage_region = var.region
storage_project_id = var.project_id
source_directory = "./services/budget_service/"
archive_file_excludes = [
".mvn",
"run.bat",
".vscode",
"target",
"wrapper",
"Makefile",
"mvnw",
"mvnw.cmd",
".gitignore",
"install_manual.sh",
"budget-service.zip"
]
}
# Pub/Sub for Budget Alert Service
module "pubsub_budget_alert_service" {
source = "./modules/pubsub"
# Topic
topic_name = "budget-alerting-topic"
subscription_name = "budget-alerting-subscription"
ack_deadline = 10 # 10 Seconds
message_retention = 604800 # 7 Days
expiration_policy_ttl = 31 # 31 Days
retry_policy = {
minimum_backoff = 10 # 10 Seconds
maximum_backoff = 600 # 600 Seconds
}
}
# Billing Budget Alert
# module "billing_budget_alert_service" {
# source = "./modules/billing"
# project_id = var.project_id
# billing_name = "docpet-billing-name"
# billing_account = "000000-111111-222222"
# pubsub_topic_id = module.pubsub_budget_alert_service.pubsub_topic_id
# }
# Cloud Functions for Budget ALert Service
module "functions_budget_alert_service" {
source = "./modules/functions"
functions_name = "budget-alert-functions"
functions_project_id = var.project_id
functions_region = var.region
functions_runtime = "java11"
functions_description = "budget alerting"
storage_name = module.storage_budget_alert_service.bucket_name_output
storage_zip_name = module.storage_budget_alert_service.bucket_zip_name_output
functions_entrypoint = "com.BudgetService.BudgetServiceApplication"
functions_event_type = "google.pubsub.topic.publish"
functions_event_resource = module.pubsub_budget_alert_service.pubsub_topic_name
functions_retry_policy = true
functions_timeout = 60 # 60 Seconds
functions_min_instance = 0
functions_max_instance = 3
functions_memory = 1024 # 1024 MB
functions_envars = {
DISCORD_BOT_NAME = var.discord_bot_name
DISCORD_BOT_AVATAR = var.discord_bot_avatar
# SECRET VALUES
DISCORD_WEBHOOK_ID = var.discord_id
DISCORD_WEBHOOK_TOKEN = var.discord_token
DISCORD_TEAM_TAG = var.discord_team_tag
}
}