This repository has been archived by the owner on Mar 29, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.tf
103 lines (92 loc) · 3.77 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#terraform {
# Use local state storage by default. For production environments please
# consider using a more robust backend.
#backend "local" {
# path = "terraform.tfstate"
#}
# Use Google Cloud Storage for robust, collaborative state storage.
# Note: The bucket name need to be globally unique.
#backend "gcs" {
# bucket = "GLOBALLY UNIQ BUCKET NAME"
#}
#}
module "velociraptor" {
source = "./modules/velociraptor"
project_name = var.project_name
gcp_project = var.gcp_project
gcp_region = var.gcp_region
gcp_zone = var.gcp_zone
gcp_machine_type = var.gcp_velociraptor_machine_type
gcp_network = google_compute_network.network.id
gcp_lb_ip_address = google_compute_global_address.velociraptor.id
domain_name = "velociraptor.${var.domain_name}"
velociraptor_version = var.velociraptor_version
file_store_size = var.velociraptor_file_store_size
}
module "processing" {
source = "./modules/processing"
project_name = var.project_name
gcp_project = var.gcp_project
gcp_region = var.gcp_region
gcp_zone = var.gcp_zone
gcp_network = google_compute_network.network.id
gcp_machine_type = var.gcp_plaso_machine_type
timesketch_version = var.timesketch_version
timesketch_password = random_string.timesketch_admin_password.result
bucket_name = "${var.project_name}-velociraptor" # hardcoded module.velociraptor.google_storage_bucket.default.name
timesketch_web_internal = var.timesketch_web_internal
}
module "timesketch" {
source = "./modules/timesketch"
project_name = var.project_name
gcp_project = var.gcp_project
gcp_region = var.gcp_region
gcp_zone = var.gcp_zone
gcp_network = google_compute_network.network.id
gcp_lb_ip_address = google_compute_global_address.timesketch.id
domain_name = "timesketch.${var.domain_name}"
elastic_cloud_api_key = var.elastic_cloud_api_key
gcp_machine_type_web = var.gcp_timesketch_machine_type_web
gcp_machine_type_worker = var.gcp_timesketch_machine_type_worker
timesketch_version = var.timesketch_version
timesketch_password = random_string.timesketch_admin_password.result
timesketch_web_internal = var.timesketch_web_internal
web_target_size = var.timesketch_web_target_size
worker_target_size = var.timesketch_worker_target_size
file_store_size = var.timesketch_file_store_size
}
resource "random_string" "timesketch_admin_password" {
length = 16
special = false
}
resource "google_compute_network" "network" {
name = var.project_name
description = "The network for Velociraptor and Timesketch"
routing_mode = "REGIONAL"
#delete_default_routes_on_create = true
}
resource "google_compute_global_address" "velociraptor" {
name = "${var.project_name}-velociraptor"
description = "The IP address used by the load balancers of Velociraptor"
address_type = "EXTERNAL"
}
resource "google_compute_global_address" "timesketch" {
name = "${var.project_name}-timesketch"
description = "The IP address used by the load balancers of Timesketch"
address_type = "EXTERNAL"
}
resource "google_compute_router" "router" {
name = var.project_name
network = google_compute_network.network.id
}
resource "google_compute_router_nat" "nat" {
name = var.project_name
router = google_compute_router.router.name
region = var.gcp_region
nat_ip_allocate_option = "AUTO_ONLY"
source_subnetwork_ip_ranges_to_nat = "ALL_SUBNETWORKS_ALL_IP_RANGES"
log_config {
enable = true
filter = "ERRORS_ONLY"
}
}