Skip to content

Commit b751a59

Browse files
committed
chore: Updates from testing and validating upgrade guide
1 parent 6b63603 commit b751a59

File tree

8 files changed

+48
-71
lines changed

8 files changed

+48
-71
lines changed

README.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ module "redshift" {
2525
encrypted = true
2626
kms_key_arn = "arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab"
2727
28+
vpc_id = "vpc-1234556abcdef"
2829
enhanced_vpc_routing = true
2930
availability_zone_relocation_enabled = true
3031
@@ -265,7 +266,7 @@ No modules.
265266
| <a name="input_iam_role_tags"></a> [iam\_role\_tags](#input\_iam\_role\_tags) | A map of additional tags to add to the scheduled action IAM role created | `map(string)` | `{}` | no |
266267
| <a name="input_iam_role_use_name_prefix"></a> [iam\_role\_use\_name\_prefix](#input\_iam\_role\_use\_name\_prefix) | Determines whether scheduled action the IAM role name (`iam_role_name`) is used as a prefix | `string` | `true` | no |
267268
| <a name="input_kms_key_arn"></a> [kms\_key\_arn](#input\_kms\_key\_arn) | The ARN for the KMS encryption key. When specifying `kms_key_arn`, `encrypted` needs to be set to `true` | `string` | `null` | no |
268-
| <a name="input_logging"></a> [logging](#input\_logging) | Logging configuration for the cluster | <pre>object({<br/> bucket_name = optional(string)<br/> log_destination_type = optional(string)<br/> log_exports = optional(list(string))<br/> s3_key_prefix = optional(string)<br/> })</pre> | `null` | no |
269+
| <a name="input_logging"></a> [logging](#input\_logging) | Logging configuration for the cluster | <pre>object({<br/> bucket_name = optional(string)<br/> log_destination_type = optional(string)<br/> log_exports = optional(list(string), [])<br/> s3_key_prefix = optional(string)<br/> })</pre> | `null` | no |
269270
| <a name="input_maintenance_track_name"></a> [maintenance\_track\_name](#input\_maintenance\_track\_name) | The name of the maintenance track for the restored cluster. When you take a snapshot, the snapshot inherits the MaintenanceTrack value from the cluster. The snapshot might be on a different track than the cluster that was the source for the snapshot. Default value is `current` | `string` | `null` | no |
270271
| <a name="input_manage_master_password"></a> [manage\_master\_password](#input\_manage\_master\_password) | Whether to use AWS SecretsManager to manage the cluster admin credentials. Conflicts with `master_password`. One of `master_password` or `manage_master_password` is required unless `snapshot_identifier` is provided | `bool` | `false` | no |
271272
| <a name="input_manage_master_password_rotation"></a> [manage\_master\_password\_rotation](#input\_manage\_master\_password\_rotation) | Whether to manage the master user password rotation. Setting this value to false after previously having been set to true will disable automatic rotation | `bool` | `false` | no |
@@ -343,10 +344,7 @@ No modules.
343344
| <a name="output_cluster_type"></a> [cluster\_type](#output\_cluster\_type) | The Redshift cluster type |
344345
| <a name="output_cluster_version"></a> [cluster\_version](#output\_cluster\_version) | The version of Redshift engine software |
345346
| <a name="output_cluster_vpc_security_group_ids"></a> [cluster\_vpc\_security\_group\_ids](#output\_cluster\_vpc\_security\_group\_ids) | The VPC security group ids associated with the cluster |
346-
| <a name="output_endpoint_access_address"></a> [endpoint\_access\_address](#output\_endpoint\_access\_address) | The DNS address of the endpoint |
347-
| <a name="output_endpoint_access_id"></a> [endpoint\_access\_id](#output\_endpoint\_access\_id) | The Redshift-managed VPC endpoint name |
348-
| <a name="output_endpoint_access_port"></a> [endpoint\_access\_port](#output\_endpoint\_access\_port) | The port number on which the cluster accepts incoming connections |
349-
| <a name="output_endpoint_access_vpc_endpoint"></a> [endpoint\_access\_vpc\_endpoint](#output\_endpoint\_access\_vpc\_endpoint) | The connection endpoint for connecting to an Amazon Redshift cluster through the proxy. See details below |
347+
| <a name="output_endpoint_access"></a> [endpoint\_access](#output\_endpoint\_access) | A map of access endpoints created and their attributes |
350348
| <a name="output_master_password_secret_arn"></a> [master\_password\_secret\_arn](#output\_master\_password\_secret\_arn) | ARN of managed master password secret |
351349
| <a name="output_parameter_group_arn"></a> [parameter\_group\_arn](#output\_parameter\_group\_arn) | Amazon Resource Name (ARN) of the parameter group created |
352350
| <a name="output_parameter_group_id"></a> [parameter\_group\_id](#output\_parameter\_group\_id) | The name of the Redshift parameter group created |

docs/UPGRADE-7.0.md

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,14 @@ Please consult the `examples` directory for reference example configurations. If
88
- AWS provider `v6.18` is now minimum supported version
99
- The ability for the module to create a random password has been removed in order to ensure passwords are not stored in plain text within the state file. Users must now provide their own password via the `master_password_wo` variable.
1010
- `master_password` is no longer supported and only the write-only equivalent is supported (`master_password_wo` and `master_password_wo_version`)
11+
- The variable(s) used to create access endpoints has changed from creating a single endpoint to n-number of endpoints
1112

1213
## Additional changes
1314

1415
### Added
1516

1617
- Support for `region` argument to specify the AWS region for the resources created if different from the provider region.
17-
- Support for creating security group
18+
- Support for creating a security group used by the cluster
1819

1920
### Modified
2021

@@ -23,7 +24,7 @@ Please consult the `examples` directory for reference example configurations. If
2324

2425
### Removed
2526

26-
-
27+
- Support for generating random passwords has been removed.
2728

2829
### Variable and output changes
2930

@@ -64,15 +65,18 @@ Please consult the `examples` directory for reference example configurations. If
6465

6566
4. Removed outputs:
6667

67-
-
68+
- `endpoint_access_address` -> see `endpoint_access` output
69+
- `endpoint_access_port` -> see `endpoint_access` output
70+
- `endpoint_access_id` -> see `endpoint_access` output
71+
- `endpoint_access_vpc_endpoint` -> see `endpoint_access` output
6872

6973
5. Renamed outputs:
7074

71-
-
75+
- None
7276

7377
6. Added outputs:
7478

75-
-
79+
- None
7680

7781
## Upgrade Migration
7882

@@ -121,9 +125,9 @@ module "redshift" {
121125
122126
# Endpoint access - only available when using the ra3.x type
123127
create_endpoint_access = true
124-
endpoint_name = "example-example"
125-
endpoint_subnet_group_name = aws_redshift_subnet_group.endpoint.id
126-
endpoint_vpc_security_group_ids = [module.security_group.security_group_id]
128+
endpoint_name = "example"
129+
endpoint_subnet_group_name = "example"
130+
endpoint_vpc_security_group_ids = ["sg-12345678"]
127131
}
128132
```
129133

@@ -136,6 +140,9 @@ module "redshift" {
136140
137141
# Only the affected attributes are shown
138142
143+
# Security group
144+
vpc_id = "vpc-1234556abcdef"
145+
139146
# Snapshot schedule
140147
snapshot_schedule = {
141148
identifier = "example"
@@ -180,14 +187,19 @@ module "redshift" {
180187
# Endpoint access - only available when using the ra3.x type
181188
endpoint_access = {
182189
example = {
183-
name = "example-example"
184-
subnet_group_name = aws_redshift_subnet_group.endpoint.id
185-
vpc_security_group_ids = [module.security_group.security_group_id]
190+
name = "example"
191+
subnet_group_name = "example"
192+
vpc_security_group_ids = ["sg-12345678"]
186193
}
187194
}
195+
196+
# Maintains backward compatibility, as needed
197+
parameter_group_family = "redshift-1.0"
188198
}
189199
```
190200

191201
### State Move Commands
192202

193-
TBD
203+
```sh
204+
terraform state mv 'module.redshift.aws_redshift_endpoint_access.this[0]' 'module.redshift.aws_redshift_endpoint_access.this["example"]'
205+
```

examples/complete/README.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,7 @@ No inputs.
8888
| <a name="output_cluster_type"></a> [cluster\_type](#output\_cluster\_type) | The Redshift cluster type |
8989
| <a name="output_cluster_version"></a> [cluster\_version](#output\_cluster\_version) | The version of Redshift engine software |
9090
| <a name="output_cluster_vpc_security_group_ids"></a> [cluster\_vpc\_security\_group\_ids](#output\_cluster\_vpc\_security\_group\_ids) | The VPC security group ids associated with the cluster |
91-
| <a name="output_endpoint_access_address"></a> [endpoint\_access\_address](#output\_endpoint\_access\_address) | The DNS address of the endpoint |
92-
| <a name="output_endpoint_access_id"></a> [endpoint\_access\_id](#output\_endpoint\_access\_id) | The Redshift-managed VPC endpoint name |
93-
| <a name="output_endpoint_access_port"></a> [endpoint\_access\_port](#output\_endpoint\_access\_port) | The port number on which the cluster accepts incoming connections |
94-
| <a name="output_endpoint_access_vpc_endpoint"></a> [endpoint\_access\_vpc\_endpoint](#output\_endpoint\_access\_vpc\_endpoint) | The connection endpoint for connecting to an Amazon Redshift cluster through the proxy. See details below |
91+
| <a name="output_endpoint_access"></a> [endpoint\_access](#output\_endpoint\_access) | A map of access endpoints created and their attributes |
9592
| <a name="output_master_password_secret_arn"></a> [master\_password\_secret\_arn](#output\_master\_password\_secret\_arn) | ARN of managed master password secret |
9693
| <a name="output_master_password_secretsmanager_secret_rotation_enabled"></a> [master\_password\_secretsmanager\_secret\_rotation\_enabled](#output\_master\_password\_secretsmanager\_secret\_rotation\_enabled) | Specifies whether automatic rotation is enabled for the secret |
9794
| <a name="output_parameter_group_arn"></a> [parameter\_group\_arn](#output\_parameter\_group\_arn) | Amazon Resource Name (ARN) of the parameter group created |

examples/complete/main.tf

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ module "redshift" {
5151
# Only available when using the ra3.x type
5252
availability_zone_relocation_enabled = true
5353
enhanced_vpc_routing = true
54+
vpc_id = module.vpc.vpc_id
5455

5556
snapshot_copy = {
5657
destination_region = "us-east-1"
@@ -217,8 +218,9 @@ module "with_cloudwatch_logging" {
217218
source = "../../"
218219

219220
cluster_identifier = "${local.name}-with-cloudwatch-logging"
220-
node_type = "dc2.large"
221+
node_type = "ra3.large"
221222

223+
vpc_id = module.vpc.vpc_id
222224
subnet_ids = module.vpc.redshift_subnets
223225

224226
create_cloudwatch_log_group = true
@@ -239,8 +241,9 @@ module "default" {
239241
source = "../../"
240242

241243
cluster_identifier = "${local.name}-default"
242-
node_type = "dc2.large"
244+
node_type = "ra3.large"
243245

246+
vpc_id = module.vpc.vpc_id
244247
subnet_ids = module.vpc.redshift_subnets
245248

246249
tags = local.tags

examples/complete/outputs.tf

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ output "cluster_namespace_arn" {
115115
output "cluster_master_password" {
116116
description = "The Redshift cluster master password"
117117
value = module.redshift.cluster_master_password
118+
sensitive = true
118119
}
119120

120121
output "cluster_master_username" {
@@ -187,24 +188,9 @@ output "scheduled_action_iam_role_unique_id" {
187188
# Endpoint Access
188189
################################################################################
189190

190-
output "endpoint_access_address" {
191-
description = "The DNS address of the endpoint"
192-
value = module.redshift.endpoint_access_address
193-
}
194-
195-
output "endpoint_access_id" {
196-
description = "The Redshift-managed VPC endpoint name"
197-
value = module.redshift.endpoint_access_id
198-
}
199-
200-
output "endpoint_access_port" {
201-
description = "The port number on which the cluster accepts incoming connections"
202-
value = module.redshift.endpoint_access_port
203-
}
204-
205-
output "endpoint_access_vpc_endpoint" {
206-
description = "The connection endpoint for connecting to an Amazon Redshift cluster through the proxy. See details below"
207-
value = module.redshift.endpoint_access_vpc_endpoint
191+
output "endpoint_access" {
192+
description = "A map of access endpoints created and their attributes"
193+
value = module.redshift.endpoint_access
208194
}
209195

210196
################################################################################

main.tf

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,6 @@ resource "aws_redshift_subnet_group" "this" {
125125
# Snapshot Schedule
126126
################################################################################
127127

128-
locals {
129-
snapshot_schedule_identifier = try(coalesce(var.snapshot_schedule.identifier, var.cluster_identifier))
130-
}
131-
132128
resource "aws_redshift_snapshot_schedule" "this" {
133129
count = var.create && var.snapshot_schedule != null ? 1 : 0
134130

@@ -137,8 +133,8 @@ resource "aws_redshift_snapshot_schedule" "this" {
137133
definitions = var.snapshot_schedule.definitions
138134
description = var.snapshot_schedule.description
139135
force_destroy = var.snapshot_schedule.force_destroy
140-
identifier = var.snapshot_schedule.use_prefix ? null : local.snapshot_schedule_identifier
141-
identifier_prefix = var.snapshot_schedule.use_prefix ? "${local.snapshot_schedule_identifier}-" : null
136+
identifier = var.snapshot_schedule.use_prefix ? null : try(coalesce(var.snapshot_schedule.identifier, var.cluster_identifier), "")
137+
identifier_prefix = var.snapshot_schedule.use_prefix ? "${try(coalesce(var.snapshot_schedule.identifier, var.cluster_identifier), "")}-" : null
142138

143139
tags = merge(var.tags, var.snapshot_schedule.tags)
144140
}
@@ -178,15 +174,15 @@ resource "aws_redshift_scheduled_action" "this" {
178174

179175
content {
180176
dynamic "pause_cluster" {
181-
for_each = each.value.pause_cluster != null ? [1] : []
177+
for_each = target_action.value.pause_cluster != null && target_action.value.pause_cluster ? [1] : []
182178

183179
content {
184180
cluster_identifier = aws_redshift_cluster.this[0].id
185181
}
186182
}
187183

188184
dynamic "resize_cluster" {
189-
for_each = each.value.resize_cluster != null ? [1] : []
185+
for_each = target_action.value.resize_cluster != null ? [target_action.value.resize_cluster] : []
190186

191187
content {
192188
classic = resize_cluster.value.classic
@@ -198,7 +194,7 @@ resource "aws_redshift_scheduled_action" "this" {
198194
}
199195

200196
dynamic "resume_cluster" {
201-
for_each = each.value.resume_cluster != null ? [each.value.resume_cluster] : []
197+
for_each = target_action.value.resume_cluster != null && target_action.value.resume_cluster ? [target_action.value.resume_cluster] : []
202198

203199
content {
204200
cluster_identifier = aws_redshift_cluster.this[0].id
@@ -317,7 +313,7 @@ resource "aws_redshift_authentication_profile" "this" {
317313

318314
region = var.region
319315

320-
authentication_profile_name = try(each.value.name, each.key)
316+
authentication_profile_name = try(coalesce(each.value.name, each.key))
321317
authentication_profile_content = jsonencode(each.value.content)
322318
}
323319

@@ -342,7 +338,7 @@ resource "aws_redshift_logging" "this" {
342338
################################################################################
343339

344340
resource "aws_cloudwatch_log_group" "this" {
345-
for_each = toset([for log in try(var.logging.log_exports, []) : log if var.create && var.create_cloudwatch_log_group])
341+
for_each = var.create && var.create_cloudwatch_log_group && var.logging != null ? toset([for log in try(var.logging.log_exports, []) : log]) : toset([])
346342

347343
region = var.region
348344

outputs.tf

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -193,24 +193,9 @@ output "scheduled_action_iam_role_unique_id" {
193193
# Endpoint Access
194194
################################################################################
195195

196-
output "endpoint_access_address" {
197-
description = "The DNS address of the endpoint"
198-
value = try(aws_redshift_endpoint_access.this[0].address, null)
199-
}
200-
201-
output "endpoint_access_id" {
202-
description = "The Redshift-managed VPC endpoint name"
203-
value = try(aws_redshift_endpoint_access.this[0].id, null)
204-
}
205-
206-
output "endpoint_access_port" {
207-
description = "The port number on which the cluster accepts incoming connections"
208-
value = try(aws_redshift_endpoint_access.this[0].port, null)
209-
}
210-
211-
output "endpoint_access_vpc_endpoint" {
212-
description = "The connection endpoint for connecting to an Amazon Redshift cluster through the proxy. See details below"
213-
value = try(aws_redshift_endpoint_access.this[0].vpc_endpoint, null)
196+
output "endpoint_access" {
197+
description = "A map of access endpoints created and their attributes"
198+
value = aws_redshift_endpoint_access.this
214199
}
215200

216201
################################################################################

variables.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ variable "logging" {
465465
type = object({
466466
bucket_name = optional(string)
467467
log_destination_type = optional(string)
468-
log_exports = optional(list(string))
468+
log_exports = optional(list(string), [])
469469
s3_key_prefix = optional(string)
470470
})
471471
default = null

0 commit comments

Comments
 (0)