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 --chdir flag #12183

Open
gammore opened this issue Jan 5, 2023 · 2 comments · May be fixed by #12264
Open

Add --chdir flag #12183

gammore opened this issue Jan 5, 2023 · 2 comments · May be fixed by #12264

Comments

@gammore
Copy link

gammore commented Jan 5, 2023

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Please search the existing issues for relevant feature requests, and use the
reaction feature
(https://blog.github.com/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/)
to add upvotes to pre-existing requests.

Description

Hello! When using packer on my repo it would be very useful to be able to "chdir" o a folder when execution packer build.

The idea is the same on Terraform: https://developer.hashicorp.com/terraform/cli/commands#switching-working-directory-with-chdir

Use Case(s)

My repo structure is as follows:

repo/
  Makefile
  packer/
    variables/
      variables.pkrvars.hcl
    frontend/
      packer.pkr.hcl
    backend/
      packer.pkr.hcl
 
  terraform/
    terraform stuff

I would like to be able to execute packer from the root of my repo, from a Makefile, to make it very easy to build my images.

Potential configuration

An example of execution would be, using my repo structure above:

packer init -chdir packer/frontend/packer.pkr.hcl
packer build -chdir packer/frontend/packer.pkr.hcl -var-file packer/variables/variables.pkrvars.hcl
@teddylear
Copy link
Contributor

@gammore I can try to take a look at this.

@gammore
Copy link
Author

gammore commented Jan 31, 2023

@gammore I can try to take a look at this.

That would be great, thank you!

@teddylear teddylear linked a pull request Feb 12, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants