如何使用 terraform 将运动流与流水线传输流连接起来

How to connect a kinesis stream with a firehose delivery stream using terraform

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

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

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

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

DeliveryStreamType

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. Type: String

Valid Values: DirectPut | KinesisStreamAsSource

考虑到这一点,我想我只需编辑 terraform 代码以使用必要的配置设置 DeliveryStreamType,"KinesisStreamSourceConfiguration." 但是四处寻找,我发现 terraform 存储库中的 aws sdk 代码中没有对 DeliveryStreamType 的引用。但是我确实看到了 DeliveryStreamName。

是否可以使用 terraform 连接 kinesis 和 firehose 流?如果不是,这是即将推出的功能吗?

提前致谢。

我从 https://github.com/aws/aws-sdk-go 克隆了最新版本并确认 terraform 只是使用不支持 DeliveryStreamType 的旧版本的 go aws API。地形代码:

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 here