Skip to content

Commit

Permalink
Format example Dhall expression
Browse files Browse the repository at this point in the history
… and also fix the Dhall comment syntax
  • Loading branch information
Gabriella439 authored Nov 29, 2021
1 parent 28dddda commit 09e94a5
Showing 1 changed file with 26 additions and 24 deletions.
50 changes: 26 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,37 +31,39 @@ terraform {
```

```dhall
# assets_access.dhall
-- assets_access.dhall
let predicate =
https://raw.githubusercontent.com/mjgpy3/iam-dhall/20bcc9c507d353fb3736a633280239a922b91aa6/policy.dhall

let policy =
https://raw.githubusercontent.com/mjgpy3/iam-dhall/20bcc9c507d353fb3736a633280239a922b91aa6/output.dhall

let Aws : Type = { accountId : Text, region : Text }
let Aws
: Type
= { accountId : Text, region : Text }

{- Grant access to list the objects on a store, and get any object -}
let listGetBucketAccess = \(bucket: Text) ->
[ predicate.serviceAllow
predicate.Service.S3
[ "ListBucket" ]
[ bucket ]
// { sid = "ListObjects" }
, predicate.serviceAllow
predicate.Service.S3
[ "GetObject" ]
[ "${bucket}/*" ]
// { sid = "GetObject" }
]
let listGetBucketAccess =
\(bucket : Text) ->
[ predicate.serviceAllow
predicate.Service.S3
[ "ListBucket" ]
[ bucket ]
// { sid = "ListObjects" }
, predicate.serviceAllow
predicate.Service.S3
[ "GetObject" ]
[ "${bucket}/*" ]
// { sid = "GetObject" }
]

let assetsAccess = \(aws: Aws) ->
policy
aws
(
{- merge access to public-assets and static-assets -}
( listGetBucketAccess "public-assets" )
# ( listGetBucketAccess "static-assets" )
)
let assetsAccess =
\(aws : Aws) ->
policy
aws
( listGetBucketAccess "public-assets"
# listGetBucketAccess "static-assets"
)

in assetsAccess

in assetsAccess
```

0 comments on commit 09e94a5

Please sign in to comment.