Filter Aws accounts in Organizations based on tags

Hello,

I want to get the list of AWS Organizations Accounts based on Tags. For example, Need to retrieve all the Production Accounts (Tagged as Prod) in AWS .I am not finding the datasource config for the same.Please advise

Example:

data “aws_organizations_account” “account” {

filter {
name = “tag:Name”
values = [“Prod”]
}
}

Thanks

That data source does not exist.

Could you put your production accounts in a dedicated OU, and then look them up that way?

https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/organizations_organizational_units

Assuming the API call exists you can make a request on the provider’s github. nvm I see you did that already :slight_smile: