Terraform module template and testing suite
If you want to create and test terraform modules, you want to have one place to maintain the testing logic.
tftest
requires terraform to be present. You can either install it manually or get it via sbpl.
tftest [diff-file] [diff-file-wine]
tftest
runs terraform
init
, get
, apply
and destroy
and echos the output variables on success.
If called with an argument tftest
will diff the output variables with the file provided. If wine
is present tftest
will execute the same steps inside the windows environment. The wine outputs are compared with the diff file, if provided. If a second argument is used, the first diff file is used for unix, the second for windows.
If a file named outputs.diff
is present in PWD, tftest will use this file to diff the results.
-
TFTEST_WINE
- set this to false, to disable testing with wine -
TFTEST_DIFFOUTPUT
- set this to false to disable auto diffs withoutputs.diff
Shows basic usage of tftest
. outputs.diff
is used to compare the result of output.tf.
Shows basic usage of tftest
. verify.sh
is used to check the creation of ressources after terraform apply
.
Simple example which shows how to run a number of test cases with tftest
and sbpl
.
MIT