Module: Cumuliform::DSL::Functions
- Included in:
- Template
- Defined in:
- lib/cumuliform/dsl/functions.rb
Overview
DSL methods for working with CloudFormation Intrinsic and Ref functions
Defined Under Namespace
Modules: ConditionFunctions Classes: IntrinsicFunctions
Instance Method Summary collapse
-
#fn ⇒ IntrinsicFunctions
returns an instance of IntrinsicFunctions which provides wrappers for Fn::* functions.
-
#ref(logical_id) ⇒ Hash
Wraps Ref.
-
#xref(logical_id) ⇒ String
Checks
logical_id
is present and either returnslogical_id
or raises Cumuliform::Error::NoSuchLogicalId.
Instance Method Details
#fn ⇒ IntrinsicFunctions
returns an instance of IntrinsicFunctions which provides wrappers for Fn::* functions
333 334 335 |
# File 'lib/cumuliform/dsl/functions.rb', line 333 def fn @fn ||= IntrinsicFunctions.new(self) end |
#ref(logical_id) ⇒ Hash
Wraps Ref
CloudFormation evaluates the Ref
and returns the value of the Parameter or Resource with Logical ID logical_id
.
326 327 328 |
# File 'lib/cumuliform/dsl/functions.rb', line 326 def ref(logical_id) {"Ref" => xref(logical_id)} end |
#xref(logical_id) ⇒ String
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.
312 313 314 315 316 317 |
# 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 |