gh-actions
gh-actions copied to clipboard
When using the config-file option, defaults cause unwanted overrides
Describe the bug
GitHub workflow file for reference available here.
Despite using the config-file
option, action defaults appear to cause unwanted overrides. From an action log from the repo I am testing with, you can clearly see the unwanted behaviour:
::debug working_dir=.
::debug config_file=.terraform-docs.yml
::debug output_mode=inject
::debug output_file=README.md
::debug terraform-docs markdown table --config .terraform-docs.yml --output-mode inject --output-file README.md --output-template <!-- BEGIN_TF_DOCS -->
{{ .Content }}
<!-- END_TF_DOCS --> .
README.md updated successfully
modules/dns/README.md updated successfully
modules/ipam/README.md updated successfully
modules/network_firewall_vpc/README.md updated successfully
modules/tgw/README.md updated successfully
modules/vpc_endpoints/README.md updated successfully
As .terraform-docs.yml already contains all the desired settings, none of the following defaults is desirable:
markdown table
--output-mode inject
--output-file README.md
--output-template <!-- BEGIN_TF_DOCS -->
{{ .Content }}
<!-- END_TF_DOCS -->
None of the modules/**/README.md files should have been created.
This is what should have happened, i.e. only the README.md file in the root folder should have been updated, according to the contents of the .terraform-docs.yml file in the root folder and those in the module/*/ subfolders:
::debug working_dir=.
::debug config_file=.terraform-docs.yml
::debug terraform-docs --config .terraform-docs.yml .
README.md updated successfully
README.md updated successfully
README.md updated successfully
README.md updated successfully
README.md updated successfully
README.md updated successfully
That produces the correct results and is consistent with running terraform-docs
v0.16.0 manually in the repo root:
C:\github-repos\aws-network-hub-for-terraform> terraform-docs --config .terraform-docs.yml .
README.md updated successfully
README.md updated successfully
README.md updated successfully
README.md updated successfully
README.md updated successfully
README.md updated successfully
Long story short: when using the config-file
option, no defaults should be passed down to terraform-docs
. For backward compatibility, one could perhaps add an ignore-defaults
option.
How can we reproduce it?
You can:
- fork the repo I am testing with
- create a branch in which you update any of the outputs.tf files
- start a pull request
Environment information
This is running a GitHub action directly. See GitHub workflow file.