Skip to content

Commit 30fe054

Browse files
committed
chore: update migration steps
1 parent d05ed10 commit 30fe054

File tree

1 file changed

+55
-6
lines changed

1 file changed

+55
-6
lines changed

UPGRADE-6.0.md

Lines changed: 55 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ If you find a bug, please open an issue with supporting configuration to reprodu
8282
- `additional_cluster_endpoints`
8383
- `cluster_role_associations`
8484

85-
## Upgrade State Migrations
85+
## Upgrade Migrations
8686

8787
### Before 5.x Example
8888

@@ -193,18 +193,67 @@ module "cluster_after" {
193193
}
194194
```
195195

196+
### State Changes
197+
196198
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:
197199

198200
```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
201203
# 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>"]'
203205

204206
terraform state mv 'module.cluster_before.aws_appautoscaling_policy.autoscaling_read_replica_count[0]' 'module.cluster_after.aws_appautoscaling_policy.this[0]'
205207
terraform state mv 'module.cluster_before.aws_appautoscaling_target.read_replica_count[0]' 'module.cluster_after.aws_appautoscaling_target.this[0]'
206208
```
207209

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+
224+
and the updated syntax of:
225+
226+
```hcl
227+
module "aurora" {
228+
229+
instance_class = "db.r5.large"
230+
instances = {
231+
1 = {
232+
promotion_tier = 1
233+
}
234+
2 = {
235+
instance_class = "db.t3.medium"
236+
promotion_tier = 2
237+
}
238+
239+
autoscaling_enabled = true
240+
autoscaling_min_capacity = 2
241+
autoscaling_max_capacity = 5
242+
```
243+
244+
The associated Terraform state move commands would be:
245+
246+
```bash
247+
terraform state mv 'module.aurora.aws_rds_cluster_instance.this[0]' 'module.aurora.aws_rds_cluster_instance.this["1"]'
248+
terraform state mv 'module.aurora.aws_rds_cluster_instance.this[1]' 'module.aurora.aws_rds_cluster_instance.this["2"]'
249+
250+
terraform state mv 'module.aurora.aws_appautoscaling_policy.autoscaling_read_replica_count[0]' 'module.aurora.aws_appautoscaling_policy.this[0]'
251+
terraform state mv 'module.aurora.aws_appautoscaling_target.read_replica_count[0]' 'module.aurora.aws_appautoscaling_target.this[0]'
252+
```
253+
254+
### Configuration Changes
209255

210-
- TODO
256+
To avoid re-creation of the security group created by the module, you can add the following attribute and value:
257+
```hcl
258+
security_group_description = "Managed by Terraform"
259+
```

0 commit comments

Comments
 (0)