Parameter
The Parameter
declaration specifies a value that is supplied at module deployment time either by the LambdaSharp CLI or a parent module. Module parameters can be modified subsequently by updating the CloudFormation stack in the AWS console.
Syntax
Parameter: String
Description: String
Section: String
Label: String
Scope: ScopeDefinition
NoEcho: Boolean
Default: String
AllowedValues:
- String
AllowedPattern: String
ConstraintDescription: String
MaxLength: Int
MaxValue: Int
MinLength: Int
MinValue: Int
Pragmas:
- PragmaDefinition
Type: String
Allow: AllowDefinition
DefaultAttribute: String
Properties:
ResourceProperties
DeletionPolicy: String
EncryptionContext:
Key-Value Mapping
Properties
Allow
-
The
Allow
attribute can be either a comma-separated, single string value, or a list of string values. String values that contain a colon (:
) are interpreted as IAM permission and used as is (e.g.dynamodb:GetItem
,s3:GetObject*
, etc.). Otherwise, the value is interpreted as a LambdaSharp shorthand (see LambdaSharp Shorthand by Resource Type). Both notations can be used simultaneously within a singleAllow
section. Duplicate IAM permissions, after LambdaSharp shorthand resolution, are removed.Required: No
Type: Either String or List of String
AllowedPattern
-
The
AllowedPattern
attribute specifies a regular expression that represents the patterns to allow forString
types.Required: No
Type: String
AllowedValues
-
The
AllowedValues
attribute specifies a list of allowed values for the parameter.Required: No
Type: List of String
ConstraintDescription
-
The
ConstraintDescription
is used to explain a constraint when the constraint is violated.Required: No
Type: String
Default
-
The
Default
attribute specifies a value to use when no value is provided for a module deployment. If the parameter defines value constraints, the default value must adhere to those constraints.Required: No
Type: String
DefaultAttribute
-
The
DefaultAttribute
attribute specifies the resource attribute to use when exporting the resource from the module or to a Lambda function. By default, the LambdaSharp CLI automatically selects theArn
attribute when available. Otherwise, it uses the return value of a!Ref
expressions. This behavior can be overwritten by specifying aDefaultAttribute
attribute.Required: No
Type: String
DeletionPolicy
-
The
DeletionPolicy
attribute specifies what to do with the resource when the stack is deleted. The value must be one of:Retain
orSnapshot
. TheDeletionPolicy
attribute can only be used on conjunction with theProperties
section.Required: No
Type: String
Description
-
The
Description
attribute specifies the parameter description. The description is shown in the AWS Console when creating or updating the CloudFormation stack.Required: No
Type: String
EncryptionContext
-
The
EncryptionContext
section is an optional mapping of key-value pairs used for decrypting a variable of typeSecret
. For all other types, specifyingEncryptionContext
will produce a compilation error.Required: No
Type: Key-Value Pair Mapping
Label
-
The
Label
specifies a human readable label for the parameter. This label is used instead of the parameter name by the AWS Console when updating a CloudFormation stack.Required: No
Type: String
MaxLength
-
The
MaxLength
attribute specifies an integer value that determines the largest number of characters you want to allow forString
types.Required: No
Type: Int
MaxValue
-
The
MaxValue
attribute specifies a numeric value that determines the largest numeric value you want to allow forNumber
types.Required: No
Type: Int
MinLength
-
The
MinLength
attribute specifies an integer value that determines the smallest number of characters you want to allow forString
types.Required: No
Type: Int
MinValue
-
The
MinValue
attribute specifies a numeric value that determines the smallest numeric value you want to allow forNumber
types.Required: No
Type: Int
NoEcho
-
The
NoEcho
attribute specifies whether to mask the parameter value when a call is made that describes the stack. If you set the value totrue
, the parameter value is masked with asterisks (*****).Required: No
Type: String
Parameter
-
The
Parameter
attribute specifies the parameter name. The name must start with a letter and followed only by letters or digits. Punctuation marks are not allowed. All names are case-sensitive.Required: Yes
Type: String
Pragmas
-
The
Pragmas
section specifies directives that change the default compiler behavior.Required: No
Type: List of Pragma Definition
Properties
-
The
Properties
section indicates the parameter represents a resource that can be specified at stack creation/update time. When omitted, the parameter is treated as a new resource that is instantiated.The
Properties
section specifies additional options that can be specified for a managed resource. This section is copied verbatim into the CloudFormation template and can use CloudFormation intrinsic functions (e.g.!Ref
,!Join
,!Sub
, etc.) for referencing other resources.The
Properties
section cannot be specified for referenced resources. For a list of all additional options, see AWS Resource Types Reference.Required: No
Type: Map
Scope
-
The
Scope
attribute specifies which functions need to have access to this item. TheScope
attribute can be a comma-separated list or a YAML list of function names. If all functions need the item, thenall
can be used as a wildcard. In addition,public
can be used to export the item from the module. Alternatively,stack
can be used to make the item available only in a nested stack.Required: No
Type: Comma-delimited String or List of String
Section
-
The
Section
attribute specifies a title for grouping related module inputs together. The AWS Console uses the title for laying out module inputs into sections. The order of the sections and the order of the module inputs in the section is determined by the order in which they occur in the module definition.Required: No
Type: String
Type
-
The
Type
attribute specifies the data type for the parameter. When omitted, the type is assumed to beString
.Required: No
Type: String
The following parameter types are supported by CloudFormation. When using other AWS resource types, LambdaSharp automatically declares them as
String
type.String
-
A literal string.
Secret
-
An encrypted string.
Number
-
An integer or float. The parameter value is validated as a number. However, when you use the parameter elsewhere in your module (for example, by using the
!Ref
function), the parameter value becomes a string. List<Number>
-
An array of integers or floats that are separated by commas. The parameter value is validated as numbers. However, when you use the parameter elsewhere in your module (for example, by using the
!Ref
function), the parameter value becomes a list of strings. CommaDelimitedList
-
An array of literal strings that are separated by commas. The total number of strings should be one more than the total number of commas. Also, each member string is space trimmed.
- AWS-Specific Parameter Types
-
AWS values such as Amazon EC2 key pair names and VPC IDs. For more information, see AWS-Specific Parameter Types.
- SSM Parameter Types
-
Parameters that correspond to existing parameters in Systems Manager Parameter Store. You specify a Systems Manager parameter key as the value of the SSM parameter, and AWS CloudFormation fetches the latest value from Parameter Store to use for the stack. For more information, see SSM Parameter Types.
Examples
A parameter
- Parameter: MyParameter
Description: A module parameter
An optional parameter
- Parameter: MyParameter
Description: A module parameter
Default: no value provided
A parameter with associated IAM permissions
- Parameter: MyTopic
Description: A topic ARN
Type: AWS::SNS::Topic
Allow: Publish
An optional parameter that generates a resource on default value
- Parameter: MyTopic
Description: A topic ARN
Type: AWS::SNS::Topic
Allow: Publish
Properties:
DisplayName: New topic display name