module Cumuliform::DSL::Functions

DSL methods for working with CloudFormation Intrinsic and Ref functions

Public Instance Methods

fn() click to toggle source

returns an instance of IntrinsicFunctions which provides wrappers for Fn::* functions @return [IntrinsicFunctions] the DSL wrapper

# File lib/cumuliform/dsl/functions.rb, line 333
def fn
  @fn ||= IntrinsicFunctions.new(self)
end
ref(logical_id) click to toggle source

Wraps Ref

CloudFormation evaluates the Ref and returns the value of the Parameter or Resource with Logical ID logical_id.

@param logical_id [String] The logical ID of the parameter or resource @return [Hash] the Ref object

# File lib/cumuliform/dsl/functions.rb, line 326
def ref(logical_id)
  {"Ref" => xref(logical_id)}
end
xref(logical_id) click to toggle source

Checks logical_id is present and either returns logical_id or raises Cumuliform::Error::NoSuchLogicalId.

You can use it anywhere you need a string Logical ID and want the protection of having it be verified, for example in the cfn-init invocation in a Cfn::Init metadata block or the condition name field of, e.g. Fn::And.

@param logical_id [String] the logical ID you want to check @return [String] the logical_id param

# File lib/cumuliform/dsl/functions.rb, line 312
def xref(logical_id)
  unless has_logical_id?(logical_id)
    raise Error::NoSuchLogicalId, logical_id
  end
  logical_id
end