[英]How to connect a kinesis stream with a firehose delivery stream using terraform
My logging system uses a kinesis stream attached to a firehose delivery stream which writes to an S3 bucket. 我的日志记录系统使用连接到firehose传输流的kinesis流,该传输流写入S3存储桶。 This can be manually configured through the AWS console by setting the "Source" attribute of the firehose stream to the kinesis stream.
这可以通过AWS控制台手动配置,方法是将firehose流的“Source”属性设置为kinesis流。 I want to use terraform and capture this setup in code.
我想使用terraform并在代码中捕获此设置。
Neither the aws_kinesis_firehose_delivery_stream nor the aws_kinesis_stream terraform resources have attributes (that I can find) which set the Source attribute. aws_kinesis_firehose_delivery_stream和aws_kinesis_stream terraform资源都没有设置Source属性的属性(我可以找到)。 I cloned the terraform source and looking through it and I see this:
我克隆了terraform源并查看它,我看到了这个:
createInput := &firehose.CreateDeliveryStreamInput{
DeliveryStreamName: aws.String(sn),
}
My next thought was to see if I could edit the code to set the Source attribute. 我的下一个想法是看我是否可以编辑代码来设置Source属性。 So I looked through the AWS Firehose API to find the attribute name and I found this:
所以我浏览了AWS Firehose API以找到属性名称,我发现了这个:
DeliveryStreamType
DeliveryStreamType
The delivery stream type.
传递流类型。 This parameter can be one of the following values:
此参数可以是以下值之一:
DirectPut: Provider applications access the delivery stream directly.
DirectPut:提供者应用程序直接访问传递流。
KinesisStreamAsSource: The delivery stream uses a Kinesis stream as a source.
KinesisStreamAsSource:传递流使用Kinesis流作为源。 Type: String
类型:字符串
Valid Values: DirectPut |
有效值:DirectPut | KinesisStreamAsSource
KinesisStreamAsSource
Given this I thought I would just edit the terraform code to set DeliveryStreamType with the necessary configuration, "KinesisStreamSourceConfiguration." 鉴于此,我想我只需编辑terraform代码,使用必要的配置“KinesisStreamSourceConfiguration”设置DeliveryStreamType。 However grepping around I find no reference to DeliveryStreamType in the aws sdk code present in the terraform repo.
无论如何,我都没有在terraform repo中出现的aws sdk代码中找到对DeliveryStreamType的引用。 I do see DeliveryStreamName however.
我确实看到了DeliveryStreamName。
Is it possible to connect kinesis and firehose streams using terraform? 是否可以使用terraform连接kinesis和firehose溪流? If not, is this a feature that's on the horizon?
如果没有,这是一个即将到来的功能吗?
Thanks in advance. 提前致谢。
I cloned the latest from https://github.com/aws/aws-sdk-go and confirmed that terraform is simply using an older version of the go aws API that doesn't support DeliveryStreamType. 我从https://github.com/aws/aws-sdk-go克隆了最新版本,并确认terraform只是使用不支持DeliveryStreamType的旧版本的go aws API。 Terraform code:
Terraform代码:
type CreateDeliveryStreamInput struct {
_ struct{} `type:"structure"`
// The name of the delivery stream. This name must be unique per AWS account
// in the same region. You can have multiple delivery streams with the same
// name if they are in different accounts or different regions.
//
// DeliveryStreamName is a required field
DeliveryStreamName *string `min:"1" type:"string" required:"true"`
...
}
Current aws-sdk-go repo: 目前的aws-sdk-go回购:
type CreateDeliveryStreamInput struct {
_ struct{} `type:"structure"`
// The name of the delivery stream. This name must be unique per AWS account
// in the same region. If the delivery streams are in different accounts or
// different regions, you can have multiple delivery streams with the same name.
//
// DeliveryStreamName is a required field
DeliveryStreamName *string `min:"1" type:"string" required:"true"`
// The delivery stream type. This parameter can be one of the following values:
//
// * DirectPut: Provider applications access the delivery stream directly.
//
// * KinesisStreamAsSource: The delivery stream uses a Kinesis stream as
// a source.
DeliveryStreamType *string `type:"string" enum:"DeliveryStreamType"`
...
// When a Kinesis stream is used as the source for the delivery stream, a KinesisStreamSourceConfiguration
// containing the Kinesis stream ARN and the role ARN for the source stream.
KinesisStreamSourceConfiguration *KinesisStreamSourceConfiguration `type:"structure"`
...
}
So this answers my question, basically the terraform repo needs to be updated to use the current aws-sdk-go code. 所以这回答了我的问题,基本上需要更新terraform repo以使用当前的aws-sdk-go代码。
我试图实现这个功能,并在这里提出了一个PR
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.