v0.5.6
Add support for declaring simple lambda permissions in-module @jpalomaki (#69)
## whatAllow lambda configuration author to optionally declare lambda:InvokeFunction
lambda permissions directly in this module.
More complex permissions configurations could still be done outside of this module.
why
This co-locates permissions related to the lambda in the module configuration (where we also declare lambda IAM role permissions), which can help a reader understand where the lambda is invoked from, e.g. in cases where the actual event sources are declared in a different root configuration.
In our specific use case, we use terragrunt to deploy the lambda function (straight from terraform registry module), so this feature would also help us avoid having to create a wrapper module just to add the necessary permission resources.
questions
- Because we support terraform 0.14+ (no default value support for optionals), we scope this to just the specific action
lambda:InvokeFunction
and keep the number of attributes a user has to fill in, small. Does this look like a sane approach (looks like it could cover a lot of ground already, judging by examples)? - Because we support terraform 0.14+, we can't do replace_triggered_by. Not entirely sure if that is a problem though, since we just attach the permission to the function itself (and not an alias or version)
- The resource
for_each
is keyed by list index, which isn't ideal, since it would force recreations if items are shuffled/inserted
references
Slack discussion, cc/ @osterman