Terraform - AWS DataPipeline 调度

问题描述 投票:0回答:1

我正在考虑使用 Terraform 创建一个 AWS 数据管道,并在每天上午 12.30 进行调度。

如何在 terraform 中应用调度?文档中似乎没有提到。

AWS Data Pipeline Terraform 参考

amazon-web-services terraform terraform-provider-aws
1个回答
0
投票

我认为 aws_datapipeline_pipeline_definition 是您正在寻找的资源。

您可以使用

pipeline_object
来定义时间表 - 例如:

resource "aws_datapipeline_pipeline" "default" {
  name = "tf-pipeline-default"
}

resource "aws_datapipeline_pipeline_definition" "example" {
  pipeline_id = aws_datapipeline_pipeline.default.id
  pipeline_object {
    id   = "Default"
    name = "Default"
    field {
      key          = "workerGroup"
      string_value = "workerGroup"
    }
  }
  pipeline_object {
    id   = "Schedule"
    name = "Schedule"
    field {
      key          = "startDateTime"
      string_value = "2012-12-12T00:00:00"
    }
    field {
      key          = "type"
      string_value = "Schedule"
    }
    field {
      key          = "period"
      string_value = "1 hour"
    }
    field {
      key          = "endDateTime"
      string_value = "2012-12-21T18:00:00"
    }
  }
  pipeline_object {
    id   = "SayHello"
    name = "SayHello"
    field {
      key          = "type"
      string_value = "ShellCommandActivity"
    }
    field {
      key          = "command"
      string_value = "echo hello"
    }
    field {
      key          = "parent"
      string_value = "Default"
    }
    field {
      key          = "schedule"
      string_value = "Schedule"
    }
  }
}
© www.soinside.com 2019 - 2024. All rights reserved.