Merge pull request #1425 from whummer/feat/cf-fn-GetAZs
Implement Fn::GetAZs function in CloudFormation
This commit is contained in:
commit
7fa14c81f4
2 changed files with 37 additions and 0 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue