-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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 recursive directory check for --restrict-file-list #4972
base: main
Are you sure you want to change the base?
Conversation
@@ -629,8 +629,10 @@ func (p *DefaultProjectCommandBuilder) buildProjectPlanCommand(ctx *command.Cont | |||
foundDir := false | |||
|
|||
for _, f := range modifiedFiles { | |||
if filepath.Dir(f) == cmd.RepoRelDir { | |||
// Check if the file is in the directory or any subdirectory of the target | |||
if strings.HasPrefix(filepath.Dir(f), cmd.RepoRelDir) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Personally I would hide this behind a flag to make sure people that want to be very strict can still do so.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so should we bind this logic to another parameter like --restrict-file-list-recursive
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ibalat, yeah, that looks like a good flag to me. Just be aware that I can review this, but I'm not sure I'm the best person to give a final word if this should be accepted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I totally agree with @Fabianoshz. Introducing that flag could help to backwards compatibility 👍
This change enhances the file change detection logic in Atlantis to support recursive directory checks for --restrict-file-list parameter. Previously, only direct changes to specified directories were considered for plan and apply. With this update, changes in subdirectories are also detected, ensuring resources that depend on configuration files in nested directories are properly applied.
What:
Why:
In cases where Terraform resources in a directory (e.g., clusters/dev) depend on configuration files from subdirectories (e.g., clusters/dev/configs/dashboards/application), changes to those subdirectories were not triggering the necessary plan and apply commands. This fix resolves that issue, improving the workflow when working with nested configurations.
references
ISSUE #4971