-
Notifications
You must be signed in to change notification settings - Fork 13
Open
Description
When using "Sub" with parameter values, if any of these are of the Number type and the default value is not wrapped in quotes it will error.
This will result in an error when using this library, but is valid to deploy.
pTargetDatabaseClusterNumber:
Type: Number
Description: The number of the Aurora Cluster where the database is hosted
Default: 1
This will not
pTargetDatabaseClusterNumber:
Type: Number
Description: The number of the Aurora Cluster where the database is hosted
Default: "1"
Error message:
pattern = '(?!\\$\\{\\!)[\\$\\{(\\w+[^}]*)\\](file://$/%7b(/w+%5b%5e%7d%5d*)/)}', repl = <function sub_l.<locals>.replace_var at 0x7ff2b6c48d60>
string = '{{resolve:ssm:/${pProduct}/${EnvShort}/${AWS::Region}/aurora/cluster/${pTargetDatabaseClusterNumber}/sec-grp/id}}', count = 0, flags = 0
def sub(pattern, repl, string, count=0, flags=0):
"""Return the string obtained by replacing the leftmost
non-overlapping occurrences of the pattern in string by the
replacement repl. repl can be either a string or a callable;
if a string, backslash escapes in it are processed. If it is
a callable, it's passed the Match object and must return
a replacement string to be used."""
> return _compile(pattern, flags).sub(repl, string, count)
E TypeError: sequence item 7: expected str instance, int found
/usr/lib/python3.11/re/__init__.py:185: TypeError
------------------------------------------------------------------------------- Captured stdout call --------------------------------------------------------------------------------
<cloud_radar.cf.unit._template.Template object at 0x7ff2b6c544d0>
Cloudformation snippets:
AWSTemplateFormatVersion: 2010-09-09
Parameters:
pTargetDatabaseClusterNumber:
Type: Number
Description: The number of the Aurora Cluster where the database is hosted
Default: 1
pProduct:
Type: String
Description: The resources are part of which product
Default: dummy
Resources:
rFunctionSecurityGroup:
Type: AWS::EC2::SecurityGroup
Properties:
GroupName: !Sub '${pProduct}-${AWS::Region}-lmb-sg'
GroupDescription: Lambda security group
VpcId: !Sub '{{resolve:ssm:/${pProduct}/dev/${AWS::Region}/vpc/id/horizontal-vpc}}'
SecurityGroupEgress:
- IpProtocol: 'tcp'
DestinationSecurityGroupId: !Sub '{{resolve:ssm:/${pProduct}/dev/${AWS::Region}/aurora/cluster/${pTargetDatabaseClusterNumber}/sec-grp/id}}'
Description: !Sub 'RDS Access to cluster ${pTargetDatabaseClusterNumber}'
FromPort: 5432
ToPort: 5432
Metadata
Metadata
Assignees
Labels
No labels