AWSTemplateFormatVersion: 2010-09-09
Description: An IAM Role with an inline policy

Parameters:

  DeploymentName:
    Type: String
    Description: A name for this deployment

Resources:

  Role:
    Type: AWS::IAM::Role
    Properties:
      RoleName: !Sub "${DeploymentName}-Role"
      Description: Allows EC2 instances to call AWS services
      AssumeRolePolicyDocument:
        Version: 2012-10-17
        Statement:
          - Effect: Allow
            Principal:
              Service: ec2.amazonaws.com
            Action:
              - sts:AssumeRole
      Policies:
        - PolicyName: InstancePolicy
          PolicyDocument:
            Version: 2012-10-17
            Statement:
              - Effect: Allow
                Action:
                  - logs:CreateLogGroup
                  - logs:CreateLogStream
                  - logs:PutLogEvents
                  - logs:DescribeLogStreams
                  - cloudformation:DescribeStackResource
                Resource: "*"
