Method: Codebuild::Deploy#find_stack

Defined in:
lib/codebuild/deploy.rb

#find_stack(stack_name) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/codebuild/deploy.rb', line 27

def find_stack(stack_name)
  return if ENV['TEST']
  resp = cfn.describe_stacks(stack_name: stack_name)
  resp.stacks.first
rescue Aws::CloudFormation::Errors::ValidationError => e
  # example: Stack with id demo-web does not exist
  if e.message =~ /Stack with/ && e.message =~ /does not exist/
    nil
  else
    raise
  end
end