Implement Terraform validate test (#63)
This commit is contained in:
25
test/validation/validate_all_modules_and_examples_test.go
Normal file
25
test/validation/validate_all_modules_and_examples_test.go
Normal file
@@ -0,0 +1,25 @@
|
||||
package testvalidate
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
test_structure "github.com/gruntwork-io/terratest/modules/test-structure"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
// TestValidateAllTerraformModulesAndExamples recursively finds all modules and examples (by default) subdirectories in
|
||||
// the repo and runs Terraform InitAndValidate on them to flush out missing variables, typos, unused vars, etc
|
||||
func TestValidateAllTerraformModulesAndExamples(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
cwd, err := os.Getwd()
|
||||
require.NoError(t, err)
|
||||
|
||||
opts, optsErr := test_structure.NewValidationOptions(filepath.Join(cwd, "../.."), []string{}, []string{})
|
||||
require.NoError(t, optsErr)
|
||||
|
||||
test_structure.ValidateAllTerraformModules(t, opts)
|
||||
}
|
||||
Reference in New Issue
Block a user