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: Updated version of Terraform AWS Lambda module to support multiple copies #117

Merged
merged 1 commit into from
Nov 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
repos:
- repo: git://github.com/antonbabenko/pre-commit-terraform
rev: v1.43.0
rev: v1.44.0
hooks:
- id: terraform_fmt
- id: terraform_validate
- id: terraform_docs
- id: terraform_tflint
args:
Expand All @@ -20,6 +21,6 @@ repos:
- '--args=--only=terraform_standard_module_structure'
- '--args=--only=terraform_workspace_remote'
- repo: git://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
rev: v3.3.0
hooks:
- id: check-merge-conflict
12 changes: 10 additions & 2 deletions examples/cloudwatch-alerts-to-slack/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,16 @@ resource "aws_kms_ciphertext" "slack_url" {
module "notify_slack" {
source = "../../"

for_each = toset([
"develop",
"release",
"test",
])

sns_topic_name = "slack-topic"

lambda_function_name = "notify_slack_${each.value}"

slack_webhook_url = aws_kms_ciphertext.slack_url.ciphertext_blob
slack_channel = "aws-notification"
slack_username = "reporter"
Expand All @@ -43,9 +51,9 @@ resource "aws_cloudwatch_metric_alarm" "lambda_duration" {
threshold = "5000"
alarm_description = "Duration of notifying slack exceeds threshold"

alarm_actions = [module.notify_slack.this_slack_topic_arn]
alarm_actions = [module.notify_slack["develop"].this_slack_topic_arn]

dimensions = {
FunctionName = module.notify_slack.notify_slack_lambda_function_name
FunctionName = module.notify_slack["develop"].notify_slack_lambda_function_name
}
}
16 changes: 8 additions & 8 deletions examples/cloudwatch-alerts-to-slack/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
output "this_sns_topic_arn" {
description = "The ARN of the SNS topic from which messages will be sent to Slack"
value = module.notify_slack.this_slack_topic_arn
value = module.notify_slack["develop"].this_slack_topic_arn
}

output "lambda_iam_role_arn" {
description = "The ARN of the IAM role used by Lambda function"
value = module.notify_slack.lambda_iam_role_arn
value = module.notify_slack["develop"].lambda_iam_role_arn
}

output "lambda_iam_role_name" {
description = "The name of the IAM role used by Lambda function"
value = module.notify_slack.lambda_iam_role_name
value = module.notify_slack["develop"].lambda_iam_role_name
}

output "notify_slack_lambda_function_arn" {
description = "The ARN of the Lambda function"
value = module.notify_slack.notify_slack_lambda_function_arn
value = module.notify_slack["develop"].notify_slack_lambda_function_arn
}

output "notify_slack_lambda_function_name" {
description = "The name of the Lambda function"
value = module.notify_slack.notify_slack_lambda_function_name
value = module.notify_slack["develop"].notify_slack_lambda_function_name
}

output "notify_slack_lambda_function_invoke_arn" {
description = "The ARN to be used for invoking Lambda function from API Gateway"
value = module.notify_slack.notify_slack_lambda_function_invoke_arn
value = module.notify_slack["develop"].notify_slack_lambda_function_invoke_arn
}

output "notify_slack_lambda_function_last_modified" {
description = "The date Lambda function was last modified"
value = module.notify_slack.notify_slack_lambda_function_last_modified
value = module.notify_slack["develop"].notify_slack_lambda_function_last_modified
}

output "notify_slack_lambda_function_version" {
description = "Latest published version of your Lambda function"
value = module.notify_slack.notify_slack_lambda_function_version
value = module.notify_slack["develop"].notify_slack_lambda_function_version
}
2 changes: 1 addition & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ resource "aws_sns_topic_subscription" "sns_notify_slack" {

module "lambda" {
source = "terraform-aws-modules/lambda/aws"
version = "1.18.0"
version = "1.27.0"

create = var.create

Expand Down