Sha256: eca039ebea81a8717efb729ace4b5a84e2772b2d6824803d3b0330b8f6007b12
Contents?: true
Size: 855 Bytes
Versions: 2
Compression:
Stored size: 855 Bytes
Contents
module Terraformer module Credentials class AwsMissingCredentals < RuntimeError attr_reader :key def initialize(key) @key = key super(message) end def message "'#{key}' not passed. set it via CLI --#{key} or #{key.upcase} enviroment variable." end end class Aws KEYS = %w(aws_region aws_access_key_id aws_secret_access_key).freeze def self.get_from_options(options) KEYS.inject({}) do |credentials, key| aws_key = key.sub("aws_", "").to_sym credentials[aws_key] = options[key.to_sym].nil? ? options[key] : options[key.to_sym] credentials[aws_key] = ENV[key.upcase] if credentials[aws_key].nil? raise AwsMissingCredentals.new(key) if credentials[aws_key].nil? credentials end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
terraform-exporter-0.0.4 | lib/terraformer/credentials/aws.rb |
terraform-exporter-0.0.3 | lib/terraformer/credentials/aws.rb |