将 AWS Data Pipeline 导出为 CloudFormation 模板以在 Terraform 中使用它

Exporting AWS Data Pipeline as CloudFormation template to use it in Terraform

我正在尝试以某种方式导出 现有 AWS Data Pipeline task to Terraform 基础设施。

据此issue, there is no direct support for Data Pipelines, but it still seems achievable using CloudFormation templates (terraform resource).

问题是我找不到将现有管道导出到 CloudFormation 模板的方法。

导出管道及其特定 definition syntax won't work as I've not found a way to include this definition into CloudFormation. CloudFormer 也不支持导出管道。

有人知道如何将管道导出到 CloudFormation 或通过 Terraform 使 AWS Data Pipeline 自动化的任何其他方式吗?

感谢您的帮助!

UPD [七月。 2019]:terraform 存储库取得了一些进展。 aws_datapipeline_pipeline resource has been implemented, but it is not yet clear how to use it. Merged pull request

原回答:

作为这个问题的解决方案,我想出了一个 node.js 脚本,它涵盖了我的用例。此外,我创建了一个 Terraform 模块以用于 Terraform 配置。

Here is the link to the gist with the code

将在此处复制使用示例。

命令行:

node converter-cli.js ./template.json "Data Pipeline Cool Name" "Data Pipeline Cool Description" "true" >> cloudformation.json

地形:

module "some_cool_pipeline" {
  source = "./pipeline"
  name = "cool-pipeline"
  description = "The best pipeline!"
  activate = true
  template = "${file("./cool-pipeline-template.json")}"

  values = {
    myDatabase = "some_database",
    myUsername = "${var.db_user}",
    myPassword = "${var.db_password}",
    myTableName = "some_table",
  }
}