Skip to content

Commit 62b5a25

Browse files
committed
code refactoring
1 parent bcb4e3e commit 62b5a25

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

lambda/README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,5 +56,4 @@ No modules.
5656
| <a name="output_exec_role_id"></a> [exec\_role\_id](#output\_exec\_role\_id) | The ID of the Function's IAM Role. |
5757
| <a name="output_invoke_arn"></a> [invoke\_arn](#output\_invoke\_arn) | The ARN to be used for invoking Lambda Function from API Gateway. |
5858
| <a name="output_name"></a> [name](#output\_name) | The name of the Lambda Function. |
59-
60-
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
59+
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->

lambda/sns_slack.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def format_cloudwatch_alarm_message(event):
3333
return message
3434

3535
def lambda_handler(event, context):
36-
url = slack_url
36+
url = slack_url
3737
msg = {
3838
"channel": slack_channel,
3939
"username": slack_user,
@@ -43,9 +43,9 @@ def lambda_handler(event, context):
4343

4444
encoded_msg = json.dumps(msg).encode('utf-8')
4545
resp = http.request('POST', url, body=encoded_msg)
46-
46+
4747
print({
4848
"message": msg,
4949
"status_code": resp.status,
5050
"response": resp.data
51-
})
51+
})

main.tf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -214,10 +214,10 @@ resource "aws_kms_ciphertext" "slack_url" {
214214
}
215215

216216
resource "aws_sns_topic" "slack_topic" {
217-
count = var.cloudwatch_metric_alarms_enabled ? 1 : 0
218-
depends_on = [aws_elasticache_replication_group.redis]
219-
name = format("%s-%s-%s", var.environment, var.name, "slack-topic")
220-
delivery_policy = <<EOF
217+
count = var.cloudwatch_metric_alarms_enabled ? 1 : 0
218+
depends_on = [aws_elasticache_replication_group.redis]
219+
name = format("%s-%s-%s", var.environment, var.name, "slack-topic")
220+
delivery_policy = <<EOF
221221
{
222222
"http": {
223223
"defaultHealthyRetryPolicy": {

0 commit comments

Comments
 (0)