-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.tf
66 lines (58 loc) · 1.69 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
56
57
58
59
60
61
62
63
64
65
66
module "service_account" {
for_each = tomap({
"db-instance-sa" : [
"roles/storage.objectViewer",
"roles/storage.objectCreator",
"roles/artifactregistry.reader",
],
"cloud-run" : [
"roles/run.invoker",
"roles/storage.objectUser",
"roles/iam.serviceAccountUser",
],
"cloud-build" : [
"roles/cloudbuild.builds.builder",
"roles/artifactregistry.writer",
"roles/run.admin",
"roles/iam.serviceAccountUser",
],
})
source = "./modules/service_account"
project_id = var.project_id
account_id = each.key
roles = each.value
}
module "network" {
source = "./modules/network"
region = var.region
}
module "instance" {
source = "./modules/instance"
network = module.network.network_link
subnet = module.network.subnet_link
service_account = module.service_account["db-instance-sa"].email
static_ip = module.network.static_ip_address
}
module "storage" {
source = "./modules/storage"
location = var.region
}
module "tutortoise_registry" {
source = "./modules/registry"
repository_id = "tutortoise"
description = "Tutortoise's Artifact Registry"
location = var.region
}
module "cloud_build" {
source = "./modules/cloud_build"
service_account_id = module.service_account["cloud-build"].id
}
module "cloud_run" {
source = "./modules/cloud_run"
project_id = var.project_id
location = var.region
service_account = module.service_account["cloud-run"].email
ENV_DATABASE_URL = var.ENV_DATABASE_URL
ENV_JWT_SECRET = var.ENV_JWT_SECRET
ENV_FIREBASE_DATABASE_URL = var.ENV_FIREBASE_DATABASE_URL
}