class Stack
Public Class Methods
new()
click to toggle source
# File lib/eops/stack.rb, line 3 def initialize @cfn = AWS::CloudFormation.new end
Public Instance Methods
create(template, stack_name, parameters = {}, wait=false)
click to toggle source
# File lib/eops/stack.rb, line 7 def create(template, stack_name, parameters = {}, wait=false) stack = @cfn.stacks.create(stack_name, File.open(template, "r").read, :parameters => parameters, :capabilities => ["CAPABILITY_IAM"], :disable_rollback => true) if wait while stack.status != "CREATE_COMPLETE" sleep 30 case stack.status when "ROLLBACK_IN_PROGESS" stack.delete when "ROLLBACK_COMPLETE" stack.delete end end end end
destroy(stack_name)
click to toggle source
# File lib/eops/stack.rb, line 28 def destroy(stack_name) stack = @cfn.stacks[stack_name] stack.delete while stack.exists? sleep 30 end end
list()
click to toggle source
# File lib/eops/stack.rb, line 36 def list @cfn.stacks.each do |stack| case stack.status when "CREATE_COMPLETE" puts "Stack Name: #{stack.name} | Status: Available" when "CREATE_IN_PROGRESS" puts "Stack Name: #{stack.name} | Status: In Progress" end end end