File tree Expand file tree Collapse file tree 16 files changed +594
-3
lines changed Expand file tree Collapse file tree 16 files changed +594
-3
lines changed Original file line number Diff line number Diff line change
1
+ ## ClickPipe Kinesis with IAM role authentication
2
+
3
+ This example demonstrates how to deploy a Kinesis ClickPipe using IAM role authentication. This method allows ClickHouse to securely access your Kinesis streams without needing to store access keys.
4
+
5
+ ## How to run
6
+
7
+ - Rename ` variables.tfvars.sample ` to ` variables.tfvars ` and fill in all needed data.
8
+ - Run ` terraform init `
9
+ - Run ` terraform <plan|apply> -var-file=variables.tfvars `
Original file line number Diff line number Diff line change
1
+ resource "clickhouse_clickpipe" "kinesis_iam_role" {
2
+ service_id = var. service_id
3
+ name = var. pipe_name
4
+ description = var. pipe_description
5
+
6
+ source = {
7
+ kinesis = {
8
+ format = " JSONEachRow"
9
+ stream_name = var.kinesis_stream_name
10
+ region = var.aws_region
11
+ iterator_type = " LATEST"
12
+
13
+ # Set to true to use enhanced fan-out consumer (optional)
14
+ use_enhanced_fan_out = true
15
+
16
+ # Using IAM role authentication
17
+ authentication = " IAM_ROLE"
18
+ iam_role = var.iam_role_arn
19
+ }
20
+ }
21
+
22
+ destination = {
23
+ table = " my_table"
24
+ managed_table = true
25
+
26
+ table_definition = {
27
+ engine = {
28
+ type = " MergeTree"
29
+ }
30
+ }
31
+
32
+ columns = [
33
+ {
34
+ name = " my_field1"
35
+ type = " String"
36
+ }, {
37
+ name = " my_field2"
38
+ type = " UInt64"
39
+ }
40
+ ]
41
+ }
42
+
43
+ field_mappings = [
44
+ {
45
+ source_field = " my_field"
46
+ destination_field = " my_field1"
47
+ }
48
+ ]
49
+ }
50
+
51
+ output "clickpipe_id" {
52
+ value = clickhouse_clickpipe. kinesis_iam_user . id
53
+ }
Original file line number Diff line number Diff line change
1
+ # This file is generated automatically please do not edit
2
+ terraform {
3
+ required_providers {
4
+ clickhouse = {
5
+ version = " 3.0.0-alpha2"
6
+ source = " ClickHouse/clickhouse"
7
+ }
8
+ }
9
+ }
10
+
11
+ provider "clickhouse" {
12
+ organization_id = var. organization_id
13
+ token_key = var. token_key
14
+ token_secret = var. token_secret
15
+ }
Original file line number Diff line number Diff line change
1
+ terraform {
2
+ required_providers {
3
+ clickhouse = {
4
+ version = "${CLICKHOUSE_TERRAFORM_PROVIDER_VERSION}"
5
+ source = "ClickHouse/clickhouse"
6
+ }
7
+ }
8
+ }
9
+
10
+ provider "clickhouse" {
11
+ organization_id = var.organization_id
12
+ token_key = var.token_key
13
+ token_secret = var.token_secret
14
+ }
Original file line number Diff line number Diff line change
1
+ variable "token_key" {
2
+ description = " ClickHouse Cloud API Key ID"
3
+ type = string
4
+ }
5
+
6
+ variable "token_secret" {
7
+ description = " ClickHouse Cloud API Key Secret"
8
+ type = string
9
+ sensitive = true
10
+ }
11
+
12
+ variable "organization_id" {
13
+ description = " ClickHouse Cloud Organization ID"
14
+ type = string
15
+ }
16
+
17
+ variable "service_id" {
18
+ description = " The ID of the ClickHouse Cloud service"
19
+ type = string
20
+ }
21
+
22
+ variable "pipe_name" {
23
+ description = " The name of the ClickPipe"
24
+ type = string
25
+ default = " kinesis-iam-user-example"
26
+ }
27
+
28
+ variable "pipe_description" {
29
+ description = " The description of the ClickPipe"
30
+ type = string
31
+ default = " Example of a Kinesis ClickPipe using IAM User authentication"
32
+ }
33
+
34
+ variable "database" {
35
+ description = " The database to store the data"
36
+ type = string
37
+ default = " default"
38
+ }
39
+
40
+ variable "table" {
41
+ description = " The table to store the data"
42
+ type = string
43
+ default = " kinesis_data"
44
+ }
45
+
46
+ variable "kinesis_stream_name" {
47
+ description = " The name of the Kinesis stream"
48
+ type = string
49
+ }
50
+
51
+ variable "aws_region" {
52
+ description = " The AWS region where the Kinesis stream is located"
53
+ type = string
54
+ default = " us-east-1"
55
+ }
56
+
57
+ variable "iam_role_arn" {
58
+ description = " The ARN of the IAM role that ClickHouse will assume to access Kinesis"
59
+ type = string
60
+ }
Original file line number Diff line number Diff line change
1
+ api_key_id = "<YOUR_CLICKHOUSE_CLOUD_API_KEY_ID>"
2
+ api_key_secret = "<YOUR_CLICKHOUSE_CLOUD_API_KEY_SECRET>"
3
+ organization = "<YOUR_CLICKHOUSE_CLOUD_ORGANIZATION_ID>"
4
+ region = "us-east-1"
5
+
6
+ service_id = "<YOUR_CLICKHOUSE_CLOUD_SERVICE_ID>"
7
+
8
+ kinesis_stream_name = "<YOUR_AWS_KINESIS_STREAM_NAME>"
9
+ aws_region = "<YOUR_AWS_REGION>"
10
+ iam_role_arn = "<IAM_ROLE_ARN>"
Original file line number Diff line number Diff line change
1
+ ## ClickPipe Kinesis with IAM user authentication
2
+
3
+ This example demonstrates how to deploy a Kinesis ClickPipe using IAM user credentials for authentication.
4
+
5
+ ## How to run
6
+
7
+ - Rename ` variables.tfvars.sample ` to ` variables.tfvars ` and fill in all needed data.
8
+ - Run ` terraform init `
9
+ - Run ` terraform <plan|apply> -var-file=variables.tfvars `
Original file line number Diff line number Diff line change
1
+ resource "clickhouse_clickpipe" "kinesis_iam_user" {
2
+ service_id = var. service_id
3
+ name = var. pipe_name
4
+ description = var. pipe_description
5
+
6
+ source = {
7
+ kinesis = {
8
+ format = " JSONEachRow"
9
+ stream_name = var.kinesis_stream_name
10
+ region = var.aws_region
11
+ iterator_type = " TRIM_HORIZON"
12
+
13
+ authentication = " IAM_USER"
14
+ access_key = {
15
+ access_key_id = var.aws_access_key
16
+ secret_key = var.aws_secret_key
17
+ }
18
+ }
19
+ }
20
+
21
+ destination = {
22
+ table = " my_table"
23
+ managed_table = true
24
+
25
+ table_definition = {
26
+ engine = {
27
+ type = " MergeTree"
28
+ }
29
+ }
30
+
31
+ columns = [
32
+ {
33
+ name = " my_field1"
34
+ type = " String"
35
+ }, {
36
+ name = " my_field2"
37
+ type = " UInt64"
38
+ }
39
+ ]
40
+ }
41
+
42
+ field_mappings = [
43
+ {
44
+ source_field = " my_field"
45
+ destination_field = " my_field1"
46
+ }
47
+ ]
48
+ }
49
+
50
+ output "clickpipe_id" {
51
+ value = clickhouse_clickpipe. kinesis_iam_user . id
52
+ }
Original file line number Diff line number Diff line change
1
+ # This file is generated automatically please do not edit
2
+ terraform {
3
+ required_providers {
4
+ clickhouse = {
5
+ version = " 3.0.0-alpha2"
6
+ source = " ClickHouse/clickhouse"
7
+ }
8
+ }
9
+ }
10
+
11
+ provider "clickhouse" {
12
+ organization_id = var. organization_id
13
+ token_key = var. token_key
14
+ token_secret = var. token_secret
15
+ }
Original file line number Diff line number Diff line change
1
+ terraform {
2
+ required_providers {
3
+ clickhouse = {
4
+ version = "${CLICKHOUSE_TERRAFORM_PROVIDER_VERSION}"
5
+ source = "ClickHouse/clickhouse"
6
+ }
7
+ }
8
+ }
9
+
10
+ provider "clickhouse" {
11
+ organization_id = var.organization_id
12
+ token_key = var.token_key
13
+ token_secret = var.token_secret
14
+ }
You can’t perform that action at this time.
0 commit comments