Skip to content

Commit 83c3910

Browse files
authored
Don't replace Default values in SAM (#3874)
1 parent 644c119 commit 83c3910

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

src/cfnlint/template/transforms/_sam.py

+4
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,10 @@ def _replace_variables_with_language_extension(self):
151151
if "AWS::LanguageExtensions" in transforms:
152152
parameters = {}
153153
for k, v in self._template.get("Parameters", {}).items():
154+
p_type = v.get("Type")
155+
if isinstance(p_type, str):
156+
if p_type.startswith("AWS::SSM::Parameter::"):
157+
continue
154158
if isinstance(v, dict) and v.get("Default"):
155159
parameters[k] = v.get("Default")
156160

test/fixtures/templates/good/transform/language_extension.yaml

+9
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ Parameters:
1010
AutoPublishAliasParameter:
1111
Type: String
1212
Default: TestAliasRef
13+
VpcId:
14+
Type: "AWS::SSM::Parameter::Value<AWS::EC2::VPC::Id>"
15+
Default: "/network/vpc/primary/id"
1316
Mappings:
1417
StackIdMap01:
1518
teststack1:
@@ -63,3 +66,9 @@ Resources:
6366
def handler(event, context):
6467
print("Hello, world!")
6568
AutoPublishAlias: !Ref AutoPublishAliasParameter
69+
70+
SecurityGroups:
71+
Type: AWS::EC2::SecurityGroup
72+
Properties:
73+
GroupDescription: Example security group
74+
VpcId: !Ref VpcId

0 commit comments

Comments
 (0)