Description: CloudFormation Stack that deploys a service role for MediaConnect
Resources:
  MediaConnectServiceRole:
    Type: "AWS::IAM::Role"
    Properties: 
      RoleName: MediaConnectServiceRole
      AssumeRolePolicyDocument:
        Version: "2012-10-17"
        Statement:
          - Effect: Allow
            Principal:
              Service:
                - mediaconnect.amazonaws.com
            Action:
              - 'sts:AssumeRole'
      Policies:
        - PolicyName: Ec2Permission
          PolicyDocument:
            Version: "2012-10-17"
            Statement:
              - Effect: Allow
                Action: 
                  - "ec2:describeNetworkInterfaces"
                  - "ec2:describeSecurityGroups"
                  - "ec2:describeSubnets"
                  - "ec2:createNetworkInterface"
                  - "ec2:createNetworkInterfacePermission"
                  - "ec2:deleteNetworkInterface"
                  - "ec2:deleteNetworkInterfacePermission"
                Resource: '*'
