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

Can't go through validate hook with an pkrvars file as input #3

Open
1 task
schniber opened this issue Mar 24, 2021 · 2 comments
Open
1 task

Can't go through validate hook with an pkrvars file as input #3

schniber opened this issue Mar 24, 2021 · 2 comments
Assignees
Labels
improvement This issue or pull request will add or improve functionality, maintainability, or ease of use

Comments

@schniber
Copy link

💡 Summary

It would be great to allow the args to specify the path to the pkrvars file to be used when validating the packer files

Motivation and context

as of today the basic command with packer works :
packer validate -var-file="inputs/dev.pkrvars.hcl" .

However when using the pre-commit hook validate there is no way to map with the righ pkrvars file.
This would be useful because...

Implementation notes

Please provide details for implementation, such as:

an example would be :

repos:

Acceptance criteria

How do we know when this work is done?

  • Ability to run validate by providing a pkrvars.hcl file as input
@mcdonnnj mcdonnnj added the improvement This issue or pull request will add or improve functionality, maintainability, or ease of use label Mar 25, 2021
@mcdonnnj mcdonnnj self-assigned this Mar 25, 2021
@h3ct0rjs
Copy link

Hi, I'm currently writing a few pipelines and I would like to use this pre-commit option, I'm just wondering if this is implemented @mcdonnnj ?

I will check if I can add this to the code, but it will take me a while.

@mcdonnnj
Copy link
Member

mcdonnnj commented Oct 16, 2024

As of the 0.1.0 release you should be able to do this with:

repo: https://github.com/cisagov/pre-commit-packer
rev: v0.2.0
hooks:
  - id: packer_fmt
  - id: packer_validate
    args:
      - '-var-file=inputs/dev.pkrvars.hcl"'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement This issue or pull request will add or improve functionality, maintainability, or ease of use
Projects
None yet
Development

No branches or pull requests

3 participants