Skip to content

Commit a24cf94

Browse files
Feat: Dynamically using retention policy for SFTP's log group. (#38)
* feat: dynamically using retention policy for sftp log group * fix- fixed spacing in variable file --------- Co-authored-by: Anmol Nagpal <[email protected]>
1 parent b962617 commit a24cf94

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ data "aws_s3_bucket" "landing" {
4545

4646
resource "aws_cloudwatch_log_group" "sftp_log_group" {
4747
name = "/aws/transfer/${module.labels.id}"
48-
retention_in_days = 90
48+
retention_in_days = var.retention_in_days
4949
}
5050

5151
##----------------------------------------------------------------------------------

variables.tf

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
#Module : LABEL
33
#Description : Terraform label module variables.
44
##----------------------------------------------------------------------------------
5-
65
variable "name" {
76
type = string
87
default = ""
@@ -49,21 +48,18 @@ variable "enabled" {
4948
#Module : SFTP
5049
#Description : Terraform sftp module variables.
5150
##----------------------------------------------------------------------------------
52-
5351
variable "enable_sftp" {
5452
type = bool
5553
default = true
5654
description = "Set to false to prevent the module from creating any resources."
5755
}
5856

59-
6057
variable "identity_provider_type" {
6158
type = string
6259
default = "SERVICE_MANAGED"
6360
description = "The mode of authentication enabled for this service. The default value is SERVICE_MANAGED, which allows you to store and access SFTP user credentials within the service. API_GATEWAY."
6461
}
6562

66-
6763
variable "s3_bucket_name" {
6864
type = string
6965
description = "This is the bucket that the SFTP users will use when managing files"
@@ -117,13 +113,18 @@ variable "subnet_ids" {
117113
default = []
118114
}
119115

120-
121116
variable "security_policy_name" {
122117
type = string
123118
description = "Specifies the name of the security policy that is attached to the server. Possible values are TransferSecurityPolicy-2018-11, TransferSecurityPolicy-2020-06, and TransferSecurityPolicy-FIPS-2020-06. Default value is: TransferSecurityPolicy-2018-11."
124119
default = "TransferSecurityPolicy-2018-11"
125120
}
126121

122+
variable "retention_in_days" {
123+
type = number
124+
description = "Specifies the number of days you want to retain log events in the specified log group. Possible values are: 1, 3, 5, 7, 14, 30, 60, 90, 120, 150, 180, 365, 400, 545, 731, 1096, 1827, 2192, 2557, 2922, 3288, 3653, and 0. If you select 0, the events in the log group are always retained and never expire."
125+
default = 3
126+
}
127+
127128
variable "domain_name" {
128129
type = string
129130
description = "Domain to use when connecting to the SFTP endpoint"

0 commit comments

Comments
 (0)