Terratest ๐งช

A simple Dagger module to run tests on Terraform modules using Terratest.
Configuration ๐ ๏ธ
Through the Dagger CLI, or by using it directly reusing it within your module, you can configure the following options:
- โ๏ธ
version: The version of the underlying Go image to use. Defaults to 1.22.0-alpine3.19.
- โ๏ธ
tfVersion: The version of Terraform to use. Defaults to 1.6.0.
NOTE: The terraform binary is installed on top of the Go image, so the tfVersion is the version of the Terraform binary to install.
Features ๐จ
| Command or functionality |
Command |
Example |
Status |
| Run a Terratest test with optional arguments |
run |
dagger call --src="." run --test-dir="test/demo-1" |
โ
|
| Run a Terratest test with verbose and coverage reporting |
run |
dagger call --src="." run --test-dir="test/demo-1" --args="-v -cover" |
โ
|
NOTE: The run command is used to execute Terratest tests within a specified directory by using the --test-dir argument. Additional go test arguments can be passed through the --args= flag to customize test execution. This feature allows for more detailed output or coverage analysis.
Usage ๐
To run Terratest tests from within your project directory:
dagger call --src="." run --test-dir="test/my-test-directory"
With additional arguments:
dagger call --src="." run --test-dir="test/my-test-directory" --args="-v -cover"