hashicorp / terraform-provider-runscope

Terraform runscope provider. Please note: This Terraform provider is archived per our provider archiving process: https://terraform.io/docs/internals/archiving.html
https://www.terraform.io/docs/providers/runscope/
Other
8 stars 25 forks source link

Ruscope test steps order #26

Open taraspos opened 5 years ago

taraspos commented 5 years ago

Hey, today I faced the issue, that there is no way to define the order of the steps. And since runscope test steps can depend on each other, therefore the order is important.

Directive depends_on can be used to chain the dependency between tests and it works fine until you need to insert a new test between the existing ones and that doesn't work, because terraform will simply create the new test as last one.

The workaround I figured is to state the test order in the resources name and chain dependencies between each other like:

resource "runscope_step" "create_test_01" {
    depends_on = ["runscope_step.test00"]
    ...
}

resource "runscope_step" "delete_test_02" {
    depends_on = ["runscope_step.create_test_01"]
    ...
}

# ... etc, etc

The serious drawback of such approach is if I want to put the update_test_02 between these two, I would need to rename all the tests after this one, incrementing the order in the resource name like:

resource "runscope_step" "create_test_01" {
    depends_on = ["runscope_step.test00"]
    ...
}

resource "runscope_step" "update_test_02" {
    depends_on = ["runscope_step.create_test_01"]
    ...
}

resource "runscope_step" "delete_test_03" {
    depends_on = ["runscope_step.update_test_02"]
    ...
}

# ... etc, etc

In this case, terraform will remove all the test steps whose names were changed and create them in the correct order. But updating manually the name of all the test isn't a good option.

Do you have any ideas how that can be resolved?

The only viable idea I have is to introduce a new resource type called runscope_steps which actually takes the array of steps and preserves the order.

wolf31o2 commented 3 years ago

See #18 for an implementation of this