"attachments": [
{
"state": "available",
"vpc_id": "vpc-54321"
}
],
"internet_gateway_id": "igw-12345",
"tags": [
{
"key": "Name",
"value": "PROD"
}
]
}
],
Как мне отсюда вытащить internet_gateway_id на основании vpc_id?
Варианты, которые не работают:
"igw_info.internet_gateways | selectattr('attachments.vpc_id', 'equalto', item.vpc_id) | list": "VARIABLE IS NOT DEFINED!: 'list object' has no attribute 'vpc_id'"
"igw_info.internet_gateways | selectattr('attachments[0].vpc_id', 'equalto', item.vpc_id) | list": "VARIABLE IS NOT DEFINED!: 'dict object' has no attribute 'attachments[0]'
"igw_info.internet_gateways | selectattr('attachments | first | vpc_id', 'equalto', item.vpc_id) | list": "VARIABLE IS NOT DEFINED!: 'dict object' has no attribute 'attachments | first | vpc_id'"
А полностью igw_info как выглядит?
Обсуждают сегодня