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
Allowattribute 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 singleAllowsection. Duplicate IAM permissions, after LambdaSharp shorthand resolution, are removed.Required: No
Type: Either String or List of String
AllowedPattern-
The
AllowedPatternattribute specifies a regular expression that represents the patterns to allow forStringtypes.Required: No
Type: String
AllowedValues-
The
AllowedValuesattribute specifies a list of allowed values for the parameter.Required: No
Type: List of String
ConstraintDescription-
The
ConstraintDescriptionis used to explain a constraint when the constraint is violated.Required: No
Type: String
Default-
The
Defaultattribute 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
DefaultAttributeattribute 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 theArnattribute when available. Otherwise, it uses the return value of a!Refexpressions. This behavior can be overwritten by specifying aDefaultAttributeattribute.Required: No
Type: String
DeletionPolicy-
The
DeletionPolicyattribute specifies what to do with the resource when the stack is deleted. The value must be one of:RetainorSnapshot. TheDeletionPolicyattribute can only be used on conjunction with thePropertiessection.Required: No
Type: String
Description-
The
Descriptionattribute 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
EncryptionContextsection is an optional mapping of key-value pairs used for decrypting a variable of typeSecret. For all other types, specifyingEncryptionContextwill produce a compilation error.Required: No
Type: Key-Value Pair Mapping
Label-
The
Labelspecifies 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
MaxLengthattribute specifies an integer value that determines the largest number of characters you want to allow forStringtypes.Required: No
Type: Int
MaxValue-
The
MaxValueattribute specifies a numeric value that determines the largest numeric value you want to allow forNumbertypes.Required: No
Type: Int
MinLength-
The
MinLengthattribute specifies an integer value that determines the smallest number of characters you want to allow forStringtypes.Required: No
Type: Int
MinValue-
The
MinValueattribute specifies a numeric value that determines the smallest numeric value you want to allow forNumbertypes.Required: No
Type: Int
NoEcho-
The
NoEchoattribute 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
Parameterattribute 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
Pragmassection specifies directives that change the default compiler behavior.Required: No
Type: List of Pragma Definition
Properties-
The
Propertiessection 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
Propertiessection 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
Propertiessection cannot be specified for referenced resources. For a list of all additional options, see AWS Resource Types Reference.Required: No
Type: Map
Scope-
The
Scopeattribute specifies which functions need to have access to this item. TheScopeattribute can be a comma-separated list or a YAML list of function names. If all functions need the item, thenallcan be used as a wildcard. In addition,publiccan be used to export the item from the module. Alternatively,stackcan be used to make the item available only in a nested stack.Required: No
Type: Comma-delimited String or List of String
Section-
The
Sectionattribute 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
Typeattribute 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
Stringtype.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
!Reffunction), 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
!Reffunction), 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