-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathmain.tf
76 lines (62 loc) · 1.63 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
variable "organization_id" {
type = string
}
variable "token_key" {
type = string
}
variable "token_secret" {
type = string
}
variable "service_name" {
type = string
default = "My Terraform Service"
}
variable "region" {
type = string
default = "us-east-2"
}
variable "release_channel" {
type = string
default = "default"
validation {
condition = var.release_channel == "default" || var.release_channel == "fast"
error_message = "Release channel can be either 'default' or 'fast'."
}
}
data "clickhouse_api_key_id" "self" {
}
resource "clickhouse_service" "service" {
name = var.service_name
cloud_provider = "aws"
region = var.region
release_channel = var.release_channel
idle_scaling = true
idle_timeout_minutes = 5
password_hash = "n4bQgYhMfWWaL+qgxVrQFaO/TxsrC4Is0V1sFbDwCgg=" # base64 encoded sha256 hash of "test"
ip_access = [
{
source = "0.0.0.0"
description = "Anywhere"
}
]
min_replica_memory_gb = 8
max_replica_memory_gb = 120
backup_configuration = {
backup_period_in_hours = 24
backup_retention_period_in_hours = 24
backup_start_time = null
}
transparent_data_encryption = {
enabled = true
}
}
resource "clickhouse_service_transparent_data_encryption_key_association" "service_key_association" {
service_id = clickhouse_service.service.id
key_id = aws_kms_key.enc.arn
}
output "service_endpoints" {
value = clickhouse_service.service.endpoints
}
output "service_iam" {
value = clickhouse_service.service.iam_role
}