lib/cfnguardian/resources/base.rb in cfn-guardian-0.10.4 vs lib/cfnguardian/resources/base.rb in cfn-guardian-0.11.0
- old
+ new
@@ -82,12 +82,15 @@
next
end
alarms = find_alarms(name)
- if alarms.empty?
+ if alarms.empty? && !['LogGroup'].any?(group)
# if the alarm doesn't exist and it's not being inherited from another alarm create a new alarm
+ # and is a supported a resource group.
+ # unsupported resource groups
+ # - LogGroup: this is not required as alarms are defined in the Metric Filters object in the resource group
resources = @resource.has_key?('Hosts') ? @resource['Hosts'] : [@resource]
resources.each do |res|
alarm = Kernel.const_get("CfnGuardian::Models::#{self.class.to_s.split('::').last}Alarm").new(res)
properties.each {|attr,value| update_object(alarm,attr,value)}
alarm.name = name
@@ -208,9 +211,13 @@
return @event_subscriptions.select {|es| es.enabled }
end
def get_cost()
return @alarms.length * 0.10
+ end
+
+ def resource_exists?
+ return true
end
private
def find_alarm(name)
\ No newline at end of file