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

Issue with User Data script #20

Closed
yourbuddyconner opened this issue Aug 21, 2018 · 1 comment
Closed

Issue with User Data script #20

yourbuddyconner opened this issue Aug 21, 2018 · 1 comment

Comments

@yourbuddyconner
Copy link

yourbuddyconner commented Aug 21, 2018

Hey! Thanks for the module, it's super useful!

I ran into a little issue here: https://github.com/Guimove/terraform-aws-bastion/blob/master/user_data.sh#L116

The AWS CLI Command can result in multiple objects being listed on the same line which breaks the subsequent while read line loop.

I fixed it locally by changing it to:
aws s3api list-objects --bucket BUCKET --prefix public-keys/ --region REGION --output text --query 'Contents[?Size>0].Key' | sed -e 'y/\\t/\\n/' | tr '\t' '\n' > ~/keys_retrieved_from_s3

Note the replacement of tab characters with newlines: tr '\t' '\n'

I'd be happy to contribute a PR if it helps.

@Guimove
Copy link
Owner

Guimove commented Aug 29, 2018

Hello @yourbuddyconner
Thanks for you complimentary, I'm happy to know that my module is used by someone 😄

This is normally already done by the sed -e 'y/\\t/\\n/'
The tr should be useless
When have tested are you sure that sed -e 'y/\\t/\\n/' was replaced by sed -e 'y/\t/\n/' (notice the \) ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants