Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Terragrunt validate #951

Merged
merged 7 commits into from
Aug 16, 2021
Merged

Implement Terragrunt validate #951

merged 7 commits into from
Aug 16, 2021

Conversation

zackproser
Copy link
Contributor

@zackproser zackproser commented Jul 16, 2021

@zackproser zackproser changed the title [WIP] Implement Terragrunt validate Implement Terragrunt validate Aug 3, 2021
@@ -69,6 +82,28 @@ func NewValidationOptions(rootDir string, includeDirs, excludeDirs []string) (*V
return vo, nil
}

// NewValidationOptions returns a ValidationOptions struct, with override-able sane defaults, configured to find
// and process all directories containing .tf files
func NewValidationOptions(rootDir string, includeDirs, excludeDirs []string) (*ValidationOptions, error) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By splitting NewValidationOptions into two separate functions, one that configures ValidationOptions with a FileType of TF for Terraform, and one that configures ValidationOptions with a FileType of TG for Terragrunt, we can a backward incompatible release for the tests already calling the NewValidationOptions function.

Copy link
Contributor

@yorinasub17 yorinasub17 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like good progress. I have a couple high level thoughts:

  • We want to run both terragrunt validate-inputs AND terragrunt validate. The latter is important to run to ensure generate blocks output valid terraform configuration.
  • Can you do a speed test to compare if it is faster to run validate in this way, or if you run run-all validate like we are doing in the service catalog repo smoke test? I have a sneaking suspicion that run-all validate might be significantly faster, but I could be wrong.

modules/terraform/validate.go Outdated Show resolved Hide resolved
modules/test-structure/validate_struct.go Outdated Show resolved Hide resolved
@zackproser zackproser force-pushed the terragrunt-validate-all branch from e8bfc84 to be9d3ef Compare August 16, 2021 17:26
Copy link
Contributor

@yorinasub17 yorinasub17 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updates LGTM!

@zackproser
Copy link
Contributor Author

Updates LGTM!

Thanks for the reviews! Going to merge this in now.

@zackproser zackproser merged commit 2db22cd into master Aug 16, 2021
@zackproser zackproser deleted the terragrunt-validate-all branch August 16, 2021 18:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants