answerdigital / terraform-modules

The repo for the infrastructure as code
MIT License
3 stars 4 forks source link

Altered README format for modules #12

Closed JoeCSykes closed 1 year ago

robg-test commented 1 year ago

FYI this'll be conflicting with the Terraform fmt change as part of CI. I'd suggest not bother trying to merge take yours and run terraform fmt on it.

JoeCSykes commented 1 year ago

Not part of the diff here, but I would advise marking the username/password outputs of rds_serverless_cluster as sensitive = true.

I have changed this. Does this need to be shown in the README output table? If so, how do you want me to show it? i.e. in the desc or in a new column?

JoeCSykes commented 1 year ago

@robg-answer I have set up terraform.docs.yml files for each module so that the README.md can be generated using 'terraform-docs -c .terraform.docs.yml > README.md`. Do you thing it is worth running this command in your github action to autogenerate any changes in the README.md files?

cmbuckley commented 1 year ago

Could you update this to use a single .terraform-docs.yml at the root of the repo? You can fence the auto-generated part of the readme like this:

<!-- BEGIN_TF_DOCS -->
...
<!-- END_TF_DOCS -->

and terraform-doc will inject updates into the file, if you also add config like this:

output:
  file: README.md

You might find you don't even need the config file when using the action as the defaults do the job:

    - name: Run terraform-docs and commit changes
      uses: terraform-docs/gh-actions@v1.0.0
      with:
        working-dir: "Terraform_modules/${{ matrix.module }}"
        output-method: inject
        git-push: "true"
robg-test commented 1 year ago

@cmbuckley How does this know to recursively update all of the README.md's?

cmbuckley commented 1 year ago

@robg-answer it uses the find-dir input of the action here.

Check the action docs: https://github.com/terraform-docs/gh-actions#inputs

JoeCSykes commented 1 year ago

how come this is picking up changes to the .idea folder when this is in the .gitignore file?

cmbuckley commented 1 year ago

Updated that now - .idea/ will ignore recursively, but .idea/* is seen as a glob match only at the top-level

JoeCSykes commented 1 year ago

I am happy for this to be merged now