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

Shell Provisioner AWS EC2 Mac not escaping $() ${} #12655

Closed
gurfink opened this issue Oct 16, 2023 · 1 comment
Closed

Shell Provisioner AWS EC2 Mac not escaping $() ${} #12655

gurfink opened this issue Oct 16, 2023 · 1 comment
Labels

Comments

@gurfink
Copy link

gurfink commented Oct 16, 2023

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

When filing a bug, please include the following headings if possible. Any
example text in this template can be deleted.

Overview of the Issue

Building a Mac AWS EC2 AMI and utilising provisioner inline shell to create an instance start up script that when run on init of the instance will automate start up of a few things and access the instance Meta Data service to get an instance tag value to configure something, e.g;

provisioner "shell" { inline = [ "sudo cat > /usr/local/aws/suncorp/startup.sh <<EOF", "#!/bin/bash", "instanceid=$$(curl -s http://169.254.169.254/latest/meta-data/instance-id)" "EOF" ]}

The translation/escape of the $$ ends up being translated as a number instead of $, e.g;
instanceid=604(curl -s http://169.254.169.254/latest/meta-data/instance-id)

I've tried both bash and zsh as I know shells cause issue on escapes in ubuntu.

Reproduction Steps

Attempt to escape '$' character in inline provisioner shell create an Amazon Mac instance type (mac1.metal or mac2.metal) as per overview. The escaping of the '$' ends up becoming a numeric value.

Packer version

1.9.4

Operating system and Environment details

AWS Mac EC2 instances

@gurfink gurfink added the bug label Oct 16, 2023
@gurfink gurfink closed this as completed Oct 16, 2023
Copy link

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.
If you have found a problem that seems similar to this, 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 Nov 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant