Skip to content

Commit

Permalink
Don't replace Default values in SAM (#3874)
Browse files Browse the repository at this point in the history
  • Loading branch information
kddejong authored Dec 12, 2024
1 parent 644c119 commit 83c3910
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/cfnlint/template/transforms/_sam.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,10 @@ def _replace_variables_with_language_extension(self):
if "AWS::LanguageExtensions" in transforms:
parameters = {}
for k, v in self._template.get("Parameters", {}).items():
p_type = v.get("Type")
if isinstance(p_type, str):
if p_type.startswith("AWS::SSM::Parameter::"):
continue
if isinstance(v, dict) and v.get("Default"):
parameters[k] = v.get("Default")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ Parameters:
AutoPublishAliasParameter:
Type: String
Default: TestAliasRef
VpcId:
Type: "AWS::SSM::Parameter::Value<AWS::EC2::VPC::Id>"
Default: "/network/vpc/primary/id"
Mappings:
StackIdMap01:
teststack1:
Expand Down Expand Up @@ -63,3 +66,9 @@ Resources:
def handler(event, context):
print("Hello, world!")
AutoPublishAlias: !Ref AutoPublishAliasParameter

SecurityGroups:
Type: AWS::EC2::SecurityGroup
Properties:
GroupDescription: Example security group
VpcId: !Ref VpcId

0 comments on commit 83c3910

Please sign in to comment.