Terraform v1.12.2
terraform-provider-aws:
- v6.28.0 (released version)
- main branch (commit: c3d2ba1c5a5b274e46830b55e380a9276f2041c5, acceptance tests)
aws_organizations_account
The account should be destroyed and appear closed on AWS console. The account state should transition to PENDING_CLOSURE and then stay in CLOSED state (Monitor the state of your AWS accounts).
I'm experiencing consistent timeouts when trying to destroy AWS accounts with close_on_deletion = true. The account enters in the PENDING_CLOSURE state as expected, but during destroy the operation never completes and eventually times out (reporting the last account state as ACTIVE). However, in the AWS console the account appear closed.
I also ran the related acceptance test for the "TestAccOrganizations_serial/Account/CloseOnDeletion" use case, and it fails with the same timeout behavior.
resource "aws_organizations_account" "test" {
name = "TestAccount"
email = "testaccount@yourdomain.com"
close_on_deletion = true
}
</details>
aws_organizations_account resourceBelow I report both the acceptance test logs and the relevant debug logs.
The debug logs were obtained by adding additional logging to findAccountByID and statusAccountState in order to monitor the account state transitions. I am not including the full debug output (approximately ten minutes of logs), but only the entries that show the unexpected transition from PENDING_CLOSURE back to ACTIVE.
make testacc TESTS='TestAccOrganizations_serial/Account/CloseOnDeletion' PKG=organizations
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
make: Running acceptance tests on branch: 🌿 main 🌿...
TF_ACC=1 go1.25.6 test ./internal/service/organizations/... -v -count 1 -parallel 20 -run='TestAccOrganizations_serial/Account/CloseOnDeletion' -timeout 360m -vet=off
2026/01/31 15:57:02 Creating Terraform AWS Provider (SDKv2-style)...
2026/01/31 15:57:02 Initializing Terraform AWS Provider (SDKv2-style)...
=== RUN TestAccOrganizations_serial
=== PAUSE TestAccOrganizations_serial
=== CONT TestAccOrganizations_serial
=== RUN TestAccOrganizations_serial/Account
=== RUN TestAccOrganizations_serial/Account/CloseOnDeletion
account_test.go:86: Error running post-test destroy, there may be dangling resources: exit status 1
Error: waiting for AWS Organizations Account (488762301176) delete: timeout while waiting for resource to be gone (last state: 'ACTIVE', timeout: 10m0s)
--- FAIL: TestAccOrganizations_serial (634.30s)
--- FAIL: TestAccOrganizations_serial/Account (634.30s)
--- FAIL: TestAccOrganizations_serial/Account/CloseOnDeletion (634.30s)
FAIL
FAIL github.com/hashicorp/terraform-provider-aws/internal/service/organizations 634.457s
FAIL
make: *** [GNUmakefile:897: testacc] Error 1
</details>
<details open>
<summary>Debug logs</summary>
(testAccCheckAccountDestroy) CHECK ACCOUNT DESTROY
(findAccountByID) out: &{0xc00451b2b0 0xc00451b2c0 0xc00451b2d0 CREATED 2026-01-31 15:33:48.938 +0000 UTC 0xc00451b2a0 ACTIVE ACTIVE {}}, state: ACTIVE, err: <nil>
(findAccountByID) out: &{0xc0084c03d0 0xc0084c03a0 0xc0084c03b0 CREATED 2026-01-31 15:33:48.938 +0000 UTC 0xc0084c03c0 ACTIVE ACTIVE {}}, state: ACTIVE, err: <nil>
(findAccountByID) out: &{0xc004034b40 0xc004034b10 0xc004034b20 CREATED 2026-01-31 15:33:48.938 +0000 UTC 0xc004034b30 ACTIVE ACTIVE {}}, state: ACTIVE, err: <nil>
(findAccountByID) out: &{0xc003f86590 0xc003f865a0 0xc003f865b0 CREATED 2026-01-31 15:33:48.938 +0000 UTC 0xc003f86580 ACTIVE ACTIVE {}}, state: ACTIVE, err: <nil>
(findAccountByID) out: &{0xc0039485f0 0xc003948600 0xc0039485d0 CREATED 2026-01-31 15:33:48.938 +0000 UTC 0xc0039485e0 PENDING_CLOSURE PENDING_CLOSURE {}}, state: PENDING_CLOSURE, err: <nil>
(statusAccountState) PENDING_CLOSURE, <nil>
(findAccountByID) out: &{0xc00849e460 0xc00849e470 0xc00849e480 CREATED 2026-01-31 15:33:48.938 +0000 UTC 0xc00849e490 ACTIVE ACTIVE {}}, state: ACTIVE, err: <nil>
(statusAccountState) ACTIVE, <nil>
(findAccountByID) out: &{0xc0084a0550 0xc0084a0520 0xc0084a0530 CREATED 2026-01-31 15:33:48.938 +0000 UTC 0xc0084a0540 ACTIVE ACTIVE {}}, state: ACTIVE, err: <nil>
(statusAccountState) ACTIVE, <nil>
(findAccountByID) out: &{0xc003949000 0xc003949010 0xc003949020 CREATED 2026-01-31 15:33:48.938 +0000 UTC 0xc003949030 ACTIVE ACTIVE {}}, state: ACTIVE, err: <nil>
(statusAccountState) ACTIVE, <nil>
(findAccountByID) out: &{0xc0084a0c10 0xc0084a0c20 0xc0084a0c30 CREATED 2026-01-31 15:33:48.938 +0000 UTC 0xc0084a0c00 ACTIVE ACTIVE {}}, state: ACTIVE, err: <nil>
(statusAccountState) ACTIVE, <nil>
(findAccountByID) out: &{0xc00849f810 0xc00849f7e0 0xc00849f7f0 CREATED 2026-01-31 15:33:48.938 +0000 UTC 0xc00849f800 ACTIVE ACTIVE {}}, state: ACTIVE, err: <nil>
(statusAccountState) ACTIVE, <nil>
(findAccountByID) out: &{0xc0084b5100 0xc0084b5110 0xc0084b5120 CREATED 2026-01-31 15:33:48.938 +0000 UTC 0xc0084b5130 ACTIVE ACTIVE {}}, state: ACTIVE, err: <nil>
(statusAccountState) ACTIVE, <nil>
(findAccountByID) out: &{0xc0084c06c0 0xc0084c0690 0xc0084c06a0 CREATED 2026-01-31 15:33:48.938 +0000 UTC 0xc0084c06b0 ACTIVE ACTIVE {}}, state: ACTIVE, err: <nil>
</details>
n/a
No