Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: allow use of existing lambda_role vs creating it #85

Merged
merged 7 commits into from
Sep 7, 2020

Conversation

heathsnow
Copy link
Contributor

@heathsnow heathsnow commented Jul 7, 2020

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:

module "rds-unisem_aoi_yield_dw-alarms_slack" {
  # source            = "terraform-aws-modules/notify-slack/aws"
  # use fork source (below) until module source (above) merges fork.  The fork allows you to
  # pass in your own lambda_role instead of the module creating it.
  source            = "git::https://github.com/heathsnow/terraform-aws-notify-slack?ref=lambda_role"
  lambda_role       = data.terraform_remote_state.iam.outputs.lambda_slack_notifier_arn
  sns_topic_name    = "my_sns_topic_name"
  slack_webhook_url = "https://hooks.slack.com/services/foo"
  slack_channel     = "my-alerts"
  slack_username    = "my_alert"
}

@heathsnow heathsnow changed the title allow use of existing lambda_role vs creating it feat: allow use of existing lambda_role vs creating it Jul 7, 2020
@antonbabenko antonbabenko merged commit 60f3eed into terraform-aws-modules:master Sep 7, 2020
@antonbabenko
Copy link
Member

Thanks @heathsnow !

v4.3.0 has been just released.

@heathsnow heathsnow deleted the lambda_role branch December 8, 2020 00:00
@github-actions
Copy link

github-actions bot commented Nov 8, 2022

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 8, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants