Skip to content

Commit

Permalink
Merge pull request #2 from CU-CommunityApps/dev
Browse files Browse the repository at this point in the history
v2.0.0
  • Loading branch information
paul-e-allen authored Nov 12, 2021
2 parents 841cda3 + cbf27a3 commit faca406
Show file tree
Hide file tree
Showing 4 changed files with 221 additions and 165 deletions.
30 changes: 19 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,24 @@ Terraform module to relay AWS SNS messages to a Teams webhook
A CloudFormation template of these resources is available at https://github.com/CU-CommunityApps/cu-aws-cloudformation/tree/main/sns-teams-relay

## Change Log
- 1.1.0
- refactor `aws_sns_topic_subscription`, `aws_lambda_permission` to avoid this TF error: 'The "for_each" value depends on resource attributes that cannot be determined until apply, so Terraform cannot predict how many instances will be created. To work around this, use the -target argument to first apply only the resources that the for_each depends on.'
- 1.0.0
- Initial release

### v2.0.0
- apply some Python style improvements
- add support for two different webhook URLs; one handles regular notifications, one handles more critical notifications
- add support for contextual colors, depending on notification type

### v1.1.0
- refactor `aws_sns_topic_subscription`, `aws_lambda_permission` to avoid this TF error: 'The "for_each" value depends on resource attributes that cannot be determined until apply, so Terraform cannot predict how many instances will be created. To work around this, use the -target argument to first apply only the resources that the for_each depends on.'

### v1.0.0
- Initial release

## Variables

- `namespace` (optional) --- A string prefix to add to AWS resource in order to ensure unique AWS resource names, if the module is deployed multiple times in the same region
- `tags` (optional) --- Mapping of tags to apply to AWS resources created
- `teams_webhook_url` (required) --- URL of webhook for the target Teams channel
- `teams_webhook_url_normal` (required) --- URL of webhook exposed for target Teams channel for regular notifications
- `teams_webhook_url_alert` (required) --- URL of webhook for the target Teams channel
- `sns_topic_arn_list` --- A list of SNS Arns which should have messages relayed to Teams

## Outputs
Expand All @@ -28,14 +36,14 @@ resource "aws_sns_topic" "example" {
}
module "sns_teams_relay" {
source = "github.com/CU-CommunityApps/tf-module-sns-teams-relay.git?ref=v1.0.0"
source = "github.com/CU-CommunityApps/tf-module-sns-teams-relay.git?ref=v2.0.0"
tags = {
tags = {
"Environment" = "development"
}
namespace = "example"
teams_webhook_url = "https://cornellprod.webhook.office.com/webhookb2/abc123"
sns_topic_arn_list = [ aws_sns_topic.example.arn ]
namespace = "example"
teams_webhook_url_normal = "https://cornellprod.webhook.office.com/webhookb2/abc123"
teams_webhook_url_alert = "https://cornellprod.webhook.office.com/webhookb2/xyz789"
sns_topic_arn_list = [ aws_sns_topic.example.arn ]
}
```
3 changes: 2 additions & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ resource "aws_lambda_function" "lambda" {

environment {
variables = {
WEBHOOK_URL = var.teams_webhook_url
WEBHOOK_URL_NORMAL = var.teams_webhook_url_normal
WEBHOOK_URL_ALERT = var.teams_webhook_url_alert
}
}
}
Expand Down
Loading

0 comments on commit faca406

Please sign in to comment.