fix(cloudformation): remove the login profile when deleting an IAM user (#3975)

Since login profiles became real state, DeleteUser returns DeleteConflict while one exists, so deleting a stack whose AWS::IAM::User was given a password out of band ended in DELETE_FAILED. The provisioner now deletes the login profile before the user, tolerating a user that has none. The resource-type table notes that the template LoginProfile and PermissionsBoundary properties are ignored.
This commit is contained in:
Priamo Germosen authored and GitHub committed 2026-09-20 09:13:36 -05:00
1 parent b1e0751764
commit 8af15a71c4
6 files changed
+120 -1

No files matched your search

@@ -314,6 +314,9 @@ public class IamUserCfnProvisioner implements CfnResourceProvisioner {
LOG.debugv("IAM user access keys already gone, treating as deleted: {0}", physicalId);
}
CfnDeletes.safeDelete("login profile on user", physicalId,
() -> iamService.deleteLoginProfile(physicalId), "NoSuchEntity");
CfnDeletes.safeDelete("IAM user", physicalId,
() -> iamService.deleteUser(physicalId), "NoSuchEntity");
}