forked from futurice/terraform-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.tf
77 lines (64 loc) · 1.84 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
67
68
69
70
71
72
73
74
75
76
terraform {
backend "gcs" {
prefix = "terraform/state"
bucket = "terraform-larkworthy-tester" // Must be pre-provisioned
}
}
provider "google" {
project = "larkworthy-tester"
region = "europe-west1"
}
provider "google-beta" {
project = "larkworthy-tester"
region = "europe-west1"
}
provider "archive" {
version = "~> 1.2.0"
}
locals {
project = "larkworthy-tester"
config = {
project = local.project
region = "europe-west1"
version = module.version.result
retention_days = 30
network = "default"
ip_cidr_range = "10.9.0.0/28"
memorystore_tier = "BASIC"
code_bucket = google_storage_bucket.code
}
}
// We generate a version of the backend by hashing the contents of this directory
module "version" {
source = "github.com/claranet/terraform-path-hash?ref=v0.1.0"
path = "."
}
resource "google_storage_bucket" "code" {
name = "${local.project}_code"
location = "EU"
}
resource "google_storage_bucket_object" "config_file" {
name = "config.json"
content = jsonencode(local.config)
bucket = google_storage_bucket.code.name
}
module "bigquery" {
source = "./bigquery"
config = local.config
}
module "memorystore" {
source = "./memorystore"
config = "${local.config}"
}
module "functions" {
source = "./functions"
memorystore_host = module.memorystore.memorystore_host
prober_ingress_table = module.bigquery.prober_ingress_table
control_dataset = module.bigquery.control_dataset
unified_values_table = module.bigquery.unified_values_table
current_totals_latest_table = module.bigquery.current_totals_latest_table
historical_totals_latest_table = module.bigquery.historical_totals_latest_table
current_totals_table = module.bigquery.current_totals_table
historical_totals_table = module.bigquery.historical_totals_table
config = local.config
}