resources:
    {% for stream, stream_name in streams.items() %}
    {{stream.title()}}ApiResourceExecutionRole:
        Type: 'AWS::IAM::Role'
        Properties:
            AssumeRolePolicyDocument:
                Version: '2012-10-17'
                Statement:
                    - Effect: Allow
                      Principal:
                          Service: 'apigateway.amazonaws.com'
                      Action: 'sts:AssumeRole'
            Path: '/humilis/'
            Policies:
                - PolicyName: "{{stream.title()}}StreamWriteAccess"
                  PolicyDocument:
                      Version: '2012-10-17'
                      Statement:
                          - Effect: Allow
                            Action:
                                - 'kinesis:*'
                            Resource: 
                                "Fn::Join": 
                                    - ''
                                    -
                                        - "arn:aws:kinesis:"
                                        - Ref: "AWS::Region"
                                        - ':'
                                        - Ref: "AWS::AccountId"
                                        - ':'
                                        - "stream/{{stream_name}}"
    {% endfor %}
