Skip to content

Commit 192e365

Browse files
committed
Initial commit
1 parent 233d1af commit 192e365

File tree

5 files changed

+35
-1
lines changed

5 files changed

+35
-1
lines changed

main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ module "redshift_cluster" {
3333
security_group_data = var.security_group_data
3434
security_group_name = var.security_group_name
3535
create_security_groups = var.create_security_groups
36+
redshift_logging = var.redshift_logging
3637

3738

3839
# Snapshot configuration

modules/redshift-cluster/main.tf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,14 @@ resource "aws_ssm_parameter" "redshift_master_password" {
5656
tags = var.tags
5757

5858
}
59+
resource "aws_redshift_logging" "example" {
60+
count = var.redshift_logging.enable ? 1 : 0
61+
cluster_identifier = local.cluster_identifier
62+
log_destination_type = var.redshift_logging.log_destination_type
63+
bucket_name = var.redshift_logging.bucket_name
64+
s3_key_prefix = var.redshift_logging.s3_key_prefix
65+
}
66+
5967

6068
resource "aws_redshift_cluster" "this" {
6169
cluster_identifier = local.cluster_identifier

modules/redshift-cluster/variables.tf

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,19 @@ variable "number_of_nodes" {
5959
default = 1
6060
}
6161

62+
variable "redshift_logging" {
63+
description = "Configuration for Redshift logging"
64+
type = object({
65+
enable = optional(bool, false)
66+
bucket_name = optional(string, null)
67+
s3_key_prefix = optional(string, "redshift-logs/")
68+
log_destination_type = optional(string, "s3")
69+
})
70+
default = {
71+
enable = false
72+
}
73+
}
74+
6275
variable "cluster_type" {
6376
description = "The cluster type to use. Either 'single-node' or 'multi-node'"
6477
type = string

modules/redshift-serverless/variables.tf

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ variable "admin_username" {
4646
default = null
4747
}
4848

49-
5049
variable "manage_admin_password" {
5150
description = "Whether to allow Redshift to manage the admin password automatically"
5251
type = bool

variables.tf

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,19 @@ variable "create_security_groups" {
5454
type = bool
5555
default = true
5656
}
57+
variable "redshift_logging" {
58+
description = "Configuration for Redshift logging"
59+
type = object({
60+
enable = optional(bool, false)
61+
bucket_name = optional(string, null)
62+
s3_key_prefix = optional(string, "redshift-logs/")
63+
log_destination_type = optional(string, "s3")
64+
})
65+
default = {
66+
enable = false
67+
}
68+
}
69+
5770
variable "create_random_password" {
5871
description = "Determines whether to create random password for cluster `master_password`"
5972
type = bool

0 commit comments

Comments
 (0)