module Formatron::CloudFormation
manage the CloudFormation
stack
Public Class Methods
deploy(aws:, bucket:, name:, target:, parameters:)
click to toggle source
rubocop:disable Metrics/MethodLength
# File lib/formatron/cloud_formation.rb, line 8 def self.deploy(aws:, bucket:, name:, target:, parameters:) stack_name = _stack_name name, target Formatron::LOG.info do "Deploy CloudFormation stack: #{stack_name}" end aws.deploy_stack( stack_name: stack_name, template_url: S3::CloudFormationTemplate.url( region: aws.region, bucket: bucket, name: name, target: target ), parameters: parameters ) end
destroy(aws:, name:, target:)
click to toggle source
rubocop:enable Metrics/MethodLength
# File lib/formatron/cloud_formation.rb, line 26 def self.destroy(aws:, name:, target:) stack_name = _stack_name name, target Formatron::LOG.info do "Destroy CloudFormation stack: #{stack_name}" end aws.delete_stack stack_name: stack_name end
outputs(aws:, bucket:, name:, target:)
click to toggle source
rubocop:disable Metrics/MethodLength
# File lib/formatron/cloud_formation.rb, line 35 def self.outputs(aws:, bucket:, name:, target:) if S3::CloudFormationTemplate.exists?( aws: aws, bucket: bucket, name: name, target: target ) stack_name = _stack_name name, target Formatron::LOG.info do "Query CloudFormation stack outputs: #{stack_name}" end aws.stack_outputs stack_name: stack_name else {} end end
stack_ready!(aws:, name:, target:)
click to toggle source
rubocop:enable Metrics/MethodLength
# File lib/formatron/cloud_formation.rb, line 53 def self.stack_ready!(aws:, name:, target:) aws.stack_ready! stack_name: _stack_name(name, target) end
Private Class Methods
_stack_name(name, target)
click to toggle source
# File lib/formatron/cloud_formation.rb, line 57 def self._stack_name(name, target) "#{name}-#{target}" end