Merge pull request #1425 from whummer/feat/cf-fn-GetAZs

Implement Fn::GetAZs function in CloudFormation
This commit is contained in:
Steve Pulec 2018-03-06 22:28:31 -05:00 committed by GitHub
commit 7fa14c81f4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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)