Skip to content

Commit

Permalink
Merge pull request #2 from orenmaor/ability-to-use-iam
Browse files Browse the repository at this point in the history
Ability to use iam role
  • Loading branch information
amalucelli authored Apr 2, 2017
2 parents c2a40f0 + 2d5a97c commit 127303e
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 12 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
Changes
=======

# 1.1.6 / 2017-02-22
* Removed the requirement for `aws_access_key_id` and `aws_secret_access_key` attributes values.

# 1.1.5 / 2017-01-31
* Implementing a better way to handle AWS CloudWatch Logs configurations,
now each log has a configuration file that is provisioned via Chef Resources.
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Agent and deploy it's configurations automatically.

Add this cookbook to your base recipe:
```ruby
cookbook 'aws-cloudwatchlogs', '~> 1.1.5'
cookbook 'aws-cloudwatchlogs', '~> 1.1.6'
```

You need to configure the following node attributes via an `environment` or `role`:
Expand Down Expand Up @@ -47,6 +47,7 @@ default['aws_cwlogs']['log']['syslog'] = {
'log_group_name' => '/var/log/syslog'
}
```
**Note**: If you do not specify aws credentials, it will attempt to use the AWS IAM Role assigned to the instance instead.

Once you defined the attributes, you will need to reference `aws_cwlogs` resource in your recipe:
```ruby
Expand Down
2 changes: 1 addition & 1 deletion metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
license 'Apache 2.0'
description 'Installs/Configures AWS CloudWatch Logs Agent'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version '1.1.5'
version '1.1.6'
source_url 'https://github.com/amalucelli/chef-cloudwatchlogs' if respond_to? :source_url
issues_url 'https://github.com/amalucelli/chef-cloudwatchlogs/issues' if respond_to? :issues_url
10 changes: 0 additions & 10 deletions recipes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,6 @@
return
end

if node['aws_cwlogs']['aws_access_key_id'].nil?
log('AWS Access Key is necessary for this cookbook.') { level :error }
return
end

if node['aws_cwlogs']['aws_secret_access_key'].nil?
log('AWS Secret Access Key is necessary for this cookbook.') { level :error }
return
end

# only install if it isn't installed
include_recipe 'aws-cloudwatchlogs::install' unless ::File.exist?(node['aws_cwlogs']['path'])
# always reconfigure aws cloudwatch logs configuration files
Expand Down
4 changes: 4 additions & 0 deletions templates/default/aws.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,9 @@
cwlogs = cwlogs
[default]
region = <%= @awsRegion %>
<% if ! @awsAccessKey.nil? %>
aws_access_key_id = <%= @awsAccessKey %>
<% end %>
<% if ! @awsSecretKey.nil? %>
aws_secret_access_key = <%= @awsSecretKey %>
<% end %>

0 comments on commit 127303e

Please sign in to comment.