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

Update readme.md in root folder from terraform files in subfolders not working #93

Open
cberge908 opened this issue Oct 17, 2022 · 5 comments
Labels
bug Something isn't working

Comments

@cberge908
Copy link

Describe the bug

It seems that the following is not working with the github action for terraform-docs. I have the following directory structure, terraform files in a subdirectory and the readme.md to update in the root folder:

.
├── application
│   ├── main.tf
│   ├── terraform.tfvars
│   └── variables.tf
├── argoCD
│   ├── kustomization.yaml
│   ├── patch_argocd-cm.yaml
│   └── patch_clusterrolebinding.yaml
├── infrastructure
│   ├── main.tf
│   ├── terraform.tfvars
│   └── variables.tf
└── readme.md

When setting the working-directory to infrastructure and the output file to ../readme the changes will be made but not committed during the execution of the action. Output from the log looks like this:

::debug working_dir=infrastructure
::debug output_mode=inject
::debug output_file=../readme.md
::debug terraform-docs markdown table --hide data-sources --hide footer --hide header --hide inputs --hide outputs --hide providers --hide requirements --hide resources --indent 2 --output-mode inject --output-file ../readme.md --output-template <!-- BEGIN_TF_DOCS -->
{{ .Content }}
<!-- END_TF_DOCS --> infrastructure
readme.md updated successfully
::debug No change in infrastructure/ detected
::debug Following files will be committed
 M readme.md
On branch fix-tf-docs-section
Your branch is up to date with 'origin/fix-tf-docs-section'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
	modified:   readme.md

no changes added to commit (use "git add" and/or "git commit -a")

Technically it should work, but I feel that there is an error in the logic which files should be added to the commit.

How can we reproduce it?

Use a git repository with the terraform file in a subfolder of the root folder. Writing the terraform-docs changes into a file readme.md in the root directory via the github action. See folder structure above.

Environment information

Terraform-docs github action v1.0.0

@cberge908 cberge908 added the bug Something isn't working label Oct 17, 2022
@Raghunadh89
Copy link

Thanks for raising the bug, I am facing the same issue

@Lincon-Freitas
Copy link

I am also facing the same issue

@SamuelMolling
Copy link

Same problem here

@xiujiao
Copy link

xiujiao commented Mar 5, 2024

I have encountered similar issue. The difference is I configured find-dir to specify sub dir that I want it generate README.me, but it always modify README.md in root dir regardless. When there are new README generated for sub dir it works; when only README in root get modified, the above issue show up

@xiujiao
Copy link

xiujiao commented Mar 5, 2024

Any plan to address this issue in your roadmap?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants