Skip to content

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

Open
@cberge908

Description

@cberge908

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions