Skip to content

Commit b0c395d

Browse files
committed
Short-circuit when change set has no changes
- Don't call ExecuteChangeSet on stack start when there are no changes in the change set. Fix a spurious error when using a change set with no changes on a stack in an `UPDATE_ROLLBACK_COMPLETE` state. Short-circuit when changes is empty. This fixes a mistaken error when stack-start! believes that we made changes and throws on seeing `UPDATE_ROLLBACK_COMPLETE` because it thinks that we caused it. This also avoids an unnecessary ExecuteChangeSet operation.
1 parent 1c32585 commit b0c395d

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
## Unreleased
22

3+
- Don't call ExecuteChangeSet on stack start when there are no
4+
changes in the change set. Fix a spurious error when using a
5+
change set with no changes on a stack in an
6+
`UPDATE_ROLLBACK_COMPLETE` state.
7+
38
## v0.25.0 (2025-02-26)
49

510
- Add :template-url option to change-set and stack components.

src/salmon/cloudformation.clj

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -419,13 +419,15 @@
419419
(aws/client {:api :cloudformation :region region}))]
420420
(if inst-client
421421
instance
422-
(let [{:keys [stack-id]} change-set
422+
(let [{:keys [changes stack-id]} change-set
423423
ex! (if change-set
424424
(fn []
425-
(let [r (execute-change-set! client name change-set)]
426-
(if (u/anomaly? r)
427-
[stack-id false]
428-
[stack-id true])))
425+
(if (seq changes)
426+
(let [r (execute-change-set! client name change-set)]
427+
(if (u/anomaly? r)
428+
[stack-id false]
429+
[stack-id true]))
430+
[stack-id false]))
429431
#(cou-stack! client signal (template-data config :template template :validate? false)))]
430432
(validate! signal)
431433
(loop [[r updated?] (ex!)]

0 commit comments

Comments
 (0)