-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaiven.tf
61 lines (47 loc) · 1.54 KB
/
aiven.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
locals {
cloud_name = "google-europe-north1"
}
data "aiven_project" "this" {
project = "jorge-9430"
}
resource "aiven_kafka" "broker" {
project = data.aiven_project.this.project
cloud_name = local.cloud_name
plan = "startup-2"
service_name = "urlmonitorbroker${var.integration ? "integration" : ""}"
termination_protection = false # we're not selling this just yet
}
resource "aiven_kafka_topic" "this" {
project = data.aiven_project.this.project
service_name = aiven_kafka.broker.service_name
topic_name = "url_monitor"
partitions = 3
replication = 2
termination_protection = false
}
resource "aiven_service_user" "kafka" {
for_each = toset(["read", "write"])
project = data.aiven_project.this.project
service_name = aiven_kafka.broker.service_name
username = "kafka_${each.value}"
}
resource "aiven_kafka_acl" "this" {
for_each = aiven_service_user.kafka
project = data.aiven_project.this.project
service_name = aiven_kafka.broker.service_name
topic = aiven_kafka_topic.this.topic_name
permission = each.key
username = each.value.username
}
resource "aiven_pg" "db_server" {
project = data.aiven_project.this.project
cloud_name = local.cloud_name
plan = "hobbyist"
service_name = "urlmonitordatabase${var.integration ? "integration" : ""}"
termination_protection = false
}
resource "aiven_database" "this" {
project = data.aiven_project.this.project
service_name = aiven_pg.db_server.service_name
database_name = "url_monitor"
}