Skip to content

Commit

Permalink
Add :describe-stack-raw to stack and stack-properties instances
Browse files Browse the repository at this point in the history
  • Loading branch information
john-shaffer committed Jul 11, 2023
1 parent 6a7bc1f commit d3b0ead
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
`referencing-component-id` argument so that it can handle local-refs.
- Add `:parameters` and `:parameters-raw` maps to stack and stack-properties
instances.
- Add `:describe-stack-raw` to stack and stack-properties instances. This provides
access to the raw DescribeStack response.

## v0.9.0 (2023-07-08)

Expand Down
1 change: 1 addition & 0 deletions src/salmon/cloudformation.clj
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@
(let [outputs-raw (-> describe-r :Outputs outputs-map-raw)
parameters-raw (-> describe-r :Parameters parameters-map-raw)]
{:client client
:describe-stack-raw describe-r
:name stack-name
:outputs (me/map-vals :OutputValue outputs-raw)
:outputs-raw outputs-raw
Expand Down
18 changes: 17 additions & 1 deletion test/salmon/cloudformation_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,16 @@
"Outputs are correct")
(sig/delete! sys))))

(deftest test-describe-stack-raw
(let [stack-name (rand-stack-name)
sys (sig/start! (system-a (stack-a :capabilities #{"CAPABILITY_NAMED_IAM"} :name stack-name :template template-a)))]
(testing "Raw stack description is retrieved and attached to the stack-properties instance"
(is (= ["CAPABILITY_NAMED_IAM"]
(->> sys ::ds/instances :services :stack-a :describe-stack-raw :Capabilities)))
(is (inst?
(->> sys ::ds/instances :services :stack-a :describe-stack-raw :CreationTime))))
(sig/delete! sys)))

(deftest test-outputs
(let [stack-name (rand-stack-name)
template (assoc template-a :Outputs
Expand Down Expand Up @@ -305,7 +315,8 @@
system (atom nil)]
(testing ":start works"
(reset! system (sig/start! (system-b
(stack-a :lint? true
(stack-a :capabilities #{"CAPABILITY_NAMED_IAM"}
:lint? true
:name stack-name
:parameters {:Username "User1"}
:template template)
Expand All @@ -319,6 +330,11 @@
(->> @system ::ds/instances :services :stack-properties-a :resources
(map :LogicalResourceId) set))
"Resources are retrieved and attached to the stack-properties instance")
(testing "Raw stack description is retrieved and attached to the stack-properties instance"
(is (= ["CAPABILITY_NAMED_IAM"]
(->> @system ::ds/instances :services :stack-properties-a :describe-stack-raw :Capabilities)))
(is (inst?
(->> @system ::ds/instances :services :stack-properties-a :describe-stack-raw :CreationTime))))
(is (= {:Username "User1"}
(->> @system ::ds/instances :services :stack-properties-a :parameters))
"Parameters are retrieved and attached to the stack-properties instance")
Expand Down

0 comments on commit d3b0ead

Please sign in to comment.