in control-plane/custom-resources/src_macro/index.py [0:0]
def multiply(resource_name, resource_structure, count):
"""Multiply resources and create copies of them.
Parameters
----------
resource_name : string
The resource name.
resource_structure : JSON
CloudFormation resource definition.
count : Integer
Amount of copies thar are goint to be created.
Returns
-------
type
Dictonary with the replicated resources.
"""
resources = {}
# Loop according to the number of times we want to
# multiply, creating a new resource each time
for iteration in range(0, count):
print("Multiplying '{}', iteration count {}"
.format(resource_name, iteration + 1))
multipliedResourceStructure = update_placeholder(
resource_structure,
iteration)
resources[resource_name+str(iteration)] = multipliedResourceStructure
return resources