Skip to content

Commit a04c7af

Browse files
authored
Update main.tf (#27)
1. aws sftp has supports to json logging format which makes it easy to read the logs in cloudwatch. 2. We can create our own name-specific log group name to meet the standards
1 parent 3f3556b commit a04c7af

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

main.tf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,11 @@ data "aws_s3_bucket" "landing" {
4646
bucket = var.s3_bucket_name
4747
}
4848

49+
resource "aws_cloudwatch_log_group" "sftp_log_group" {
50+
name = "/aws/transfer/${module.labels.id}"
51+
retention_in_days = 90
52+
}
53+
4954
##----------------------------------------------------------------------------------
5055
# IAM POLICIES
5156
##----------------------------------------------------------------------------------
@@ -202,6 +207,9 @@ resource "aws_transfer_server" "transfer_server" {
202207
security_policy_name = var.security_policy_name
203208
logging_role = join("", aws_iam_role.logging[*].arn)
204209
tags = module.labels.tags
210+
structured_log_destinations = [
211+
"${aws_cloudwatch_log_group.sftp_log_group.arn}:*"
212+
]
205213
dynamic "workflow_details" {
206214
for_each = var.enable_workflow ? [1] : []
207215
content {

0 commit comments

Comments
 (0)