You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: UPGRADE-6.0.md
+54-6Lines changed: 54 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -82,7 +82,7 @@ If you find a bug, please open an issue with supporting configuration to reprodu
82
82
-`additional_cluster_endpoints`
83
83
-`cluster_role_associations`
84
84
85
-
## Upgrade State Migrations
85
+
## Upgrade Migrations
86
86
87
87
### Before 5.x Example
88
88
@@ -193,18 +193,66 @@ module "cluster_after" {
193
193
}
194
194
```
195
195
196
+
### State Changes
197
+
196
198
To migrate from the `v5.x` version to `v6.x` version example shown above, the following state move commands can be performed to maintain the current resources without modification:
197
199
198
200
```bash
199
-
terraform state mv 'module.cluster_before.aws_rds_cluster_instance.this[0]''module.cluster_after.aws_rds_cluster_instance.this["0"]'
200
-
# Note: this move will need to be made for each instance in the cluster, where `<n>` is the instance creation order and is mapped to its new `<key>` specified
201
+
terraform state mv 'module.cluster_before.aws_rds_cluster_instance.this[0]''module.cluster_after.aws_rds_cluster_instance.this["1"]'
202
+
# Note: this move will need to be made for each instance in the cluster, where `<index>` is the instance creation index/position and is mapped to its new `<key>` specified
201
203
# in the `var.instances` map. See next line for rough pattern to follow for all instances in your cluster
202
-
# terraform state mv 'module.cluster_before.aws_rds_cluster_instance.this[<n>]' 'module.cluster_after.aws_rds_cluster_instance.this["<key>"]'
204
+
# terraform state mv 'module.cluster_before.aws_rds_cluster_instance.this[<index>]' 'module.cluster_after.aws_rds_cluster_instance.this["<key>"]'
203
205
204
206
terraform state mv 'module.cluster_before.aws_appautoscaling_policy.autoscaling_read_replica_count[0]''module.cluster_after.aws_appautoscaling_policy.this[0]'
205
207
terraform state mv 'module.cluster_before.aws_appautoscaling_target.read_replica_count[0]''module.cluster_after.aws_appautoscaling_target.this[0]'
206
208
```
207
209
208
-
:info: Notes
210
+
For example, if you previously had a configuration such as (truncated for brevity):
211
+
212
+
```hcl
213
+
module "aurora" {
214
+
215
+
instance_type = "db.r5.large"
216
+
instance_type_replica = "db.t3.medium"
217
+
replica_count = 2
218
+
replica_scale_enabled = true
219
+
replica_scale_min = 2
220
+
replica_scale_max = 5
221
+
```
222
+
223
+
After updating the configuration to the latest 6.x changes:
224
+
225
+
```hcl
226
+
module "aurora" {
227
+
228
+
instance_class = "db.r5.large"
229
+
instances = {
230
+
1 = {
231
+
promotion_tier = 1
232
+
}
233
+
2 = {
234
+
instance_class = "db.t3.medium"
235
+
promotion_tier = 2
236
+
}
237
+
238
+
autoscaling_enabled = true
239
+
autoscaling_min_capacity = 2
240
+
autoscaling_max_capacity = 5
241
+
```
242
+
243
+
The associated Terraform state move commands would be:
244
+
245
+
```bash
246
+
terraform state mv 'module.aurora.aws_rds_cluster_instance.this[0]''module.aurora.aws_rds_cluster_instance.this["1"]'
247
+
terraform state mv 'module.aurora.aws_rds_cluster_instance.this[1]''module.aurora.aws_rds_cluster_instance.this["2"]'
209
248
210
-
- TODO
249
+
terraform state mv 'module.aurora.aws_appautoscaling_policy.autoscaling_read_replica_count[0]''module.aurora.aws_appautoscaling_policy.this[0]'
250
+
terraform state mv 'module.aurora.aws_appautoscaling_target.read_replica_count[0]''module.aurora.aws_appautoscaling_target.this[0]'
251
+
```
252
+
253
+
### Configuration Changes
254
+
255
+
To avoid re-creation of the security group created by the module, you can add the following attribute and value:
256
+
```hcl
257
+
security_group_description = "Managed by Terraform"
0 commit comments