Thanks for your reply.
I’ve already tried to use
testAccPreCheck as in the aws provider implementation to invoke
Configure on the provider, however, that does not seem to persist across the various lifecycle steps of
Test: the provider is configured initially (as part of
PreCheck) but subsequent steps use an instance of the provider with the default configuration. Doesn’t even work if
Configure is called from
init() - is this because every step re-initialises the provider?
I also just tried with
Setenv and it works as expected, thanks!
However, I must say it does feel a bit unintuitive having to export environment variables to configure the provider for tests. Wouldn’t it make more sense to include a field in the
TestCase struct of type
*terraform.ResourceConfig and have the framework use that to configure the provider internally?