如何使用Terraform订购Runscope测试步骤

时间:2019-05-23 17:56:03

标签: api monitoring terraform runscope

使用Runscope provider for Terraform创建Runscope测试时,每个测试均作为引用测试资源的单独资源创建。

resource "runscope_test" "api" {
  name         = "api-test"
  description  = "checks the api is up and running"
  bucket_id    = "${runscope_bucket.main}"
}

resource "runscope_step" "step_1" {
  bucket_id      = "${runscope_bucket.bucket.id}"
  test_id        = "${runscope_test.test.id}"
  step_type      = "request"

  ...

}

resource "runscope_step" "step_2" {
  bucket_id      = "${runscope_bucket.bucket.id}"
  test_id        = "${runscope_test.test.id}"
  step_type      = "request"

  ...

}

According to Terraform,声明资源的顺序没有任何区别。

用于Terraform的Runscope提供程序如何确定测试的步骤顺序?

1 个答案:

答案 0 :(得分:0)

我认为您可以在以下步骤之间使用隐式依赖关系:

resource "runscope_step" "step_1" {
  bucket_id      = "${runscope_bucket.bucket.id}"
  test_id        = "${runscope_test.test.id}"
  step_type      = "request"

  ...

}

resource "runscope_step" "step_2" {
  bucket_id      = "${runscope_step.step_1.bucket_id}"
  test_id        = "${runscope_test.test.id}"
  step_type      = "request"

  ...

}

resource "runscope_step" "step_3" {
  bucket_id      = "${runscope_step.step_2.bucket_id}"
  test_id        = "${runscope_test.test.id}"
  step_type      = "request"

  ...

}

and you can check dependencies via [terraform graph][1] command


  [1]: https://www.terraform.io/docs/commands/graph.html