Skip to content

Commit

Permalink
[stack-deploy} Add assumeRolePolicyDocument
Browse files Browse the repository at this point in the history
  • Loading branch information
mbj committed Apr 21, 2024
1 parent a9817ad commit f29f76a
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions stack-deploy/src/StackDeploy/Stratosphere.hs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
module StackDeploy.Stratosphere
( allowResourcePolicy
, assumeRole
, assumeRolePolicyDocument
, dependencies
, getAtt
, getAttArn
Expand Down Expand Up @@ -72,6 +73,18 @@ assumeRole service =
)
]

assumeRolePolicyDocument :: CFT.Value Text -> JSON.Object
assumeRolePolicyDocument service =
[ ("Version", JSON.String "2012-10-17")
, ("Statement"
, JSON.object
[ ("Action", "sts:AssumeRole")
, ("Effect", "Allow")
, ("Principal", JSON.object [("Service", JSON.toJSON service)])
]
)
]

dependencies :: [CFT.Resource] -> CFT.Resource -> CFT.Resource
dependencies deps resource =
resource { CFT.dependsOn = pure (CFT.itemName <$> deps) }
Expand Down

0 comments on commit f29f76a

Please sign in to comment.