class CfnParameter (construct)
Language | Type name |
---|---|
![]() | Amazon.CDK.CfnParameter |
![]() | github.com/aws/aws-cdk-go/awscdk/v2#CfnParameter |
![]() | software.amazon.awscdk.CfnParameter |
![]() | aws_cdk.CfnParameter |
![]() | aws-cdk-lib » CfnParameter |
Implements
IConstruct
, IDependable
A CloudFormation parameter.
Use the optional Parameters section to customize your templates. Parameters enable you to input custom values to your template each time you create or update a stack.
Example
const myTopic = new sns.Topic(this, 'MyTopic');
const url = new CfnParameter(this, 'url-param');
myTopic.addSubscription(new subscriptions.UrlSubscription(url.valueAsString));
Initializer
new CfnParameter(scope: Construct, id: string, props?: CfnParameterProps)
Parameters
- scope
Construct
— The parent construct. - id
string
- props
Cfn
— The parameter properties.Parameter Props
Creates a parameter construct.
Note that the name (logical ID) of the parameter will derive from it's coname
and location
within the stack. Therefore, it is recommended that parameters are defined at the stack level.
Construct Props
Name | Type | Description |
---|---|---|
allowed | string | A regular expression that represents the patterns to allow for String types. |
allowed | string[] | An array containing the list of values allowed for the parameter. |
constraint | string | A string that explains a constraint when the constraint is violated. |
default? | any | A value of the appropriate type for the template to use if no value is specified when a stack is created. |
description? | string | A string of up to 4000 characters that describes the parameter. |
max | number | An integer value that determines the largest number of characters you want to allow for String types. |
max | number | A numeric value that determines the largest numeric value you want to allow for Number types. |
min | number | An integer value that determines the smallest number of characters you want to allow for String types. |
min | number | A numeric value that determines the smallest numeric value you want to allow for Number types. |
no | boolean | Whether to mask the parameter value when anyone makes a call that describes the stack. |
type? | string | The data type for the parameter (DataType). |
allowedPattern?
Type:
string
(optional, default: No constraints on patterns allowed for parameter.)
A regular expression that represents the patterns to allow for String types.
allowedValues?
Type:
string[]
(optional, default: No constraints on values allowed for parameter.)
An array containing the list of values allowed for the parameter.
constraintDescription?
Type:
string
(optional, default: No description with customized error message when user specifies invalid values.)
A string that explains a constraint when the constraint is violated.
For example, without a constraint description, a parameter that has an allowed pattern of [A-Za-z0-9]+ displays the following error message when the user specifies an invalid value:
default?
Type:
any
(optional, default: No default value for parameter.)
A value of the appropriate type for the template to use if no value is specified when a stack is created.
If you define constraints for the parameter, you must specify a value that adheres to those constraints.
description?
Type:
string
(optional, default: No description for the parameter.)
A string of up to 4000 characters that describes the parameter.
maxLength?
Type:
number
(optional, default: None.)
An integer value that determines the largest number of characters you want to allow for String types.
maxValue?
Type:
number
(optional, default: None.)
A numeric value that determines the largest numeric value you want to allow for Number types.
minLength?
Type:
number
(optional, default: None.)
An integer value that determines the smallest number of characters you want to allow for String types.
minValue?
Type:
number
(optional, default: None.)
A numeric value that determines the smallest numeric value you want to allow for Number types.
noEcho?
Type:
boolean
(optional, default: Parameter values are not masked.)
Whether to mask the parameter value when anyone makes a call that describes the stack.
If you set the value to true
, the parameter value is masked with asterisks (*****
).
type?
Type:
string
(optional, default: String)
The data type for the parameter (DataType).
Properties
Name | Type | Description |
---|---|---|
creation | string[] | |
default | any | A value of the appropriate type for the template to use if no value is specified when a stack is created. |
logical | string | The logical ID for this CloudFormation stack element. |
no | boolean | Indicates if this parameter is configured with "NoEcho" enabled. |
node | Node | The tree node. |
stack | Stack | The stack in which this element is defined. |
type | string | The data type for the parameter (DataType). |
value | IResolvable | The parameter value as a Token. |
value | string[] | The parameter value, if it represents a string list. |
value | number | The parameter value, if it represents a number. |
value | string | The parameter value, if it represents a string. |
allowed | string | A regular expression that represents the patterns to allow for String types. |
allowed | string[] | An array containing the list of values allowed for the parameter. |
constraint | string | A string that explains a constraint when the constraint is violated. |
description? | string | A string of up to 4000 characters that describes the parameter. |
max | number | An integer value that determines the largest number of characters you want to allow for String types. |
max | number | A numeric value that determines the largest numeric value you want to allow for Number types. |
min | number | An integer value that determines the smallest number of characters you want to allow for String types. |
min | number | A numeric value that determines the smallest numeric value you want to allow for Number types. |
creationStack
Type:
string[]
default
Type:
any
A value of the appropriate type for the template to use if no value is specified when a stack is created.
If you define constraints for the parameter, you must specify a value that adheres to those constraints.
logicalId
Type:
string
The logical ID for this CloudFormation stack element.
The logical ID of the element is calculated from the path of the resource node in the construct tree.
To override this value, use overrideLogicalId(newLogicalId)
.
noEcho
Type:
boolean
Indicates if this parameter is configured with "NoEcho" enabled.
node
Type:
Node
The tree node.
stack
Type:
Stack
The stack in which this element is defined.
CfnElements must be defined within a stack scope (directly or indirectly).
type
Type:
string
The data type for the parameter (DataType).
value
Type:
IResolvable
The parameter value as a Token.
valueAsList
Type:
string[]
The parameter value, if it represents a string list.
valueAsNumber
Type:
number
The parameter value, if it represents a number.
valueAsString
Type:
string
The parameter value, if it represents a string.
allowedPattern?
Type:
string
(optional, default: No constraints on patterns allowed for parameter.)
A regular expression that represents the patterns to allow for String types.
allowedValues?
Type:
string[]
(optional, default: No constraints on values allowed for parameter.)
An array containing the list of values allowed for the parameter.
constraintDescription?
Type:
string
(optional, default: No description with customized error message when user specifies invalid values.)
A string that explains a constraint when the constraint is violated.
For example, without a constraint description, a parameter that has an allowed pattern of [A-Za-z0-9]+ displays the following error message when the user specifies an invalid value:
description?
Type:
string
(optional, default: No description for the parameter.)
A string of up to 4000 characters that describes the parameter.
maxLength?
Type:
number
(optional, default: None.)
An integer value that determines the largest number of characters you want to allow for String types.
maxValue?
Type:
number
(optional, default: None.)
A numeric value that determines the largest numeric value you want to allow for Number types.
minLength?
Type:
number
(optional, default: None.)
An integer value that determines the smallest number of characters you want to allow for String types.
minValue?
Type:
number
(optional, default: None.)
A numeric value that determines the smallest numeric value you want to allow for Number types.
Methods
Name | Description |
---|---|
override | Overrides the auto-generated logical ID with a specific ID. |
resolve(_context) | |
to | Returns a string representation of this construct. |
overrideLogicalId(newLogicalId)
public overrideLogicalId(newLogicalId: string): void
Parameters
- newLogicalId
string
— The new logical ID to use for this stack element.
Overrides the auto-generated logical ID with a specific ID.
resolve(_context)
public resolve(_context: IResolveContext): any
Parameters
- _context
IResolve
Context
Returns
any
toString()
public toString(): string
Returns
string
Returns a string representation of this construct.