如何使用terraform连接Kinesis流和Firehose交付流

3
我的日志系统使用连接到Firehose交付流的Kinesis流,该流会写入S3存储桶。您可以通过在AWS控制台中设置Firehose流的“源”属性为Kinesis流来手动配置此设置。我想使用terraform并将此设置捕获到代码中。
在terraform资源中,aws_kinesis_firehose_delivery_stream和aws_kinesis_stream都没有(我找不到)设置源属性的属性。我克隆了terraform源代码并查看了它,发现如下内容:
createInput := &firehose.CreateDeliveryStreamInput{
    DeliveryStreamName: aws.String(sn),
}

我的下一个想法是看能否编辑代码来设置源属性。因此,我查找了AWS Firehose API以查找属性名称,并找到了以下内容:
DeliveryStreamType 传递流类型。该参数可以是以下值之一:
DirectPut:提供程序应用程序可以直接访问传递流。 KinesisStreamAsSource: 传递流使用 Kinesis 流作为源。 类型:字符串
有效值: DirectPut | KinesisStreamAsSource 鉴于此,我认为只需编辑terraform代码以使用所需的配置“KinesisStreamSourceConfiguration”设置DeliveryStreamType。然而,在grep周围,我在terraform存储库中存在的aws sdk代码中没有找到DeliveryStreamType的引用。不过,我确实看到了DeliveryStreamName。
是否可能使用terraform连接kinesis和firehose流?如果不行,这是即将推出的功能吗?
提前致谢。
2个回答

0

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


太棒了!我最终自己在本地实现了这个,但如果你已经有一个待处理的PR,那就太好了。你知道这样的事情通常需要多长时间才能合并吗?感谢你! - CAS
不确定,这是我第一次为这个项目做出贡献。 - Peter

0

我从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仓库需要更新以使用当前的aws-sdk-go代码。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接