我想使用terraform,Kinesis数据流和数据流水线创建文件,并将它们连接(作为管道)。当使用UI时,当我转到流水线时,可以转到source-> Kinesis流,并选择我创建的kinesis流。但是我想用terraform来做。
这是创建运动学流的代码(我从官方运动学文档中获取了它):
resource "aws_kinesis_stream" "test_stream" {
name = "terraform-kinesis-test"
shard_count = 1
retention_period = 30
shard_level_metrics = [
"IncomingBytes",
"OutgoingBytes",
]
tags = {
Environment = "test"
}
这是数据流水线的代码:
resource "aws_elasticsearch_domain" "test_cluster" {
domain_name = "firehose-es-test"
elasticsearch_version = "6.4"
cluster_config {
instance_type = "t2.small.elasticsearch"
}
ebs_options{
ebs_enabled = true
volume_size = 10
}
}
resource "aws_iam_role" "firehose_role" {
name = "firehose_test_role"
assume_role_policy = <<EOF
{
"Version": "2012-10-17",
"Statement": [
{
"Action": "sts:AssumeRole",
"Principal": {
"Service": "firehose.amazonaws.com"
},
"Effect": "Allow",
"Sid": ""
}
]
}
EOF
}
resource "aws_kinesis_firehose_delivery_stream" "test_stream" {
name = "terraform-kinesis-firehose-test-stream"
destination = "elasticsearch"
/*
s3_configuration {
role_arn = "${aws_iam_role.firehose_role.arn}"
bucket_arn = "${aws_s3_bucket.bucket.arn}"
buffer_size = 10
buffer_interval = 400
compression_format = "GZIP"
}
*/
elasticsearch_configuration {
domain_arn = "${aws_elasticsearch_domain.test_cluster.arn}"
role_arn = "${aws_iam_role.firehose_role.arn}"
index_name = "test"
type_name = "test"
processing_configuration {
enabled = "true"
}
}
}
那么我该如何连接它们,像$ {aws_kinesis_stream.test_stream.arn}这样的东西吗?或类似的东西?
我使用了aws_kinesis_stream和aws_kinesis_firehose_delivery_stream(elasticsearch目标)的官方文档。
答案 0 :(得分:1)
这在kinesis_firehose_delivery_stream]
文档中。将示例带到Argument Reference部分,您将看到:
kinesis_source_configuration对象支持以下内容:
kinesis_stream_arn(必需)用作流水管传输流源的运动流。 role_arn(必需),该角色的ARN提供对源Kinesis流的访问。