Sha256: 3d0865dce677a6c33596170a674ee6d4d59b2d5ffe91d8fd236d2f5c06901d34

Contents?: true

Size: 648 Bytes

Versions: 3

Compression:

Stored size: 648 Bytes

Contents

require "aws-sdk-ssm"

module Cody::Dsl::Project
  module Ssm
    # This method grabs the ssm parameter store value at "compile" time vs
    # CloudFormation run time. In case we need it as part of the DSL compile phase.
    def ssm(name)
      resp = ssm_client.get_parameter(name: name)
      if resp.parameter.type == "SecureString"
        resp = ssm_client.get_parameter(name: name, with_decryption: true)
      end

      resp.parameter.value
    rescue Aws::SSM::Errors::ParameterNotFound
      puts "WARN: #{name} not found on AWS SSM.".color(:yellow)
    end

    def ssm_client
      @ssm_client ||= Aws::SSM::Client.new
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
cody-1.2.1 lib/cody/dsl/project/ssm.rb
cody-1.1.0 lib/cody/dsl/project/ssm.rb
cody-1.0.6 lib/cody/dsl/project/ssm.rb