diff --git a/modules/terraform/validate.go b/modules/terraform/validate.go index 19218c433..26ab8b2ec 100644 --- a/modules/terraform/validate.go +++ b/modules/terraform/validate.go @@ -12,6 +12,13 @@ func Validate(t testing.TestingT, options *Options) string { return out } +// ValidateInputs calls terragrunt validate and returns stdout/stderr. +func ValidateInputs(t testing.TestingT, options *Options) string { + out, err := ValidateInputsE(t, options) + require.NoError(t, err) + return out +} + // ValidateE calls terraform validate and returns stdout/stderr. func ValidateE(t testing.TestingT, options *Options) (string, error) { return RunTerraformCommandE(t, options, FormatArgs(options, "validate")...) @@ -54,6 +61,5 @@ func InitAndValidateInputsE(t testing.TestingT, options *Options) (string, error if _, err := InitE(t, options); err != nil { return "", err } - // JUST FOR TESTING / BENCHMARKING - return ValidateE(t, options) + return ValidateInputsE(t, options) } diff --git a/modules/test-structure/test_structure.go b/modules/test-structure/test_structure.go index 76a62aa18..532ac3643 100644 --- a/modules/test-structure/test_structure.go +++ b/modules/test-structure/test_structure.go @@ -135,7 +135,10 @@ func ValidateAllTerraformModules(t *go_test.T, opts *ValidationOptions) { tfOpts := &terraform.Options{TerraformDir: testFolder} if opts.FileType == TG { tfOpts.TerraformBinary = "terragrunt" + // First call init and terraform validate terraform.InitAndValidate(t, tfOpts) + // Next, call terragrunt validate-inputs which will catch mis-aligned inputs provided via Terragrunt + terraform.ValidateInputs(t, tfOpts) } else if opts.FileType == TF { terraform.InitAndValidate(t, tfOpts) }