Skip to content

Allow specifying content for vagrantfile_template #104

@flmmartins

Description

@flmmartins

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

Today vagrantfile_template needs to be a file path.

Allow to specify vagrantfile_template_content in Vagrant post processor so I can use templatefile with it.

Use Case(s)

I want to specify my own SSH to be used in Vagrant instead of the public one therefore I would like to inject a vagrant with the following:

Vagrant.configure("2") do |config|
  config.ssh.private_key_path = ${my_ssh_key}
  config.ssh.forward_agent = true
end

This could be applied many configurations in the Vagrantfile. This is only an example.

Potential configuration

locals {
   vagrantfile = templatefile("vagrantfile.pkrtpl.hcl", { 
      my_ssh_key = "~/.ssh/rsa
    })
 }
 ....
 post-processor "vagrant" {
    vagrantfile_template_content = local.vagrantfile
 }  

Potential References

https://developer.hashicorp.com/packer/integrations/hashicorp/vagrant/latest/components/post-processor/vagrant

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions