Skip to content
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

Disabling --lockfile for terraform_docs #212

Closed
nitrocode opened this issue Aug 11, 2021 · 5 comments
Closed

Disabling --lockfile for terraform_docs #212

nitrocode opened this issue Aug 11, 2021 · 5 comments

Comments

@nitrocode
Copy link

nitrocode commented Aug 11, 2021

I'm using the latest terraform-docs 0.15.0 which adds a way to disable reading the lockfile.

Locally this works

$ terraform-docs --version
terraform-docs version v0.15.0 darwin/amd64
$ terraform-docs md --lockfile=false .

I tried setting the following

repos:
  - repo: git:/antonbabenko/pre-commit-terraform
    rev: v1.50.0
    hooks:
      - id: terraform_docs
        args: ['--lockfile=false']

When the pre-commit hook runs, I get the following error

✗ git commit -m 'test'
Terraform docs...........................................................Failed
- hook id: terraform_docs
- exit code: 1

getopt: unrecognized option '--lockfile=false'

How do I set this correctly ?

I also tried setting a .terraform.docs.yml in the root of my repo but this doesn't seem to be consumed by the pre-commit.

settings:
  lockfile: false
@antonbabenko
Copy link
Owner

Hi,

I have not tried it myself yet but you can try it like it is described for terraform_tflint:

repos:
  - repo: git:/antonbabenko/pre-commit-terraform
    rev: v1.50.0
    hooks:
      - id: terraform_docs
        args: ['--args=--lockfile=false']

@nitrocode
Copy link
Author

Ah brilliant, that worked.

@adamantike
Copy link

@antonbabenko, should I file a separate issue to bring this option to the terraform_docs_replace hook? At the moment, whitelisting it will require some changes to the entrypoint:

$ pre-commit run --all-files terraform_docs_replace
Terraform docs (overwrite README.md).....................................Failed
- hook id: terraform_docs_replace
- exit code: 2

usage: terraform_docs_replace
       [-h]
       [--dest DEST]
       [--sort-inputs-by-required]
       [--sort-by-required]
       [--with-aggregate-type-defaults]
       [filenames ...]
terraform_docs_replace: error: unrecognized arguments: --args=--lockfile=false

@MaxymVlasov
Copy link
Collaborator

MaxymVlasov commented Nov 8, 2021

terraform_docs_replace is deprecated and its functional will be moved to terraform_docs in the next few months

See #248

@adamantike
Copy link

Thanks for the heads up. As soon as I went deeper on why this argument wasn't working for terraform_docs_replace, it was evident that many other flags from terraform-docs shouldn't be working right now, so I'm glad the idea to reduce complexity is being considered!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants