Skip to content

Commit

Permalink
Update E1010 lang ext function support (#3817)
Browse files Browse the repository at this point in the history
  • Loading branch information
kddejong authored Nov 8, 2024
1 parent 76c134c commit 9d83f3f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
17 changes: 13 additions & 4 deletions src/cfnlint/rules/functions/GetAtt.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,23 +32,32 @@ def __init__(self) -> None:
super().__init__("Fn::GetAtt", all_types)

def schema(self, validator, instance) -> dict[str, Any]:
resource_functions = []
resource_name_functions = []
resource_attribute_functions = ["Ref"]
if validator.context.transforms.has_language_extensions_transform():
resource_functions = ["Ref"]
resource_name_functions = resource_attribute_functions = [
"Ref",
"Fn::Base64",
"Fn::FindInMap",
"Fn::Sub",
"Fn::If",
"Fn::Join",
"Fn::ToJsonString",
]

return {
"type": ["string", "array"],
"minItems": 2,
"maxItems": 2,
"fn_items": [
{
"functions": resource_functions,
"functions": resource_name_functions,
"schema": {
"type": ["string"],
},
},
{
"functions": ["Ref"],
"functions": resource_attribute_functions,
"schema": {
"type": ["string"],
},
Expand Down
2 changes: 1 addition & 1 deletion test/unit/rules/functions/test_getatt.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ def validate(self, validator, s, instance, schema):
),
(
"Valid Ref in GetAtt for attribute",
{"Fn::GetAtt": ["MyBucket", {"Ref": "MyAttributeParameter"}]},
{"Fn::GetAtt": ["MyBucket", {"Fn::Sub": "${MyAttributeParameter}"}]},
{"type": "string"},
_template_with_transform,
{},
Expand Down

0 comments on commit 9d83f3f

Please sign in to comment.