Module: References

Defined in:
lib/cfn-model/model/references.rb

Overview

this is a placeholder for anything related to resolving references

not sure if we are going to be able to have a useful generic set of code for references yet… in the meantime pile things up here and hope a pattern becomes clear

Class Method Summary collapse

Class Method Details

.is_security_group_id_external(group_id) ⇒ Object



9
10
11
# File 'lib/cfn-model/model/references.rb', line 9

def self.is_security_group_id_external(group_id)
  resolve_security_group_id(group_id).nil?
end

.resolve_security_group_id(group_id) ⇒ Object

Return nil if



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/cfn-model/model/references.rb', line 15

def self.resolve_security_group_id(group_id)
  return nil if group_id.is_a? String

  # an imported value can only yield a literal to an external sg vs. referencing something local
  if !group_id['Ref'].nil?
    group_id['Ref']
  elsif !group_id['Fn::GetAtt'].nil?
    logical_resource_id_from_get_att group_id['Fn::GetAtt']
  else # !group_id['Fn::ImportValue'].nil?
    # anything else will be string manipulation functions
    # which again leads us back to a string which must be an external security group known out of band
    # so don't/can't link it up to a security group
    return nil
  end
end