7.1.0 • Published 4 days ago

@openaddresses/cloudfriend v7.1.0

Weekly downloads
-
License
ISC
Repository
github
Last release
4 days ago

cloudfriend

Build Status

Helper functions for assembling CloudFormation templates in JavaScript.

Intrinsic functions and conditions

These are functions that you can use in place of various CloudFormation objects.

CloudFriendCloudFormation
base64(value)Fn::Base64
cidr(ipBlock, count, cidrBits)Fn::Cidr
findInMap(mapping, key, attr)Fn::FindInMap
getAtt(obj, key)Fn::GetAtt
getAzs(region)Fn::GetAZs
join(delimiter, pieces)Fn::Join
split(delimiter, string)Fn::Split
select(index, list)Fn::Select
ref(name)Ref
userData(list)Fn::Base64 and Fn::Join with \n delimiter
and(conditions)Fn::And
equals(a, b)Fn::Equals
if(condition, ifTrue, ifFalse)Fn::If
not(condition)Fn::Not
or(conditions)Fn::Or
notEquals(a, b)Fn::Not and Fn::Equals
sub(str, variables)Fn::Sub
importValue(sharedValue)Fn::ImportValue,
arn(service, suffix)Fn::Sub designed for an ARN
transform(name, parameters)Fn::Transform
contains(strings, s)Fn::Contains
eachMemberEquals(strings, s)Fn::EachMemberEquals
eachMemberIn(stringsToCheck, stringsToMatch)Fn::EachMemberIn
refAll(parameterType)Fn::RefAll
valueOf(parameterLogicalId, attribute)Fn::ValueOf
valueOfAll(parameterType, attribute)Fn::ValueOfAll

Pseudo parameters

These are static properties of cloudfriend that you can use to reference various CloudFormation objects.

CloudFriendCloudFormation
accountIdAWS::AccountId
notificationArnsAWS::NotificationARNs
noValueAWS::NoValue
regionAWS::Region
stackIdAWS::StackId
stackNameAWS::StackName
partitionAWS::Partition
urlSuffixAWS::URLSuffix

Other helpers

methoddescription
build(file, opts)Builds a template defined by a static JavaScript export, a synchronous or an asynchronous function.
merge(...template)Merges templates together. Throws errors if logical names are reused. Transform macros from all template arguments are merged into a single array, in order of their appearance in the template arguments, and an error is thrown if any macro is repeated.

CLI tools

By installing cloudfriend globally, it can provide you with simple CLI tools for building and validating CloudFormation templates.

# either...
$ git clone https://github.com/mapbox/cloudfriend && cd cloudfriend && npm link
# ... or ...
$ npm install -g @mapbox/cloudfriend

Then, to build a template:

# Prints the template as JSON to stdout
$ build-template path/to/template.js
7.1.0

4 days ago

7.0.0

1 year ago

6.0.0

1 year ago