VirtusLab / besom

Besom - a Pulumi SDK for Scala. Also, incidentally, a broom made of twigs tied round a stick. Brooms and besoms are used for protection, to ward off evil spirits, and cleansing of ritual spaces.
https://virtuslab.github.io/besom/
Apache License 2.0
113 stars 7 forks source link

Add `Output.when` convenience method #435

Closed pawelprazak closed 2 months ago

pawelprazak commented 3 months ago

Allow for easy combination of Output[Boolean] and Output[Resource] to mamy Output[Option[Resource]].

e.g. instead of

 val databaseInstance: Output[Option[Output[Server]]] =
    bootzookaConfig.dbEnabled.map(Option.when(_)(postgresDatabase(appName, resourceGroup, bootzookaConfig.sql)))

allow for:

val databaseInstance: Output[Option[Server]] = Output.when(bootzookaConfig.dbEnabled)(postgresDatabase(appName, resourceGroup, bootzookaConfig.sql)