jbussdieker/puppet-cloud_file — pull request #1 by xentek (2014-07-02 04:38:09+00:00)
Title: Allow automatic authentication

The `aws-sdk` allows for automatic authentication through a variety of methods, most notably via the `~/.aws/config` file (used by the `aws-cli`), environment variables, and EC2 roles. The last one, and the motivation behind this pull request, will allow users of this module to avoid having to put their AWS credentials into a puppet manifest, which is obviously a very good thing™.

This pull request introduces two fundamental changes that should still be backwards compatible with current versions:

- set the default value of the `access_key_id` and `secret_access_key` params to `undef`, making them effectively `nil` if left unset.
- use `AWS.config` to set the keys with the `aws-sdk` but only if values for the keys were provided, enabling automatic configuration by the `aws-sdk`

This is my first pass and there are a couple of caveats:

- I am currently unsure if setting the defaults to `undef` will have any side effects.
- I didn't bump the version of the module (thought you might want to do that after it's been merged in).
- I didn't add any tests (I didn't see any examples in this project to build off of and I haven't written tests for puppet before so was unsure of where to start).
- With that said, I will be using my fork to configure a server and fix any issues I run into.

It would be great if someone could test this on an existing setup to ensure backwards compatibility, but I will do my best to test that this module works when you supply keys or default to automatic configuration from the environment.

Thanks for considering my patch!