-
-
Notifications
You must be signed in to change notification settings - Fork 541
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
terraform_docs: unable to specify relative PATH to config file #225
Comments
Hi, @7adityaraj . After, check, please describe is it help you. |
Hi @MaxymVlasov, Thank you for the suggestions. I tried with commit ID as below, but it didn't work. May be I am still missing something
|
Good, at least now it show right path to config file in error. @7adityaraj , using this fork, try change first arg to - --config=__GIT_WORKING_DIR__/precommit/.terraform-docs.yml |
Many thanks @MaxymVlasov, It works when I pass the full path of the yml file. Also, I figure out with your help, it does work with the previous release tag 1.50.0 when I provide the full path of yml file. Is this expected or do we need to fill a bug for it. |
This is exepted behavior. I will clarify docs about that. |
And |
It didn't work that way.
|
Is it work if use tag 1.50 from this repo? repos:
- repo: https://github.com/antonbabenko/pre-commit-terraform
rev: v1.50.0
hooks:
- id: terraform_docs
args:
- --config=__GIT_WORKING_DIR__/precommit/.terraform-docs.yml
- md |
no luck.
|
That really looks like a bug.
Thank you, @7adityaraj ! |
thank you @MaxymVlasov and will wait for the next release. I am using a workaround as have a copy of yml file in each readme directory with tag 1.50.0 |
Already done |
Why is this function doing such convolute stuff for functionality that is built-in to It basically does terraform-docs markdown --config .tfdocs-markdown.yaml ${terraform_module_folder} where the config file looks like: formatter: markdown
output:
file: README.md
mode: inject
template: |-
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
{{ .Content }}
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK --> |
@tpdownes In short, the terraform_docs hook in We are improving it all the time. |
@antonbabenko, @MaxymVlasov sorry for the delay.
running from directory where yaml file exists.
When I add a full path, all seems to be fine. I have compared the changes from 1.50.0 to 1.52.0 and which should be helpful but somehow there seems an issue. I am not sure what I am misisng. I would appreciate any feedbacks. |
@7adityaraj you missing that it will be in 1.53.0 :) You can use the latest commit SHA from master branch, for tests proposes |
Oops my bad, thank you for the quick response. |
Hello @MaxymVlasov, Tried with latest SHA but have the same error.
|
Try to specify the relative path from the repo root. repos:
- repo: https://github.com/antonbabenko/pre-commit-terraform
rev: 2973f85f3ba5f8f5b4610cce9b01a7ce26510c84
hooks:
- id: terraform_docs
args:
- --args=--sort-by required
- --args=--config=precommit/.terraform-docs.yml |
Hi @MaxymVlasov, I have tried all possible ways but it still returns an error. Following the above, one more time:
|
@7adityaraj can you try this one please? repos:
- repo: https://github.com/antonbabenko/pre-commit-terraform
rev: 41329df414df04a78d06c228e2fbfd2aedc1c5ea
hooks:
- id: terraform_docs
args:
- --args=--sort-by required
- --args=--config=precommit/.terraform-docs.yml |
If it works, then I successfully fixed a bug introduced in #244 and will prepare PR with fix |
Hi @MaxymVlasov, Many thanks, yes it works. I tried with all behaviour and it all works.
|
Yay! |
@MaxymVlasov thank you very much. |
Describe the bug
I looked over the below block on how tf docs pick the config file.
https://github.com/terraform-docs/terraform-docs/blob/3d84cad448378bc36dfef856a319ff6a43d7752f/internal/cli/run.go#L133
I have my configuration files under precommit dir as below
my precommit config is:
Please let us know what behaviour you expected and how terraform-docs diverged from that behaviour.
.terraform-docs.yml should be picked as config for tf-docs or someone can suggest if there is other way.
Adding yml file to each directory where I have readme with tf-docs hooks works. But I would like to have only one yml file to the precommit dir if possible.
Thank you in advance.
How can we reproduce it?
with above steps.
Environment information
The text was updated successfully, but these errors were encountered: