At the risk of telling people stuff they already know.
One issue with needs: ["build"] is that although it can pass linting fine, if the build job is not instantiated (because of rules that depend on variable values) this can give an invalid yaml error. You can find that the pipeline runs fine on commits, but errors on deploys (for example) because different variables are set.
I don't know if this actually arises in this case.
Also, some pipelines currently have a dependency on the docker image built in the build step, but actually it's not necessary because all the test job is actually doing is a terraform fmt. (Replacing with just a terraform fmt step is also a lot quicker in these cases.)
I don't know if this actually arises in this case.
In this case the way we run tox tests requires that a container be built so there must have been a build step and hence we actually want some fast-failure if we don't have one.
I agree that we shouldn't add the dependency to the test job as a matter of course.
Also, some pipelines currently have a dependency on the docker image built in the build step, but actually it's not necessary because all the test job is actually doing is a terraform fmt. (Replacing with just a terraform fmt step is also a lot quicker in these cases.)
maybe we can move this into "create a terraform fmt test job template"? Then we can just include it from each deployment's config.