Tim-B / grunt-aws-lambda

A grunt plugin to assist in developing functions for AWS Lambda.
MIT License
247 stars 100 forks source link

Allow for all credential forms #34

Closed robbiet480 closed 9 years ago

robbiet480 commented 9 years ago

I totally agree that credentials shouldn't be hardcoded.

Having said that, I think it should be allowed. I just implemented grunt-aws and noticed that they support passed in keys but not profiles (although profiles can be used by using the AWS_PROFILE environment variable according to the AWS docs). I have a profile setup on my local computer, but other developers on my project may not have the same. I would rather have an IAM user which has specific permissions to support both projects and keep the credentials in an AWS supported credentials JSON file in the repo (yes, in the repo) instead of having to explain differences between hardcoded & profile (in addition to all the other credential methods)

This pull request allows passing in credentials to the library via the Grunt config or a JSON file. It also improves the README.md to list all possible authentication avenues (IAM role, profile, hardcoded, JSON file, environment variables).

Tim-B commented 9 years ago

Thanks for the pull request!

I'm still a bit undecided about whether this is a good idea.

If we do want to support hard coded credentials, perhaps it would be better to provide an option for setting a path which is passed to AWS.config.loadFromPath.

That way you could set your hard coded credentials in a separate file to your Gruntfile (and therefore could be excluded from version control), but it might still avoid the complications of using a profile.

robbiet480 commented 9 years ago

@Tim-B The credentials JSON option is built in now, in addition to the hardcoding of access key and secret key

robbiet480 commented 9 years ago

@Tim-B Thank you!