module Terraformer module Credentials class Aws def self.get_from_options(options) credentials = {} %w(aws_region aws_access_key_id aws_secret_access_key).each do |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? end credentials.reject{ |k, v| v.nil? } end end end end