Skip to content

Conversation

tmccombs
Copy link
Contributor

@tmccombs tmccombs commented Oct 1, 2025

When reading the UserData for an instance, if the decoded user data isn't valid UTF-8, then store the base64 value in user_data_base64 instead of the raw value in user_data.

This ensures that we don't store an invalid string in the user_data field, resulting in invalid json.

In particular, this allows importing an aws_instance that has binary UserData without resulting in an invalid state.

Relations

Fixes: #44506

Rollback Plan

If a change needs to be reverted, we will publish an updated version of the library.

When reading the UserData for an instance, if the decoded user data isn't valid UTF-8, then store
the base64 value in user_data_base64 instead of the raw value in user_data.

This ensures that we don't store an invalid string in the `user_data` field, resulting in invalid
json.

In particular, this allows importing an aws_instance that has binary UserData without resulting in
an invalid state.

Fixes: hashicorp#44506
@tmccombs tmccombs requested a review from a team as a code owner October 1, 2025 16:44
Copy link
Contributor

github-actions bot commented Oct 1, 2025

Community Guidelines

This comment is added to every new Pull Request to provide quick reference to how the Terraform AWS Provider is maintained. Please review the information below, and thank you for contributing to the community that keeps the provider thriving! 🚀

Voting for Prioritization

  • Please vote on this Pull Request by adding a 👍 reaction to the original post to help the community and maintainers prioritize it.
  • Please see our prioritization guide for additional information on how the maintainers handle prioritization.
  • Please do not leave +1 or other comments that do not add relevant new information or questions; they generate extra noise for others following the Pull Request and do not help prioritize the request.

Pull Request Authors

  • Review the contribution guide relating to the type of change you are making to ensure all of the necessary steps have been taken.
  • Whether or not the branch has been rebased will not impact prioritization, but doing so is always a welcome surprise.

@github-actions github-actions bot added needs-triage Waiting for first response or review from a maintainer. service/ec2 Issues and PRs that pertain to the ec2 service. size/XS Managed by automation to categorize the size of a PR. labels Oct 1, 2025
@justinretzolk justinretzolk added bug Addresses a defect in current functionality. and removed needs-triage Waiting for first response or review from a maintainer. labels Oct 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Addresses a defect in current functionality. service/ec2 Issues and PRs that pertain to the ec2 service. size/XS Managed by automation to categorize the size of a PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Upgrade to v6 causes bad binary data to get written to user_data in state
2 participants