繁体   English   中英

如何使用terraform将kinesis流与firehose传输流连接

[英]How to connect a kinesis stream with a firehose delivery stream using terraform

我的日志记录系统使用连接到firehose传输流的kinesis流,该传输流写入S3存储桶。 这可以通过AWS控制台手动配置,方法是将firehose流的“Source”属性设置为kinesis流。 我想使用terraform并在代码中捕获此设置。

aws_kinesis_firehose_delivery_stream和aws_kinesis_stream terraform资源都没有设置Source属性的属性(我可以找到)。 我克隆了terraform源并查看它,我看到了这个:

createInput := &firehose.CreateDeliveryStreamInput{
    DeliveryStreamName: aws.String(sn),
}

我的下一个想法是看我是否可以编辑代码来设置Source属性。 所以我浏览了AWS Firehose API以找到属性名称,我发现了这个:

DeliveryStreamType

传递流类型。 此参数可以是以下值之一:

DirectPut:提供者应用程序直接访问传递流。

KinesisStreamAsSource:传递流使用Kinesis流作为源。 类型:字符串

有效值:DirectPut | KinesisStreamAsSource

鉴于此,我想我只需编辑terraform代码,使用必要的配置“KinesisStreamSourceConfiguration”设置DeliveryStreamType。 无论如何,我都没有在terraform repo中出现的aws sdk代码中找到对DeliveryStreamType的引用。 我确实看到了DeliveryStreamName。

是否可以使用terraform连接kinesis和firehose溪流? 如果没有,这是一个即将到来的功能吗?

提前致谢。

我从https://github.com/aws/aws-sdk-go克隆了最新版本,并确认terraform只是使用不支持DeliveryStreamType的旧版本的go aws API。 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"`
    ...
}

目前的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"`
    ...
}

所以这回答了我的问题,基本上需要更新terraform repo以使用当前的aws-sdk-go代码。

我试图实现这个功能,并在这里提出了一个PR

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM