Skip to content

Commit

Permalink
Merge pull request #3 from niaid/python3.11
Browse files Browse the repository at this point in the history
update python version from 3.8 to 3.11
  • Loading branch information
yangx17 authored Aug 7, 2024
2 parents 7e1676f + 18c2994 commit 1d1cc57
Show file tree
Hide file tree
Showing 11 changed files with 21 additions and 66 deletions.
52 changes: 0 additions & 52 deletions .github/workflows/pr-title.yml

This file was deleted.

8 changes: 4 additions & 4 deletions .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Set up Python 3.8
uses: actions/setup-python@v2
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: 3.8
python-version: 3.11

- name: Install pipenv
run: |
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

All notable changes to this project will be documented in this file.

## (2024-05-01)

* Update Python lambda runtime from `3.8` to `3.11`


## [5.3.0](https://github.com/terraform-aws-modules/terraform-aws-notify-slack/compare/v5.2.0...v5.3.0) (2022-06-17)


Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Doing serverless with Terraform? Check out [serverless.tf framework](https://ser

## Supported Features

- AWS Lambda runtime Python 3.8
- AWS Lambda runtime Python 3.11
- Create new SNS topic or use existing one
- Support plaintext and encrypted version of Slack webhook URL
- Most of Slack message options are customizable
Expand Down
2 changes: 1 addition & 1 deletion functions/.pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.black]
line-length = 120
target-version = ['py38']
target-version = ['py311']
include = '\.pyi?$'
verbose = true
exclude = '''
Expand Down
6 changes: 3 additions & 3 deletions functions/Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ name = "pypi"
[packages]

[dev-packages]
boto3 = "~=1.20"
botocore = "~=1.23"
boto3 = "~=1.34"
botocore = "~=1.34"
black = "*"
flake8 = "*"
isort = "*"
Expand All @@ -18,7 +18,7 @@ radon = "*"
snapshottest = "~=0.6"

[requires]
python_version = "3.8"
python_version = "3.11"

[scripts]
test = "python3 -m pytest --cov --cov-report=term"
Expand Down
2 changes: 1 addition & 1 deletion functions/events/guardduty_finding_high.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"detail-type": "GuardDuty Finding",
"region": "us-east-1",
"detail": {
"id": "sample-id-2",
"accountId": "sample-id-2",
"title": "SAMPLE Unprotected port on EC2 instance i-123123123 is being probed",
"severity": 9,
"description": "EC2 instance has an unprotected port which is being probed by a known malicious host.",
Expand Down
2 changes: 1 addition & 1 deletion functions/events/guardduty_finding_low.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"detail-type": "GuardDuty Finding",
"region": "us-east-1",
"detail": {
"id": "sample-id-2",
"accountId": "sample-id-2",
"title": "SAMPLE Unprotected port on EC2 instance i-123123123 is being probed",
"severity": 2,
"description": "EC2 instance has an unprotected port which is being probed by a known malicious host.",
Expand Down
2 changes: 1 addition & 1 deletion functions/events/guardduty_finding_medium.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"detail-type": "GuardDuty Finding",
"region": "us-east-1",
"detail": {
"id": "sample-id-2",
"accountId": "sample-id-2",
"title": "SAMPLE Unprotected port on EC2 instance i-123123123 is being probed",
"severity": 5,
"description": "EC2 instance has an unprotected port which is being probed by a known malicious host.",
Expand Down
4 changes: 3 additions & 1 deletion functions/notify_slack.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ def format_guardduty_finding(message: Dict[str, Any], region: str) -> Dict[str,
"text": f"AWS GuardDuty Finding - {detail.get('title')}",
}


def format_security_announcements(message: Dict[str, Any]) -> Dict[str, Any]:
"""
Format GuardDuty & SecurityHub announcements into Slack message format
Expand Down Expand Up @@ -284,7 +285,8 @@ def format_security_announcements(message: Dict[str, Any]) -> Dict[str, Any]:
}

else:
return False
return {}


class AwsHealthCategory(Enum):
"""Maps AWS Health eventTypeCategory to Slack message format color
Expand Down
2 changes: 1 addition & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ module "lambda" {
handler = "${local.lambda_handler}.lambda_handler"
source_path = var.lambda_source_path != null ? "${path.root}/${var.lambda_source_path}" : "${path.module}/functions/notify_slack.py"
recreate_missing_package = var.recreate_missing_package
runtime = "python3.8"
runtime = "python3.11"
timeout = 30
kms_key_arn = var.kms_key_arn
reserved_concurrent_executions = var.reserved_concurrent_executions
Expand Down

0 comments on commit 1d1cc57

Please sign in to comment.