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

Fixed recursive flag stat error #657

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

alexyz79
Copy link

@alexyz79 alexyz79 commented Dec 1, 2022

Description of your changes

Changed the behaviour of 'findSubmodules' in 'internal/cli/run.go', by returning an empty module list if the folder is not found, this will allow the normal execution of terraform-docs using '--recursive' even if the 'modules' folder is not available. It fixes when the recursive flag is used on a project without a "modules" folder.

It only returns an empty list if 'err' is a 'NotExist' error, other wise it keeps the same behaviour: returns the error code.

Fixes #654

I have:

How has this code been tested

Tested in terraform projects with and without "modules" folder.

Signed-off-by: Alexandre Pires <[email protected]>
@trenslow
Copy link

trenslow commented Jun 7, 2023

any updates on getting this merged?

@khos2ow

@khos2ow
Copy link
Member

khos2ow commented Mar 28, 2024

The fix looks good and simple enough, but I don't see the benefit of it. This error, if happens, indicates either of two things: 1) you do intend for the modules folder to be there, but it's not (missing, typo in folder name, etc) 2) you do not intend for the recursive modules to be there, hence the .terraform-docs.yml or the command line execution flags are not supposed to have the recursive configs.

In both cases the error seems to be needed, IMO.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Flag "--recursive" fails if "modules" folder does not exists
3 participants