-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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 equivalent of terraform's textencodebase64 function #12982
Comments
Hi @josh-martin-1, PR open now, if you can please consider testing it before we merge it and release a new version of Packer, but hopefully this should work both for encode/decode much like Terraform does. Thanks for bringing this up! |
I just tested the changes that you made and it works perfectly for my use case (I only tested textencodebase64 function, didn't test the decode one). Do you know how long will it take for these changes to make it to an official Packer release? |
Hey @josh-martin-1, That depends if we can merge it in time, but given 1.11.0 is around the corner, this could be folded into it, so hopefully in a couple days you may be able to use those functions. Given the nature of the change though, I'm reasonably confident this can happen for 1.11.0, but we'll keep you updated on that subject. |
Hi @josh-martin-1, FYI we just released Packer 1.11.0 today, which embeds this change. Happy testing! |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. |
Community Note
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
Terraform has base64encode (UTF-8) function
https://developer.hashicorp.com/terraform/language/functions/base64encode
& textencodebase64 (UTF-16LE) function
https://developer.hashicorp.com/terraform/language/functions/textencodebase64
Packer only has base64encode (UTF-8)
https://developer.hashicorp.com/packer/docs/templates/hcl_templates/functions/encoding/base64encode
Use Case(s)
I would like an equivalent of Terraform's textencodebase64 function in Packer so I can use UTF-16LE/base64 for Windows image creation.
I am creating an autounattend.xml file for the Windows image creation, and I am using a template file (autounattend.xml.tpl) to insert text that needs the UTF-16LE/base64 encoding.
Potential configuration
Potential References
https://developer.hashicorp.com/terraform/language/functions/base64encode
https://developer.hashicorp.com/terraform/language/functions/textencodebase64
https://developer.hashicorp.com/packer/docs/templates/hcl_templates/functions/encoding/base64encode
https://learn.microsoft.com/en-us/windows-hardware/customize/desktop/unattend/microsoft-windows-shell-setup-useraccounts-administratorpassword#xml-example This doc from Microsoft has an example of the XML that I am trying to put in the autounattend.xml file. If you take the AdministratorPassword.Value from the XML example and put it into https://www.base64decode.org/ with the source character set set to UTF-16LE, you can see that the example password is "pwAdministratorPassword'.
The text was updated successfully, but these errors were encountered: