LambdaSharp Module Syntax
A LambdaSharp module is divided into three main components: details about the module, required dependencies, and item definitions, such as parameters, variables, resources, and functions.
Parameter values are provided at module deployment time. Optionally, parameters can act as conditional resources that are created when a parameter value is omitted.
Variables hold intermediate results that can be shared with other item definitions in the module. Variables are inlined during compilation and don't appear in the final output unless shared publicly.
Parameters, variables, and resources can be shared with other modules by making them
public. These can then be imported using cross-module references. Alternatively, they can be scoped as
stack, which makes them only available in a nested stack.
The LambdaSharp CLI
build command compiles the module into a CloudFormation template. The
publish command uploads the artifacts to the deployment bucket. Finally, the
deploy command creates/updates a CloudFormation stack.
Module: String Version: String Origin: String Description: String Pragmas: - PragmaDefinition Secrets: - String Using: - UsingDefinition Items: - ItemDefinition
Descriptionattribute specifies the description for the CloudFormation stack.
Itemssection specifies the items defined in the module, such as parameters, variables, resources, conditions, mappings, functions, nested stacks, resource type definitions, macro definitions, and module imports.
Type: List of Item Definition
Moduleattribute specifies the full name of the module. It must be formatted as
The module namespace and name can be retrieved using the
Module::Name, respectively. Alternatively, the full name can be retrieved using
Originattribute specifies the origin S3 bucket of the module. When omitted, the origin information is filled in when the module is published to an S3 bucket.
Pragmassection specifies directives that change the default compiler behavior.
Type: List of Pragma Definition
Usingsection specifies LambdaSharp modules that are used by this module. During the build phase, the manifests of the used modules are imported to validate their parameters and attributes. During the deploy phase, the used modules are automatically deployed when missing.
Type: List of Using Definition
Secretssection specifies which KMS keys can be used to decrypt parameter values. The module IAM role will get permission to use these keys (
Type: List of String (see Secrets Section)
Versionattribute specifies the version of the LambdaSharp module. The format of the version must be
Major.Minor[.Build[.Revision]][-Suffix]. Components in square brackets (
) are optional and can be omitted. The presence of the
-Suffixelement indicates a pre-release version.
The module version can be accessed as a variable in
!Suboperations using the
CloudFormation intrinsic functions are supported in item definitions where values can be specified.
LambdaSharp modules can use the
!Include pre-processor directive to include plain text files as strings or YAML files as nested objects. The
!Include directive can be used anywhere in a YAML file.
Module: My.Module Items: - !Include MyFirstItem