feat: allow use of existing lambda_role vs creating it #85
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This module calls the terraform-aws-lambda module which takes an input variable lambda_role for use if you don't want the module to create the role.
This PR simply passes through the option of setting
lambda_role
and, if it's set (ie not an empty string), not to create the role but to use the set value instead.Motivation and Context
Many organizations require IAM creation to occur under a different user/role than that which deploys other types of resources. Many/most community modules support passing your own IAM roles as an option to the module creating it for this reason.
Breaking Changes
The logic I used (
create_role = var.lambda_role == ""
) is backwards compatible and doesn't have any breaking changes.How Has This Been Tested?
I tested this using my forked branch and calling the module like so: