From 793726cb0ff37349184c2ee5996a08e3e67406b7 Mon Sep 17 00:00:00 2001 From: maqayyumgeldmaat <112961060+maqayyumgeldmaat@users.noreply.github.com> Date: Fri, 30 Dec 2022 14:11:06 +0100 Subject: [PATCH] Add support for setting log bucket lifecycle rules (#21) --- README.md | 1 + main.tf | 13 +++++++------ variables.tf | 6 ++++++ 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 84995e8..e5df1fc 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,7 @@ Terraform module to setup and manage an AWS Redshift cluster | force\_destroy | A boolean that indicates all logging should be deleted when deleting the cluster | `bool` | `false` | no | | iam\_roles | A list of IAM Role ARNs to associate with the cluster | `list(string)` | `[]` | no | | kms\_key\_arn | The ARN for the KMS encryption key to encrypt the Redshift cluster | `string` | `null` | no | +| lifecycle\_rule | List of maps containing lifecycle management configuration settings | `any` | `[]` | no | | logging | Enables logging information such as queries and connection attempts | `bool` | `true` | no | | node\_type | The node type to be provisioned for the cluster | `string` | `"dc2.large"` | no | | number\_of\_nodes | The number of compute nodes in the cluster | `number` | `1` | no | diff --git a/main.tf b/main.tf index f5c8fc6..f8e2857 100644 --- a/main.tf +++ b/main.tf @@ -90,12 +90,13 @@ resource "aws_redshift_parameter_group" "default" { } module "logging_bucket" { - count = var.logging ? 1 : 0 - source = "github.com/schubergphilis/terraform-aws-mcaf-s3?ref=v0.5.0" - name = var.logging_bucket - policy = data.aws_iam_policy_document.logging.json - versioning = true - tags = var.tags + count = var.logging ? 1 : 0 + source = "github.com/schubergphilis/terraform-aws-mcaf-s3?ref=v0.5.0" + name = var.logging_bucket + policy = data.aws_iam_policy_document.logging.json + versioning = true + tags = var.tags + lifecycle_rule = var.lifecycle_rule } data "aws_redshift_service_account" "main" {} diff --git a/variables.tf b/variables.tf index 8608093..9ecedf4 100644 --- a/variables.tf +++ b/variables.tf @@ -85,6 +85,12 @@ variable "kms_key_arn" { description = "The ARN for the KMS encryption key to encrypt the Redshift cluster" } +variable "lifecycle_rule" { + type = any + default = [] + description = "List of maps containing lifecycle management configuration settings" +} + variable "logging" { type = bool default = true