Skip to content

Commit

Permalink
Return dict str_node when doing transform (#2996)
Browse files Browse the repository at this point in the history
  • Loading branch information
kddejong authored Jan 2, 2024
1 parent 624ad06 commit 6e39e8c
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/cfnlint/template/transforms/_language_extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import regex as re

from cfnlint.conditions._utils import get_hash
from cfnlint.decode.node import str_node
from cfnlint.helpers import FUNCTION_FOR_EACH
from cfnlint.template.transforms._types import TransformResult

Expand Down Expand Up @@ -197,10 +198,15 @@ def _replace_string_params(
pattern = r"\${[a-zA-Z0-9\.:]+}"
if not re.search(pattern, s):
return (True, s)

new_s = deepcopy(s)
for k, v in params.items():
s = re.sub(rf"\$\{{{k}\}}", v, s)
new_s = re.sub(rf"\$\{{{k}\}}", v, new_s)

if isinstance(s, str_node):
new_s = str_node(new_s, s.start_mark, s.end_mark)

return (not (bool(re.search(pattern, s))), s)
return (not (bool(re.search(pattern, new_s))), new_s)


class _ForEachValue:
Expand Down

0 comments on commit 6e39e8c

Please sign in to comment.