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

Modernize the Packer template in this repository #835

Open
wants to merge 15 commits into
base: develop
Choose a base branch
from

Conversation

mcdonnnj
Copy link
Member

🗣 Description

This pull request modernizes the Packer template in this repository by converting it from the old, legacy JSON format to the fresh, modern HCL format.

Note

The version of cisagov/pre-commit-packer in our pre-commit configuration is updated because we need a newer version to support the changes in this pull request.

💭 Motivation and context

Packer has officially supported (and preferred) using HCL for its templates since version 1.7.0 (released 2021-02-17). It makes sense to update the template in this repository to better align with Packer as it is now and improve the maintainability of the template.

🧪 Testing

Automated tests pass. I have used the updated configuration to build and deploy the AMIs in my development environment.

✅ Pre-approval checklist

  • This PR has an informative and human-readable title.
  • Changes are limited to a single goal - eschew scope creep!
  • All relevant type-of-change labels have been added.
  • I have read the CONTRIBUTING document.
  • These code changes follow cisagov code standards.
  • All relevant repo and/or project documentation has been updated
    to reflect the changes in this PR.
  • All new and existing tests pass.

This will provide settings for Packer such as a minimum version of
Packer required and any external plugins that the templates require.
Currently we use Debian Buster and Debian Bookworm for our Packer
templates so we define them both as data sources for use.
Provide basic information about the Packer templates and how to build
an AMI.
Since the new Packer configuration is in HCL2 we can use
`terraform-docs` to populate the Packer README with some information.
Although the information populated is limited it at least documents the
variables used by the configuration.
Update to reflect the conversion of the Packer configuration to HCL2.
@mcdonnnj mcdonnnj added breaking change This issue or pull request involves changes to existing functionality improvement This issue or pull request will add or improve functionality, maintainability, or ease of use hacktoberfest-accepted Pull request that should count toward Hacktoberfest participation packer Pull requests that update Packer code labels Oct 18, 2024
@mcdonnnj mcdonnnj requested a review from a team October 18, 2024 20:48
@mcdonnnj mcdonnnj self-assigned this Oct 18, 2024
Copy link
Member

@dav3r dav3r left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love it! 🚀

packer/README.md Outdated Show resolved Hide resolved
Comment on lines +19 to +26
Build an AMI with:

```console
cd packer
ansible-galaxy install --role-file ansible/requirements.yml
packer init .
packer build -only amazon-ebs.<target AMI> .
```
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We also should mention here how to build all of the AMIs at once like we do in the main repo README.

packer/variables.pkr.hcl Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change This issue or pull request involves changes to existing functionality hacktoberfest-accepted Pull request that should count toward Hacktoberfest participation improvement This issue or pull request will add or improve functionality, maintainability, or ease of use packer Pull requests that update Packer code
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

4 participants