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

feat: Add filter flag to allow generating configs for subset of folders #124

Merged
merged 3 commits into from
Mar 19, 2021

Conversation

GenPage
Copy link
Contributor

@GenPage GenPage commented Mar 19, 2021

Pull Request

Related Github Issues

Description

I was originally using the root flag for this but realized this caused
unintended issues with Atlantis and how the pattern matching is done.

This provides an additional flag "--filter" that is passed to
FindConfigFilesInPath() to only search a sub-path based on root.

Security Implications

  • None

System Availability

  • All

I was originally using the root flag for this but realized this caused
unintended issues with Atlantis and how the pattern matching is done.

This provides an additional flag "--filter" that is passed to
FindConfigFilesInPath() to only search a sub-path based on root.

See runatlantis/atlantis#1466
@GenPage
Copy link
Contributor Author

GenPage commented Mar 19, 2021

Looks like the feature will need a bit more work after adding tests. They are currently failing with:

=== RUN   TestFilterFlagWithInfraLiveProd
time="2021-03-19T12:22:36-04:00" level=info msg="Could not find an old config file. Starting from scratch"
Error: Rel: can't make /Users/paged/workspace/terragrunt-atlantis-config/test_examples/terragrunt-infrastructure-live-example/prod/account.hcl relative to ../test_examples/terragrunt-infrastructure-live-example/prod/us-east-1/prod/mysql/

    generate_test.go:62: open test_artifacts/8563953357423524462.yaml: no such file or directory
--- FAIL: TestFilterFlagWithInfraLiveProd (0.01s)
=== RUN   TestFilterFlagWithInfraLiveNonProd
time="2021-03-19T12:22:36-04:00" level=info msg="Could not find an old config file. Starting from scratch"
Error: Rel: can't make /Users/paged/workspace/terragrunt-atlantis-config/test_examples/terragrunt-infrastructure-live-example/non-prod/account.hcl relative to ../test_examples/terragrunt-infrastructure-live-example/non-prod/us-east-1/qa/mysql/

    generate_test.go:62: open test_artifacts/3173967700786741497.yaml: no such file or directory
--- FAIL: TestFilterFlagWithInfraLiveNonProd (0.01s)
FAIL
FAIL    github.com/transcend-io/terragrunt-atlantis-config/cmd  0.903s
FAIL
make: *** [test] Error 1

Copy link
Member

@dmattia dmattia left a comment

Choose a reason for hiding this comment

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

The two new tests are failing, which I believe to be because some of these functions require absolute paths passed in, while the filterPath specified in the tests is relative.

I added a suggestion for where I believe the filepath.Abs call ought to go, please let me know if you have other suggestions.

Thank you very much for this wonderful PR with great comments and tests, I will merge and release as soon as tests pass

cmd/generate.go Outdated Show resolved Hide resolved
Co-authored-by: David Mattia <david@transcend.io>
@GenPage
Copy link
Contributor Author

GenPage commented Mar 19, 2021

@dmattia Ah! Make sense! I don't have any other suggestions at this time. The tests pass locally with your suggestion.

Thank you for a wonderful tool. I appreciate your kind words. :)

@dmattia dmattia merged commit 27771ea into transcend-io:master Mar 19, 2021
@GenPage GenPage deleted the add-filter-flag branch March 19, 2021 18:25
@dmattia
Copy link
Member

dmattia commented Mar 19, 2021

Released in https://github.com/transcend-io/terragrunt-atlantis-config/releases/tag/v1.2.1 @GenPage

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