implement Fn::GetAZs function in CloudFormation

This commit is contained in:
Waldemar Hummer 2018-01-10 19:57:49 -05:00
commit da4a6fe616
2 changed files with 37 additions and 0 deletions

View file

@ -106,6 +106,8 @@ NULL_MODELS = [
"AWS::CloudFormation::WaitConditionHandle",
]
DEFAULT_REGION = 'us-east-1'
logger = logging.getLogger("moto")
@ -203,6 +205,14 @@ def clean_json(resource_json, resources_map):
if any(values):
return values[0]
if 'Fn::GetAZs' in resource_json:
region = resource_json.get('Fn::GetAZs') or DEFAULT_REGION
result = []
# TODO: make this configurable, to reflect the real AWS AZs
for az in ('a', 'b', 'c', 'd'):
result.append('%s%s' % (region, az))
return result
cleaned_json = {}
for key, value in resource_json.items():
cleaned_val = clean_json(value, resources_map)