Behaviour changing Account Name in AWS Organization

My client provisions all their accounts via Terraform using the "aws_organizations_account" "account" resource; it’s worked well for years. The accounts are defined as a variable map:

XYZ_account_map = {
       email = ""
      id    = "123412341234"
      name  = "old_name"

Multiple other non-account resources reference these accounts by reading their state entries.

Now we have a requirement to rename a wide range of accounts to conform to an external schema.

In theory it’s easy - we change the name in the resource, and see for example:

XYZ_account_map = {
        email = """"
      ~ id    = "123412341234" -> (known after apply)
      ~ name  = "old_name" -> "new_name"

However …
The change in ID suggests that TF’s behaviour in this case might be an unpleasant surprise. For example, along the lines of account deletion in an organization, TF might well remove the old account from the org (rendering it unreachable without a root setup) and create a new one.

This is the sort of thing I’d rather know before trying. Could anyone respond to what the actual behaviour is in a rename case like this?

Failing the desired behaviour (just change the name), I expect we could change code and mess with state, but a rename per above would be great … if it does no harm.

Hello rpattcorner,

wanted to check if (and how than?) you managed to rename your AWS accounts and keep TFs state in order, since I currently have the same requirement for a few of our member accounts.
Ran this in a POC and saw the same plan suggestion. Since it was a playground, I went ahead and applied the configuration, to find myself with a new AccountID …

thanks in advance for getting back on this.