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

Add possibility to generate hcl files with terraform-docs #199

Closed
lays147 opened this issue May 5, 2021 · 2 comments · Fixed by #232
Closed

Add possibility to generate hcl files with terraform-docs #199

lays147 opened this issue May 5, 2021 · 2 comments · Fixed by #232
Assignees
Labels
documentation Improvements or additions to documentation estimate/1h Need 1 hour to be done good first issue Good for newcomers hook/terraform_docs Bash hook

Comments

@lays147
Copy link

lays147 commented May 5, 2021

When using the terraform_docs hook I'm not able to generate the hcl file based on this setup:

repos:
    - repo: git://github.com/antonbabenko/pre-commit-terraform
      rev: v1.50.0 # Get the latest from: https://github.com/antonbabenko/pre-commit-terraform/releases
      hooks:
          - id: terraform_fmt
          - id: terraform_docs
          - id: terraform_docs
            args:
                [
                    "tfvars",
                    "hcl",
                    "--output-file",
                    "terraform.tfvars.model",
                    ".",
                ]
          - id: terraform_tflint
          - id: terraform_tfsec
➜  ecs-service-module git:(master) ✗ pre-commit run -a
Terraform fmt............................................................Passed
Terraform docs...........................................................Passed
Terraform docs...........................................................Failed
- hook id: terraform_docs
- exit code: 1

getopt: unrecognized option '--output-file'

Terraform validate with tflint...........................................Passed
Terraform validate with tfsec............................................Passed

Is it possible to add the possibility to generate the hcl, since apparently the command for terraform_tfdocs is directly connected with the markdown generation?

@MaxymVlasov
Copy link
Collaborator

Hi @lays147

Yes.

repos:
- repo: git://github.com/antonbabenko/pre-commit-terraform
  rev: v1.50.0
  hooks:
   - id: terraform_docs
     args:
       - tfvars hcl --output-file terraform.tfvars.model .

@MaxymVlasov MaxymVlasov added estimate/1h Need 1 hour to be done good first issue Good for newcomers hook/terraform_docs Bash hook documentation Improvements or additions to documentation labels Sep 9, 2021
@MaxymVlasov
Copy link
Collaborator

MaxymVlasov commented Sep 9, 2021

Can be fixed together with #208
TBD: Add/clarify doc how to use arguments with terraform_docs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation estimate/1h Need 1 hour to be done good first issue Good for newcomers hook/terraform_docs Bash hook
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants