forked from kzzzr/airbyte_lab
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.tf
226 lines (196 loc) · 6.15 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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
terraform {
required_providers {
yandex = {
source = "yandex-cloud/yandex"
}
}
required_version = ">= 0.13"
}
provider "yandex" {
}
resource "yandex_vpc_network" "default_network" {}
resource "yandex_vpc_subnet" "default_subnet" {
zone = "ru-central1-b"
network_id = yandex_vpc_network.default_network.id
v4_cidr_blocks = ["10.5.0.0/24"]
}
// Create SA
resource "yandex_iam_service_account" "sa" {
folder_id = var.folder_id
name = "airbyte-storage"
}
// Grant permissions
resource "yandex_resourcemanager_folder_iam_member" "sa-editor" {
folder_id = var.folder_id
role = "storage.editor"
member = "serviceAccount:${yandex_iam_service_account.sa.id}"
}
// Create Static Access Keys
resource "yandex_iam_service_account_static_access_key" "sa-static-key" {
service_account_id = yandex_iam_service_account.sa.id
description = "static access key for object storage"
}
// Use keys to create bucket
resource "yandex_storage_bucket" "analytics_engineering_airbyte" {
access_key = yandex_iam_service_account_static_access_key.sa-static-key.access_key
secret_key = yandex_iam_service_account_static_access_key.sa-static-key.secret_key
bucket_prefix = "analytics-engineering-airbyte"
acl = "public-read"
max_size = 32212254720
force_destroy = true
}
resource "yandex_compute_instance" "airbyte" {
name = "airbyte"
platform_id = "standard-v3"
zone = yandex_vpc_subnet.default_subnet.zone
resources {
cores = 4
memory = 8
core_fraction = 100
}
boot_disk {
auto_delete = true
initialize_params {
image_id = "fd8linvus5t2ielkr8no" # with Airbyte installed
# image_id = "fd80o2eikcn22b229tsa" # Container-optimized image
size = 30
type = "network-ssd"
}
}
network_interface {
subnet_id = yandex_vpc_subnet.default_subnet.id
ipv4 = true
nat = true
}
scheduling_policy {
preemptible = true
}
metadata = {
user-data = "${file("cloud-init.yaml")}"
}
}
resource "yandex_mdb_clickhouse_cluster" "clickhouse_starschema" {
name = "clickhouse_starschema"
environment = "PRESTABLE"
network_id = yandex_vpc_network.default_network.id
sql_database_management = true
sql_user_management = true
admin_password = var.clickhouse_password
version = "23.3"
clickhouse {
resources {
resource_preset_id = "s3-c2-m8"
disk_type_id = "network-ssd"
disk_size = 64
}
config {
log_level = "TRACE"
max_connections = 100
max_concurrent_queries = 100
keep_alive_timeout = 3000
uncompressed_cache_size = 8589934592
mark_cache_size = 5368709120
max_table_size_to_drop = 53687091200
max_partition_size_to_drop = 53687091200
timezone = "UTC"
geobase_uri = ""
query_log_retention_size = 1073741824
query_log_retention_time = 2592000
query_thread_log_enabled = true
query_thread_log_retention_size = 536870912
query_thread_log_retention_time = 2592000
part_log_retention_size = 536870912
part_log_retention_time = 2592000
metric_log_enabled = true
metric_log_retention_size = 536870912
metric_log_retention_time = 2592000
trace_log_enabled = true
trace_log_retention_size = 536870912
trace_log_retention_time = 2592000
text_log_enabled = true
text_log_retention_size = 536870912
text_log_retention_time = 2592000
text_log_level = "TRACE"
background_pool_size = 16
background_schedule_pool_size = 16
merge_tree {
replicated_deduplication_window = 100
replicated_deduplication_window_seconds = 604800
parts_to_delay_insert = 150
parts_to_throw_insert = 300
max_replicated_merges_in_queue = 16
number_of_free_entries_in_pool_to_lower_max_size_of_merge = 8
max_bytes_to_merge_at_min_space_in_pool = 1048576
}
kafka {
security_protocol = "SECURITY_PROTOCOL_PLAINTEXT"
sasl_mechanism = "SASL_MECHANISM_GSSAPI"
sasl_username = "user1"
sasl_password = "pass1"
}
kafka_topic {
name = "topic1"
settings {
security_protocol = "SECURITY_PROTOCOL_SSL"
sasl_mechanism = "SASL_MECHANISM_SCRAM_SHA_256"
sasl_username = "user2"
sasl_password = "pass2"
}
}
kafka_topic {
name = "topic2"
settings {
security_protocol = "SECURITY_PROTOCOL_SASL_PLAINTEXT"
sasl_mechanism = "SASL_MECHANISM_PLAIN"
}
}
rabbitmq {
username = "rabbit_user"
password = "rabbit_pass"
}
compression {
method = "LZ4"
min_part_size = 1024
min_part_size_ratio = 0.5
}
compression {
method = "ZSTD"
min_part_size = 2048
min_part_size_ratio = 0.7
}
graphite_rollup {
name = "rollup1"
pattern {
regexp = "abc"
function = "func1"
retention {
age = 1000
precision = 3
}
}
}
graphite_rollup {
name = "rollup2"
pattern {
function = "func2"
retention {
age = 2000
precision = 5
}
}
}
}
}
host {
type = "CLICKHOUSE"
zone = "ru-central1-b"
subnet_id = yandex_vpc_subnet.default_subnet.id
assign_public_ip = true
}
cloud_storage {
enabled = false
}
maintenance_window {
type = "ANYTIME"
}
}