Skip to content

Commit 57d5136

Browse files
committed
fix: Update migration commands to remove
1 parent 0bbb9f2 commit 57d5136

File tree

1 file changed

+34
-13
lines changed

1 file changed

+34
-13
lines changed

docs/UPGRADE-6.0.md

Lines changed: 34 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -364,13 +364,16 @@ module "iam_role" {
364364

365365
##### State Changes
366366

367+
Remove all prior policy attachments (that are marked for deletion in `terraform plan`).
368+
Policies will stay attached to the role but new attachment IDs will be created on next apply
369+
367370
```sh
368-
terraform state mv "module.iam_role.aws_iam_role_policy_attachment.admin[0]" 'module.iam_role.aws_iam_role_policy_attachment.this["AdministratorAccess"]'
371+
terraform state rm "module.iam_role.aws_iam_role_policy_attachment.admin[0]"
369372

370373
# One move command for each ARN in prior custom_role_policy_arns
371-
terraform state mv "module.iam_role.aws_iam_role_policy_attachment.custom[0]" 'module.iam_role.aws_iam_role_policy_attachment.this["AmazonCognitoReadOnly"]'
372-
terraform state mv "module.iam_role.aws_iam_role_policy_attachment.custom[1]" 'module.iam_role.aws_iam_role_policy_attachment.this["AlexaForBusinessFullAccess"]'
373-
terraform state mv "module.iam_role.aws_iam_role_policy_attachment.custom[2]" 'module.iam_role.aws_iam_role_policy_attachment.this["custom"]'
374+
terraform state rm "module.iam_role.aws_iam_role_policy_attachment.custom[0]"
375+
terraform state rm "module.iam_role.aws_iam_role_policy_attachment.custom[1]"
376+
terraform state rm "module.iam_role.aws_iam_role_policy_attachment.custom[2]"
374377
```
375378

376379
#### `iam-assumable-role-with-oidc` -> `iam-role`
@@ -410,9 +413,12 @@ module "iam_role" {
410413

411414
##### State Changes
412415

416+
Remove all prior policy attachments (that are marked for deletion in `terraform plan`).
417+
Policies will stay attached to the role but new attachment IDs will be created on next apply
418+
413419
```sh
414420
# One move command for each ARN in prior custom_role_policy_arns
415-
terraform state mv "module.iam_role.aws_iam_role_policy_attachment.custom[0]" 'module.iam_role.aws_iam_role_policy_attachment.this["AmazonEC2ContainerRegistryPowerUser"]'
421+
terraform state rm "module.iam_role.aws_iam_role_policy_attachment.custom[0]"
416422
```
417423

418424
#### `iam-assumable-role-with-saml` -> `iam-role`
@@ -453,9 +459,12 @@ resource "aws_iam_saml_provider" "second_idp_saml" {
453459

454460
##### State Changes
455461

462+
Remove all prior policy attachments (that are marked for deletion in `terraform plan`).
463+
Policies will stay attached to the role but new attachment IDs will be created on next apply
464+
456465
```sh
457466
# One move command for each ARN in prior custom_role_policy_arns
458-
terraform state mv "module.iam_role.aws_iam_role_policy_attachment.custom[0]" 'module.iam_role.aws_iam_role_policy_attachment.this["ReadOnlyAccess"]'
467+
terraform state rm "module.iam_role.aws_iam_role_policy_attachment.custom[0]"
459468
```
460469

461470
#### `iam-assumable-roles` -> `iam-role`
@@ -563,14 +572,17 @@ module "iam_role_poweruser" {
563572

564573
##### State Changes
565574

575+
Remove all prior policy attachments (that are marked for deletion in `terraform plan`).
576+
Policies will stay attached to the role but new attachment IDs will be created on next apply
577+
566578
```sh
567579
terraform state mv "module.iam_assumable_roles.aws_iam_role.admin[0]" "module.iam_role_admin.aws_iam_role.this[0]"
568-
terraform state mv "module.iam_assumable_roles.aws_iam_role_policy_attachment.admin[0]" 'module.iam_role_admin.aws_iam_role_policy_attachment.this["AdministratorAccess"]'
580+
terraform state rm "module.iam_assumable_roles.aws_iam_role_policy_attachment.admin[0]"
569581

570582
terraform state mv "module.iam_assumable_roles.aws_iam_role.poweruser[0]" "module.iam_role_poweruser.aws_iam_role.this[0]"
571583
# One move command for each ARN in prior `poweruser_role_policy_arns`
572-
terraform state mv "module.iam_assumable_roles.aws_iam_role_policy_attachment.poweruser[0]" 'module.iam_role_poweruser.aws_iam_role_policy_attachment.this["Billing"]'
573-
terraform state mv "module.iam_assumable_roles.aws_iam_role_policy_attachment.poweruser[1]" 'module.iam_role_poweruser.aws_iam_role_policy_attachment.this["AWSSupportAccess"]'
584+
terraform state rm "module.iam_assumable_roles.aws_iam_role_policy_attachment.poweruser[0]"
585+
terraform state rm "module.iam_assumable_roles.aws_iam_role_policy_attachment.poweruser[1]"
574586
```
575587

576588
#### `iam-assumable-roles-with-saml` -> `iam-role`
@@ -644,12 +656,15 @@ module "iam_role_poweruser" {
644656

645657
##### State Changes
646658

659+
Remove all prior policy attachments (that are marked for deletion in `terraform plan`).
660+
Policies will stay attached to the role but new attachment IDs will be created on next apply
661+
647662
```sh
648663
terraform state mv "module.iam_assumable_roles.aws_iam_role.admin[0]" "module.iam_role_admin.aws_iam_role.this[0]"
649-
terraform state mv "module.iam_assumable_roles.aws_iam_role_policy_attachment.admin[0]" 'module.iam_role_admin.aws_iam_role_policy_attachment.this["AdministratorAccess"]'
664+
terraform state rm "module.iam_assumable_roles.aws_iam_role_policy_attachment.admin[0]"
650665

651666
terraform state mv "module.iam_assumable_roles.aws_iam_role.poweruser[0]" "module.iam_role_poweruser.aws_iam_role.this[0]"
652-
terraform state mv "module.iam_assumable_roles.aws_iam_role_policy_attachment.poweruser[0]" 'module.iam_role_poweruser.aws_iam_role_policy_attachment.this["PowerUserAccess"]'
667+
terraform state rm "module.iam_assumable_roles.aws_iam_role_policy_attachment.poweruser[0]"
653668
```
654669

655670
#### `iam-eks-role` -> `iam-role-for-service-accounts`
@@ -789,9 +804,12 @@ module "iam_user" {
789804

790805
##### State Changes
791806

807+
Remove all prior policy attachments (that are marked for deletion in `terraform plan`).
808+
Policies will stay attached to the role but new attachment IDs will be created on next apply
809+
792810
```sh
793811
# One move command for each ARN in prior `custom_group_policy_arns`
794-
terraform state mv "module.iam_group.aws_iam_group_policy_attachment.custom_arns[0]" 'module.iam_group.aws_iam_group_policy_attachment.additional["AmazonS3FullAccess"]'
812+
terraform state rm "module.iam_group.aws_iam_group_policy_attachment.custom_arns[0]"
795813
```
796814

797815
#### `iam-policy`
@@ -823,6 +841,9 @@ module "iam_user" {
823841

824842
##### State Changes
825843

844+
Remove all prior policy attachments (that are marked for deletion in `terraform plan`).
845+
Policies will stay attached to the role but new attachment IDs will be created on next apply
846+
826847
```sh
827-
terraform state mv "module.iam_user[0].aws_iam_user_policy_attachment.this[0]" "module.iam_user[0].aws_iam_user_policy_attachment.this["S3ReadOnly"]"
848+
terraform state rm "module.iam_user[0].aws_iam_user_policy_attachment.this[0]"
828849
```

0 commit comments

Comments
 (0)