Skip to content

Commit

Permalink
Feat: Dynamically using retention policy for SFTP's log group. (#38)
Browse files Browse the repository at this point in the history
* feat: dynamically using retention policy for sftp log group

* fix- fixed spacing in variable file

---------

Co-authored-by: Anmol Nagpal <anmol@clouddrove.com>
  • Loading branch information
nileshgadgi and anmolnagpal authored Jan 10, 2024
1 parent b962617 commit a24cf94
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ data "aws_s3_bucket" "landing" {

resource "aws_cloudwatch_log_group" "sftp_log_group" {
name = "/aws/transfer/${module.labels.id}"
retention_in_days = 90
retention_in_days = var.retention_in_days
}

##----------------------------------------------------------------------------------
Expand Down
11 changes: 6 additions & 5 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#Module : LABEL
#Description : Terraform label module variables.
##----------------------------------------------------------------------------------

variable "name" {
type = string
default = ""
Expand Down Expand Up @@ -49,21 +48,18 @@ variable "enabled" {
#Module : SFTP
#Description : Terraform sftp module variables.
##----------------------------------------------------------------------------------

variable "enable_sftp" {
type = bool
default = true
description = "Set to false to prevent the module from creating any resources."
}


variable "identity_provider_type" {
type = string
default = "SERVICE_MANAGED"
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."
}


variable "s3_bucket_name" {
type = string
description = "This is the bucket that the SFTP users will use when managing files"
Expand Down Expand Up @@ -117,13 +113,18 @@ variable "subnet_ids" {
default = []
}


variable "security_policy_name" {
type = string
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."
default = "TransferSecurityPolicy-2018-11"
}

variable "retention_in_days" {
type = number
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."
default = 3
}

variable "domain_name" {
type = string
description = "Domain to use when connecting to the SFTP endpoint"
Expand Down

0 comments on commit a24cf94

Please sign in to comment.