class Terracop::Cop::Aws::SecurityGroupRuleCop

Base class that provides helper methods for other Cops checking Security Group rules.

Protected Instance Methods

any_ip?() click to toggle source
# File lib/terracop/cop/aws/security_group_rule_cop.rb, line 23
def any_ip?
  attributes['cidr_blocks'].include?('0.0.0.0/0')
end
any_port?() click to toggle source
# File lib/terracop/cop/aws/security_group_rule_cop.rb, line 39
def any_port?
  (attributes['from_port']..attributes['to_port']).count == 65_536
end
egress?() click to toggle source
# File lib/terracop/cop/aws/security_group_rule_cop.rb, line 19
def egress?
  attributes['type'] == 'egress'
end
ingress?() click to toggle source
# File lib/terracop/cop/aws/security_group_rule_cop.rb, line 15
def ingress?
  attributes['type'] == 'ingress'
end
port?(port) click to toggle source
# File lib/terracop/cop/aws/security_group_rule_cop.rb, line 35
def port?(port)
  (attributes['from_port']..attributes['to_port']).include?(port)
end
tcp?() click to toggle source
# File lib/terracop/cop/aws/security_group_rule_cop.rb, line 27
def tcp?
  attributes['protocol'] == 'tcp'
end
udp?() click to toggle source
# File lib/terracop/cop/aws/security_group_rule_cop.rb, line 31
def udp?
  attributes['protocol'] == 'udp'
end