Sha256: d63dc15f468a37ce8d7775d3d3fb74592ab19b4595fea40bfa5730d37652d5b7

Contents?: true

Size: 561 Bytes

Versions: 2

Compression:

Stored size: 561 Bytes

Contents

module Subiam::DSL::Helper
  module Arn
    private

    def arn_policy_by_aws(name)
      "arn:aws:iam::aws:policy/#{name}"
    end

    def arn_policy_by_current_account(name)
      "arn:aws:iam::#{current_account}:policy/#{name}"
    end

    def current_account
      if @current_account
        return @current_account
      end
      aws_config = (@context.options && @context.options[:aws_config]) ? @context.options[:aws_config] : {}
      sts = Aws::STS::Client.new(aws_config)
      @current_account = sts.get_caller_identity.user_id
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
subiam-1.3.0 lib/subiam/dsl/helper/arn.rb
subiam-1.2.1 lib/subiam/dsl/helper/arn.rb