Skip to content

Commit cbb2b25

Browse files
authored
Add backwards compatibility for account state vs status (#116)
> [AWS Organizations](https://aws.amazon.com/organizations/) provides a new State field in the AWS Organizations Console and APIs (DescribeAccount, ListAccounts, and ListAccountsForParent) to enhance AWS account lifecycle visibility. With this launch, the account state, a new State field replaced the existing account status, Status field in the AWS Organizations Console, however both Status and State fields will remain available in the APIs until September 9, 2026. This launch allows you to have a more granular account state information such as, 'SUSPENDED' for AWS-enforced suspension, 'PENDING_CLOSURE' for in-process closure requests, and 'CLOSED' for accounts in their 90-day reinstatement window, and more. After September, 2026 the Status field will be fully deprecated. Customers using account vending pipelines should update their implementations to reference the State field before the Status field deprecation date. This feature is available in all AWS commercial and AWS GovCloud (US) Regions. To get started managing your accounts, please see the [blog post](https://aws.amazon.com/blogs/mt/updates-to-account-status-information-in-aws-organizations/) and [documentation](https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_accounts_account_state.html). [[link](https://aws.amazon.com/about-aws/whats-new/2025/09/aws-organizations-provides-account-state-information-member-accounts/)] #106 added a filter using the new `state` attribute, but this breaks the module when using an AWS Provider version <[6.18.0](https://github.com/hashicorp/terraform-provider-aws/releases/tag/v6.18.0). This PR adds a `try()` function to use both attributes, maintaining backward compatibility with the AWS Provider.
1 parent d9eb242 commit cbb2b25

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

modules/service-deployment/regional.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ data "aws_organizations_organizational_unit_descendant_accounts" "target_account
66

77
locals {
88
ram_target_accounts = try(flatten(values(data.aws_organizations_organizational_unit_descendant_accounts.target_accounts)[*].accounts[*]), [])
9-
ram_target_account_ids = [for a in local.ram_target_accounts : a.id if a.state == "ACTIVE"]
9+
ram_target_account_ids = [for a in local.ram_target_accounts : a.id if try(a.state == "ACTIVE", a.status == "ACTIVE")]
1010
}
1111

1212
#

0 commit comments

Comments
 (0)