Skip to content

Commit

Permalink
Merge pull request #3 from movableink/mc/secrets
Browse files Browse the repository at this point in the history
Add secret retrieval
  • Loading branch information
mchesler authored Jan 29, 2018
2 parents fac1ac0 + be168f4 commit f936280
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
18 changes: 18 additions & 0 deletions lib/movable_ink/aws.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ def route53
@route53_client ||= Aws::Route53::Client.new(region: 'us-east-1')
end

def ssm
@ssm_client ||= Aws::SSM::Client.new(region: 'us-east-1')
end

def sns_slack_topic_arn
run_with_backoff do
sns.list_topics.topics.select {|topic| topic.topic_arn.include? "slack-aws-alerts"}
Expand Down Expand Up @@ -336,5 +340,19 @@ def list_all_r53_resource_record_sets(hosted_zone_id)
resource_record_sets
end
end

def get_secret(environment: mi_env, role:, attribute:)
run_with_backoff do
begin
resp = ssm.get_parameter(
name: "/#{environment}/#{role}/#{attribute}",
with_decryption: true
)
resp.parameter.value
rescue Aws::SSM::Errors::ParameterNotFound => e
nil
end
end
end
end
end
2 changes: 1 addition & 1 deletion lib/movable_ink/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module MovableInk
module AWS
VERSION = '0.0.7'
VERSION = '0.0.8'
end
end

0 comments on commit f936280

Please sign in to comment.