terraform-aws-ec2-instance icon indicating copy to clipboard operation
terraform-aws-ec2-instance copied to clipboard

Set repository shortname in .pre-commit-config.yaml

Open tofupup opened this issue 3 years ago β€’ 0 comments

Is your request related to a new offering from AWS?

No

Is your request related to a problem? Please describe.

When cloning the repository, and using the pre-commit-terraform docker container to run pre-commit checks, it requires modifying the .pre-commit-config.yaml file every clone/new branch to allow the wrappers/README.md to be properly generated. The module repo shortname is misdetected as lint if this is not set.

Describe the solution you'd like.

Modify .pre-commit-config.yaml to add the argument:

      - id: terraform_wrapper_module_for_each
        args:
          - '--args=--module-repo-shortname=ec2-instance'

Describe alternatives you've considered.

I submitted PR 431 to modify behavior of pre-commit-terraform to try to detect this itself, but it would be simpler to have this value set on cloning.

Additional context

This change should not impact people who don't use docker to run pre-commit, as the module repo shortname is valid regardless of running in the container or not.

This would break the situation where this repository was cloned to be used as the base for a new module. If the directory were renamed to the new module name, and the argument wasn't changed in .pre-commit-config.yaml, it would use ec2-instance still in the wrappers/README.md file. However, this seems a less likely scenario.

tofupup avatar Sep 05 '22 23:09 tofupup