When creating a Runscope testing using the Runscope provider for Terraform, each test is created as a separate resource that references the test resource.
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, the sequence in which resources are declared does not make any difference.
How does the Runscope provider for Terraform determine step sequence for the tests?
UPDATE
Looking at implicit dependencies between resources in the Terraform documentation, I found that I could simply reference the previous step.
Terraform is able to infer a dependency, and knows it must create the instance first.
In this case I used the note
attribute of the second step to refer to the first step:
resource "runscope_step" "step_2" {
bucket_id = "${runscope_bucket.bucket.id}"
test_id = "${runscope_test.test.id}"
step_type = "request"
note = "Follows step: ${runscope_step.step_1.id}"
...
}