From 9e5adfb9ce59493892d754069c9158b6f1f4266e Mon Sep 17 00:00:00 2001 From: Adam Pippin Date: Wed, 17 Feb 2021 02:52:55 -0800 Subject: [PATCH] Bugfix: !if that creates cfn conditions properly replaces parent node --- app/Cfnpp/Functions.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/Cfnpp/Functions.php b/app/Cfnpp/Functions.php index 59aa9bf..29131a8 100644 --- a/app/Cfnpp/Functions.php +++ b/app/Cfnpp/Functions.php @@ -195,13 +195,14 @@ class Functions $n_orig = new Node(null, $node->hasName() ? $node->getName() : null); $n_if = new Node($n_orig, 'Fn::If'); + $n_orig->addChild($n_if); $n_if->addChild(new NodeValue($n_if, null, $condition_name)); $n_if->addChild($if_true); if (isset($if_false)) { $n_if->addChild($if_false); } - return $n_if; + return $n_orig; } /**