|
| 1 | +# Upgrade from v3.x to v4.x |
| 2 | + |
| 3 | +Please consult the `examples` directory for reference example configurations. If you find a bug, please open an issue with supporting configuration to reproduce. |
| 4 | + |
| 5 | +## List of backwards incompatible changes |
| 6 | + |
| 7 | +- Minimum supported version of Terraform AWS provider updated to v4.17 to support latest resources |
| 8 | +- Minimum supported version of Terraform updated to v1.0 |
| 9 | +- `create` variable added to control whether all resources are created or not. This means that all resources now use the zeroth index `[0]` in the resource name |
| 10 | + |
| 11 | +## Additional changes |
| 12 | + |
| 13 | +### Added |
| 14 | + |
| 15 | +- Support for generating a random password for the `master_password` |
| 16 | +- `aws_redshift_snapshot_schedule` resource including the variables and outputs used to support it |
| 17 | +- `aws_redshift_snapshot_schedule_association` resource including the variables and outputs used to support it |
| 18 | +- `aws_redshift_scheduled_action` resource including support for creating the IAM role and policies plus the associated variables and outputs to support |
| 19 | +- `aws_redshift_usage_limit` resource including the variables and outputs used to support it |
| 20 | +- `aws_redshift_authentication_profile` resource including the variables and outputs used to support it |
| 21 | +- `aws_redshift_cluster_iam_roles` resource including the variables and outputs used to support it |
| 22 | + |
| 23 | +### Modified |
| 24 | + |
| 25 | +- `number_of_nodes` default value of `3` changed to `1` |
| 26 | +- `cluster_version` default value of `"1.0"` changed to `null` |
| 27 | +- `master_username` default value of `"awsuser"` added |
| 28 | +- `encrypted` default value changed to `true` |
| 29 | +- By default, a randomly generated password of length `16` is used for the `master_password` |
| 30 | +- `master_password` variable marked as `sensitive` |
| 31 | + |
| 32 | +### Removed |
| 33 | + |
| 34 | +- None |
| 35 | + |
| 36 | +### Variable and output changes |
| 37 | + |
| 38 | +1. Removed variables: |
| 39 | + |
| 40 | + - Parameter Group |
| 41 | + - `wlm_json_configuration`, `require_ssl`, `use_fips_ssl`, `enable_user_activity_logging`, `max_concurrency_scaling_clusters`, `enable_case_sensitive_identifier` have been replaced by the use of `parameter_group_parameters` where any/all of these values can be set as well as others not listed here. |
| 42 | + |
| 43 | +2. Renamed variables: |
| 44 | + |
| 45 | + - Cluster |
| 46 | + - Cluster variables that per the AWS provider do not start with `cluster_` have been renamed to remove the `cluster_` prefix. |
| 47 | + - `enable_logging`, `logging_bucket_name`, and `logging_s3_key_prefix` have been replaced with the top level variable `logging` where their equivalent parameters `enable`, `bucket_name`, and `s3_key_prefix` are set, and support for new parameters `log_destination_type`, and `log_exports` have been added. |
| 48 | + - `snapshot_copy_destination_region`, `automated_snapshot_retention_period`, `snapshot_copy_grant_name` have been replaced with the top level variable `snapshot_copy` where their equivalent parameters `destination_region`, `retention_period`, and `grant_name` are set. |
| 49 | + - `iam_roles` has been renamed to `iam_role_arns` to match API of `aws_redshift_cluster_iam_roles` resource now used |
| 50 | + |
| 51 | + - Parameter Group |
| 52 | + - `cluster_parameter_group` ->`parameter_group_family` |
| 53 | + |
| 54 | + - Subnet Group |
| 55 | + - `redshift_subnet_group_name` -> `subnet_group_name`: Note: this was not previously used in the manner it was intended. The `cluster_identifier` was used as the name of the subnet group. This has now been corrected |
| 56 | + - `subnets` -> `subnet_ids` to match AWS provider |
| 57 | + |
| 58 | +3. Added variables: |
| 59 | + |
| 60 | + ## Cluster |
| 61 | + - `create` which affects all resources |
| 62 | + - `create_random_password` and `random_password_length` to support generating a random password for the `master_password` |
| 63 | + - `apply_immediately` |
| 64 | + - `aqua_configuration_status` |
| 65 | + - `availability_zone` |
| 66 | + - `availability_zone_relocation_enabled` |
| 67 | + - `default_iam_role_arn` |
| 68 | + - `maintenance_track_name` |
| 69 | + - `manual_snapshot_retention_period` |
| 70 | + - `cluster_timeouts` to support setting `create`, `update`, and `delete` timeout durations |
| 71 | + |
| 72 | + - Parameter Group |
| 73 | + - `create_parameter_group` was added to replace `length(var.parameter_group_name) > 0` logic |
| 74 | + - `parameter_group_name` |
| 75 | + - `parameter_group_parameters` which allows users to set any number of parameters, replacing the previously hardcoed parameters |
| 76 | + - `parameter_group_tags` |
| 77 | + |
| 78 | + - Subnet Group |
| 79 | + - `create_subnet_group` was added to replace `var.redshift_subnet_group_name == ""` logic |
| 80 | + - `subnet_group_description` was added to replace the hardcoded description used previously |
| 81 | + - `subnet_group_tags` |
| 82 | + |
| 83 | +4. Removed outputs: |
| 84 | + |
| 85 | + - None |
| 86 | + |
| 87 | +5. Renamed outputs: |
| 88 | + |
| 89 | + - The preceding `redshift_` prefix has been removed from all outputs |
| 90 | + |
| 91 | +6. Added outputs: |
| 92 | + |
| 93 | + - `cluster_dns_name` |
| 94 | + - `parameter_group_arn` |
| 95 | + - `subnet_group_arn` |
| 96 | + |
| 97 | +## Upgrade Migrations |
| 98 | + |
| 99 | +### Before v3.x Example |
| 100 | + |
| 101 | +```hcl |
| 102 | +module "redshift" { |
| 103 | + source = "terraform-aws-modules/redshift/aws" |
| 104 | + version = "3.4.1" |
| 105 | +
|
| 106 | + cluster_identifier = local.name |
| 107 | + cluster_node_type = "dc2.large" |
| 108 | + cluster_number_of_nodes = 1 |
| 109 | +
|
| 110 | + cluster_database_name = "mydb" |
| 111 | + cluster_master_username = "mydbuser" |
| 112 | + cluster_master_password = "MySecretPassw0rd" |
| 113 | +
|
| 114 | + subnets = module.vpc.redshift_subnets |
| 115 | + vpc_security_group_ids = [module.sg.security_group_id] |
| 116 | +} |
| 117 | +``` |
| 118 | + |
| 119 | +### After v4.x Example |
| 120 | + |
| 121 | +```hcl |
| 122 | +module "redshift" { |
| 123 | + source = "terraform-aws-modules/redshift/aws" |
| 124 | + version = "4.0.0" |
| 125 | +
|
| 126 | + cluster_identifier = local.name |
| 127 | + node_type = "dc2.large" |
| 128 | + number_of_nodes = 1 |
| 129 | +
|
| 130 | + database_name = "mydb" |
| 131 | + master_username = "mydbuser" |
| 132 | + master_password = "MySecretPassw0rd" |
| 133 | +
|
| 134 | + subnet_ids = module.vpc.redshift_subnets |
| 135 | + vpc_security_group_ids = [module.sg.security_group_id] |
| 136 | +
|
| 137 | + # Maintain v3.x settings |
| 138 | + encrypted = false |
| 139 | + automated_snapshot_retention_period = 0 |
| 140 | + parameter_group_name = "${local.name}-redshift-1-0-custom-params" |
| 141 | + parameter_group_parameters = { |
| 142 | + wlm_json_configuration = { |
| 143 | + name = "wlm_json_configuration" |
| 144 | + value = jsonencode([ |
| 145 | + { |
| 146 | + query_concurrency = 5 |
| 147 | + } |
| 148 | + ]) |
| 149 | + } |
| 150 | + require_ssl = { |
| 151 | + name = "require_ssl" |
| 152 | + value = false |
| 153 | + } |
| 154 | + use_fips_ssl = { |
| 155 | + name = "use_fips_ssl" |
| 156 | + value = false |
| 157 | + } |
| 158 | + enable_user_activity_logging = { |
| 159 | + name = "enable_user_activity_logging" |
| 160 | + value = false |
| 161 | + } |
| 162 | + max_concurrency_scaling_clusters = { |
| 163 | + name = "max_concurrency_scaling_clusters" |
| 164 | + value = 1 |
| 165 | + } |
| 166 | + enable_case_sensitive_identifier = { |
| 167 | + name = "enable_case_sensitive_identifier" |
| 168 | + value = false |
| 169 | + } |
| 170 | + } |
| 171 | + subnet_group_description = "Redshift subnet group of ${local.name}" |
| 172 | + create_random_password = false |
| 173 | +} |
| 174 | +``` |
| 175 | + |
| 176 | +### Diff of Before vs After |
| 177 | + |
| 178 | +```diff |
| 179 | +module "redshift" { |
| 180 | + source = "terraform-aws-modules/redshift/aws" |
| 181 | +- version = "3.4.1" |
| 182 | ++ version = "4.0.0" |
| 183 | + |
| 184 | + cluster_identifier = local.name |
| 185 | +- cluster_node_type = "dc2.large" |
| 186 | ++ node_type = "dc2.large" |
| 187 | +- cluster_number_of_nodes = 1 |
| 188 | ++ number_of_nodes = 1 |
| 189 | + |
| 190 | +- cluster_database_name = "mydb" |
| 191 | ++ database_name = "mydb" |
| 192 | +- cluster_master_username = "mydbuser" |
| 193 | ++ master_username = "mydbuser" |
| 194 | +- cluster_master_password = "MySecretPassw0rd" |
| 195 | ++ master_password = "MySecretPassw0rd" |
| 196 | + |
| 197 | +- subnets = module.vpc.redshift_subnets |
| 198 | ++ subnet_ids = module.vpc.redshift_subnets |
| 199 | + vpc_security_group_ids = [module.sg.security_group_id] |
| 200 | + |
| 201 | ++ # Maintain v3.x settings |
| 202 | ++ encrypted = false |
| 203 | ++ automated_snapshot_retention_period = 0 |
| 204 | ++ parameter_group_name = "${local.name}-redshift-1-0-custom-params" |
| 205 | ++ parameter_group_parameters = { |
| 206 | ++ wlm_json_configuration = { |
| 207 | ++ name = "wlm_json_configuration" |
| 208 | ++ value = jsonencode([ |
| 209 | ++ { |
| 210 | ++ query_concurrency = 5 |
| 211 | ++ } |
| 212 | ++ ]) |
| 213 | ++ } |
| 214 | ++ require_ssl = { |
| 215 | ++ name = "require_ssl" |
| 216 | ++ value = false |
| 217 | ++ } |
| 218 | ++ use_fips_ssl = { |
| 219 | ++ name = "use_fips_ssl" |
| 220 | ++ value = false |
| 221 | ++ } |
| 222 | ++ enable_user_activity_logging = { |
| 223 | ++ name = "enable_user_activity_logging" |
| 224 | ++ value = false |
| 225 | ++ } |
| 226 | ++ max_concurrency_scaling_clusters = { |
| 227 | ++ name = "max_concurrency_scaling_clusters" |
| 228 | ++ value = 1 |
| 229 | ++ } |
| 230 | ++ enable_case_sensitive_identifier = { |
| 231 | ++ name = "enable_case_sensitive_identifier" |
| 232 | ++ value = false |
| 233 | ++ } |
| 234 | ++ } |
| 235 | ++ subnet_group_description = "Redshift subnet group of ${local.name}" |
| 236 | ++ create_random_password = false |
| 237 | +} |
| 238 | +``` |
| 239 | + |
| 240 | +### State Move Commands |
| 241 | + |
| 242 | +None required |
0 commit comments