-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfluent-resoures.tf
54 lines (44 loc) · 1.45 KB
/
confluent-resoures.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
# Reference the Confluent Cloud
data "confluent_organization" "env" {}
# Create the Confluent Cloud Environment
resource "confluent_environment" "env" {
display_name = "${var.environment_name}"
stream_governance {
package = "ESSENTIALS"
}
}
# Create the Service Account for the Kafka Cluster API
resource "confluent_service_account" "schema_registry_cluster_api" {
display_name = "${var.environment_name}-environment-api"
description = "Environment API Service Account"
}
# Config the environment's schema registry
data "confluent_schema_registry_cluster" "env" {
environment {
id = confluent_environment.env.id
}
depends_on = [
confluent_kafka_cluster.kafka_cluster
]
}
# Create the Kafka cluster
resource "confluent_kafka_cluster" "kafka_cluster" {
display_name = "kafka_cluster"
availability = "SINGLE_ZONE"
cloud = local.cloud
region = var.aws_region
basic {}
environment {
id = confluent_environment.env.id
}
}
# Create the Service Account for the Kafka Cluster API
resource "confluent_service_account" "kafka_cluster_api" {
display_name = "${var.environment_name}-kafka_cluster-api"
description = "Kafka Cluster API Service Account"
}
resource "confluent_role_binding" "kafka_cluster_api_environment_admin" {
principal = "User:${confluent_service_account.kafka_cluster_api.id}"
role_name = "EnvironmentAdmin"
crn_pattern = confluent_environment.env.resource_name
}