1
0
mirror of synced 2025-12-19 18:05:44 -05:00

Implement Terraform validate test (#63)

This commit is contained in:
Zack Proser
2021-07-14 13:01:51 -04:00
committed by GitHub
parent ceaf70539d
commit 6128b76064
3 changed files with 83 additions and 6 deletions

View 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)
}