Skip to content

Commit c706e44

Browse files
authored
Merge pull request terraform-aws-modules#5 from sc250024/enhanced-redshift-functionality
Fix terraform-aws-modules#4 & enhanced RedShift functionality
2 parents b97aa0d + be8eeab commit c706e44

File tree

2 files changed

+48
-3
lines changed

2 files changed

+48
-3
lines changed

main.tf

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
locals {
22
redshift_subnet_group_name = "${coalesce(var.redshift_subnet_group_name, element(concat(aws_redshift_subnet_group.this.*.name, list("")), 0))}"
3-
enable_create_redshift_subnet_group = "${var.redshift_subnet_group_name == "" ? 0 : 1}"
3+
enable_create_redshift_subnet_group = "${var.redshift_subnet_group_name == "" ? 1 : 0}"
44
parameter_group_name = "${coalesce(var.parameter_group_name, element(concat(aws_redshift_parameter_group.this.*.id, list("")), 0))}"
55
enable_create_redshift_parameter_group = "${var.parameter_group_name == "" ? 0 : 1}"
66
}
@@ -10,6 +10,7 @@ resource "aws_redshift_cluster" "this" {
1010
cluster_version = "${var.cluster_version}"
1111
node_type = "${var.cluster_node_type}"
1212
number_of_nodes = "${var.cluster_number_of_nodes}"
13+
cluster_type = "${var.cluster_number_of_nodes > 1 ? "multi-node" : "single-node" }"
1314
database_name = "${var.cluster_database_name}"
1415
master_username = "${var.cluster_master_username}"
1516
master_password = "${var.cluster_master_password}"
@@ -24,9 +25,11 @@ resource "aws_redshift_cluster" "this" {
2425
publicly_accessible = "${var.publicly_accessible}"
2526

2627
# Snapshots and backups
28+
final_snapshot_identifier = "${var.final_snapshot_identifier}"
2729
skip_final_snapshot = "${var.skip_final_snapshot}"
2830
automated_snapshot_retention_period = "${var.automated_snapshot_retention_period }"
2931
preferred_maintenance_window = "${var.preferred_maintenance_window}"
32+
allow_version_upgrade = "${var.allow_version_upgrade}"
3033

3134
# IAM Roles
3235
iam_roles = ["${var.cluster_iam_roles}"]
@@ -35,6 +38,16 @@ resource "aws_redshift_cluster" "this" {
3538
encrypted = "${var.encrypted}"
3639
kms_key_id = "${var.kms_key_id}"
3740

41+
# Enhanced VPC routing
42+
enhanced_vpc_routing = "${var.enhanced_vpc_routing}"
43+
44+
# Logging
45+
logging {
46+
enable = "${var.enable_logging}"
47+
bucket_name = "${var.logging_bucket_name}"
48+
s3_key_prefix = "${var.logging_s3_key_prefix}"
49+
}
50+
3851
tags = "${var.tags}"
3952

4053
lifecycle {

variables.tf

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ variable "cluster_version" {
1515
variable "cluster_node_type" {
1616
description = "Node Type of Redshift cluster"
1717

18-
# Valid Values: ds1.xlarge | ds1.8xlarge | ds2.xlarge | ds2.8xlarge | dc1.large | dc1.8xlarge.
18+
# Valid Values: dc1.large | dc1.8xlarge | dc2.large | dc2.8xlarge | ds2.xlarge | ds2.8xlarge.
1919
# http://docs.aws.amazon.com/cli/latest/reference/redshift/create-cluster.html
2020
}
2121

2222
variable "cluster_number_of_nodes" {
23-
description = "Number of Node in the cluster"
23+
description = "Number of nodes in the cluster (values greater than 1 will trigger 'cluster_type' of 'multi-node')"
2424
default = 3
2525
}
2626

@@ -76,6 +76,12 @@ variable "vpc_security_group_ids" {
7676
default = []
7777
}
7878

79+
# Snapshots and maintenance windows
80+
variable "final_snapshot_identifier" {
81+
description = "(Optional) The identifier of the final snapshot that is to be created immediately before deleting the cluster. If this parameter is provided, 'skip_final_snapshot' must be false."
82+
default = false
83+
}
84+
7985
variable "skip_final_snapshot" {
8086
description = "If true (default), no snapshot will be made before deleting DB"
8187
default = true
@@ -91,6 +97,22 @@ variable "automated_snapshot_retention_period" {
9197
default = 0
9298
}
9399

100+
# Logging
101+
variable "enable_logging" {
102+
description = "Enables logging information such as queries and connection attempts, for the specified Amazon Redshift cluster."
103+
default = false
104+
}
105+
106+
variable "logging_bucket_name" {
107+
description = "(Optional, required when enable_logging is true) The name of an existing S3 bucket where the log files are to be stored. Must be in the same region as the cluster and the cluster must have read bucket and put object permissions."
108+
default = false
109+
}
110+
111+
variable "logging_s3_key_prefix" {
112+
description = "(Optional) The prefix applied to the log file names."
113+
default = false
114+
}
115+
94116
variable "wlm_json_configuration" {
95117
default = "[{\"query_concurrency\": 5}]"
96118
}
@@ -109,3 +131,13 @@ variable "kms_key_id" {
109131
description = "(Optional) The ARN for the KMS encryption key. When specifying kms_key_id, encrypted needs to be set to true."
110132
default = ""
111133
}
134+
135+
variable "enhanced_vpc_routing" {
136+
description = "(Optional) If true, enhanced VPC routing is enabled."
137+
default = false
138+
}
139+
140+
variable "allow_version_upgrade" {
141+
description = "(Optional) If true, major version upgrades can be applied during the maintenance window to the Amazon Redshift engine that is running on the cluster."
142+
default = true
143+
}

0 commit comments

Comments
 (0)