def convert_template()

in ExecutionRoleBuilder/lambda/index.py [0:0]


def convert_template(fragment):
    # Debug output
    print ('This was the fragment: {}'.format(fragment))
    
    # Loop through each resource in the template
    resources = fragment['Resources']
    for resource in resources:
        print ('Determining if {} is an IAM role'.format(resource))
        resourcejson = resources[resource]
        # If the resource is an IAM Role, expand the shorthand notation to the proper
        # CloudFormation using the function below, otherwise leave the resource as is
        if resourcejson['Type'] == 'AWS::IAM::Role':
            print ('Found a role: {}'.format(resource))
            # Expanding role
            resources[resource] = expand_role(resourcejson)
    
    # Debug output
    print ('This is the transformed fragment: {}'.format(fragment))
    # Return the converted/expanded template fragment
    return fragment