fix(cloudformation): preserve nested dynamic reference opt-out (#6574)

* fix(cloudformation): preserve nested dynamic reference opt-out

Keep nested intrinsics on the RDS credential path outside the general dynamic-reference stage. Reuse the existing suspension counter and restore it after every exit.

Signed-off-by: Andre Kurait <AndreKurait@gmail.com>

* test(cloudformation): preserve joined-reference test documentation

Move the nested opt-out test above the joined-string Javadoc so the comment documents its original test. Preserve both test bodies unchanged.

Signed-off-by: Andre Kurait <AndreKurait@gmail.com>

---------

Signed-off-by: Andre Kurait <AndreKurait@gmail.com>
This commit is contained in:
Andre Kurait authored and GitHub committed 2026-10-25 22:53:18 -04:00
1 parent f1816dbb44
commit b5532028e1
3 files changed
+50 -13

No files matched your search

@@ -80,8 +80,8 @@ public class CloudFormationTemplateEngine {
private final AttributeValueResolver attributeValueResolver;
private final List<String> unresolvedIntrinsics = new ArrayList<>();
/**
* Above zero while {@code Fn::GetStackOutput}'s arguments resolve: CloudFormation hands them on
* with their dynamic references unresolved.
* Above zero while an intrinsic-only property or {@code Fn::GetStackOutput}'s arguments resolve,
* including nested intrinsic calls.
*/
private int dynamicReferencesSuspended;
@@ -234,7 +234,12 @@ public class CloudFormationTemplateEngine {
* only that property is allowed.
*/
public String resolveWithoutDynamicReferences(JsonNode node) {
return resolveIntrinsic(node);
dynamicReferencesSuspended++;
try {
return resolveIntrinsic(node);
} finally {
dynamicReferencesSuspended--;
}
}
private String resolveIntrinsic(JsonNode node) {
@@ -1041,12 +1046,7 @@ public class CloudFormationTemplateEngine {
if (value == null || value.isNull()) {
return "";
}
dynamicReferencesSuspended++;
try {
return resolveIntrinsic(value);
} finally {
dynamicReferencesSuspended--;
}
return resolveWithoutDynamicReferences(value);
}
/**