|
| 1 | +# Upgrade from v9.x to v10.x |
| 2 | + |
| 3 | +If you have any questions regarding this upgrade process, please consult the `examples` directory. |
| 4 | +If you find a bug, please open an issue with supporting configuration to reproduce. |
| 5 | + |
| 6 | +## List of backwards incompatible changes |
| 7 | + |
| 8 | +- Terraform `v1.11` is now minimum supported version to support write-only (`wo_*`) attributes. |
| 9 | +- AWS provider `v6.18` is now minimum supported version |
| 10 | +- The underlying `aws_security_group_rule` resources has been replaced with `aws_vpc_security_group_ingress_rule` and `aws_vpc_security_group_egress_rule` to allow for more flexibility in defining security group rules. |
| 11 | +- `master_password` is no longer supported and only the write-only equivalent is supported (`master_password_wo` and `master_password_wo_version`) ([#513](https://github.com/terraform-aws-modules/terraform-aws-rds-aurora/pull/513)) |
| 12 | +- `security_group_rules` has been split into `security_group_ingress_rules` and `security_group_egress_rules` to better match the AWS API and allow for more flexibility in defining security group rules |
| 13 | + |
| 14 | +## Additional changes |
| 15 | + |
| 16 | +### Added |
| 17 | + |
| 18 | +- Support for `region` argument to specify the AWS region for the resources created if different from the provider region. |
| 19 | + |
| 20 | +### Modified |
| 21 | + |
| 22 | +- Variable definitions now contain detailed object types in place of the previously used `any` type |
| 23 | +- `copy_tags_to_snapshot` default value is now `true` ([#521](https://github.com/terraform-aws-modules/terraform-aws-rds-aurora/issues/521)) |
| 24 | +- `db_cluster_parameter_group_parameters` was previously of type `list(map(...))`, now of type `map(object(...))`with `name` being optional and defaulting to the map key if not provided |
| 25 | +- `preferred_maintenance_window` and `preferred_backup_window` default values are now `null` ([#524](https://github.com/terraform-aws-modules/terraform-aws-rds-aurora/pull/524)) |
| 26 | + |
| 27 | +### Removed |
| 28 | + |
| 29 | +- None |
| 30 | + |
| 31 | +### Variable and output changes |
| 32 | + |
| 33 | +1. Removed variables: |
| 34 | + |
| 35 | + - `auto_minor_version_upgrade` -> still available within the `instances` variable definition |
| 36 | + - `ca_cert_identifier` -> available within the `instances` variable definition |
| 37 | + - `monitoring_interval` -> still available within the `instances` variable definition |
| 38 | + - `performance_insights_enabled` -> still available within the `instances` variable definition |
| 39 | + - `performance_insights_kms_key_id` -> still available within the `instances` variable definition |
| 40 | + - `performance_insights_retention_period` -> still available within the `instances` variable definition |
| 41 | + - `iam_role_managed_policy_arns` -> deprecated argument on `aws_iam_role` resource |
| 42 | + - `iam_role_force_detach_policies` -> hardcode to `true` |
| 43 | + |
| 44 | +2. Renamed variables: |
| 45 | + |
| 46 | + - `instance_class` -> `cluster_instance_class` |
| 47 | + - `db_cluster_db_instance_parameter_group_name` -> `cluster_db_instance_parameter_group_name` |
| 48 | + - `role_associations` was previously `iam_roles` |
| 49 | + - `master_password` replaced with `master_password_wo` and `master_password_wo_version` |
| 50 | + - The variables for DB shard group have been nested under a single, top-level `shard_group` variable: |
| 51 | + - `create_shard_group` removed - set `shard_group` to `null` to disable or provide an object to enable |
| 52 | + - `compute_redundancy` -> `shard_group.compute_redundancy` |
| 53 | + - `db_shard_group_identifier` -> `shard_group.identifier` |
| 54 | + - `max_acu` -> `shard_group.max_acu` |
| 55 | + - `min_acu` -> `shard_group.min_acu` |
| 56 | + - `publicly_accessible` -> `shard_group.publicly_accessible` |
| 57 | + - `shard_group_tags` -> `shard_group.tags` |
| 58 | + - `shard_group_timeouts` -> `shard_group.timeouts` |
| 59 | + - The variables for the cluster activity stream have been nested under a single, top-level `cluster_activity_stream` variable: |
| 60 | + - `create_db_cluster_activity_stream` removed - set `cluster_activity_stream` to `null` to disable or provide an object to enable |
| 61 | + - `db_cluster_activity_stream_mode` -> `cluster_activity_stream.mode` |
| 62 | + - `db_cluster_activity_stream_kms_key_id` -> `cluster_activity_stream.kms_key_id` |
| 63 | + - `engine_native_audit_fields_included` -> `cluster_activity_stream.include_audit_fields` |
| 64 | + - The variables for the cluster parameter group have been nested under a single, top-level `cluster_parameter_group` variable: |
| 65 | + - `create_db_cluster_parameter_group` removed - set `cluster_parameter_group` to `null` to disable or provide an object to enable |
| 66 | + - `db_cluster_parameter_group_name` -> `cluster_parameter_group.name` |
| 67 | + - `db_cluster_parameter_group_use_name_prefix` -> `cluster_parameter_group.use_name_prefix` |
| 68 | + - `db_cluster_parameter_group_description` -> `cluster_parameter_group.description` |
| 69 | + - `db_cluster_parameter_group_family` -> `cluster_parameter_group.family` |
| 70 | + - `db_cluster_parameter_group_parameters` -> `cluster_parameter_group.parameters` |
| 71 | + - The variables for the instance parameter group have been nested under a single, top-level `db_parameter_group` variable: |
| 72 | + - `create_db_parameter_group` removed - set `db_parameter_group` to `null` to disable or provide an object to enable |
| 73 | + - `db_parameter_group_name` -> `db_parameter_group.name` |
| 74 | + - A variable `cluster_parameter_group_name` has been retained for when users want to provide an existing cluster parameter group name. |
| 75 | + - `db_parameter_group_use_name_prefix` -> `db_parameter_group.use_name_prefix` |
| 76 | + - `db_parameter_group_description` -> `db_parameter_group.description` |
| 77 | + - `db_parameter_group_family` -> `db_parameter_group.family` |
| 78 | + - `db_parameter_group_parameters` -> `db_parameter_group.parameters` |
| 79 | + |
| 80 | +3. Added variables: |
| 81 | + |
| 82 | + - `region` |
| 83 | + |
| 84 | +4. Removed outputs: |
| 85 | + |
| 86 | + - None |
| 87 | + |
| 88 | +5. Renamed outputs: |
| 89 | + |
| 90 | + - None |
| 91 | + |
| 92 | +6. Added outputs: |
| 93 | + |
| 94 | + - None |
| 95 | + |
| 96 | +## Upgrade Migrations |
| 97 | + |
| 98 | +### Before 9.x Example |
| 99 | + |
| 100 | +```hcl |
| 101 | +module "cluster" { |
| 102 | + source = "terraform-aws-modules/rds-aurora/aws" |
| 103 | + version = "~> 9.0" |
| 104 | +
|
| 105 | + # Only the affected attributes are shown |
| 106 | + instance_class = "db.r8g.large" |
| 107 | + monitoring_interval = 60 |
| 108 | +
|
| 109 | + security_group_rules = { |
| 110 | + vpc_ingress = { |
| 111 | + cidr_blocks = module.vpc.private_subnets_cidr_blocks |
| 112 | + } |
| 113 | + } |
| 114 | +
|
| 115 | + master_password = random_password.master.result |
| 116 | +
|
| 117 | + # For limitless databases |
| 118 | + create_shard_group = true |
| 119 | + compute_redundancy = 0 |
| 120 | + db_shard_group_identifier = "example" |
| 121 | + max_acu = 16 |
| 122 | +
|
| 123 | + create_db_cluster_parameter_group = true |
| 124 | + db_cluster_parameter_group_name = "example" |
| 125 | + db_cluster_parameter_group_family = "aurora-postgresql16" |
| 126 | + db_cluster_parameter_group_description = "Example cluster parameter group" |
| 127 | + db_cluster_parameter_group_parameters = [ |
| 128 | + { |
| 129 | + name = "log_min_duration_statement" |
| 130 | + value = 4000 |
| 131 | + apply_method = "immediate" |
| 132 | + }, { |
| 133 | + name = "rds.force_ssl" |
| 134 | + value = 1 |
| 135 | + apply_method = "immediate" |
| 136 | + } |
| 137 | + ] |
| 138 | +
|
| 139 | + create_db_parameter_group = true |
| 140 | + db_parameter_group_name = "example" |
| 141 | + db_parameter_group_family = "aurora-mysql8.0" |
| 142 | + db_parameter_group_description = "Example DB parameter group" |
| 143 | + db_parameter_group_parameters = [ |
| 144 | + { |
| 145 | + name = "connect_timeout" |
| 146 | + value = 60 |
| 147 | + apply_method = "immediate" |
| 148 | + }, |
| 149 | + ] |
| 150 | +
|
| 151 | + create_db_cluster_activity_stream = true |
| 152 | + db_cluster_activity_stream_kms_key_id = module.kms.key_id |
| 153 | + db_cluster_activity_stream_mode = "async" |
| 154 | +
|
| 155 | + iam_roles = { |
| 156 | + s3_import = { |
| 157 | + role_arn = aws_iam_role.s3_import.arn |
| 158 | + feature_name = "s3Import" |
| 159 | + } |
| 160 | + } |
| 161 | +
|
| 162 | + tags = { |
| 163 | + Environment = "dev" |
| 164 | + Terraform = "true" |
| 165 | + } |
| 166 | +} |
| 167 | +``` |
| 168 | + |
| 169 | +### After 10.x Example |
| 170 | + |
| 171 | +```hcl |
| 172 | +module "cluster" { |
| 173 | + source = "terraform-aws-modules/rds-aurora/aws" |
| 174 | + version = "~> 10.0" |
| 175 | +
|
| 176 | + # Only the affected attributes are shown |
| 177 | + cluster_instance_class = "db.r8g.large" |
| 178 | + cluster_monitoring_interval = 60 |
| 179 | +
|
| 180 | + security_group_ingress_rules = { |
| 181 | + private-az1 = { |
| 182 | + cidr_ipv4 = element(module.vpc.private_subnets_cidr_blocks, 0) |
| 183 | + } |
| 184 | + private-az2 = { |
| 185 | + cidr_ipv4 = element(module.vpc.private_subnets_cidr_blocks, 1) |
| 186 | + } |
| 187 | + private-az3 = { |
| 188 | + cidr_ipv4 = element(module.vpc.private_subnets_cidr_blocks, 2) |
| 189 | + } |
| 190 | + } |
| 191 | +
|
| 192 | + master_password_wo = random_password.master.result |
| 193 | + master_password_wo_version = 1 |
| 194 | +
|
| 195 | + # For limitless databases |
| 196 | + shard_group = { |
| 197 | + compute_redundancy = 0 |
| 198 | + identifier = "example" |
| 199 | + max_acu = 16 |
| 200 | + } |
| 201 | +
|
| 202 | + cluster_parameter_group = { |
| 203 | + name = "example" |
| 204 | + family = "aurora-postgresql16" |
| 205 | + description = "Example cluster parameter group" |
| 206 | + parameters = [ |
| 207 | + { |
| 208 | + name = "log_min_duration_statement" |
| 209 | + value = 4000 |
| 210 | + apply_method = "immediate" |
| 211 | + }, { |
| 212 | + name = "rds.force_ssl" |
| 213 | + value = 1 |
| 214 | + apply_method = "immediate" |
| 215 | + } |
| 216 | + ] |
| 217 | + } |
| 218 | +
|
| 219 | + db_parameter_group = { |
| 220 | + name = "example" |
| 221 | + family = "aurora-mysql8.0" |
| 222 | + description = "Example DB parameter group" |
| 223 | + parameters = [ |
| 224 | + { |
| 225 | + name = "connect_timeout" |
| 226 | + value = 60 |
| 227 | + apply_method = "immediate" |
| 228 | + }, |
| 229 | + ] |
| 230 | + } |
| 231 | +
|
| 232 | + cluster_activity_stream = { |
| 233 | + kms_key_id = module.kms.key_id |
| 234 | + mode = "async" |
| 235 | + } |
| 236 | +
|
| 237 | + role_associations = { |
| 238 | + s3Import = { |
| 239 | + role_arn = aws_iam_role.s3_import.arn |
| 240 | + # feature_name = "s3Import" # same as setting value to key |
| 241 | + } |
| 242 | + } |
| 243 | +
|
| 244 | + tags = { |
| 245 | + Environment = "dev" |
| 246 | + Terraform = "true" |
| 247 | + } |
| 248 | +} |
| 249 | +``` |
| 250 | + |
| 251 | +### State Changes |
| 252 | + |
| 253 | +Due to the change from `aws_security_group_rule` to `aws_vpc_security_group_ingress_rule` and `aws_vpc_security_group_egress_rule`, the following reference state changes are required to maintain the current security group rules. (Note: these are different resource types so they cannot be moved with `terraform mv ...`) |
| 254 | + |
| 255 | +```sh |
| 256 | +terraform state rm 'module.aurora.aws_security_group_rule.this["vpc_ingress"]' |
| 257 | +terraform state import 'module.aurora.aws_vpc_security_group_ingress_rule.this["private-az1"]' 'sg-xxx' |
| 258 | +terraform state import 'module.aurora.aws_vpc_security_group_ingress_rule.this["private-az2"]' 'sg-xxx' |
| 259 | +terraform state import 'module.aurora.aws_vpc_security_group_ingress_rule.this["private-az3"]' 'sg-xxx' |
| 260 | +``` |
0 commit comments