Module: Ufo::TaskDefinition::Helpers::Waf

Includes:
Utils::CallLine, Utils::Pretty
Defined in:
lib/ufo/task_definition/helpers/waf.rb

Instance Method Summary collapse

Methods included from Utils::Pretty

#pretty_home, #pretty_path, #pretty_time

Methods included from Utils::CallLine

#ufo_call_line

Instance Method Details

#waf(name, options = {}) ⇒ Object

Waf names are uniq within their scope. Tested with AWS console Only use regional since this is for ELB support Returns waf arn



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/ufo/task_definition/helpers/waf.rb', line 9

def waf(name, options={})
  resp = waf_client.list_web_acls(
    scope: "REGIONAL", # required, accepts CLOUDFRONT, REGIONAL
    # next_marker: "NextMarker",
    # limit: 1,
  )
  web_acl = resp.web_acls.find do |acl|
    acl.name == name
  end
  if web_acl
    web_acl.arn
  else
    # Logger causes infinite loop when waf helper used in .ufo/
    logger.warn "WARN: Web ACL not found: #{name}".color(:yellow)
    call_line = ufo_call_line
    DslEvaluator.print_code(call_line)
  end
end