【发布时间】:2022-01-09 18:35:24
【问题描述】:
我有以下 YAML 配置文件:
AWSConfig:
conformance_pack_templates:
- Operational_Best_Practices_test1:
- excluded_accounts:
- "closed"
- "staging"
- Operational_Best_Practices_test2:
- excluded_accounts:
- "opened"
我想获取我的AWS organization 中存在的所有“排除”帐户id,其中包括列表中指定的名称。
我正在使用data.aws_organizations_organization.org.accounts 获取AWS organization 下的所有帐户详细信息。data source 输出是:
([{
"arn" = "arn:aws:organizations::example1:account/f-432145321/example"
"email" = "test@example.com"
"id" = "543632464532"
"name" = "closed"
"status" = "SUSPENDED"
},
{
"arn" = "arn:aws:organizations::example2:account/f-43214431/example"
"email" = "test1@example.com"
"id" = "45321534214"
"name" = "closed"
"status" = "SUSPENDED"
},
])
我需要过滤列表中指定名称的所有帐户,并获取以下对象列表格式输出:
[
{ template = Operational_Best_Practices_test1,
excluded_accounts = [ 543632464532, 45321534214, 54325413421 ]},
{ template = Operational_Best_Practices_test2,
excluded_accounts = [ 65465554365, 654365436543 ]}
]
【问题讨论】:
标签: yaml terraform terraform-provider-aws terraform0.12+ terraform-template-file