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

Packer provider for terraform: dreaming a seamlessly IaaS management solution #29990

Open
albertogeniola opened this issue Nov 21, 2021 · 0 comments
Labels
enhancement new new issue not yet triaged

Comments

@albertogeniola
Copy link

Current Terraform Version

>=0.15.5

Use-cases

In my company, we managed to achieve 100% IaC cloud infrastructure definition (Terraform, thanks to you guys!), so every cloud project has its cloud infrastructure defined at terraform layer.
However, custom VM images do still require a separate building step, which happens manually (or via pipelines) using packer.
Therefore, our ambition, is to have the packer step handled in the same place where infrastructure definition takes place. In other words we'd like to have the packer-init + packer-build commands executed while applying a terraform file, so that the resulting image can be referenced in terraform VMs. In this way, if any of the packer definition steps change, terraform will trigger the image build step, assign a new version to the image, and all the terraform VMs referencing that image would update accordingly.

Attempted Solutions

At the moment, we use some local-exec tricks to make it happen. All our packer scripts require a "image-name" to be passed as variable. That image name is later referenced in Terraform VMs and, using depends_on, we force the packer step to happen before the usage of such images. The packer step is basically handled via null_resource, leveraging triggers to control whether or not the packer image should be re-built.

Proposal

The idea is to have a "Packer" provider at terraform level that handles Image resources. A packer-image resource would take as input the packer build json/HCL and return, as output, the image-id of the built artifact.

References

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement new new issue not yet triaged
Projects
None yet
Development

No branches or pull requests

1 participant