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

Backport of [Feature] Add base64gzip function support to Packer template into release/1.11.x #13145

Conversation

hc-github-team-packer
Copy link
Collaborator

Backport

This PR is auto-generated from #13142 to be assessed for backporting due to the inclusion of the label backport/1.11.x.

The below text is copied from the body of the original PR.


Why

Packer doesn't support base64zip() which is a useful function to compress user_data or any string in Packer. However terraform indeed supports this function.

As one of the many usecases, AWS has limit the EC2 user_data size on 16KB. It's easier to over this size and we are willing to have this compress function.

Changes

  • Add base64gzip function support in Packer template
  • Add unittest for base64gzip function
  • Add mdx page for base64gzip function

Tests

  1. Build test: Confirmed we can decode base64gzip from the temporary instance user_data
$ aws ec2 describe-instance-attribute --instance-id i-031779e5c7811745e --attribute userData --output text --query "UserData.Value"  --region us-west-2 | base64 -d | gunzip | head
#cloud-config

# see /etc/cloud/cloud.cfg for order of operations for cloud-init

# This cloud_init will run during the image baking process
# Purpose: Install needed software, pull docker images and provision configs

write_files:
- path: /etc/ssh/sshd_config
  owner: root:root
  1. Test base64gzip() in Packer console, confirmed content in base64gzip
> local.user_data
> I2Nsb3VkL....
  1. Unittest

Overview of commits

@hc-github-team-packer hc-github-team-packer requested a review from a team as a code owner August 13, 2024 18:54
@hc-github-team-packer hc-github-team-packer force-pushed the backport/feature/add-base64gzip-function-support/forcibly-chief-toad branch from 606bc6e to b408cff Compare August 13, 2024 18:54
@hc-github-team-packer hc-github-team-packer merged commit 477c5c5 into release/1.11.x Aug 13, 2024
Copy link

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants