-
Notifications
You must be signed in to change notification settings - Fork 1
/
databases.tf
60 lines (51 loc) · 1.41 KB
/
databases.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
# AWS DynamoDB Database
# This is not a global table, the name is just from an earlier
# Terraform config revision
resource "aws_dynamodb_table" "dynamodb_global_table" {
name = local.dynamodb_table_name
billing_mode = "PAY_PER_REQUEST"
hash_key = "id"
stream_enabled = true
stream_view_type = "NEW_AND_OLD_IMAGES"
attribute {
name = "id"
type = "N"
}
# This will be hardcoded to "github" just to enable using the
# DynamoDB query API with an index over the scan API
attribute {
name = "host"
type = "S"
}
attribute {
name = "forks_count"
type = "N"
}
global_secondary_index {
name = local.dynamodb_table_gsi_index
hash_key = "host"
range_key = "forks_count"
projection_type = "ALL"
}
}
# Output to be reused by the DynamoDB populating script
output "dynamodb_table_gsi_index" {
value = local.dynamodb_table_gsi_index
}
output "dynamodb_table_name" {
value = local.dynamodb_table_name
}
# GCP Firestore Database
resource "google_firestore_database" "firestore" {
name = "(default)"
location_id = local.gcp_region
type = "FIRESTORE_NATIVE"
}
# CloudFlare Workers KV Database
resource "cloudflare_workers_kv_namespace" "namespace" {
account_id = local.cf_account_id
title = local.cf_kv_namespace
}
output "cf_kv_namespace_id" {
value = cloudflare_workers_kv_namespace.namespace.id
}