terraform.aws-baseline-infra/modules/util/account-list
2022-08-17 15:20:12 +08:00
..
main.tf NEW: account-list module 2022-08-17 15:20:12 +08:00
outputs.tf NEW: account-list module 2022-08-17 15:20:12 +08:00
provider.tf NEW: account-list module 2022-08-17 15:20:12 +08:00
README.md NEW: account-list module 2022-08-17 15:20:12 +08:00

acocunt-list module

This module returns a list of accounts by querying the aws_organizations_organiation datasource. It returns an accounts map like this

{
        account-name-1 = "111111111111"
        account-name-2 = "111111111111"
}

In the root module, query the account id like this

output result {
  value = lookup(module.account-list.accounts, "account-name-1")
}