-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.tf
65 lines (54 loc) · 1.61 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
locals {
secrets = {
"TF_API_TOKEN" : var.TF_API_TOKEN,
"ACTIONS_GITHUB_TOKEN" : var.ACTIONS_GITHUB_TOKEN
"CLOUDFLARE_R2_ACCESS_KEY": var.cloudflare_r2_access_key
"CLOUDFLARE_R2_SECRET_KEY": var.cloudflare_r2_secret_key
"CLOUDFLARE_R2_BUCKET": var.CLOUDFLARE_R2_BUCKET
"CLOUDFLARE_ACCOUNT_ID": var.cloudflare_account_id
}
name = "notes"
}
module "secrets" {
for_each = local.secrets
source = "app.terraform.io/okkema/secret/github"
version = "0.2.1"
repository = var.github_repository
key = each.key
value = each.value
}
module "bucket" {
source = "app.terraform.io/okkema/bucket/cloudflare"
version = "0.1.1"
account_id = var.cloudflare_account_id
access_key = var.cloudflare_r2_access_key
secret_key = var.cloudflare_r2_secret_key
bucket = local.name
}
module "worker" {
source = "app.terraform.io/okkema/worker/cloudflare"
version = "0.4.0"
depends_on = [module.bucket]
account_id = var.cloudflare_account_id
zone_id = var.cloudflare_zone_id
name = local.name
content = file(abspath("${path.module}/../dist/index.js"))
hostnames = ["public.${local.name}", "private.${local.name}"]
buckets = [{
binding = "NOTES"
name = local.name
}]
}
module "team" {
source = "app.terraform.io/okkema/team/github"
version = "0.1.0"
name = local.name
}
module "application" {
source = "app.terraform.io/okkema/application/cloudflare"
version = "0.2.2"
depends_on = [module.team, module.worker]
zone_id = var.cloudflare_zone_id
name = "private.${local.name}"
github_teams = [local.name]
}