54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
# File 'lib/cfn_flow/cli.rb', line 54
def deploy(environment)
ENV['CFN_FLOW_ENVIRONMENT'] = environment
begin
params = CfnFlow.stack_params(environment)
stack = CfnFlow.cfn_resource.create_stack(params)
rescue Aws::CloudFormation::Errors::ValidationError => e
raise Thor::Error.new(e.message)
end
say "Launching stack #{stack.name}"
say "Polling for events..."
invoke :events, [stack.name], ['--poll']
say "Stack Outputs:"
invoke :show, [stack.name], ['--format=outputs-table']
if options[:cleanup]
puts "Finding stacks to clean up"
list_stacks_in_service.select {|s|
s.name != stack.name && \
s.tags.any? {|tag| tag.key == 'CfnFlowEnvironment' && tag.value == environment }
}.map(&:name).each do |name|
delete(name)
end
end
end
|