Giter Site home page Giter Site logo

Comments (10)

rochana-atapattu avatar rochana-atapattu commented on August 11, 2024

also i think you need to add pull_request_targe here

from tfaction.

suzuki-shunsuke avatar suzuki-shunsuke commented on August 11, 2024

Thank you for your feedback.
I didn't know the output config.
But I think you can use header-from and footer-from instead of inject mode.

https://github.com/suzuki-shunsuke/tfaction-example/blob/main/templates/module-hello/.terraform-docs.yml

from tfaction.

suzuki-shunsuke avatar suzuki-shunsuke commented on August 11, 2024

also i think you need to add pull_request_targe here

Yeah, that's right. Thank you for pointing it out.

from tfaction.

rochana-atapattu avatar rochana-atapattu commented on August 11, 2024

Thank you for your feedback. I didn't know the output config. But I think you can use header-from and footer-from instead of inject mode.

https://github.com/suzuki-shunsuke/tfaction-example/blob/main/templates/module-hello/.terraform-docs.yml

yes but we can use headers and footers to add more general information to the README which will give more flexibilty to the user
we can also do

github-comment exec \
    -config "${GITHUB_ACTION_PATH}/github-comment.yaml" \
    -var "tfaction_target:${TFACTION_TARGET}" \
   -- terraform-docs --output-file README.md .

which will give us the same results without overwritting the README
--output-file README.md override the output.file option in .terraform-docs.yml
and default output mode is inject

from tfaction.

suzuki-shunsuke avatar suzuki-shunsuke commented on August 11, 2024

also i think you need to add pull_request_targe here

from tfaction.

suzuki-shunsuke avatar suzuki-shunsuke commented on August 11, 2024

📝 --output-file was added at terraform-docs v0.12.0.

https://github.com/terraform-docs/terraform-docs/releases/tag/v0.12.0

The release date is Mar 23, 2021, so there is no problem.

from tfaction.

suzuki-shunsuke avatar suzuki-shunsuke commented on August 11, 2024

Now test-module runs terraform-docs as the following.

-- terraform-docs . > README.md

terraform-docs . > README.md

If output is set as the following, README.md becomes empty.

output:
  file: README.md
  mode: inject
$ terraform-docs . > README.md
$ cat README.md 
Error: file content is empty

On the other hand, terraform-docs --output-file README.md . works well.

$ terraform-docs --output-file README.md .

But if the comment <!-- BEGIN_TF_DOCS --> isn't set, the command fails.

$ terraform-docs --output-file README.md .
Error: begin comment is missing

So this is a breaking change.

We can check if the comment exists, and if they don't exist we can run terraform-docs . > README.md without --output-file option.
This keeps the compatibility, but I'm not sure if it's good.

from tfaction.

suzuki-shunsuke avatar suzuki-shunsuke commented on August 11, 2024
  1. Check .terraform-docs.yml if output.file is set
  2. If output.file is set, tfaction runs terraform-docs .
  3. Otherwise tfaction runs terraform-docs . > README (Redirect the stdout to README.md)

from tfaction.

suzuki-shunsuke avatar suzuki-shunsuke commented on August 11, 2024

from tfaction.

suzuki-shunsuke avatar suzuki-shunsuke commented on August 11, 2024

v1.2.3 is out 🎉
https://github.com/suzuki-shunsuke/tfaction/releases/tag/v1.2.3

from tfaction.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.