Skip to content

Commit

Permalink
Add support for setting log bucket lifecycle rules (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
maqayyumgeldmaat authored Dec 30, 2022
1 parent bf89d62 commit 793726c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand Down
13 changes: 7 additions & 6 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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" {}
Expand Down
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 793726c

Please sign in to comment.