I posted this question in the PR adding the prototype for the new
test command, but was directed here.
One thing I’ve run into using terratest, is tests of modules that use
for_each, and issues where the test config generates the resources passed to those expressions in a way where the index/label cannot be determined until apply. My workaround has been to support a “prereq” config for each test that is applied first, and to read the outputs via the data source
Has any similar pattern/issue been discussed or explored yet, and how to address it within the context of a builtin
Maybe some kind of “setup” and “teardown” features, common to many test frameworks? I would envision the “setup” running the init/apply on a different config, so the test config(s) could reference its outputs.
Or perhaps, the ability to order and create dependencies between configs? I.e. Run test config “A” first, and in test config “B” use
terraform_remote_state to read outputs from test config A’s tfstate?