Search code examples
terratest

Is there a way to specify terraform plugins directory for terratest?


and thanks in advance.

I have a practical question about terratest, with terraform I can do this:

terraform init -backend-config /tmp/provider.tfvars.json -plugin-dir /opt/terra_plugins

such as, terraform leaves our company proxy alone, and does not download the plugins million times a day (we have a docker build script thingy, so we build terraform env releases into docker). All in all I would like to make the same with terratest - first surprise was that even if I do terraform init before, terratest seems to use some other way than .terraform directory, it does not get the things from there - shall I aim to change this behaviour?

Thanks a lot in advance!


Solution

  • terratest has the ability to specify Options. This includes BackendConfig. -plugin-dir is not included, but the included EnvVars can use the terraform TF_CLI_ARGS environment variable to specify the -plugin-dir option.