Skip to content

Commit d28f022

Browse files
committed
Add :resource-ids map to stack & stack-properties
1 parent 9076b6b commit d28f022

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

CHANGELOG.md

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

3+
- Add `:resource-ids` map to stack and stack-properties instances.
4+
35
## v0.25.1 (2025-02-28)
46

57
- Don't call ExecuteChangeSet on stack start when there are no

src/salmon/cloudformation.clj

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,7 @@
394394
{:stack-id stack-id
395395
:stack-name stack-name}
396396
e))))
397+
resources-map (resources-map resources)
397398
describe-r (describe-stack client stack-id)
398399
outputs-raw (-> describe-r :Outputs outputs-map-raw)
399400
parameters-raw (-> describe-r :Parameters parameters-map-raw)
@@ -405,7 +406,8 @@
405406
:outputs-raw outputs-raw
406407
:parameters (me/map-vals :ParameterValue parameters-raw)
407408
:parameters-raw parameters-raw
408-
:resources (resources-map resources)
409+
:resources resources-map
410+
:resource-ids (me/map-vals :PhysicalResourceId resources-map)
409411
:stack-id stack-id
410412
:tags-raw tags-raw
411413
:tags (me/map-vals :Value tags-raw)}))

test/salmon/cloudformation_test.clj

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -576,13 +576,18 @@
576576
(let [sys (ds/start (system-a (stack-a :template template-b)))]
577577
(is (= #{:OAI1 :OAI2}
578578
(->> sys ::ds/instances :services :stack-a :resources
579+
keys set)
580+
(->> sys ::ds/instances :services :stack-a :resource-ids
579581
keys set))
580582
"Resources are retrieved and attached to the stack instance")
581583
(is (= #{:DriftInformation :LastUpdatedTimestamp :PhysicalResourceId
582584
:ResourceStatus :ResourceType}
583585
(->> sys ::ds/instances :services :stack-a :resources
584586
vals (mapcat keys) set))
585587
"Resource maps have the expected keys")
588+
(let [oai1-id (-> sys ::ds/instances :services :stack-a :resource-ids :OAI1)]
589+
(is (and (string? oai1-id) (seq oai1-id))
590+
"Resource IDS are present in :resource-ids on the stack instance"))
586591
(ds/signal sys :salmon/delete)))
587592

588593
(deftest test-aws-error-messages

0 commit comments

Comments
 (0)