class Formatron::CloudFormation::Template
generates a CloudFormation
template
Constants
- REGION_MAP
Public Class Methods
base_64(value)
click to toggle source
# File lib/formatron/cloud_formation/template.rb, line 101 def self.base_64(value) { 'Fn::Base64' => value } end
find_in_map(map, key, property)
click to toggle source
# File lib/formatron/cloud_formation/template.rb, line 91 def self.find_in_map(map, key, property) { 'Fn::FindInMap' => [ map, key, property ] } end
get_attribute(resource, attribute)
click to toggle source
# File lib/formatron/cloud_formation/template.rb, line 107 def self.get_attribute(resource, attribute) { 'Fn::GetAtt' => [resource, attribute] } end
join(*items)
click to toggle source
# File lib/formatron/cloud_formation/template.rb, line 83 def self.join(*items) { 'Fn::Join' => [ '', items ] } end
new( formatron:, external:, hosted_zone_name:, key_pair:, administrator_name:, administrator_password:, kms_key:, hosted_zone_id:, target: )
click to toggle source
rubocop:disable Metrics/MethodLength rubocop:disable Metrics/ParameterLists
# File lib/formatron/cloud_formation/template.rb, line 13 def initialize( formatron:, external:, hosted_zone_name:, key_pair:, administrator_name:, administrator_password:, kms_key:, hosted_zone_id:, target: ) @formatron = formatron @external = external @external_formatron = external.formatron @external_outputs = external.outputs @hosted_zone_name = hosted_zone_name @key_pair = key_pair @administrator_name = administrator_name @administrator_password = administrator_password @kms_key = kms_key @hosted_zone_id = hosted_zone_id @bucket = formatron.bucket @name = formatron.name @target = target end
output(value)
click to toggle source
# File lib/formatron/cloud_formation/template.rb, line 113 def self.output(value) { Value: value } end
ref(logical_id)
click to toggle source
rubocop:enable Metrics/MethodLength
# File lib/formatron/cloud_formation/template.rb, line 77 def self.ref(logical_id) { Ref: logical_id } end
Public Instance Methods
hash()
click to toggle source
rubocop:disable Metrics/MethodLength
# File lib/formatron/cloud_formation/template.rb, line 42 def hash resources = {} outputs = {} parameters = {} @formatron.vpc.each do |key, vpc| template_vpc = VPC.new( vpc: vpc, external: @external_formatron.vpc[key], hosted_zone_name: @hosted_zone_name, key_pair: @key_pair, administrator_name: @administrator_name, administrator_password: @administrator_password, kms_key: @kms_key, hosted_zone_id: @hosted_zone_id, bucket: @bucket, name: @name, target: @target ) template_vpc.merge resources: resources, outputs: outputs end template_parameters = Parameters.new keys: @external_outputs.hash.keys template_parameters.merge parameters: parameters { AWSTemplateFormatVersion: '2010-09-09', Description: "Formatron stack: #{@formatron.name}", Mappings: { REGION_MAP => AWS::REGIONS }, Parameters: parameters, Resources: resources, Outputs: outputs } end