Skip to content
This repository has been archived by the owner on Apr 21, 2020. It is now read-only.

Support getting credentials from instance metadata #37

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,21 @@
:display_name => 'New Relic AWS Cloudwatch Plugin Access Key',
:description => 'AWS Access Key for New Relic AWS Cloudwatch Plugin',
:type => 'string',
:required => 'required',
:required => 'optional',
:recipes => ['newrelic_plugins::aws_cloudwatch']

attribute 'newrelic/aws_cloudwatch/aws_secret_key',
:display_name => 'New Relic AWS Cloudwatch Plugin Secret Key',
:description => 'AWS Secret Key for New Relic AWS Cloudwatch Plugin',
:type => 'string',
:required => 'required',
:required => 'optional',
:recipes => ['newrelic_plugins::aws_cloudwatch']

attribute 'newrelic/aws_cloudwatch/use_aws_metadata',
:display_name => 'New Relic AWS Cloudwatch Plugin Use Instance Metadata',
:description => 'Use Instance Metadata for New Relic AWS Cloudwatch Plugin',
:type => 'boolean',
:required => 'optional',
:recipes => ['newrelic_plugins::aws_cloudwatch']

attribute 'newrelic/aws_cloudwatch/agents',
Expand Down Expand Up @@ -261,4 +268,4 @@
:description => 'User to run as for New Relic Wikipedia Example Ruby Plugin',
:type => 'string',
:required => 'required',
:recipes => ['newrelic_plugins::wikipedia_example_ruby']
:recipes => ['newrelic_plugins::wikipedia_example_ruby']
2 changes: 0 additions & 2 deletions recipes/aws_cloudwatch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
'node[:newrelic][:license_key]',
'node[:newrelic][:aws_cloudwatch][:install_path]',
'node[:newrelic][:aws_cloudwatch][:user]',
'node[:newrelic][:aws_cloudwatch][:aws_access_key]',
'node[:newrelic][:aws_cloudwatch][:aws_secret_key]',
'node[:newrelic][:aws_cloudwatch][:agents]'
]
end
Expand Down
12 changes: 11 additions & 1 deletion templates/default/aws_cloudwatch/newrelic_plugin.yml.erb
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,18 @@ newrelic:
#
aws:
# Update with your AWS account keys:
<%- if node[:newrelic][:aws_cloudwatch][:aws_access_key] %>
access_key: '<%= node[:newrelic][:aws_cloudwatch][:aws_access_key] %>'
<%- end %>
<%- if node[:newrelic][:aws_cloudwatch][:aws_secret_key] %>
secret_key: '<%= node[:newrelic][:aws_cloudwatch][:aws_secret_key] %>'
<%- end %>

# Disable the key checks and enable usage of AWS instance metadata for setting keys
<%- if node[:newrelic][:aws_cloudwatch][:use_aws_metadata] %>
use_aws_metadata: <%= node[:newrelic][:aws_cloudwatch][:use_aws_metadata] %>
<%- end %>

# Specify AWS regions to query for metrics
# regions:
# us-east-1
Expand All @@ -41,4 +51,4 @@ agents:
<% node[:newrelic][:aws_cloudwatch][:agents].each do |agent| %>
<%= agent %>:
overview: false
<% end %>
<% end %>