antonbabenko / pre-commit-terraform

pre-commit git hooks to take care of Terraform configurations 🇺🇦
MIT License
3.24k stars 541 forks source link

feat(`terraform-docs`): Add support for `replace` mode for TF 0.12+; Use native saving to file for TF 0.12+. Both requires `terraform-docs` v0.12.0+ which released in 2021. #705

Closed MaxymVlasov closed 3 months ago

MaxymVlasov commented 3 months ago

[!IMPORTANT] Should be merged after #706

Put an x into the box if that apply:

Description of your changes

Closes #179

How can we test changes

.terraform-docs.yml:

formatter: "md"
output:
  mode: replace
  template: |-
        {{ .Content }}

.pre-commit-config.yaml:


repos:
  - repo: https://github.com/antonbabenko/pre-commit-terraform
    rev: ece0c17b91c17b29201aba379f99e79f59813438
    hooks:
      - id: terraform_docs
        args:
          - --args=--config=.terraform-docs.yml
          ## Also CLI options have precedence over YAML config
          ##  that's default behavior of major chunk of tools, so we just preserve it.
          #- --args=--output-mode=inject
antonbabenko commented 3 months ago

This PR is included in version 1.94.0 :tada: